equal
deleted
inserted
replaced
2572 + return NS_OK; |
2572 + return NS_OK; |
2573 +} |
2573 +} |
2574 diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in |
2574 diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in |
2575 --- a/toolkit/xre/Makefile.in |
2575 --- a/toolkit/xre/Makefile.in |
2576 +++ b/toolkit/xre/Makefile.in |
2576 +++ b/toolkit/xre/Makefile.in |
2577 @@ -131,17 +131,17 @@ CMMSRCS = nsNativeAppSupportCocoa.mm |
2577 @@ -42,16 +42,18 @@ srcdir = @srcdir@ |
|
2578 VPATH = @srcdir@ |
|
2579 |
|
2580 include $(DEPTH)/config/autoconf.mk |
|
2581 |
|
2582 MODULE = xulapp |
|
2583 LIBRARY_NAME = xulapp_s |
|
2584 LIBXUL_LIBRARY = 1 |
|
2585 |
|
2586 +EXPORTS = nsKDEUtils.h |
|
2587 + |
|
2588 REQUIRES = \ |
|
2589 appcomps \ |
|
2590 toolkitcomps \ |
|
2591 appshell \ |
|
2592 chrome \ |
|
2593 content \ |
|
2594 docshell \ |
|
2595 dom \ |
|
2596 @@ -131,17 +133,17 @@ CMMSRCS = nsNativeAppSupportCocoa.mm |
2578 else |
2597 else |
2579 ifeq ($(MOZ_WIDGET_TOOLKIT),os2) |
2598 ifeq ($(MOZ_WIDGET_TOOLKIT),os2) |
2580 CPPSRCS += nsNativeAppSupportOS2.cpp |
2599 CPPSRCS += nsNativeAppSupportOS2.cpp |
2581 else |
2600 else |
2582 ifeq ($(MOZ_WIDGET_TOOLKIT),beos) |
2601 ifeq ($(MOZ_WIDGET_TOOLKIT),beos) |
2595 |
2614 |
2596 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp |
2615 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp |
2597 new file mode 100644 |
2616 new file mode 100644 |
2598 --- /dev/null |
2617 --- /dev/null |
2599 +++ b/toolkit/xre/nsKDEUtils.cpp |
2618 +++ b/toolkit/xre/nsKDEUtils.cpp |
2600 @@ -0,0 +1,335 @@ |
2619 @@ -0,0 +1,334 @@ |
2601 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2620 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2602 +/* ***** BEGIN LICENSE BLOCK ***** |
2621 +/* ***** BEGIN LICENSE BLOCK ***** |
2603 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
2622 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
2604 + * |
2623 + * |
2605 + * The contents of this file are subject to the Mozilla Public License Version |
2624 + * The contents of this file are subject to the Mozilla Public License Version |
2636 + * ***** END LICENSE BLOCK ***** */ |
2655 + * ***** END LICENSE BLOCK ***** */ |
2637 + |
2656 + |
2638 +#include "nsKDEUtils.h" |
2657 +#include "nsKDEUtils.h" |
2639 +#include "nsIWidget.h" |
2658 +#include "nsIWidget.h" |
2640 + |
2659 + |
2641 +#include <gtk/gtkwindow.h> |
2660 +#include <gtk/gtk.h> |
2642 +#include <gtk/gtkmain.h> |
|
2643 + |
2661 + |
2644 +#include <limits.h> |
2662 +#include <limits.h> |
2645 +#include <stdio.h> |
2663 +#include <stdio.h> |
2646 +#include <sys/wait.h> |
2664 +#include <sys/wait.h> |
2647 +#include <unistd.h> |
2665 +#include <unistd.h> |
3602 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
3620 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
3603 + |
3621 + |
3604 diff --git a/widget/src/gtk2/nsFilePicker.cpp b/widget/src/gtk2/nsFilePicker.cpp |
3622 diff --git a/widget/src/gtk2/nsFilePicker.cpp b/widget/src/gtk2/nsFilePicker.cpp |
3605 --- a/widget/src/gtk2/nsFilePicker.cpp |
3623 --- a/widget/src/gtk2/nsFilePicker.cpp |
3606 +++ b/widget/src/gtk2/nsFilePicker.cpp |
3624 +++ b/widget/src/gtk2/nsFilePicker.cpp |
3607 @@ -50,16 +50,17 @@ |
3625 @@ -31,16 +31,17 @@ |
|
3626 * decision by deleting the provisions above and replace them with the notice |
|
3627 * and other provisions required by the GPL or the LGPL. If you do not delete |
|
3628 * the provisions above, a recipient may use your version of this file under |
|
3629 * the terms of any one of the MPL, the GPL or the LGPL. |
|
3630 * |
|
3631 * ***** END LICENSE BLOCK ***** */ |
|
3632 |
|
3633 #include <gtk/gtk.h> |
|
3634 +#include <gdk/gdkx.h> |
|
3635 |
|
3636 #include "nsIFileURL.h" |
|
3637 #include "nsIURI.h" |
|
3638 #include "nsIWidget.h" |
|
3639 #include "nsILocalFile.h" |
|
3640 #include "nsIStringBundle.h" |
|
3641 |
|
3642 #include "nsArrayEnumerator.h" |
|
3643 @@ -50,16 +51,17 @@ |
3608 #include "nsReadableUtils.h" |
3644 #include "nsReadableUtils.h" |
3609 #include "mozcontainer.h" |
3645 #include "mozcontainer.h" |
3610 |
3646 |
3611 #include "prmem.h" |
3647 #include "prmem.h" |
3612 #include "prlink.h" |
3648 #include "prlink.h" |
3620 #endif |
3656 #endif |
3621 |
3657 |
3622 #define MAX_PREVIEW_SIZE 180 |
3658 #define MAX_PREVIEW_SIZE 180 |
3623 |
3659 |
3624 nsILocalFile *nsFilePicker::mPrevDisplayDirectory = nsnull; |
3660 nsILocalFile *nsFilePicker::mPrevDisplayDirectory = nsnull; |
3625 @@ -270,17 +271,19 @@ nsFilePicker::AppendFilters(PRInt32 aFil |
3661 @@ -270,17 +272,19 @@ nsFilePicker::AppendFilters(PRInt32 aFil |
3626 return nsBaseFilePicker::AppendFilters(aFilterMask); |
3662 return nsBaseFilePicker::AppendFilters(aFilterMask); |
3627 } |
3663 } |
3628 |
3664 |
3629 NS_IMETHODIMP |
3665 NS_IMETHODIMP |
3630 nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) |
3666 nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) |
3641 CopyUTF16toUTF8(aFilter, filter); |
3677 CopyUTF16toUTF8(aFilter, filter); |
3642 CopyUTF16toUTF8(aTitle, name); |
3678 CopyUTF16toUTF8(aTitle, name); |
3643 |
3679 |
3644 mFilters.AppendElement(filter); |
3680 mFilters.AppendElement(filter); |
3645 mFilterNames.AppendElement(name); |
3681 mFilterNames.AppendElement(name); |
3646 @@ -418,16 +421,19 @@ confirm_overwrite_file(GtkWidget *parent |
3682 @@ -418,16 +422,19 @@ confirm_overwrite_file(GtkWidget *parent |
3647 gtk_widget_destroy(dialog); |
3683 gtk_widget_destroy(dialog); |
3648 |
3684 |
3649 return result; |
3685 return result; |
3650 } |
3686 } |
3651 |
3687 |
3661 title.Adopt(ToNewUTF8String(mTitle)); |
3697 title.Adopt(ToNewUTF8String(mTitle)); |
3662 |
3698 |
3663 GtkWindow *parent_widget = get_gtk_window_for_nsiwidget(mParentWidget); |
3699 GtkWindow *parent_widget = get_gtk_window_for_nsiwidget(mParentWidget); |
3664 |
3700 |
3665 GtkFileChooserAction action = GetGtkFileChooserAction(mMode); |
3701 GtkFileChooserAction action = GetGtkFileChooserAction(mMode); |
3666 @@ -568,8 +574,234 @@ nsFilePicker::Show(PRInt16 *aReturn) |
3702 @@ -568,8 +575,234 @@ nsFilePicker::Show(PRInt16 *aReturn) |
3667 *aReturn = nsIFilePicker::returnCancel; |
3703 *aReturn = nsIFilePicker::returnCancel; |
3668 break; |
3704 break; |
3669 } |
3705 } |
3670 |
3706 |
3671 gtk_widget_destroy(file_chooser); |
3707 gtk_widget_destroy(file_chooser); |
3673 return NS_OK; |
3709 return NS_OK; |
3674 } |
3710 } |
3675 + |
3711 + |
3676 +nsCString nsFilePicker::kdeMakeFilter( int index ) |
3712 +nsCString nsFilePicker::kdeMakeFilter( int index ) |
3677 + { |
3713 + { |
3678 + nsCString buf = *mFilters[ index ]; |
3714 + nsCString buf = mFilters[ index ]; |
3679 + for( PRUint32 i = 0; |
3715 + for( PRUint32 i = 0; |
3680 + i < buf.Length(); |
3716 + i < buf.Length(); |
3681 + ++i ) |
3717 + ++i ) |
3682 + if( buf[ i ] == ';' ) // KDE separates just using spaces |
3718 + if( buf[ i ] == ';' ) // KDE separates just using spaces |
3683 + buf.SetCharAt( ' ', i ); |
3719 + buf.SetCharAt( ' ', i ); |
3684 + if (!mFilterNames[index]->IsEmpty()) |
3720 + if (!mFilterNames[index].IsEmpty()) |
3685 + { |
3721 + { |
3686 + buf += "|"; |
3722 + buf += "|"; |
3687 + buf += mFilterNames[index]->get(); |
3723 + buf += mFilterNames[index].get(); |
3688 + } |
3724 + } |
3689 + return buf; |
3725 + return buf; |
3690 + } |
3726 + } |
3691 + |
3727 + |
3692 +static PRInt32 windowToXid( nsIWidget* widget ) |
3728 +static PRInt32 windowToXid( nsIWidget* widget ) |
3698 + |
3734 + |
3699 +NS_IMETHODIMP nsFilePicker::kdeFileDialog(PRInt16 *aReturn) |
3735 +NS_IMETHODIMP nsFilePicker::kdeFileDialog(PRInt16 *aReturn) |
3700 + { |
3736 + { |
3701 + NS_ENSURE_ARG_POINTER(aReturn); |
3737 + NS_ENSURE_ARG_POINTER(aReturn); |
3702 + |
3738 + |
3703 + if( mMode == modeOpen && mFilters.Count() == 1 && mFilters[ 0 ]->EqualsLiteral( "..apps" )) |
3739 + if( mMode == modeOpen && mFilters.Length() == 1 && mFilters[ 0 ].EqualsLiteral( "..apps" )) |
3704 + return kdeAppsDialog( aReturn ); |
3740 + return kdeAppsDialog( aReturn ); |
3705 + |
3741 + |
3706 + nsXPIDLCString title; |
3742 + nsXPIDLCString title; |
3707 + title.Adopt(ToNewUTF8String(mTitle)); |
3743 + title.Adopt(ToNewUTF8String(mTitle)); |
3708 + |
3744 + |
3762 + } |
3798 + } |
3763 + if( startdir.IsEmpty()) |
3799 + if( startdir.IsEmpty()) |
3764 + startdir = "."; |
3800 + startdir = "."; |
3765 + |
3801 + |
3766 + nsCAutoString filters; |
3802 + nsCAutoString filters; |
3767 + PRInt32 count = mFilters.Count(); |
3803 + PRInt32 count = mFilters.Length(); |
3768 + if( count == 0 ) //just in case |
3804 + if( count == 0 ) //just in case |
3769 + filters = "*"; |
3805 + filters = "*"; |
3770 + else |
3806 + else |
3771 + { |
3807 + { |
3772 + filters = kdeMakeFilter( 0 ); |
3808 + filters = kdeMakeFilter( 0 ); |