mozilla-kde.patch
changeset 568 2c74c5927ea2
parent 546 2c9448fe783c
child 589 b3ff3d8ebf9d
equal deleted inserted replaced
565:f6d567a99b67 568:2c74c5927ea2
    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 @@ -921,17 +940,17 @@ static nsresult pref_LoadPrefsInDirList(
    84  
    84  
    85      nsCAutoString 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?
    89      if (Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi")))
    89      if (Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi")))
    90        ReadExtensionPrefs(path);
    90        ReadExtensionPrefs(path);
   157 +
   157 +
   158  CXXFLAGS += $(TK_CFLAGS)
   158  CXXFLAGS += $(TK_CFLAGS)
   159 diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp
   159 diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp
   160 --- a/toolkit/components/downloads/nsDownloadManager.cpp
   160 --- a/toolkit/components/downloads/nsDownloadManager.cpp
   161 +++ b/toolkit/components/downloads/nsDownloadManager.cpp
   161 +++ b/toolkit/components/downloads/nsDownloadManager.cpp
   162 @@ -35,16 +35,20 @@
   162 @@ -36,16 +36,20 @@
   163  
   163  
   164  #ifdef XP_WIN
   164  #ifdef XP_WIN
   165  #include <shlobj.h>
   165  #include <shlobj.h>
   166  #ifdef DOWNLOAD_SCANNER
   166  #ifdef DOWNLOAD_SCANNER
   167  #include "nsDownloadScanner.h"
   167  #include "nsDownloadScanner.h"
   178  
   178  
   179  #ifdef MOZ_WIDGET_ANDROID
   179  #ifdef MOZ_WIDGET_ANDROID
   180  #include "AndroidBridge.h"
   180  #include "AndroidBridge.h"
   181  #endif
   181  #endif
   182  
   182  
   183 @@ -2233,16 +2237,25 @@ nsDownload::SetState(DownloadState aStat
   183 @@ -2253,16 +2257,25 @@ nsDownload::SetState(DownloadState aStat
   184        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
   184        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
   185  
   185  
   186        // Master pref to control this function.
   186        // Master pref to control this function.
   187        bool showTaskbarAlert = true;
   187        bool showTaskbarAlert = true;
   188        if (pref)
   188        if (pref)
   192 +        if( nsKDEUtils::kdeSupport()) {
   192 +        if( nsKDEUtils::kdeSupport()) {
   193 +          nsTArray<nsCString> command;
   193 +          nsTArray<nsCString> command;
   194 +          command.AppendElement( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" ));
   194 +          command.AppendElement( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" ));
   195 +          nsAutoString displayName;
   195 +          nsAutoString displayName;
   196 +          GetDisplayName( displayName );
   196 +          GetDisplayName( displayName );
   197 +          command.AppendElement( nsCAutoString( ToNewUTF8String( displayName )));
   197 +          command.AppendElement( nsAutoCString( ToNewUTF8String( displayName )));
   198 +          nsKDEUtils::command( command );
   198 +          nsKDEUtils::command( command );
   199 +        } else {
   199 +        } else {
   200 +        // begin non-KDE block
   200 +        // begin non-KDE block
   201          int32_t alertInterval = 2000;
   201          int32_t alertInterval = 2000;
   202          if (pref)
   202          if (pref)
   204  
   204  
   205          int64_t alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC;
   205          int64_t alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC;
   206          int64_t goat = PR_Now() - mStartTime;
   206          int64_t goat = PR_Now() - mStartTime;
   207          showTaskbarAlert = goat > alertIntervalUSec;
   207          showTaskbarAlert = goat > alertIntervalUSec;
   208  
   208  
   209 @@ -2266,19 +2279,20 @@ nsDownload::SetState(DownloadState aStat
   209 @@ -2286,19 +2299,20 @@ nsDownload::SetState(DownloadState aStat
   210                // If downloads are automatically removed per the user's
   210                // If downloads are automatically removed per the user's
   211                // retention policy, there's no reason to make the text clickable
   211                // retention policy, there's no reason to make the text clickable
   212                // because if it is, they'll click open the download manager and
   212                // because if it is, they'll click open the download manager and
   213                // the items they downloaded will have been removed.
   213                // the items they downloaded will have been removed.
   214                alerts->ShowAlertNotification(
   214                alerts->ShowAlertNotification(
   229        if (fileURL &&
   229        if (fileURL &&
   230            NS_SUCCEEDED(fileURL->GetFile(getter_AddRefs(file))) &&
   230            NS_SUCCEEDED(fileURL->GetFile(getter_AddRefs(file))) &&
   231 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
   231 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
   232 --- a/toolkit/content/jar.mn
   232 --- a/toolkit/content/jar.mn
   233 +++ b/toolkit/content/jar.mn
   233 +++ b/toolkit/content/jar.mn
   234 @@ -45,29 +45,33 @@ toolkit.jar:
   234 @@ -46,29 +46,33 @@ toolkit.jar:
   235     content/global/viewZoomOverlay.js          (viewZoomOverlay.js)
   235     content/global/viewZoomOverlay.js          (viewZoomOverlay.js)
   236  *+ content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
   236  *+ content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
   237     content/global/bindings/browser.xml         (widgets/browser.xml)
   237     content/global/bindings/browser.xml         (widgets/browser.xml)
   238     content/global/bindings/button.xml          (widgets/button.xml)
   238     content/global/bindings/button.xml          (widgets/button.xml)
   239     content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
   239     content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
  2066 +#    PrefWindow I   (June 4, 1999)
  2066 +#    PrefWindow I   (June 4, 1999)
  2067 +#
  2067 +#
  2068 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2068 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2069 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2069 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2070 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2070 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2071 @@ -13,16 +13,19 @@
  2071 @@ -14,16 +14,18 @@
  2072  #include "prnetdb.h"
       
  2073  #include "prenv.h"
  2072  #include "prenv.h"
  2074  #include "nsPrintfCString.h"
  2073  #include "nsPrintfCString.h"
  2075  #include "nsNetUtil.h"
  2074  #include "nsNetUtil.h"
  2076  #include "nsISupportsPrimitives.h"
  2075  #include "nsISupportsPrimitives.h"
  2077  #include "nsIGSettingsService.h"
  2076  #include "nsIGSettingsService.h"
  2078  #include "nsInterfaceHashtable.h"
  2077  #include "nsInterfaceHashtable.h"
  2079  #include "mozilla/Attributes.h"
  2078  #include "mozilla/Attributes.h"
       
  2079  #include "nsIURI.h"
  2080 +#include "nsVoidArray.h"
  2080 +#include "nsVoidArray.h"
  2081 +#include "nsKDEUtils.h"
  2081 +#include "nsKDEUtils.h"
  2082 +
       
  2083  
  2082  
  2084  class nsUnixSystemProxySettings MOZ_FINAL : public nsISystemProxySettings {
  2083  class nsUnixSystemProxySettings MOZ_FINAL : public nsISystemProxySettings {
  2085  public:
  2084  public:
  2086    NS_DECL_ISUPPORTS
  2085    NS_DECL_ISUPPORTS
  2087    NS_DECL_NSISYSTEMPROXYSETTINGS
  2086    NS_DECL_NSISYSTEMPROXYSETTINGS
  2088  
  2087  
  2089    nsUnixSystemProxySettings() {}
  2088    nsUnixSystemProxySettings() {}
  2090    nsresult Init();
  2089    nsresult Init();
  2091 @@ -34,16 +37,17 @@ private:
  2090 @@ -35,16 +37,17 @@ private:
  2092    nsCOMPtr<nsIGSettingsService> mGSettings;
  2091    nsCOMPtr<nsIGSettingsService> mGSettings;
  2093    nsCOMPtr<nsIGSettingsCollection> mProxySettings;
  2092    nsCOMPtr<nsIGSettingsCollection> mProxySettings;
  2094    nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings;
  2093    nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings;
  2095    bool IsProxyMode(const char* aMode);
  2094    bool IsProxyMode(const char* aMode);
  2096    nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
  2095    nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
  2100 +  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
  2099 +  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
  2101  };
  2100  };
  2102  
  2101  
  2103  NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
  2102  NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
  2104  
  2103  
       
  2104  NS_IMETHODIMP
       
  2105  nsUnixSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly)
       
  2106  {
       
  2107    // dbus prevents us from being threadsafe, but this routine should not block anyhow
       
  2108 @@ -499,16 +502,19 @@ nsUnixSystemProxySettings::GetProxyFromG
       
  2109  
  2105  nsresult
  2110  nsresult
  2106  nsUnixSystemProxySettings::Init()
  2111  nsUnixSystemProxySettings::GetProxyForURI(const nsACString & aSpec,
       
  2112                                            const nsACString & aScheme,
       
  2113                                            const nsACString & aHost,
       
  2114                                            const int32_t      aPort,
       
  2115                                            nsACString & aResult)
  2107  {
  2116  {
  2108    // If this is a GNOME session, load gconf and try to use its preferences.
  2117 +  if( nsKDEUtils::kdeSupport()) {
  2109 @@ -496,16 +500,19 @@ nsUnixSystemProxySettings::GetProxyForUR
  2118 +    return GetProxyFromKDE(aScheme, aHost, aPort, aResult);
  2110    nsCAutoString host;
       
  2111    rv = aURI->GetHost(host);
       
  2112    NS_ENSURE_SUCCESS(rv, rv);
       
  2113  
       
  2114    int32_t port;
       
  2115    rv = aURI->GetPort(&port);
       
  2116    NS_ENSURE_SUCCESS(rv, rv);
       
  2117  
       
  2118 +  if( nsKDEUtils::kdeSupport())
       
  2119 +    return GetProxyFromKDE(scheme, host, port, aResult);
       
  2120 +
  2119 +
  2121    if (mProxySettings) {
  2120    if (mProxySettings) {
  2122      rv = GetProxyFromGSettings(scheme, host, port, aResult);
  2121      nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
  2123      if (rv == NS_OK)
  2122      if (NS_SUCCEEDED(rv))
  2124        return rv;
  2123        return rv;
  2125    }
  2124    }
  2126    if (mGConf)
  2125    if (mGConf)
  2127      return GetProxyFromGConf(scheme, host, port, aResult);
  2126      return GetProxyFromGConf(aScheme, aHost, aPort, aResult);
  2128  
  2127  
  2129 @@ -531,8 +538,34 @@ static const mozilla::Module::ContractID
  2128 @@ -534,8 +540,34 @@ static const mozilla::Module::ContractID
  2130  
  2129  
  2131  static const mozilla::Module kUnixProxyModule = {
  2130  static const mozilla::Module kUnixProxyModule = {
  2132    mozilla::Module::kVersion,
  2131    mozilla::Module::kVersion,
  2133    kUnixProxyCIDs,
  2132    kUnixProxyCIDs,
  2134    kUnixProxyContracts
  2133    kUnixProxyContracts
  2140 +nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
  2139 +nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
  2141 +                                           const nsACString& aHost,
  2140 +                                           const nsACString& aHost,
  2142 +                                           PRInt32 aPort,
  2141 +                                           PRInt32 aPort,
  2143 +                                           nsACString& aResult)
  2142 +                                           nsACString& aResult)
  2144 +{
  2143 +{
  2145 +  nsCAutoString url;
  2144 +  nsAutoCString url;
  2146 +  url = aScheme;
  2145 +  url = aScheme;
  2147 +  url += "://";
  2146 +  url += "://";
  2148 +  url += aHost;
  2147 +  url += aHost;
  2149 +  if( aPort >= 0 )
  2148 +  if( aPort >= 0 )
  2150 +  {
  2149 +  {
  2319 +//#endif
  2318 +//#endif
  2320 +        if( char* eol = strchr( buf, '\n' ))
  2319 +        if( char* eol = strchr( buf, '\n' ))
  2321 +            *eol = '\0';
  2320 +            *eol = '\0';
  2322 +        command_done = ( strcmp( buf, "\\1" ) == 0 );
  2321 +        command_done = ( strcmp( buf, "\\1" ) == 0 );
  2323 +        command_failed = ( strcmp( buf, "\\0" ) == 0 );
  2322 +        command_failed = ( strcmp( buf, "\\0" ) == 0 );
  2324 +        nsCAutoString line( buf );
  2323 +        nsAutoCString line( buf );
  2325 +        line.ReplaceSubstring( "\\n", "\n" );
  2324 +        line.ReplaceSubstring( "\\n", "\n" );
  2326 +        line.ReplaceSubstring( "\\" "\\", "\\" ); //  \\ -> \ , i.e. unescape
  2325 +        line.ReplaceSubstring( "\\" "\\", "\\" ); //  \\ -> \ , i.e. unescape
  2327 +        if( p->output && !( command_done || command_failed ))
  2326 +        if( p->output && !( command_done || command_failed ))
  2328 +            p->output->AppendElement( nsCString( buf )); // TODO utf8?
  2327 +            p->output->AppendElement( nsCString( buf )); // TODO utf8?
  2329 +        }
  2328 +        }
  2362 +    for ( PRUint32 i = 0; i < length; i++ )
  2361 +    for ( PRUint32 i = 0; i < length; i++ )
  2363 +        {
  2362 +        {
  2364 +        nsCOMPtr<nsISupportsCString> str = do_QueryElementAt( command, i );
  2363 +        nsCOMPtr<nsISupportsCString> str = do_QueryElementAt( command, i );
  2365 +        if( str )
  2364 +        if( str )
  2366 +            {
  2365 +            {
  2367 +            nsCAutoString s;
  2366 +            nsAutoCString s;
  2368 +            str->GetData( s );
  2367 +            str->GetData( s );
  2369 +            in.AppendElement( s );
  2368 +            in.AppendElement( s );
  2370 +            }
  2369 +            }
  2371 +        }
  2370 +        }
  2372 +
  2371 +
  2623 +#include "nsKDERegistry.h"
  2622 +#include "nsKDERegistry.h"
  2624 +#include "nsString.h"
  2623 +#include "nsString.h"
  2625 +#include "nsVoidArray.h"
  2624 +#include "nsVoidArray.h"
  2626 +#include "nsKDEUtils.h"
  2625 +#include "nsKDEUtils.h"
  2627 +
  2626 +
  2628 +/* static */ PRBool
  2627 +/* static */ bool
  2629 +nsCommonRegistry::HandlerExists(const char *aProtocolScheme)
  2628 +nsCommonRegistry::HandlerExists(const char *aProtocolScheme)
  2630 +{
  2629 +{
  2631 +    if( nsKDEUtils::kdeSupport())
  2630 +    if( nsKDEUtils::kdeSupport())
  2632 +        return nsKDERegistry::HandlerExists( aProtocolScheme );
  2631 +        return nsKDERegistry::HandlerExists( aProtocolScheme );
  2633 +    return nsGNOMERegistry::HandlerExists( aProtocolScheme );
  2632 +    return nsGNOMERegistry::HandlerExists( aProtocolScheme );
  2681 +class nsMIMEInfoBase;
  2680 +class nsMIMEInfoBase;
  2682 +
  2681 +
  2683 +class nsCommonRegistry
  2682 +class nsCommonRegistry
  2684 +{
  2683 +{
  2685 + public:
  2684 + public:
  2686 +  static PRBool HandlerExists(const char *aProtocolScheme);
  2685 +  static bool HandlerExists(const char *aProtocolScheme);
  2687 +
  2686 +
  2688 +  static nsresult LoadURL(nsIURI *aURL);
  2687 +  static nsresult LoadURL(nsIURI *aURL);
  2689 +
  2688 +
  2690 +  static void GetAppDescForScheme(const nsACString& aScheme,
  2689 +  static void GetAppDescForScheme(const nsACString& aScheme,
  2691 +                                  nsAString& aDesc);
  2690 +                                  nsAString& aDesc);
  2696 +};
  2695 +};
  2697 diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/unix/nsKDERegistry.cpp
  2696 diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/unix/nsKDERegistry.cpp
  2698 new file mode 100644
  2697 new file mode 100644
  2699 --- /dev/null
  2698 --- /dev/null
  2700 +++ b/uriloader/exthandler/unix/nsKDERegistry.cpp
  2699 +++ b/uriloader/exthandler/unix/nsKDERegistry.cpp
  2701 @@ -0,0 +1,86 @@
  2700 @@ -0,0 +1,90 @@
  2702 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2701 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2703 +/* This Source Code Form is subject to the terms of the Mozilla Public
  2702 +/* This Source Code Form is subject to the terms of the Mozilla Public
  2704 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  2703 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  2705 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  2704 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  2706 +
  2705 +
  2711 +#include "nsILocalFile.h"
  2710 +#include "nsILocalFile.h"
  2712 +#include "nsMIMEInfoUnix.h"
  2711 +#include "nsMIMEInfoUnix.h"
  2713 +#include "nsAutoPtr.h"
  2712 +#include "nsAutoPtr.h"
  2714 +#include "nsKDEUtils.h"
  2713 +#include "nsKDEUtils.h"
  2715 +
  2714 +
  2716 +/* static */ PRBool
  2715 +/* static */ bool
  2717 +nsKDERegistry::HandlerExists(const char *aProtocolScheme)
  2716 +nsKDERegistry::HandlerExists(const char *aProtocolScheme)
  2718 +{
  2717 +{
  2719 +    nsTArray<nsCString> command;
  2718 +    nsTArray<nsCString> command;
  2720 +    command.AppendElement( NS_LITERAL_CSTRING( "HANDLEREXISTS" ));
  2719 +    command.AppendElement( NS_LITERAL_CSTRING( "HANDLEREXISTS" ));
  2721 +    command.AppendElement( nsCAutoString( aProtocolScheme ));
  2720 +    command.AppendElement( nsAutoCString( aProtocolScheme ));
  2722 +    return nsKDEUtils::command( command );
  2721 +    return nsKDEUtils::command( command );
  2723 +}
  2722 +}
  2724 +
  2723 +
  2725 +/* static */ nsresult
  2724 +/* static */ nsresult
  2726 +nsKDERegistry::LoadURL(nsIURI *aURL)
  2725 +nsKDERegistry::LoadURL(nsIURI *aURL)
  2728 +    nsTArray<nsCString> command;
  2727 +    nsTArray<nsCString> command;
  2729 +    command.AppendElement( NS_LITERAL_CSTRING( "OPEN" ));
  2728 +    command.AppendElement( NS_LITERAL_CSTRING( "OPEN" ));
  2730 +    nsCString url;
  2729 +    nsCString url;
  2731 +    aURL->GetSpec( url );
  2730 +    aURL->GetSpec( url );
  2732 +    command.AppendElement( url );
  2731 +    command.AppendElement( url );
  2733 +    return nsKDEUtils::command( command );
  2732 +    bool rv = nsKDEUtils::command( command );
       
  2733 +    if (!rv)
       
  2734 +      return NS_ERROR_FAILURE;
       
  2735 +
       
  2736 +    return NS_OK;
  2734 +}
  2737 +}
  2735 +
  2738 +
  2736 +/* static */ void
  2739 +/* static */ void
  2737 +nsKDERegistry::GetAppDescForScheme(const nsACString& aScheme,
  2740 +nsKDERegistry::GetAppDescForScheme(const nsACString& aScheme,
  2738 +                                     nsAString& aDesc)
  2741 +                                     nsAString& aDesc)
  2797 +#include "nsIURI.h"
  2800 +#include "nsIURI.h"
  2798 +#include "nsCOMPtr.h"
  2801 +#include "nsCOMPtr.h"
  2799 +#include "nsTArray.h"
  2802 +#include "nsTArray.h"
  2800 +
  2803 +
  2801 +class nsMIMEInfoBase;
  2804 +class nsMIMEInfoBase;
  2802 +class nsCAutoString;
  2805 +class nsAutoCString;
  2803 +class nsCString;
  2806 +class nsCString;
  2804 +
  2807 +
  2805 +class nsKDERegistry
  2808 +class nsKDERegistry
  2806 +{
  2809 +{
  2807 + public:
  2810 + public:
  2808 +  static PRBool HandlerExists(const char *aProtocolScheme);
  2811 +  static bool HandlerExists(const char *aProtocolScheme);
  2809 +
  2812 +
  2810 +  static nsresult LoadURL(nsIURI *aURL);
  2813 +  static nsresult LoadURL(nsIURI *aURL);
  2811 +
  2814 +
  2812 +  static void GetAppDescForScheme(const nsACString& aScheme,
  2815 +  static void GetAppDescForScheme(const nsACString& aScheme,
  2813 +                                  nsAString& aDesc);
  2816 +                                  nsAString& aDesc);
  2853  
  2856  
  2854  #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
  2857  #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
  2855    if (NS_FAILED(rv)){
  2858    if (NS_FAILED(rv)){
  2856      HildonURIAction *action = hildon_uri_get_default_action(mSchemeOrType.get(), nullptr);
  2859      HildonURIAction *action = hildon_uri_get_default_action(mSchemeOrType.get(), nullptr);
  2857      if (action) {
  2860      if (action) {
  2858        nsCAutoString spec;
  2861        nsAutoCString spec;
  2859        aURI->GetAsciiSpec(spec);
  2862        aURI->GetAsciiSpec(spec);
  2860        if (hildon_uri_open(spec.get(), action, nullptr))
  2863        if (hildon_uri_open(spec.get(), action, nullptr))
  2861 @@ -61,22 +64,22 @@ nsMIMEInfoUnix::LoadUriInternal(nsIURI *
  2864 @@ -61,22 +64,22 @@ nsMIMEInfoUnix::LoadUriInternal(nsIURI *
  2862  
  2865  
  2863    return rv;
  2866    return rv;
  2868  {
  2871  {
  2869    *_retval = false;
  2872    *_retval = false;
  2870 -  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mSchemeOrType);
  2873 -  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mSchemeOrType);
  2871 +  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromType(mSchemeOrType);
  2874 +  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromType(mSchemeOrType);
  2872    if (!mimeInfo) {
  2875    if (!mimeInfo) {
  2873      nsCAutoString ext;
  2876      nsAutoCString ext;
  2874      nsresult rv = GetPrimaryExtension(ext);
  2877      nsresult rv = GetPrimaryExtension(ext);
  2875      if (NS_SUCCEEDED(rv)) {
  2878      if (NS_SUCCEEDED(rv)) {
  2876 -      mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
  2879 -      mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
  2877 +      mimeInfo = nsCommonRegistry::GetFromExtension(ext);
  2880 +      mimeInfo = nsCommonRegistry::GetFromExtension(ext);
  2878      }
  2881      }
  2908 +
  2911 +
  2909 +    return LaunchWithIProcess(mDefaultApplication, nativePath);
  2912 +    return LaunchWithIProcess(mDefaultApplication, nativePath);
  2910 +  }
  2913 +  }
  2911 +
  2914 +
  2912    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  2915    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  2913    nsCAutoString uriSpec;
  2916    nsAutoCString uriSpec;
  2914    if (giovfs) {
  2917    if (giovfs) {
  2915      // nsGIOMimeApp->Launch wants a URI string instead of local file
  2918      // nsGIOMimeApp->Launch wants a URI string instead of local file
  2916      nsresult rv;
  2919      nsresult rv;
  2917      nsCOMPtr<nsIIOService> ioservice = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
  2920      nsCOMPtr<nsIIOService> ioservice = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
  2918      NS_ENSURE_SUCCESS(rv, rv);
  2921      NS_ENSURE_SUCCESS(rv, rv);
  2927    // If we haven't got an app we try to get a valid one by searching for the
  2930    // If we haven't got an app we try to get a valid one by searching for the
  2928    // extension mapped type
  2931    // extension mapped type
  2929 -  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath);
  2932 -  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath);
  2930 +  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath);
  2933 +  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath);
  2931    if (mimeInfo) {
  2934    if (mimeInfo) {
  2932      nsCAutoString type;
  2935      nsAutoCString type;
  2933      mimeInfo->GetType(type);
  2936      mimeInfo->GetType(type);
  2934      if (giovfs) {
  2937      if (giovfs) {
  2935        nsCOMPtr<nsIGIOMimeApp> app;
  2938        nsCOMPtr<nsIGIOMimeApp> app;
  2936        if (NS_SUCCEEDED(giovfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
  2939        if (NS_SUCCEEDED(giovfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
  2937          return app->Launch(uriSpec);
  2940          return app->Launch(uriSpec);
  3095    if (aFilter.EqualsLiteral("..apps")) {
  3098    if (aFilter.EqualsLiteral("..apps")) {
  3096      // No platform specific thing we can do here, really....
  3099      // No platform specific thing we can do here, really....
  3097 -    return NS_OK;
  3100 -    return NS_OK;
  3098 +    // Unless it's KDE.
  3101 +    // Unless it's KDE.
  3099 +    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
  3102 +    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
  3100 +        return NS_OK;
  3103 +      return NS_OK;
  3101    }
  3104    }
  3102  
  3105  
  3103    nsCAutoString filter, name;
  3106    nsAutoCString filter, name;
  3104    CopyUTF16toUTF8(aFilter, filter);
  3107    CopyUTF16toUTF8(aFilter, filter);
  3105    CopyUTF16toUTF8(aTitle, name);
  3108    CopyUTF16toUTF8(aTitle, name);
  3106  
  3109  
  3107    mFilters.AppendElement(filter);
  3110    mFilters.AppendElement(filter);
  3108    mFilterNames.AppendElement(name);
  3111    mFilterNames.AppendElement(name);
  3124  
  3127  
  3125    while (mRunning) {
  3128    while (mRunning) {
  3126      g_main_context_iteration(nullptr, TRUE);
  3129      g_main_context_iteration(nullptr, TRUE);
  3127    }
  3130    }
  3128  
  3131  
  3129 @@ -587,8 +594,235 @@ nsFilePicker::Done(GtkWidget* file_choos
  3132 @@ -588,8 +595,235 @@ nsFilePicker::Done(GtkWidget* file_choos
  3130    if (mCallback) {
  3133    if (mCallback) {
  3131      mCallback->Done(result);
  3134      mCallback->Done(result);
  3132      mCallback = nullptr;
  3135      mCallback = nullptr;
  3133    } else {
  3136    } else {
  3134      mResult = result;
  3137      mResult = result;
  3201 +                arg = "GETDIRECTORYFILENAME";
  3204 +                arg = "GETDIRECTORYFILENAME";
  3202 +                break;
  3205 +                break;
  3203 +            }
  3206 +            }
  3204 +        }
  3207 +        }
  3205 +
  3208 +
  3206 +  nsCAutoString directory;
  3209 +  nsAutoCString directory;
  3207 +  if (mDisplayDirectory) {
  3210 +  if (mDisplayDirectory) {
  3208 +    mDisplayDirectory->GetNativePath(directory);
  3211 +    mDisplayDirectory->GetNativePath(directory);
  3209 +  } else if (mPrevDisplayDirectory) {
  3212 +  } else if (mPrevDisplayDirectory) {
  3210 +    mPrevDisplayDirectory->GetNativePath(directory);
  3213 +    mPrevDisplayDirectory->GetNativePath(directory);
  3211 +  }
  3214 +  }
  3212 +
  3215 +
  3213 +    nsCAutoString startdir;
  3216 +    nsAutoCString startdir;
  3214 +  if (!directory.IsEmpty()) {
  3217 +  if (!directory.IsEmpty()) {
  3215 +    startdir = directory;
  3218 +    startdir = directory;
  3216 +  }
  3219 +  }
  3217 +  if (mMode == nsIFilePicker::modeSave) {
  3220 +  if (mMode == nsIFilePicker::modeSave) {
  3218 +    if( !startdir.IsEmpty())
  3221 +    if( !startdir.IsEmpty())
  3224 +      startdir = ToNewUTF8String(mDefault);
  3227 +      startdir = ToNewUTF8String(mDefault);
  3225 +  }
  3228 +  }
  3226 +  if( startdir.IsEmpty())
  3229 +  if( startdir.IsEmpty())
  3227 +      startdir = ".";
  3230 +      startdir = ".";
  3228 +
  3231 +
  3229 +    nsCAutoString filters;
  3232 +    nsAutoCString filters;
  3230 +    PRInt32 count = mFilters.Length();
  3233 +    PRInt32 count = mFilters.Length();
  3231 +    if( count == 0 ) //just in case
  3234 +    if( count == 0 ) //just in case
  3232 +        filters = "*";
  3235 +        filters = "*";
  3233 +    else
  3236 +    else
  3234 +        {
  3237 +        {
  3239 +            filters += kdeMakeFilter( i );
  3242 +            filters += kdeMakeFilter( i );
  3240 +            }
  3243 +            }
  3241 +        }
  3244 +        }
  3242 +
  3245 +
  3243 +    nsTArray<nsCString> command;
  3246 +    nsTArray<nsCString> command;
  3244 +    command.AppendElement( nsCAutoString( arg ));
  3247 +    command.AppendElement( nsAutoCString( arg ));
  3245 +    command.AppendElement( startdir );
  3248 +    command.AppendElement( startdir );
  3246 +    if( mMode != nsIFilePicker::modeGetFolder )
  3249 +    if( mMode != nsIFilePicker::modeGetFolder )
  3247 +        {
  3250 +        {
  3248 +        command.AppendElement( filters );
  3251 +        command.AppendElement( filters );
  3249 +        nsCAutoString selected;
  3252 +        nsAutoCString selected;
  3250 +        selected.AppendInt( mSelectedType );
  3253 +        selected.AppendInt( mSelectedType );
  3251 +        command.AppendElement( selected );
  3254 +        command.AppendElement( selected );
  3252 +        }
  3255 +        }
  3253 +    command.AppendElement( title );
  3256 +    command.AppendElement( title );
  3254 +    if( mMode == nsIFilePicker::modeOpenMultiple )
  3257 +    if( mMode == nsIFilePicker::modeOpenMultiple )
  3255 +        command.AppendElement( NS_LITERAL_CSTRING( "MULTIPLE" ));
  3258 +        command.AppendElement( NS_LITERAL_CSTRING( "MULTIPLE" ));
  3256 +    if( PRInt32 xid = windowToXid( mParentWidget ))
  3259 +    if( PRInt32 xid = windowToXid( mParentWidget ))
  3257 +        {
  3260 +        {
  3258 +        command.AppendElement( NS_LITERAL_CSTRING( "PARENT" ));
  3261 +        command.AppendElement( NS_LITERAL_CSTRING( "PARENT" ));
  3259 +        nsCAutoString parent;
  3262 +        nsAutoCString parent;
  3260 +        parent.AppendInt( xid );
  3263 +        parent.AppendInt( xid );
  3261 +        command.AppendElement( parent );
  3264 +        command.AppendElement( parent );
  3262 +        }
  3265 +        }
  3263 +
  3266 +
  3264 +    nsTArray<nsCString> output;
  3267 +    nsTArray<nsCString> output;
  3342 +    command.AppendElement( NS_LITERAL_CSTRING( "APPSDIALOG" ));
  3345 +    command.AppendElement( NS_LITERAL_CSTRING( "APPSDIALOG" ));
  3343 +    command.AppendElement( title );
  3346 +    command.AppendElement( title );
  3344 +    if( PRInt32 xid = windowToXid( mParentWidget ))
  3347 +    if( PRInt32 xid = windowToXid( mParentWidget ))
  3345 +        {
  3348 +        {
  3346 +        command.AppendElement( NS_LITERAL_CSTRING( "PARENT" ));
  3349 +        command.AppendElement( NS_LITERAL_CSTRING( "PARENT" ));
  3347 +        nsCAutoString parent;
  3350 +        nsAutoCString parent;
  3348 +        parent.AppendInt( xid );
  3351 +        parent.AppendInt( xid );
  3349 +        command.AppendElement( parent );
  3352 +        command.AppendElement( parent );
  3350 +        }
  3353 +        }
  3351 +
  3354 +
  3352 +    nsTArray<nsCString> output;
  3355 +    nsTArray<nsCString> output;
  3530      if (directive->regfunc) {
  3533      if (directive->regfunc) {
  3531        if (GeckoProcessType_Default != XRE_GetProcessType())
  3534        if (GeckoProcessType_Default != XRE_GetProcessType())
  3532 diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in
  3535 diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in
  3533 --- a/xpcom/io/Makefile.in
  3536 --- a/xpcom/io/Makefile.in
  3534 +++ b/xpcom/io/Makefile.in
  3537 +++ b/xpcom/io/Makefile.in
  3535 @@ -157,17 +157,17 @@ include $(topsrcdir)/ipc/chromium/chromi
  3538 @@ -161,17 +161,17 @@ include $(topsrcdir)/ipc/chromium/chromi
  3536  DEFINES		+= -D_IMPL_NS_COM
  3539  DEFINES		+= -D_IMPL_NS_COM
  3537  
  3540  
  3538  ifeq ($(OS_ARCH),Linux)
  3541  ifeq ($(OS_ARCH),Linux)
  3539  ifneq (,$(findstring lib64,$(libdir)))
  3542  ifneq (,$(findstring lib64,$(libdir)))
  3540  DEFINES     += -DHAVE_USR_LIB64_DIR
  3543  DEFINES     += -DHAVE_USR_LIB64_DIR
  3552  ifdef MOZ_PLATFORM_MAEMO
  3555  ifdef MOZ_PLATFORM_MAEMO
  3553  CFLAGS          += $(MOZ_PLATFORM_MAEMO_CFLAGS) $(MOZ_QT_CFLAGS)
  3556  CFLAGS          += $(MOZ_PLATFORM_MAEMO_CFLAGS) $(MOZ_QT_CFLAGS)
  3554 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
  3557 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
  3555 --- a/xpcom/io/nsLocalFileUnix.cpp
  3558 --- a/xpcom/io/nsLocalFileUnix.cpp
  3556 +++ b/xpcom/io/nsLocalFileUnix.cpp
  3559 +++ b/xpcom/io/nsLocalFileUnix.cpp
  3557 @@ -49,16 +49,17 @@
  3560 @@ -50,16 +50,17 @@
  3558  #include "prproces.h"
  3561  #include "prproces.h"
  3559  #include "nsIDirectoryEnumerator.h"
  3562  #include "nsIDirectoryEnumerator.h"
  3560  #include "nsISimpleEnumerator.h"
  3563  #include "nsISimpleEnumerator.h"
  3561  #include "private/pprio.h"
  3564  #include "private/pprio.h"
  3562  
  3565  
  3570  #include <Carbon/Carbon.h>
  3573  #include <Carbon/Carbon.h>
  3571  #include "CocoaFileUtils.h"
  3574  #include "CocoaFileUtils.h"
  3572  #include "prmem.h"
  3575  #include "prmem.h"
  3573  #include "plbase64.h"
  3576  #include "plbase64.h"
  3574  
  3577  
  3575 @@ -1760,44 +1761,51 @@ nsLocalFile::SetPersistentDescriptor(con
  3578 @@ -1752,44 +1753,51 @@ nsLocalFile::SetPersistentDescriptor(con
  3576      return InitWithNativePath(aPersistentDescriptor);
  3579      return InitWithNativePath(aPersistentDescriptor);
  3577  #endif
  3580  #endif
  3578  }
  3581  }
  3579  
  3582  
  3580  NS_IMETHODIMP
  3583  NS_IMETHODIMP
  3584 -    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  3587 -    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  3585 -    nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
  3588 -    nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
  3586 -    if (!giovfs && !gnomevfs)
  3589 -    if (!giovfs && !gnomevfs)
  3587 -        return NS_ERROR_FAILURE;
  3590 -        return NS_ERROR_FAILURE;
  3588 -
  3591 -
  3589 +    nsCAutoString url;
  3592 +    nsAutoCString url;
  3590      bool isDirectory;
  3593      bool isDirectory;
  3591      if (NS_FAILED(IsDirectory(&isDirectory)))
  3594      if (NS_FAILED(IsDirectory(&isDirectory)))
  3592          return NS_ERROR_FAILURE;
  3595          return NS_ERROR_FAILURE;
  3593  
  3596  
  3594      if (isDirectory) {
  3597      if (isDirectory) {
  3598 -            /* Fallback to GnomeVFS */
  3601 -            /* Fallback to GnomeVFS */
  3599 -            return gnomevfs->ShowURIForInput(mPath);
  3602 -            return gnomevfs->ShowURIForInput(mPath);
  3600 +        url = mPath;
  3603 +        url = mPath;
  3601      } else {
  3604      } else {
  3602          nsCOMPtr<nsIFile> parentDir;
  3605          nsCOMPtr<nsIFile> parentDir;
  3603          nsCAutoString dirPath;
  3606          nsAutoCString dirPath;
  3604          if (NS_FAILED(GetParent(getter_AddRefs(parentDir))))
  3607          if (NS_FAILED(GetParent(getter_AddRefs(parentDir))))
  3605              return NS_ERROR_FAILURE;
  3608              return NS_ERROR_FAILURE;
  3606          if (NS_FAILED(parentDir->GetNativePath(dirPath)))
  3609          if (NS_FAILED(parentDir->GetNativePath(dirPath)))
  3607              return NS_ERROR_FAILURE;
  3610              return NS_ERROR_FAILURE;
  3608  
  3611  
  3636        nsresult rv = CocoaFileUtils::RevealFileInFinder(url);
  3639        nsresult rv = CocoaFileUtils::RevealFileInFinder(url);
  3637        ::CFRelease(url);
  3640        ::CFRelease(url);
  3638        return rv;
  3641        return rv;
  3639      }
  3642      }
  3640      return NS_ERROR_FAILURE;
  3643      return NS_ERROR_FAILURE;
  3641 @@ -1823,16 +1831,23 @@ nsLocalFile::Launch()
  3644 @@ -1815,16 +1823,23 @@ nsLocalFile::Launch()
  3642  
  3645  
  3643      if (nullptr == connection)
  3646      if (nullptr == connection)
  3644        return NS_ERROR_FAILURE;
  3647        return NS_ERROR_FAILURE;
  3645  
  3648  
  3646      if (hildon_mime_open_file(connection, mPath.get()) != kHILDON_SUCCESS)
  3649      if (hildon_mime_open_file(connection, mPath.get()) != kHILDON_SUCCESS)