mozilla-kde.patch
changeset 589 b3ff3d8ebf9d
parent 568 2c74c5927ea2
child 596 9124c1a643c5
equal deleted inserted replaced
588:dcdf243fea81 589:b3ff3d8ebf9d
    43  #include "pldhash.h"
    43  #include "pldhash.h"
    44  
    44  
    45  #include "prefapi.h"
    45  #include "prefapi.h"
    46  #include "prefread.h"
    46  #include "prefread.h"
    47  #include "prefapi_private_data.h"
    47  #include "prefapi_private_data.h"
    48 @@ -896,16 +897,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
    48 @@ -950,16 +951,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
    49  
    49  
    50  static nsresult pref_LoadPrefsInDirList(const char *listId)
    50  static nsresult pref_LoadPrefsInDirList(const char *listId)
    51  {
    51  {
    52    nsresult rv;
    52    nsresult rv;
    53    nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
    53    nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
    78                getter_AddRefs(list));
    78                getter_AddRefs(list));
    79    if (!list)
    79    if (!list)
    80      return NS_OK;
    80      return NS_OK;
    81  
    81  
    82    bool hasMore;
    82    bool hasMore;
    83 @@ -921,17 +940,17 @@ static nsresult pref_LoadPrefsInDirList(
    83 @@ -975,17 +994,17 @@ static nsresult pref_LoadPrefsInDirList(
    84  
    84  
    85      nsAutoCString leaf;
    85      nsAutoCString leaf;
    86      path->GetNativeLeafName(leaf);
    86      path->GetNativeLeafName(leaf);
    87  
    87  
    88      // Do we care if a file provided by this process fails to load?
    88      // Do we care if a file provided by this process fails to load?
    97  
    97  
    98  static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
    98  static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
    99  {
    99  {
   100    nsZipItemPtr<char> manifest(jarReader, name, true);
   100    nsZipItemPtr<char> manifest(jarReader, name, true);
   101    NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
   101    NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
   102 @@ -1025,28 +1044,40 @@ static nsresult pref_InitInitialObjects(
   102 @@ -1079,28 +1098,40 @@ static nsresult pref_InitInitialObjects(
   103    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
   103    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
   104    static const char* specialFiles[] = {
   104    static const char* specialFiles[] = {
   105  #if defined(XP_MACOSX)
   105  #if defined(XP_MACOSX)
   106      "macprefs.js"
   106      "macprefs.js"
   107  #elif defined(XP_WIN)
   107  #elif defined(XP_WIN)
  3107    CopyUTF16toUTF8(aFilter, filter);
  3107    CopyUTF16toUTF8(aFilter, filter);
  3108    CopyUTF16toUTF8(aTitle, name);
  3108    CopyUTF16toUTF8(aTitle, name);
  3109  
  3109  
  3110    mFilters.AppendElement(filter);
  3110    mFilters.AppendElement(filter);
  3111    mFilterNames.AppendElement(name);
  3111    mFilterNames.AppendElement(name);
  3112 @@ -369,16 +373,19 @@ nsFilePicker::GetFiles(nsISimpleEnumerat
  3112 @@ -388,16 +392,32 @@ nsFilePicker::Show(int16_t *aReturn)
  3113    return NS_ERROR_FAILURE;
       
  3114  }
       
  3115  
  3113  
  3116  NS_IMETHODIMP
  3114  NS_IMETHODIMP
  3117  nsFilePicker::Show(int16_t *aReturn)
  3115  nsFilePicker::Open(nsIFilePickerShownCallback *aCallback)
  3118  {
  3116  {
  3119    NS_ENSURE_ARG_POINTER(aReturn);
  3117    // Can't show two dialogs concurrently with the same filepicker
  3120  
  3118    if (mRunning)
  3121 +  if( nsKDEUtils::kdeSupport())
  3119      return NS_ERROR_NOT_AVAILABLE;
  3122 +    return kdeFileDialog(aReturn);
  3120  
  3123 +
  3121 +  // KDE file picker is not handled via callback
  3124    nsresult rv = Open(nullptr);
  3122 +  if( nsKDEUtils::kdeSupport()) {
  3125    if (NS_FAILED(rv))
  3123 +    int16_t result;
  3126      return rv;
  3124 +    mCallback = aCallback;
  3127  
  3125 +    mRunning = true;
  3128    while (mRunning) {
  3126 +    kdeFileDialog(&result);
  3129      g_main_context_iteration(nullptr, TRUE);
  3127 +    if (mCallback) {
  3130    }
  3128 +      mCallback->Done(result);
  3131  
  3129 +      mCallback = nullptr;
  3132 @@ -588,8 +595,235 @@ nsFilePicker::Done(GtkWidget* file_choos
  3130 +    } else {
       
  3131 +      mResult = result;
       
  3132 +    }
       
  3133 +    mRunning = false;
       
  3134 +    return NS_OK;
       
  3135 +  }
       
  3136 +
       
  3137    nsXPIDLCString title;
       
  3138    title.Adopt(ToNewUTF8String(mTitle));
       
  3139  
       
  3140    GtkWindow *parent_widget = get_gtk_window_for_nsiwidget(mParentWidget);
       
  3141  
       
  3142    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
       
  3143    const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE)
       
  3144                                 ? GTK_STOCK_SAVE : GTK_STOCK_OPEN;
       
  3145 @@ -588,8 +608,235 @@ nsFilePicker::Done(GtkWidget* file_choos
  3133    if (mCallback) {
  3146    if (mCallback) {
  3134      mCallback->Done(result);
  3147      mCallback->Done(result);
  3135      mCallback = nullptr;
  3148      mCallback = nullptr;
  3136    } else {
  3149    } else {
  3137      mResult = result;
  3150      mResult = result;