mozilla-kde.patch
branchfirefox68
changeset 1097 840132a4a9b3
parent 1093 3942c205588b
child 1099 8a3c73e74e65
equal deleted inserted replaced
1096:4c248180e576 1097:840132a4a9b3
     1 # HG changeset patch
     1 # HG changeset patch
     2 # Parent  cafacdb0b7c50666e5dcc927684a23e8733206a5
     2 # User msirringhaus@suse.de
       
     3 # Date 1559294891 -7200
       
     4 #      Fri May 31 11:28:11 2019 +0200
       
     5 # Node ID c2aa7198fb925e7fde96abf65b6f68b9b755f112
       
     6 # Parent  f11c2d7239c0caa4dc74272716d9e30ced1a1ca3
     3 Description: Add KDE integration to Firefox (toolkit parts)
     7 Description: Add KDE integration to Firefox (toolkit parts)
     4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
     8 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
     5 Author: Lubos Lunak <lunak@suse.com>
     9 Author: Lubos Lunak <lunak@suse.com>
     6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
    10 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
     7      https://bugzilla.novell.com/show_bug.cgi?id=170055
    11      https://bugzilla.novell.com/show_bug.cgi?id=170055
    25  #endif
    29  #endif
    26  
    30  
    27  #ifdef XP_WIN
    31  #ifdef XP_WIN
    28  #  include "windows.h"
    32  #  include "windows.h"
    29  #endif
    33  #endif
    30 @@ -4493,25 +4494,37 @@ float MOZ_MAYBE_UNUSED GetPref<float>(co
    34 @@ -4507,25 +4508,37 @@ static nsresult pref_ReadDefaultPrefs(co
    31    // application pref files for backwards compatibility.
    35    // application pref files for backwards compatibility.
    32    static const char* specialFiles[] = {
    36    static const char* specialFiles[] = {
    33  #if defined(XP_MACOSX)
    37  #if defined(XP_MACOSX)
    34      "macprefs.js"
    38      "macprefs.js"
    35  #elif defined(XP_WIN)
    39  #elif defined(XP_WIN)
    63      NS_WARNING("Error parsing application default preferences.");
    67      NS_WARNING("Error parsing application default preferences.");
    64    }
    68    }
    65  
    69  
    66    // Load jar:$app/omni.jar!/defaults/preferences/*.js
    70    // Load jar:$app/omni.jar!/defaults/preferences/*.js
    67    // or jar:$gre/omni.jar!/defaults/preferences/*.js.
    71    // or jar:$gre/omni.jar!/defaults/preferences/*.js.
    68 @@ -4559,17 +4572,17 @@ float MOZ_MAYBE_UNUSED GetPref<float>(co
    72 @@ -4573,17 +4586,17 @@ static nsresult pref_ReadDefaultPrefs(co
    69        }
    73        }
    70  
    74  
    71        nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
    75        nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
    72        if (!path) {
    76        if (!path) {
    73          continue;
    77          continue;
   181     content/global/bindings/datetimebox.css     (widgets/datetimebox.css)
   185     content/global/bindings/datetimebox.css     (widgets/datetimebox.css)
   182  *  content/global/bindings/dialog.xml          (widgets/dialog.xml)
   186  *  content/global/bindings/dialog.xml          (widgets/dialog.xml)
   183 +*  content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
   187 +*  content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
   184 +% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
   188 +% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
   185     content/global/bindings/general.xml         (widgets/general.xml)
   189     content/global/bindings/general.xml         (widgets/general.xml)
   186     content/global/bindings/menu.xml            (widgets/menu.xml)
       
   187     content/global/bindings/popup.xml           (widgets/popup.xml)
   190     content/global/bindings/popup.xml           (widgets/popup.xml)
   188     content/global/bindings/radio.xml           (widgets/radio.xml)
       
   189     content/global/bindings/richlistbox.xml     (widgets/richlistbox.xml)
   191     content/global/bindings/richlistbox.xml     (widgets/richlistbox.xml)
   190     content/global/bindings/scrollbox.xml       (widgets/scrollbox.xml)
   192     content/global/bindings/scrollbox.xml       (widgets/scrollbox.xml)
   191     content/global/bindings/spinner.js          (widgets/spinner.js)
   193     content/global/bindings/spinner.js          (widgets/spinner.js)
   192     content/global/bindings/tabbox.xml          (widgets/tabbox.xml)
   194     content/global/bindings/tabbox.xml          (widgets/tabbox.xml)
       
   195  *  content/global/bindings/textbox.xml         (widgets/textbox.xml)
       
   196     content/global/bindings/timekeeper.js       (widgets/timekeeper.js)
   193 diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml
   197 diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml
   194 new file mode 100644
   198 new file mode 100644
   195 --- /dev/null
   199 --- /dev/null
   196 +++ b/toolkit/content/widgets/dialog-kde.xml
   200 +++ b/toolkit/content/widgets/dialog-kde.xml
   197 @@ -0,0 +1,507 @@
   201 @@ -0,0 +1,499 @@
   198 +<?xml version="1.0"?>
   202 +<?xml version="1.0"?>
   199 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
   203 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
   200 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
   204 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
   201 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
   205 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
   202 +
   206 +
   492 +          buttons.cancel = document.getAnonymousElementByAttribute(this, "dlgtype", "cancel");
   496 +          buttons.cancel = document.getAnonymousElementByAttribute(this, "dlgtype", "cancel");
   493 +          buttons.extra1 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra1");
   497 +          buttons.extra1 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra1");
   494 +          buttons.extra2 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra2");
   498 +          buttons.extra2 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra2");
   495 +          buttons.help = document.getAnonymousElementByAttribute(this, "dlgtype", "help");
   499 +          buttons.help = document.getAnonymousElementByAttribute(this, "dlgtype", "help");
   496 +          buttons.disclosure = document.getAnonymousElementByAttribute(this, "dlgtype", "disclosure");
   500 +          buttons.disclosure = document.getAnonymousElementByAttribute(this, "dlgtype", "disclosure");
       
   501 +
       
   502 +          for (let button in buttons) {
       
   503 +            customElements.upgrade(buttons[button]);
       
   504 +          }
   497 +
   505 +
   498 +          // look for any overriding explicit button elements
   506 +          // look for any overriding explicit button elements
   499 +          var exBtns = this.getElementsByAttribute("dlgtype", "*");
   507 +          var exBtns = this.getElementsByAttribute("dlgtype", "*");
   500 +          var dlgtype;
   508 +          var dlgtype;
   501 +          var i;
   509 +          var i;
   644 +        <![CDATA[
   652 +        <![CDATA[
   645 +          var event = document.createEvent("Events");
   653 +          var event = document.createEvent("Events");
   646 +          event.initEvent("dialog" + aDlgType, true, true);
   654 +          event.initEvent("dialog" + aDlgType, true, true);
   647 +
   655 +
   648 +          // handle dom event handlers
   656 +          // handle dom event handlers
   649 +          var noCancel = this.dispatchEvent(event);
   657 +          return this.dispatchEvent(event);
   650 +
       
   651 +          // handle any xml attribute event handlers
       
   652 +          var handler = this.getAttribute("ondialog" + aDlgType);
       
   653 +          if (handler != "") {
       
   654 +            var fn = new Function("event", handler);
       
   655 +            var returned = fn(event);
       
   656 +            // eslint-disable-next-line mozilla/no-compare-against-boolean-literals
       
   657 +            if (returned == false)
       
   658 +              noCancel = false;
       
   659 +          }
       
   660 +
       
   661 +          return noCancel;
       
   662 +        ]]>
   658 +        ]]>
   663 +        </body>
   659 +        </body>
   664 +      </method>
   660 +      </method>
   665 +
   661 +
   666 +      <method name="_hitEnter">
   662 +      <method name="_hitEnter">
   703 +
   699 +
   704 +</bindings>
   700 +</bindings>
   705 diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/HelperAppDlg.jsm
   701 diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/HelperAppDlg.jsm
   706 --- a/toolkit/mozapps/downloads/HelperAppDlg.jsm
   702 --- a/toolkit/mozapps/downloads/HelperAppDlg.jsm
   707 +++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm
   703 +++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm
   708 @@ -1030,30 +1030,60 @@ nsUnknownContentTypeDialog.prototype = {
   704 @@ -1042,30 +1042,60 @@ nsUnknownContentTypeDialog.prototype = {
   709  
   705  
   710        if (params.handlerApp &&
   706        if (params.handlerApp &&
   711            params.handlerApp.executable &&
   707            params.handlerApp.executable &&
   712            params.handlerApp.executable.isFile()) {
   708            params.handlerApp.executable.isFile()) {
   713          // Remember the file they chose to run.
   709          // Remember the file they chose to run.
   781                nsIFilePicker.modeOpen);
   777                nsIFilePicker.modeOpen);
   782  
   778  
   783 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   779 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   784 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   780 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   785 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   781 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   786 @@ -15,16 +15,17 @@
   782 @@ -14,16 +14,17 @@
   787  #include "nsPrintfCString.h"
   783  #include "nsPrintfCString.h"
   788  #include "nsNetCID.h"
   784  #include "nsNetCID.h"
   789  #include "nsNetUtil.h"
   785  #include "nsNetUtil.h"
   790  #include "nsISupportsPrimitives.h"
   786  #include "nsISupportsPrimitives.h"
   791  #include "nsIGSettingsService.h"
   787  #include "nsIGSettingsService.h"
   799  class nsUnixSystemProxySettings final : public nsISystemProxySettings {
   795  class nsUnixSystemProxySettings final : public nsISystemProxySettings {
   800   public:
   796   public:
   801    NS_DECL_ISUPPORTS
   797    NS_DECL_ISUPPORTS
   802    NS_DECL_NSISYSTEMPROXYSETTINGS
   798    NS_DECL_NSISYSTEMPROXYSETTINGS
   803  
   799  
   804 @@ -44,16 +45,18 @@ class nsUnixSystemProxySettings final : 
   800 @@ -37,16 +38,18 @@ class nsUnixSystemProxySettings final : 
   805                                     nsACString& aResult);
   801    nsCOMPtr<nsIGSettingsCollection> mProxySettings;
   806    nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost,
   802    nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection>
   807                               int32_t aPort, nsACString& aResult);
   803        mSchemeProxySettings;
   808    nsresult GetProxyFromGSettings(const nsACString& aScheme,
   804    nsresult GetProxyFromGSettings(const nsACString& aScheme,
   809                                   const nsACString& aHost, int32_t aPort,
   805                                   const nsACString& aHost, int32_t aPort,
   810                                   nsACString& aResult);
   806                                   nsACString& aResult);
   811    nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType,
   807    nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType,
   812                                         nsACString& aResult);
   808                                         nsACString& aResult);
   818  
   814  
   819  NS_IMETHODIMP
   815  NS_IMETHODIMP
   820  nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) {
   816  nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) {
   821    // dbus prevents us from being threadsafe, but this routine should not block
   817    // dbus prevents us from being threadsafe, but this routine should not block
   822    // anyhow
   818    // anyhow
   823 @@ -487,22 +490,51 @@ nsresult nsUnixSystemProxySettings::GetP
   819 @@ -382,21 +385,50 @@ nsresult nsUnixSystemProxySettings::GetP
   824    return NS_OK;
   820    return NS_OK;
   825  }
   821  }
   826  
   822  
   827  nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec,
   823  nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec,
   828                                                     const nsACString& aScheme,
   824                                                     const nsACString& aScheme,
   834 +
   830 +
   835    if (mProxySettings) {
   831    if (mProxySettings) {
   836      nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
   832      nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
   837      if (NS_SUCCEEDED(rv)) return rv;
   833      if (NS_SUCCEEDED(rv)) return rv;
   838    }
   834    }
   839    if (mGConf) return GetProxyFromGConf(aScheme, aHost, aPort, aResult);
       
   840  
   835  
   841    return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult);
   836    return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult);
   842  }
   837  }
   843  
   838  
   844 +nsresult
   839 +nsresult
   941 +static bool getKdeSession()
   936 +static bool getKdeSession()
   942 +    {
   937 +    {
   943 +    Display* dpy = XOpenDisplay( NULL );
   938 +    Display* dpy = XOpenDisplay( NULL );
   944 +    if( dpy == NULL )
   939 +    if( dpy == NULL )
   945 +        return false;
   940 +        return false;
   946 +    Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", True );
   941 +    Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", true );
   947 +    bool kde = false;
   942 +    bool kde = false;
   948 +    if( kde_full_session != None )
   943 +    if( kde_full_session != None )
   949 +        {
   944 +        {
   950 +        int cnt;
   945 +        int cnt;
   951 +        if( Atom* props = XListProperties( dpy, DefaultRootWindow( dpy ), &cnt ))
   946 +        if( Atom* props = XListProperties( dpy, DefaultRootWindow( dpy ), &cnt ))
  1298 +
  1293 +
  1299 +#endif // nsKDEUtils
  1294 +#endif // nsKDEUtils
  1300 diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp
  1295 diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp
  1301 --- a/uriloader/exthandler/HandlerServiceParent.cpp
  1296 --- a/uriloader/exthandler/HandlerServiceParent.cpp
  1302 +++ b/uriloader/exthandler/HandlerServiceParent.cpp
  1297 +++ b/uriloader/exthandler/HandlerServiceParent.cpp
  1303 @@ -1,16 +1,16 @@
  1298 @@ -1,17 +1,17 @@
       
  1299  #include "mozilla/ipc/ProtocolUtils.h"
  1304  #include "mozilla/Logging.h"
  1300  #include "mozilla/Logging.h"
  1305  #include "HandlerServiceParent.h"
  1301  #include "HandlerServiceParent.h"
  1306  #include "nsIHandlerService.h"
  1302  #include "nsIHandlerService.h"
  1307  #include "nsIMIMEInfo.h"
  1303  #include "nsIMIMEInfo.h"
  1308  #include "ContentHandlerService.h"
  1304  #include "ContentHandlerService.h"
  1316  using mozilla::dom::HandlerApp;
  1312  using mozilla::dom::HandlerApp;
  1317  using mozilla::dom::HandlerInfo;
  1313  using mozilla::dom::HandlerInfo;
  1318  using mozilla::dom::RemoteHandlerApp;
  1314  using mozilla::dom::RemoteHandlerApp;
  1319  
  1315  
  1320  namespace {
  1316  namespace {
  1321 @@ -246,17 +246,17 @@ mozilla::ipc::IPCResult HandlerServicePa
  1317 @@ -282,17 +282,17 @@ mozilla::ipc::IPCResult HandlerServicePa
  1322    handlerSvc->Exists(info, exists);
  1318  mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocolOS(
  1323    return IPC_OK();
       
  1324  }
       
  1325  
       
  1326  mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocol(
       
  1327      const nsCString& aProtocolScheme, bool* aHandlerExists) {
  1319      const nsCString& aProtocolScheme, bool* aHandlerExists) {
       
  1320    if (aProtocolScheme.Length() > MAX_SCHEME_LENGTH) {
       
  1321      *aHandlerExists = false;
       
  1322      return IPC_OK();
       
  1323    }
  1328  #ifdef MOZ_WIDGET_GTK
  1324  #ifdef MOZ_WIDGET_GTK
  1329    // Check the GNOME registry for a protocol handler
  1325    // Check the GNOME registry for a protocol handler
  1330 -  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme.get());
  1326 -  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme.get());
  1331 +  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme.get());
  1327 +  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme.get());
  1332  #else
  1328  #else
  1333    *aHandlerExists = false;
  1329    *aHandlerExists = false;
  1334  #endif
  1330  #endif
  1335    return IPC_OK();
  1331    return IPC_OK();
  1336  }
  1332  }
  1337  
  1333  
  1338  mozilla::ipc::IPCResult HandlerServiceParent::RecvGetTypeFromExtension(
  1334  /*
  1339      const nsCString& aFileExtension, nsCString* type) {
  1335   * Check if a handler exists for the provided protocol. Check the datastore
       
  1336 @@ -311,17 +311,17 @@ mozilla::ipc::IPCResult HandlerServicePa
       
  1337    nsCOMPtr<nsIExternalProtocolService> protoSvc =
       
  1338        do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID, &rv);
       
  1339    if (NS_WARN_IF(NS_FAILED(rv))) {
       
  1340      *aHandlerExists = false;
       
  1341      return IPC_OK();
       
  1342    }
       
  1343    rv = protoSvc->ExternalProtocolHandlerExists(aProtocolScheme.get(),
       
  1344                                                 aHandlerExists);
       
  1345 -
       
  1346 +##
       
  1347    if (NS_WARN_IF(NS_FAILED(rv))) {
       
  1348      *aHandlerExists = false;
       
  1349    }
       
  1350  #else
       
  1351    MOZ_RELEASE_ASSERT(false, "No implementation on this platform.");
       
  1352    *aHandlerExists = false;
       
  1353  #endif
       
  1354    return IPC_OK();
  1340 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
  1355 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
  1341 --- a/uriloader/exthandler/moz.build
  1356 --- a/uriloader/exthandler/moz.build
  1342 +++ b/uriloader/exthandler/moz.build
  1357 +++ b/uriloader/exthandler/moz.build
  1343 @@ -80,17 +80,19 @@ else:
  1358 @@ -83,17 +83,19 @@ else:
  1344      SOURCES += [
  1359      SOURCES += [
  1345          osdir + '/nsOSHelperAppService.cpp',
  1360          osdir + '/nsOSHelperAppService.cpp',
  1346      ]
  1361      ]
  1347      if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
  1362      if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
  1348          CXXFLAGS += ['-Wno-error=shadow']
  1363          CXXFLAGS += ['-Wno-error=shadow']
  1358      UNIFIED_SOURCES += [
  1373      UNIFIED_SOURCES += [
  1359          'android/nsAndroidHandlerApp.cpp',
  1374          'android/nsAndroidHandlerApp.cpp',
  1360          'android/nsExternalURLHandlerService.cpp',
  1375          'android/nsExternalURLHandlerService.cpp',
  1361          'android/nsMIMEInfoAndroid.cpp',
  1376          'android/nsMIMEInfoAndroid.cpp',
  1362      ]
  1377      ]
  1363 @@ -130,16 +132,17 @@ include('/ipc/chromium/chromium-config.m
  1378 @@ -133,16 +135,17 @@ include('/ipc/chromium/chromium-config.m
  1364  FINAL_LIBRARY = 'xul'
  1379  FINAL_LIBRARY = 'xul'
  1365  
  1380  
  1366  LOCAL_INCLUDES += [
  1381  LOCAL_INCLUDES += [
  1367      '/docshell/base',
  1382      '/docshell/base',
  1368      '/dom/base',
  1383      '/dom/base',
  1622  #endif
  1637  #endif
  1623 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
  1638 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
  1624 +#include "nsKDEUtils.h"
  1639 +#include "nsKDEUtils.h"
  1625 +#endif
  1640 +#endif
  1626  
  1641  
  1627  nsresult nsMIMEInfoUnix::LoadUriInternal(nsIURI *aURI) {
  1642  nsresult nsMIMEInfoUnix::LoadUriInternal(nsIURI* aURI) {
  1628 -  return nsGNOMERegistry::LoadURL(aURI);
  1643 -  return nsGNOMERegistry::LoadURL(aURI);
  1629 +  return nsCommonRegistry::LoadURL(aURI);
  1644 +  return nsCommonRegistry::LoadURL(aURI);
  1630  }
  1645  }
  1631  
  1646  
  1632  NS_IMETHODIMP
  1647  NS_IMETHODIMP
  1633  nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval) {
  1648  nsMIMEInfoUnix::GetHasDefaultHandler(bool* _retval) {
  1634    // if mDefaultApplication is set, it means the application has been set from
  1649    // if mDefaultApplication is set, it means the application has been set from
  1635    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
  1650    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
  1636    // give the GNOME answer.
  1651    // give the GNOME answer.
  1637    if (mDefaultApplication) return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
  1652    if (mDefaultApplication) return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
  1638  
  1653  
  1792        NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?");
  1807        NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?");
  1793        gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions));
  1808        gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions));
  1794 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
  1809 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
  1795 --- a/widget/gtk/moz.build
  1810 --- a/widget/gtk/moz.build
  1796 +++ b/widget/gtk/moz.build
  1811 +++ b/widget/gtk/moz.build
  1797 @@ -121,16 +121,17 @@ include('/ipc/chromium/chromium-config.m
  1812 @@ -124,16 +124,17 @@ include('/ipc/chromium/chromium-config.m
  1798  
  1813  
  1799  FINAL_LIBRARY = 'xul'
  1814  FINAL_LIBRARY = 'xul'
  1800  
  1815  
  1801  LOCAL_INCLUDES += [
  1816  LOCAL_INCLUDES += [
  1802      '/layout/base',
  1817      '/layout/base',
  1847  
  1862  
  1848  #define MAX_PREVIEW_SIZE 180
  1863  #define MAX_PREVIEW_SIZE 180
  1849  // bug 1184009
  1864  // bug 1184009
  1850  #define MAX_PREVIEW_SOURCE_SIZE 4096
  1865  #define MAX_PREVIEW_SOURCE_SIZE 4096
  1851  
  1866  
  1852  nsIFile *nsFilePicker::mPrevDisplayDirectory = nullptr;
  1867  nsIFile* nsFilePicker::mPrevDisplayDirectory = nullptr;
  1853 @@ -227,17 +229,19 @@ nsFilePicker::AppendFilters(int32_t aFil
  1868 @@ -227,17 +229,19 @@ nsFilePicker::AppendFilters(int32_t aFil
  1854    mAllowURLs = !!(aFilterMask & filterAllowURLs);
  1869    mAllowURLs = !!(aFilterMask & filterAllowURLs);
  1855    return nsBaseFilePicker::AppendFilters(aFilterMask);
  1870    return nsBaseFilePicker::AppendFilters(aFilterMask);
  1856  }
  1871  }
  1857  
  1872  
  1858  NS_IMETHODIMP
  1873  NS_IMETHODIMP
  1859  nsFilePicker::AppendFilter(const nsAString &aTitle, const nsAString &aFilter) {
  1874  nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) {
  1860    if (aFilter.EqualsLiteral("..apps")) {
  1875    if (aFilter.EqualsLiteral("..apps")) {
  1861      // No platform specific thing we can do here, really....
  1876      // No platform specific thing we can do here, really....
  1862 -    return NS_OK;
  1877 -    return NS_OK;
  1863 +    // Unless it's KDE.
  1878 +    // Unless it's KDE.
  1864 +    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
  1879 +    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
  1869    CopyUTF16toUTF8(aFilter, filter);
  1884    CopyUTF16toUTF8(aFilter, filter);
  1870    CopyUTF16toUTF8(aTitle, name);
  1885    CopyUTF16toUTF8(aTitle, name);
  1871  
  1886  
  1872    mFilters.AppendElement(filter);
  1887    mFilters.AppendElement(filter);
  1873    mFilterNames.AppendElement(name);
  1888    mFilterNames.AppendElement(name);
  1874 @@ -337,16 +341,39 @@ nsresult nsFilePicker::Show(int16_t *aRe
  1889 @@ -337,16 +341,39 @@ nsresult nsFilePicker::Show(int16_t* aRe
  1875    return NS_OK;
  1890    return NS_OK;
  1876  }
  1891  }
  1877  
  1892  
  1878  NS_IMETHODIMP
  1893  NS_IMETHODIMP
  1879  nsFilePicker::Open(nsIFilePickerShownCallback *aCallback) {
  1894  nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) {
  1880    // Can't show two dialogs concurrently with the same filepicker
  1895    // Can't show two dialogs concurrently with the same filepicker
  1881    if (mRunning) return NS_ERROR_NOT_AVAILABLE;
  1896    if (mRunning) return NS_ERROR_NOT_AVAILABLE;
  1882  
  1897  
  1883 +  // KDE file picker is not handled via callback
  1898 +  // KDE file picker is not handled via callback
  1884 +  if( nsKDEUtils::kdeSupport()) {
  1899 +  if( nsKDEUtils::kdeSupport()) {
  1904 +  }
  1919 +  }
  1905 +
  1920 +
  1906    nsCString title;
  1921    nsCString title;
  1907    title.Adopt(ToNewUTF8String(mTitle));
  1922    title.Adopt(ToNewUTF8String(mTitle));
  1908  
  1923  
  1909    GtkWindow *parent_widget =
  1924    GtkWindow* parent_widget =
  1910        GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
  1925        GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
  1911  
  1926  
  1912    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
  1927    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
  1913  
  1928  
  1914 @@ -572,16 +599,240 @@ void nsFilePicker::Done(void *file_choos
  1929 @@ -572,16 +599,240 @@ void nsFilePicker::Done(void* file_choos
  1915      mCallback->Done(result);
  1930      mCallback->Done(result);
  1916      mCallback = nullptr;
  1931      mCallback = nullptr;
  1917    } else {
  1932    } else {
  1918      mResult = result;
  1933      mResult = result;
  1919    }
  1934    }
  2143 +        }
  2158 +        }
  2144 +    return NS_OK;
  2159 +    return NS_OK;
  2145 +    }
  2160 +    }
  2146 +
  2161 +
  2147  // All below functions available as of GTK 3.20+
  2162  // All below functions available as of GTK 3.20+
  2148  void *nsFilePicker::GtkFileChooserNew(const gchar *title, GtkWindow *parent,
  2163  void* nsFilePicker::GtkFileChooserNew(const gchar* title, GtkWindow* parent,
  2149                                        GtkFileChooserAction action,
  2164                                        GtkFileChooserAction action,
  2150                                        const gchar *accept_label) {
  2165                                        const gchar* accept_label) {
  2151    static auto sGtkFileChooserNativeNewPtr =
  2166    static auto sGtkFileChooserNativeNewPtr =
  2152        (void *(*)(const gchar *, GtkWindow *, GtkFileChooserAction,
  2167        (void* (*)(const gchar*, GtkWindow*, GtkFileChooserAction, const gchar*,
  2153                   const gchar *,
  2168                   const gchar*))dlsym(RTLD_DEFAULT,
  2154                   const gchar *))dlsym(RTLD_DEFAULT,
  2169                                       "gtk_file_chooser_native_new");
  2155 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h
  2170 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h
  2156 --- a/widget/gtk/nsFilePicker.h
  2171 --- a/widget/gtk/nsFilePicker.h
  2157 +++ b/widget/gtk/nsFilePicker.h
  2172 +++ b/widget/gtk/nsFilePicker.h
  2158 @@ -67,16 +67,22 @@ class nsFilePicker : public nsBaseFilePi
  2173 @@ -67,16 +67,22 @@ class nsFilePicker : public nsBaseFilePi
  2159    nsString mDefaultExtension;
  2174    nsString mDefaultExtension;
  2160  
  2175  
  2161    nsTArray<nsCString> mFilters;
  2176    nsTArray<nsCString> mFilters;
  2162    nsTArray<nsCString> mFilterNames;
  2177    nsTArray<nsCString> mFilterNames;
  2163  
  2178  
  2164   private:
  2179   private:
  2165    static nsIFile *mPrevDisplayDirectory;
  2180    static nsIFile* mPrevDisplayDirectory;
  2166  
  2181  
  2167 +  bool kdeRunning();
  2182 +  bool kdeRunning();
  2168 +  bool getKdeRunning();
  2183 +  bool getKdeRunning();
  2169 +  NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn);
  2184 +  NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn);
  2170 +  NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn);
  2185 +  NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn);
  2171 +  nsCString kdeMakeFilter( int index );
  2186 +  nsCString kdeMakeFilter( int index );
  2172 +
  2187 +
  2173    void *GtkFileChooserNew(const gchar *title, GtkWindow *parent,
  2188    void* GtkFileChooserNew(const gchar* title, GtkWindow* parent,
  2174                            GtkFileChooserAction action,
  2189                            GtkFileChooserAction action,
  2175                            const gchar *accept_label);
  2190                            const gchar* accept_label);
  2176    void GtkFileChooserShow(void *file_chooser);
  2191    void GtkFileChooserShow(void* file_chooser);
  2177    void GtkFileChooserDestroy(void *file_chooser);
  2192    void GtkFileChooserDestroy(void* file_chooser);
  2178    void GtkFileChooserSetModal(void *file_chooser, GtkWindow *parent_widget,
  2193    void GtkFileChooserSetModal(void* file_chooser, GtkWindow* parent_widget,
  2179                                gboolean modal);
  2194                                gboolean modal);
  2180  
  2195  
  2181 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
  2196 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
  2182 --- a/xpcom/components/ManifestParser.cpp
  2197 --- a/xpcom/components/ManifestParser.cpp
  2183 +++ b/xpcom/components/ManifestParser.cpp
  2198 +++ b/xpcom/components/ManifestParser.cpp
  2197  struct ManifestDirective {
  2212  struct ManifestDirective {
  2198    const char* directive;
  2213    const char* directive;
  2199    int argc;
  2214    int argc;
  2200  
  2215  
  2201    bool ischrome;
  2216    bool ischrome;
  2202 @@ -392,16 +393,17 @@ void ParseManifest(NSLocationType aType,
  2217 @@ -393,16 +394,17 @@ void ParseManifest(NSLocationType aType,
  2203    NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled");
  2218    NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled");
  2204    NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired");
  2219    NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired");
  2205    NS_NAMED_LITERAL_STRING(kApplication, "application");
  2220    NS_NAMED_LITERAL_STRING(kApplication, "application");
  2206    NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
  2221    NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
  2207    NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion");
  2222    NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion");
  2215  #endif
  2230  #endif
  2216  
  2231  
  2217    NS_NAMED_LITERAL_STRING(kMain, "main");
  2232    NS_NAMED_LITERAL_STRING(kMain, "main");
  2218    NS_NAMED_LITERAL_STRING(kContent, "content");
  2233    NS_NAMED_LITERAL_STRING(kContent, "content");
  2219  
  2234  
  2220 @@ -447,39 +449,44 @@ void ParseManifest(NSLocationType aType,
  2235 @@ -448,39 +450,44 @@ void ParseManifest(NSLocationType aType,
  2221          CopyUTF8toUTF16(s, abi);
  2236          CopyUTF8toUTF16(s, abi);
  2222          abi.Insert(char16_t('_'), 0);
  2237          abi.Insert(char16_t('_'), 0);
  2223          abi.Insert(osTarget, 0);
  2238          abi.Insert(osTarget, 0);
  2224        }
  2239        }
  2225      }
  2240      }
  2260      process = kContent;
  2275      process = kContent;
  2261    } else {
  2276    } else {
  2262      process = kMain;
  2277      process = kMain;
  2263    }
  2278    }
  2264  
  2279  
  2265 @@ -566,25 +573,27 @@ void ParseManifest(NSLocationType aType,
  2280 @@ -567,25 +574,27 @@ void ParseManifest(NSLocationType aType,
  2266      TriState stOsVersion = eUnspecified;
  2281      TriState stOsVersion = eUnspecified;
  2267      TriState stOs = eUnspecified;
  2282      TriState stOs = eUnspecified;
  2268      TriState stABI = eUnspecified;
  2283      TriState stABI = eUnspecified;
  2269      TriState stProcess = eUnspecified;
  2284      TriState stProcess = eUnspecified;
  2270  #if defined(MOZ_WIDGET_ANDROID)
  2285  #if defined(MOZ_WIDGET_ANDROID)
  2288            CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion,
  2303            CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion,
  2289                             stGeckoVersion)) {
  2304                             stGeckoVersion)) {
  2290          continue;
  2305          continue;
  2291        }
  2306        }
  2292  
  2307  
  2293 @@ -621,17 +630,17 @@ void ParseManifest(NSLocationType aType,
  2308 @@ -622,17 +631,17 @@ void ParseManifest(NSLocationType aType,
  2294        }
  2309        }
  2295  
  2310  
  2296        LogMessageWithContext(
  2311        LogMessageWithContext(
  2297            aFile, line, "Unrecognized chrome manifest modifier '%s'.", token);
  2312            aFile, line, "Unrecognized chrome manifest modifier '%s'.", token);
  2298        ok = false;
  2313        ok = false;
  2310  
  2325  
  2311      if (directive->regfunc) {
  2326      if (directive->regfunc) {
  2312 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
  2327 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
  2313 --- a/xpcom/components/moz.build
  2328 --- a/xpcom/components/moz.build
  2314 +++ b/xpcom/components/moz.build
  2329 +++ b/xpcom/components/moz.build
  2315 @@ -66,14 +66,15 @@ LOCAL_INCLUDES += [
  2330 @@ -66,16 +66,17 @@ LOCAL_INCLUDES += [
  2316      '!..',
  2331      '!..',
  2317      '../base',
  2332      '../base',
  2318      '../build',
  2333      '../build',
  2319      '../ds',
  2334      '../ds',
  2320      '/chrome',
  2335      '/chrome',
  2325  ]
  2340  ]
  2326  
  2341  
  2327  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  2342  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  2328      CXXFLAGS += CONFIG['TK_CFLAGS']
  2343      CXXFLAGS += CONFIG['TK_CFLAGS']
  2329  
  2344  
  2330  include('/ipc/chromium/chromium-config.mozbuild')
  2345  if CONFIG['MOZ_LAYOUT_DEBUGGER']:
       
  2346      DEFINES['MOZ_LAYOUT_DEBUGGER'] = True
       
  2347  
  2331 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
  2348 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
  2332 --- a/xpcom/io/nsLocalFileUnix.cpp
  2349 --- a/xpcom/io/nsLocalFileUnix.cpp
  2333 +++ b/xpcom/io/nsLocalFileUnix.cpp
  2350 +++ b/xpcom/io/nsLocalFileUnix.cpp
  2334 @@ -47,16 +47,17 @@
  2351 @@ -47,16 +47,17 @@
  2335  #include "prproces.h"
  2352  #include "prproces.h"