equal
deleted
inserted
replaced
2185 else |
2185 else |
2186 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp |
2186 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp |
2187 new file mode 100644 |
2187 new file mode 100644 |
2188 --- /dev/null |
2188 --- /dev/null |
2189 +++ b/toolkit/xre/nsKDEUtils.cpp |
2189 +++ b/toolkit/xre/nsKDEUtils.cpp |
2190 @@ -0,0 +1,341 @@ |
2190 @@ -0,0 +1,339 @@ |
2191 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2191 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2192 +/* This Source Code Form is subject to the terms of the Mozilla Public |
2192 +/* This Source Code Form is subject to the terms of the Mozilla Public |
2193 + * License, v. 2.0. If a copy of the MPL was not distributed with this |
2193 + * License, v. 2.0. If a copy of the MPL was not distributed with this |
2194 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
2194 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
2195 + |
2195 + |
2351 + return self()->internalCommand( command, NULL, false, output ); |
2351 + return self()->internalCommand( command, NULL, false, output ); |
2352 + } |
2352 + } |
2353 + |
2353 + |
2354 +bool nsKDEUtils::command( nsIArray* command, nsIArray** output) |
2354 +bool nsKDEUtils::command( nsIArray* command, nsIArray** output) |
2355 + { |
2355 + { |
2356 + NS_ENSURE_ARG( command ); |
|
2357 + |
|
2358 + nsTArray<nsCString> in; |
2356 + nsTArray<nsCString> in; |
2359 + PRUint32 length; |
2357 + PRUint32 length; |
2360 + command->GetLength( &length ); |
2358 + command->GetLength( &length ); |
2361 + for ( PRUint32 i = 0; i < length; i++ ) |
2359 + for ( PRUint32 i = 0; i < length; i++ ) |
2362 + { |
2360 + { |
3166 + return buf; |
3164 + return buf; |
3167 + } |
3165 + } |
3168 + |
3166 + |
3169 +static PRInt32 windowToXid( nsIWidget* widget ) |
3167 +static PRInt32 windowToXid( nsIWidget* widget ) |
3170 + { |
3168 + { |
3171 + GtkWindow *parent_widget = get_gtk_window_for_nsiwidget( widget ); |
3169 + GtkWindow *parent_widget = GTK_WINDOW(widget->GetNativeData(NS_NATIVE_SHELLWIDGET)); |
3172 + GdkWindow* gdk_window = gtk_widget_get_window( gtk_widget_get_toplevel( GTK_WIDGET( parent_widget ))); |
3170 + GdkWindow* gdk_window = gtk_widget_get_window( gtk_widget_get_toplevel( GTK_WIDGET( parent_widget ))); |
3173 + return GDK_WINDOW_XID( gdk_window ); |
3171 + return GDK_WINDOW_XID( gdk_window ); |
3174 + } |
3172 + } |
3175 + |
3173 + |
3176 +NS_IMETHODIMP nsFilePicker::kdeFileDialog(PRInt16 *aReturn) |
3174 +NS_IMETHODIMP nsFilePicker::kdeFileDialog(PRInt16 *aReturn) |
3274 + parent.AppendInt( xid ); |
3272 + parent.AppendInt( xid ); |
3275 + command.AppendElement( parent ); |
3273 + command.AppendElement( parent ); |
3276 + } |
3274 + } |
3277 + |
3275 + |
3278 + nsTArray<nsCString> output; |
3276 + nsTArray<nsCString> output; |
3279 + if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) |
3277 + if( nsKDEUtils::commandBlockUi( command, GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET)), &output )) |
3280 + { |
3278 + { |
3281 + *aReturn = nsIFilePicker::returnOK; |
3279 + *aReturn = nsIFilePicker::returnOK; |
3282 + mFiles.Clear(); |
3280 + mFiles.Clear(); |
3283 + if( mMode != nsIFilePicker::modeGetFolder ) |
3281 + if( mMode != nsIFilePicker::modeGetFolder ) |
3284 + { |
3282 + { |
3362 + parent.AppendInt( xid ); |
3360 + parent.AppendInt( xid ); |
3363 + command.AppendElement( parent ); |
3361 + command.AppendElement( parent ); |
3364 + } |
3362 + } |
3365 + |
3363 + |
3366 + nsTArray<nsCString> output; |
3364 + nsTArray<nsCString> output; |
3367 + if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) |
3365 + if( nsKDEUtils::commandBlockUi( command, GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET)), &output )) |
3368 + { |
3366 + { |
3369 + *aReturn = nsIFilePicker::returnOK; |
3367 + *aReturn = nsIFilePicker::returnOK; |
3370 + mFileURL = output.Length() > 0 ? output[ 0 ] : nsCString(); |
3368 + mFileURL = output.Length() > 0 ? output[ 0 ] : nsCString(); |
3371 + } |
3369 + } |
3372 + else |
3370 + else |