mozilla-kde.patch
changeset 541 830e50bbfc79
parent 538 be682f8c9361
child 546 2c9448fe783c
--- a/mozilla-kde.patch	Tue Sep 11 19:27:36 2012 +0200
+++ b/mozilla-kde.patch	Thu Sep 13 21:36:45 2012 +0200
@@ -45,7 +45,7 @@
  #include "prefapi.h"
  #include "prefread.h"
  #include "prefapi_private_data.h"
-@@ -907,16 +908,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
+@@ -896,16 +897,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
  
  static nsresult pref_LoadPrefsInDirList(const char *listId)
  {
@@ -80,7 +80,7 @@
      return NS_OK;
  
    bool hasMore;
-@@ -932,17 +951,17 @@ static nsresult pref_LoadPrefsInDirList(
+@@ -921,17 +940,17 @@ static nsresult pref_LoadPrefsInDirList(
  
      nsCAutoString leaf;
      path->GetNativeLeafName(leaf);
@@ -89,7 +89,7 @@
      if (Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi")))
        ReadExtensionPrefs(path);
      else
--      pref_LoadPrefsInDir(path, nsnull, 0);
+-      pref_LoadPrefsInDir(path, nullptr, 0);
 +      pref_LoadPrefsInDir(path, specialFiles, NS_ARRAY_LENGTH(specialFiles));
    }
    return NS_OK;
@@ -99,7 +99,7 @@
  {
    nsZipItemPtr<char> manifest(jarReader, name, true);
    NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
-@@ -1036,28 +1055,40 @@ static nsresult pref_InitInitialObjects(
+@@ -1025,28 +1044,40 @@ static nsresult pref_InitInitialObjects(
    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
    static const char* specialFiles[] = {
  #if defined(XP_MACOSX)
@@ -198,12 +198,12 @@
 +          nsKDEUtils::command( command );
 +        } else {
 +        // begin non-KDE block
-         PRInt32 alertInterval = 2000;
+         int32_t alertInterval = 2000;
          if (pref)
            pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval);
  
-         PRInt64 alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC;
-         PRInt64 goat = PR_Now() - mStartTime;
+         int64_t alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC;
+         int64_t goat = PR_Now() - mStartTime;
          showTaskbarAlert = goat > alertIntervalUSec;
  
 @@ -2266,19 +2279,20 @@ nsDownload::SetState(DownloadState aStat
@@ -2068,8 +2068,7 @@
 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
-@@ -12,16 +12,18 @@
- #include "nsArrayUtils.h"
+@@ -13,16 +13,19 @@
  #include "prnetdb.h"
  #include "prenv.h"
  #include "nsPrintfCString.h"
@@ -2077,24 +2076,26 @@
  #include "nsISupportsPrimitives.h"
  #include "nsIGSettingsService.h"
  #include "nsInterfaceHashtable.h"
+ #include "mozilla/Attributes.h"
 +#include "nsVoidArray.h"
 +#include "nsKDEUtils.h"
++
  
- class nsUnixSystemProxySettings : public nsISystemProxySettings {
+ class nsUnixSystemProxySettings MOZ_FINAL : public nsISystemProxySettings {
  public:
    NS_DECL_ISUPPORTS
    NS_DECL_NSISYSTEMPROXYSETTINGS
  
    nsUnixSystemProxySettings() {}
    nsresult Init();
-@@ -33,16 +35,17 @@ private:
+@@ -34,16 +37,17 @@ private:
    nsCOMPtr<nsIGSettingsService> mGSettings;
    nsCOMPtr<nsIGSettingsCollection> mProxySettings;
    nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings;
    bool IsProxyMode(const char* aMode);
    nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
-   nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
-   nsresult GetProxyFromGSettings(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
+   nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
+   nsresult GetProxyFromGSettings(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
    nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult);
 +  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
  };
@@ -2105,12 +2106,12 @@
  nsUnixSystemProxySettings::Init()
  {
    // If this is a GNOME session, load gconf and try to use its preferences.
-@@ -495,16 +498,19 @@ nsUnixSystemProxySettings::GetProxyForUR
+@@ -496,16 +500,19 @@ nsUnixSystemProxySettings::GetProxyForUR
    nsCAutoString host;
    rv = aURI->GetHost(host);
    NS_ENSURE_SUCCESS(rv, rv);
  
-   PRInt32 port;
+   int32_t port;
    rv = aURI->GetPort(&port);
    NS_ENSURE_SUCCESS(rv, rv);
  
@@ -2125,7 +2126,7 @@
    if (mGConf)
      return GetProxyFromGConf(scheme, host, port, aResult);
  
-@@ -530,8 +536,34 @@ static const mozilla::Module::ContractID
+@@ -531,8 +538,34 @@ static const mozilla::Module::ContractID
  
  static const mozilla::Module kUnixProxyModule = {
    mozilla::Module::kVersion,
@@ -2936,7 +2937,7 @@
 +        {
 +        nsCString mimetype = output[ 0 ];
 +        nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix( mimetype );
-+        NS_ENSURE_TRUE(mimeInfo, nsnull);
++        NS_ENSURE_TRUE(mimeInfo, nullptr);
 +        nsCString description = output[ 1 ];
 +        mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description));
 +        nsCString handlerAppName = output[ 2 ];
@@ -2946,7 +2947,7 @@
 +        NS_ADDREF((retval = mimeInfo));
 +        return retval;
 +        }
-+    return nsnull;
++    return nullptr;
 +}
 diff --git a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h
 new file mode 100644
@@ -3049,11 +3050,11 @@
  
  #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
    if (NS_FAILED(rv)){
-     HildonURIAction *action = hildon_uri_get_default_action(mSchemeOrType.get(), nsnull);
+     HildonURIAction *action = hildon_uri_get_default_action(mSchemeOrType.get(), nullptr);
      if (action) {
        nsCAutoString spec;
        aURI->GetAsciiSpec(spec);
-       if (hildon_uri_open(spec.get(), action, nsnull))
+       if (hildon_uri_open(spec.get(), action, nullptr))
 @@ -61,22 +64,22 @@ nsMIMEInfoUnix::LoadUriInternal(nsIURI *
  
    return rv;
@@ -3207,7 +3208,7 @@
                                    majorType,
 @@ -1391,17 +1391,17 @@ nsOSHelperAppService::GetFromType(const 
  #ifdef MOZ_WIDGET_GTK2
-   nsMIMEInfoBase *gnomeInfo = nsnull;
+   nsMIMEInfoBase *gnomeInfo = nullptr;
    if (handler.IsEmpty()) {
      // No useful data yet.  Check the GNOME registry.  Unfortunately, newer
      // GNOME versions no longer have type-to-extension mappings, so we might
@@ -3281,7 +3282,7 @@
  using namespace mozilla;
  
  #define MAX_PREVIEW_SIZE 180
-@@ -252,17 +254,19 @@ nsFilePicker::AppendFilters(PRInt32 aFil
+@@ -264,17 +266,19 @@ nsFilePicker::AppendFilters(int32_t aFil
    return nsBaseFilePicker::AppendFilters(aFilterMask);
  }
  
@@ -3302,34 +3303,34 @@
  
    mFilters.AppendElement(filter);
    mFilterNames.AppendElement(name);
-@@ -357,16 +361,19 @@ nsFilePicker::GetFiles(nsISimpleEnumerat
+@@ -369,16 +373,19 @@ nsFilePicker::GetFiles(nsISimpleEnumerat
    return NS_ERROR_FAILURE;
  }
  
  NS_IMETHODIMP
- nsFilePicker::Show(PRInt16 *aReturn)
+ nsFilePicker::Show(int16_t *aReturn)
  {
    NS_ENSURE_ARG_POINTER(aReturn);
  
 +  if( nsKDEUtils::kdeSupport())
 +    return kdeFileDialog(aReturn);
 +
-   nsXPIDLCString title;
-   title.Adopt(ToNewUTF8String(mTitle));
- 
-   GtkWindow *parent_widget = get_gtk_window_for_nsiwidget(mParentWidget);
+   nsresult rv = Open(nullptr);
+   if (NS_FAILED(rv))
+     return rv;
  
-   GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
-   const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE)
-                                ? GTK_STOCK_SAVE : GTK_STOCK_OPEN;
-@@ -505,8 +512,234 @@ nsFilePicker::Show(PRInt16 *aReturn)
-     *aReturn = nsIFilePicker::returnCancel;
-     break;
+   while (mRunning) {
+     g_main_context_iteration(nullptr, TRUE);
    }
  
-   gtk_widget_destroy(file_chooser);
- 
-   return NS_OK;
+@@ -587,8 +594,235 @@ nsFilePicker::Done(GtkWidget* file_choos
+   if (mCallback) {
+     mCallback->Done(result);
+     mCallback = nullptr;
+   } else {
+     mResult = result;
+   }
+   NS_RELEASE_THIS();
  }
 +
 +nsCString nsFilePicker::kdeMakeFilter( int index )
@@ -3557,10 +3558,11 @@
 +        }
 +    return NS_OK;
 +    }
++
 diff --git a/widget/gtk2/nsFilePicker.h b/widget/gtk2/nsFilePicker.h
 --- a/widget/gtk2/nsFilePicker.h
 +++ b/widget/gtk2/nsFilePicker.h
-@@ -57,11 +57,17 @@ protected:
+@@ -67,11 +67,17 @@ protected:
    nsString  mDefault;
    nsString  mDefaultExtension;
  
@@ -3835,7 +3837,7 @@
      return NS_ERROR_FAILURE;
 @@ -1823,16 +1831,23 @@ nsLocalFile::Launch()
  
-     if (nsnull == connection)
+     if (nullptr == connection)
        return NS_ERROR_FAILURE;
  
      if (hildon_mime_open_file(connection, mPath.get()) != kHILDON_SUCCESS)