firefox-kde.patch
branchfirefox120
changeset 1198 de5582739a05
parent 1196 954851a35787
child 1200 2a0735b1eb92
equal deleted inserted replaced
1197:19915e86b721 1198:de5582739a05
    25  create mode 100644 browser/components/shell/nsKDEShellService.h
    25  create mode 100644 browser/components/shell/nsKDEShellService.h
    26  create mode 100644 browser/components/shell/nsUnixShellService.cpp
    26  create mode 100644 browser/components/shell/nsUnixShellService.cpp
    27  create mode 100644 browser/components/shell/nsUnixShellService.h
    27  create mode 100644 browser/components/shell/nsUnixShellService.h
    28 
    28 
    29 diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
    29 diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
    30 index 609b9a9d06178b42b0ba8509500a1b72d8bd3b88..05df0fc6ce279ab6161a3f93450e7296c95a371f 100644
       
    31 --- a/browser/components/preferences/main.js
    30 --- a/browser/components/preferences/main.js
    32 +++ b/browser/components/preferences/main.js
    31 +++ b/browser/components/preferences/main.js
    33 @@ -294,6 +294,13 @@ var gMainPane = {
    32 @@ -291,16 +291,23 @@ var gMainPane = {
       
    33          }, backoffTimes[this._backoffIndex + 1 < backoffTimes.length ? this._backoffIndex++ : backoffTimes.length - 1]);
       
    34        };
       
    35  
       
    36        window.setTimeout(() => {
       
    37          window.requestIdleCallback(pollForDefaultBrowser);
    34        }, backoffTimes[this._backoffIndex]);
    38        }, backoffTimes[this._backoffIndex]);
    35      }
    39      }
    36  
    40  
    37 +    var env = Components.classes["@mozilla.org/process/environment;1"]
    41 +    var env = Components.classes["@mozilla.org/process/environment;1"]
    38 +      .getService(Components.interfaces.nsIEnvironment);
    42 +      .getService(Components.interfaces.nsIEnvironment);
    42 +    }
    46 +    }
    43 +
    47 +
    44      this.initBrowserContainers();
    48      this.initBrowserContainers();
    45      this.buildContentProcessCountMenuList();
    49      this.buildContentProcessCountMenuList();
    46  
    50  
    47 @@ -1725,6 +1732,17 @@ var gMainPane = {
    51      this.updateDefaultPerformanceSettingsPref();
       
    52  
       
    53      let defaultPerformancePref = Preferences.get(
       
    54        "browser.preferences.defaultPerformanceSettings.enabled"
       
    55      );
       
    56 @@ -1744,16 +1751,27 @@ var gMainPane = {
       
    57        this._backoffIndex = 0;
       
    58  
       
    59        let shellSvc = getShellService();
       
    60        if (!shellSvc) {
       
    61          return;
    48        }
    62        }
    49        try {
    63        try {
    50          shellSvc.setDefaultBrowser(true, false);
    64          shellSvc.setDefaultBrowser(false);
    51 +        if (kde_session == 1) {
    65 +        if (kde_session == 1) {
    52 +          var shellObj = Components.classes["@mozilla.org/file/local;1"]
    66 +          var shellObj = Components.classes["@mozilla.org/file/local;1"]
    53 +            .createInstance(Components.interfaces.nsILocalFile);
    67 +            .createInstance(Components.interfaces.nsILocalFile);
    54 +          shellObj.initWithPath("/usr/bin/kwriteconfig");
    68 +          shellObj.initWithPath("/usr/bin/kwriteconfig");
    55 +          var process = Components.classes["@mozilla.org/process/util;1"]
    69 +          var process = Components.classes["@mozilla.org/process/util;1"]
    60 +          process.run(false, args, args.length);
    74 +          process.run(false, args, args.length);
    61 +        }
    75 +        }
    62        } catch (ex) {
    76        } catch (ex) {
    63          console.error(ex);
    77          console.error(ex);
    64          return;
    78          return;
       
    79        }
       
    80  
       
    81        let isDefault = shellSvc.isDefaultBrowser(false, true);
       
    82        let setDefaultPane = document.getElementById("setDefaultPane");
       
    83        setDefaultPane.classList.toggle("is-default", isDefault);
    65 diff --git a/browser/components/shell/moz.build b/browser/components/shell/moz.build
    84 diff --git a/browser/components/shell/moz.build b/browser/components/shell/moz.build
    66 index eb88cb287dc3f04022b74b978666118bbd5fa6b2..95277533781a7224d108e3c45731a6d9a89ba1a0 100644
       
    67 --- a/browser/components/shell/moz.build
    85 --- a/browser/components/shell/moz.build
    68 +++ b/browser/components/shell/moz.build
    86 +++ b/browser/components/shell/moz.build
    69 @@ -36,6 +36,8 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
    87 @@ -31,16 +31,18 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "coco
       
    88      ]
       
    89  elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
       
    90      XPIDL_SOURCES += [
       
    91          "nsIGNOMEShellService.idl",
       
    92      ]
    70  
    93  
    71      SOURCES += [
    94      SOURCES += [
    72          "nsGNOMEShellService.cpp",
    95          "nsGNOMEShellService.cpp",
    73 +        "nsKDEShellService.cpp",
    96 +        "nsKDEShellService.cpp",
    74 +        "nsUnixShellService.cpp",
    97 +        "nsUnixShellService.cpp",
    75      ]
    98      ]
    76      if CONFIG["MOZ_ENABLE_DBUS"]:
    99      if CONFIG["MOZ_ENABLE_DBUS"]:
    77          SOURCES += [
   100          SOURCES += [
       
   101              "nsGNOMEShellDBusHelper.cpp",
       
   102              "nsGNOMEShellSearchProvider.cpp",
       
   103          ]
       
   104          include("/ipc/chromium/chromium-config.mozbuild")
       
   105  
    78 diff --git a/browser/components/shell/nsKDEShellService.cpp b/browser/components/shell/nsKDEShellService.cpp
   106 diff --git a/browser/components/shell/nsKDEShellService.cpp b/browser/components/shell/nsKDEShellService.cpp
    79 new file mode 100644
   107 new file mode 100644
    80 index 0000000000000000000000000000000000000000..152a3aca87ea73477bc75c4e93c01e5a52dda102
       
    81 --- /dev/null
   108 --- /dev/null
    82 +++ b/browser/components/shell/nsKDEShellService.cpp
   109 +++ b/browser/components/shell/nsKDEShellService.cpp
    83 @@ -0,0 +1,109 @@
   110 @@ -0,0 +1,108 @@
    84 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   111 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
    85 +/* This Source Code Form is subject to the terms of the Mozilla Public
   112 +/* This Source Code Form is subject to the terms of the Mozilla Public
    86 + * License, v. 2.0. If a copy of the MPL was not distributed with this
   113 + * License, v. 2.0. If a copy of the MPL was not distributed with this
    87 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
   114 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    88 +
   115 +
   134 +        *aIsDefaultBrowser = true;
   161 +        *aIsDefaultBrowser = true;
   135 +    return NS_OK;
   162 +    return NS_OK;
   136 +}
   163 +}
   137 +
   164 +
   138 +NS_IMETHODIMP
   165 +NS_IMETHODIMP
   139 +nsKDEShellService::SetDefaultBrowser(bool aClaimAllTypes,
   166 +nsKDEShellService::SetDefaultBrowser(bool aForAllUsers)
   140 +                                     bool aForAllUsers)
       
   141 +{
   167 +{
   142 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
   168 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
   143 +    if (!command)
   169 +    if (!command)
   144 +        return NS_ERROR_FAILURE;
   170 +        return NS_ERROR_FAILURE;
   145 +
   171 +
   149 +        return NS_ERROR_FAILURE;
   175 +        return NS_ERROR_FAILURE;
   150 +
   176 +
   151 +    cmdstr->SetData("SETDEFAULTBROWSER"_ns);
   177 +    cmdstr->SetData("SETDEFAULTBROWSER"_ns);
   152 +    command->AppendElement( cmdstr );
   178 +    command->AppendElement( cmdstr );
   153 +
   179 +
   154 +    paramstr->SetData( aClaimAllTypes ? "ALLTYPES"_ns : "NORMAL"_ns );
   180 +    paramstr->SetData("ALLTYPES"_ns);
   155 +    command->AppendElement( paramstr );
   181 +    command->AppendElement( paramstr );
   156 +
   182 +
   157 +    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
   183 +    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
   158 +}
   184 +}
   159 +
   185 +
   190 +    return NS_ERROR_NOT_IMPLEMENTED;
   216 +    return NS_ERROR_NOT_IMPLEMENTED;
   191 +}
   217 +}
   192 +
   218 +
   193 diff --git a/browser/components/shell/nsKDEShellService.h b/browser/components/shell/nsKDEShellService.h
   219 diff --git a/browser/components/shell/nsKDEShellService.h b/browser/components/shell/nsKDEShellService.h
   194 new file mode 100644
   220 new file mode 100644
   195 index 0000000000000000000000000000000000000000..8b0bb19164352453cfa453dd87c19263160b9ad8
       
   196 --- /dev/null
   221 --- /dev/null
   197 +++ b/browser/components/shell/nsKDEShellService.h
   222 +++ b/browser/components/shell/nsKDEShellService.h
   198 @@ -0,0 +1,32 @@
   223 @@ -0,0 +1,32 @@
   199 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   224 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   200 +/* This Source Code Form is subject to the terms of the Mozilla Public
   225 +/* This Source Code Form is subject to the terms of the Mozilla Public
   228 +};
   253 +};
   229 +
   254 +
   230 +#endif // nskdeshellservice_h____
   255 +#endif // nskdeshellservice_h____
   231 diff --git a/browser/components/shell/nsUnixShellService.cpp b/browser/components/shell/nsUnixShellService.cpp
   256 diff --git a/browser/components/shell/nsUnixShellService.cpp b/browser/components/shell/nsUnixShellService.cpp
   232 new file mode 100644
   257 new file mode 100644
   233 index 0000000000000000000000000000000000000000..abf266ebdc52e136f495911da3454e69c770c6db
       
   234 --- /dev/null
   258 --- /dev/null
   235 +++ b/browser/components/shell/nsUnixShellService.cpp
   259 +++ b/browser/components/shell/nsUnixShellService.cpp
   236 @@ -0,0 +1,22 @@
   260 @@ -0,0 +1,22 @@
   237 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   261 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   238 +/* This Source Code Form is subject to the terms of the Mozilla Public
   262 +/* This Source Code Form is subject to the terms of the Mozilla Public
   256 +        return nsKDEShellServiceConstructor( aIID, aResult );
   280 +        return nsKDEShellServiceConstructor( aIID, aResult );
   257 +    return nsGNOMEShellServiceConstructor( aIID, aResult );
   281 +    return nsGNOMEShellServiceConstructor( aIID, aResult );
   258 +}
   282 +}
   259 diff --git a/browser/components/shell/nsUnixShellService.h b/browser/components/shell/nsUnixShellService.h
   283 diff --git a/browser/components/shell/nsUnixShellService.h b/browser/components/shell/nsUnixShellService.h
   260 new file mode 100644
   284 new file mode 100644
   261 index 0000000000000000000000000000000000000000..26b5dbac47dd9a8ec1fcb6c93575cca750692735
       
   262 --- /dev/null
   285 --- /dev/null
   263 +++ b/browser/components/shell/nsUnixShellService.h
   286 +++ b/browser/components/shell/nsUnixShellService.h
   264 @@ -0,0 +1,15 @@
   287 @@ -0,0 +1,15 @@
   265 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   288 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   266 +/* This Source Code Form is subject to the terms of the Mozilla Public
   289 +/* This Source Code Form is subject to the terms of the Mozilla Public