equal
deleted
inserted
replaced
1 # HG changeset patch |
1 # HG changeset patch |
2 # Parent 87a32e5d11e9d652e331a5f852bb951069b20c4a |
2 # Parent 2504512f9a9ba7b52dd99745d15f049f2a03f4f4 |
3 Description: Add KDE integration to Firefox (toolkit parts) |
3 Description: Add KDE integration to Firefox (toolkit parts) |
4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org> |
4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org> |
5 Author: Lubos Lunak <lunak@suse.com> |
5 Author: Lubos Lunak <lunak@suse.com> |
6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751 |
6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751 |
7 https://bugzilla.novell.com/show_bug.cgi?id=170055 |
7 https://bugzilla.novell.com/show_bug.cgi?id=170055 |
3273 CopyUTF16toUTF8(aFilter, filter); |
3273 CopyUTF16toUTF8(aFilter, filter); |
3274 CopyUTF16toUTF8(aTitle, name); |
3274 CopyUTF16toUTF8(aTitle, name); |
3275 |
3275 |
3276 mFilters.AppendElement(filter); |
3276 mFilters.AppendElement(filter); |
3277 mFilterNames.AppendElement(name); |
3277 mFilterNames.AppendElement(name); |
3278 @@ -371,16 +375,37 @@ nsFilePicker::Show(int16_t *aReturn) |
3278 @@ -371,16 +375,39 @@ nsFilePicker::Show(int16_t *aReturn) |
3279 |
3279 |
3280 NS_IMETHODIMP |
3280 NS_IMETHODIMP |
3281 nsFilePicker::Open(nsIFilePickerShownCallback *aCallback) |
3281 nsFilePicker::Open(nsIFilePickerShownCallback *aCallback) |
3282 { |
3282 { |
3283 // Can't show two dialogs concurrently with the same filepicker |
3283 // Can't show two dialogs concurrently with the same filepicker |
3286 |
3286 |
3287 + // KDE file picker is not handled via callback |
3287 + // KDE file picker is not handled via callback |
3288 + if( nsKDEUtils::kdeSupport()) { |
3288 + if( nsKDEUtils::kdeSupport()) { |
3289 + mCallback = aCallback; |
3289 + mCallback = aCallback; |
3290 + mRunning = true; |
3290 + mRunning = true; |
|
3291 + NS_ADDREF_THIS(); |
3291 + g_idle_add([](gpointer data) -> gboolean { |
3292 + g_idle_add([](gpointer data) -> gboolean { |
3292 + nsFilePicker* queuedPicker = (nsFilePicker*) data; |
3293 + nsFilePicker* queuedPicker = (nsFilePicker*) data; |
3293 + int16_t result; |
3294 + int16_t result; |
3294 + queuedPicker->kdeFileDialog(&result); |
3295 + queuedPicker->kdeFileDialog(&result); |
3295 + if (queuedPicker->mCallback) { |
3296 + if (queuedPicker->mCallback) { |
3297 + queuedPicker->mCallback = nullptr; |
3298 + queuedPicker->mCallback = nullptr; |
3298 + } else { |
3299 + } else { |
3299 + queuedPicker->mResult = result; |
3300 + queuedPicker->mResult = result; |
3300 + } |
3301 + } |
3301 + queuedPicker->mRunning = false; |
3302 + queuedPicker->mRunning = false; |
|
3303 + NS_RELEASE_THIS(); |
3302 + return G_SOURCE_REMOVE; |
3304 + return G_SOURCE_REMOVE; |
3303 + }, this); |
3305 + }, this); |
3304 + |
3306 + |
3305 + return NS_OK; |
3307 + return NS_OK; |
3306 + } |
3308 + } |
3311 GtkWindow *parent_widget = |
3313 GtkWindow *parent_widget = |
3312 GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET)); |
3314 GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET)); |
3313 |
3315 |
3314 GtkFileChooserAction action = GetGtkFileChooserAction(mMode); |
3316 GtkFileChooserAction action = GetGtkFileChooserAction(mMode); |
3315 |
3317 |
3316 @@ -603,8 +628,233 @@ nsFilePicker::Done(GtkWidget* file_choos |
3318 @@ -603,8 +630,233 @@ nsFilePicker::Done(GtkWidget* file_choos |
3317 if (mCallback) { |
3319 if (mCallback) { |
3318 mCallback->Done(result); |
3320 mCallback->Done(result); |
3319 mCallback = nullptr; |
3321 mCallback = nullptr; |
3320 } else { |
3322 } else { |
3321 mResult = result; |
3323 mResult = result; |