firefox-cross-desktop.patch
changeset 223 4555a5d0d661
parent 0 ad87c5e85a41
child 419 f6b055dd94bc
equal deleted inserted replaced
221:488440b896fe 223:4555a5d0d661
     1 From: Wolfgang Rosenauer
     1 From: Wolfgang Rosenauer
     2 Subject: NonGnome/KDE integration
     2 NonGnome/KDE integration
       
     3 
     3 References:
     4 References:
     4 https://bugzilla.novell.com/show_bug.cgi?id=170055
     5 https://bugzilla.novell.com/show_bug.cgi?id=170055
     5 Caveats: desktop file name of Firefox is hardcoded to MozillaFirefox
       
     6 
     6 
     7 diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js
     7 diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js
     8 --- a/browser/base/content/nsContextMenu.js
     8 --- a/browser/base/content/nsContextMenu.js
     9 +++ b/browser/base/content/nsContextMenu.js
     9 +++ b/browser/base/content/nsContextMenu.js
    10 @@ -210,13 +210,15 @@ nsContextMenu.prototype = {
    10 @@ -237,17 +237,19 @@ nsContextMenu.prototype = {
       
    11      this.showItem("context-sep-viewsource", shouldShow);
       
    12  
    11      // Set as Desktop background depends on whether an image was clicked on,
    13      // Set as Desktop background depends on whether an image was clicked on,
    12      // and only works if we have a shell service.
    14      // and only works if we have a shell service.
    13      var haveSetDesktopBackground = false;
    15      var haveSetDesktopBackground = false;
    14  #ifdef HAVE_SHELL_SERVICE
    16  #ifdef HAVE_SHELL_SERVICE
    15      // Only enable Set as Desktop Background if we can get the shell service.
    17      // Only enable Set as Desktop Background if we can get the shell service.
    22  #endif
    24  #endif
    23      this.showItem("context-setDesktopBackground",
    25      this.showItem("context-setDesktopBackground",
    24                    haveSetDesktopBackground && this.onLoadedImage);
    26                    haveSetDesktopBackground && this.onLoadedImage);
    25  
    27  
    26      if (haveSetDesktopBackground && this.onLoadedImage) {
    28      if (haveSetDesktopBackground && this.onLoadedImage) {
    27 diff --git a/browser/components/preferences/advanced.js b/browser/components/preferences/advanced.js
    29        document.getElementById("context-setDesktopBackground")
    28 --- a/browser/components/preferences/advanced.js
    30                .disabled = this.disableSetDesktopBackground();
    29 +++ b/browser/components/preferences/advanced.js
       
    30 @@ -594,20 +594,38 @@ var gAdvancedPane = {
       
    31      var brandShortName = brandBundle.getString("brandShortName");
       
    32      var promptTitle = shellBundle.getString("setDefaultBrowserTitle");
       
    33      var promptMessage;
       
    34      const IPS = Components.interfaces.nsIPromptService;
       
    35      var psvc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
       
    36                           .getService(IPS);
       
    37 +
       
    38 +    var env = Components.classes["@mozilla.org/process/environment;1"]
       
    39 +                        .getService(Components.interfaces.nsIEnvironment);
       
    40 +    var kde_session = 0;
       
    41 +    if (env.get('KDE_FULL_SESSION') == "true")
       
    42 +      kde_session = 1;
       
    43 +     
       
    44      if (!shellSvc.isDefaultBrowser(false)) {
       
    45        promptMessage = shellBundle.getFormattedString("setDefaultBrowserMessage", 
       
    46                                                       [brandShortName]);
       
    47        var rv = psvc.confirmEx(window, promptTitle, promptMessage, 
       
    48                                IPS.STD_YES_NO_BUTTONS,
       
    49                                null, null, null, null, { });
       
    50 -      if (rv == 0)
       
    51 +      if (rv == 0) {
       
    52          shellSvc.setDefaultBrowser(true, false);
       
    53 +        if (kde_session == 1) {
       
    54 +          var shellObj = Components.classes["@mozilla.org/file/local;1"]
       
    55 +                                   .createInstance(Components.interfaces.nsILocalFile);
       
    56 +          shellObj.initWithPath("/usr/bin/kwriteconfig");
       
    57 +          var process = Components.classes["@mozilla.org/process/util;1"]
       
    58 +                                  .createInstance(Components.interfaces.nsIProcess);
       
    59 +          process.init(shellObj);
       
    60 +          var args = ["--file", "kdeglobals", "--group", "General", "--key", "BrowserApplication", "MozillaFirefox"];
       
    61 +          process.run(false, args, args.length);
       
    62 +        }
       
    63 +      }
       
    64      }
       
    65      else {
       
    66        promptMessage = shellBundle.getFormattedString("alreadyDefaultBrowser",
       
    67                                                       [brandShortName]);
       
    68        psvc.alert(window, promptTitle, promptMessage);
       
    69      }