mozilla-kde.patch
branchfirefox60
changeset 1050 bf0d08380dcf
parent 1045 f645c886d36b
child 1055 526f445635f3
child 1080 e8d4a33582b8
equal deleted inserted replaced
1049:08307c08d990 1050:bf0d08380dcf
     1 # HG changeset patch
     1 # HG changeset patch
     2 # Parent  9cc0c990890e64f69ed068cf1a4534535bcc50a7
     2 # Parent  d7a4d772ba2afb3ac43e2f2f234ffa55bcf50e70
     3 Description: Add KDE integration to Firefox (toolkit parts)
     3 Description: Add KDE integration to Firefox (toolkit parts)
     4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
     4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
     5 Author: Lubos Lunak <lunak@suse.com>
     5 Author: Lubos Lunak <lunak@suse.com>
     6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
     6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
     7      https://bugzilla.novell.com/show_bug.cgi?id=170055
     7      https://bugzilla.novell.com/show_bug.cgi?id=170055
   712  
   712  
   713      // Enable Ok button if ok to press.
   713      // Enable Ok button if ok to press.
   714      this.mDialog.document.documentElement.getButton("accept").disabled = !ok;
   714      this.mDialog.document.documentElement.getButton("accept").disabled = !ok;
   715    },
   715    },
   716  
   716  
   717 @@ -1066,30 +1066,57 @@ nsUnknownContentTypeDialog.prototype = {
   717 @@ -1066,30 +1066,60 @@ nsUnknownContentTypeDialog.prototype = {
   718  
   718  
   719        if (params.handlerApp &&
   719        if (params.handlerApp &&
   720            params.handlerApp.executable &&
   720            params.handlerApp.executable &&
   721            params.handlerApp.executable.isFile()) {
   721            params.handlerApp.executable.isFile()) {
   722          // Remember the file they chose to run.
   722          // Remember the file they chose to run.
   729 -      appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
   729 -      appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
   730 -      var contentTypeDialogObj = this;
   730 -      var contentTypeDialogObj = this;
   731 -      let appChooserCallback = function appChooserCallback_done(aResult) {
   731 -      let appChooserCallback = function appChooserCallback_done(aResult) {
   732 -        if (aResult) {
   732 -        if (aResult) {
   733 -           contentTypeDialogObj.chosenApp = aResult.QueryInterface(Ci.nsILocalHandlerApp);
   733 -           contentTypeDialogObj.chosenApp = aResult.QueryInterface(Ci.nsILocalHandlerApp);
       
   734 -        }
       
   735 -        contentTypeDialogObj.finishChooseApp();
       
   736 -      };
       
   737 -      appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback);
       
   738 -      // The finishChooseApp is called from appChooserCallback
       
   739 -      return;
   734 +      // handle the KDE case which is implemented in the filepicker
   740 +      // handle the KDE case which is implemented in the filepicker
   735 +      // therefore falling back to Gtk2 like behaviour if KDE is running
   741 +      // therefore falling back to Gtk2 like behaviour if KDE is running
   736 +      // FIXME this should be better handled in the nsIApplicationChooser
   742 +      // FIXME this should be better handled in the nsIApplicationChooser
   737 +      // interface
   743 +      // interface
   738 +      var env = Components.classes["@mozilla.org/process/environment;1"]
   744 +      var env = Components.classes["@mozilla.org/process/environment;1"]
   739 +                          .getService(Components.interfaces.nsIEnvironment);
   745 +                          .getService(Components.interfaces.nsIEnvironment);
   740 +      if (env.get('KDE_FULL_SESSION') == "true")
   746 +      if (env.get('KDE_FULL_SESSION') == "true")
   741 +      {
   747 +      {
   742 +        var nsIFilePicker = Components.interfaces.nsIFilePicker;
   748 +        var nsIFilePicker = Ci.nsIFilePicker;
   743 +        var fp = Components.classes["@mozilla.org/filepicker;1"]
   749 +        var fp = Cc["@mozilla.org/filepicker;1"]
   744 +                           .createInstance(nsIFilePicker);
   750 +                    .createInstance(nsIFilePicker);
   745 +        fp.init(this.mDialog,
   751 +        fp.init(this.mDialog,
   746 +                this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
   752 +                this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
   747 +                nsIFilePicker.modeOpen);
   753 +                nsIFilePicker.modeOpen);
   748 +
   754 +
   749 +        fp.appendFilters(nsIFilePicker.filterApps);
   755 +        fp.appendFilters(nsIFilePicker.filterApps);
   750 +
   756 +
   751 +        if (fp.show() == nsIFilePicker.returnOK && fp.file) {
   757 +        fp.open(aResult => {
   752 +          // Remember the file they chose to run.
   758 +          if (aResult == nsIFilePicker.returnOK && fp.file) {
   753 +          var localHandlerApp =
   759 +            // Remember the file they chose to run.
   754 +            Components.classes["@mozilla.org/uriloader/local-handler-app;1"].
   760 +            var localHandlerApp =
   755 +                      createInstance(Components.interfaces.nsILocalHandlerApp);
   761 +              Cc["@mozilla.org/uriloader/local-handler-app;1"].
   756 +          localHandlerApp.executable = fp.file;
   762 +                         createInstance(Ci.nsILocalHandlerApp);
   757 +          this.chosenApp = localHandlerApp;
   763 +            localHandlerApp.executable = fp.file;
   758          }
   764 +            this.chosenApp = localHandlerApp;
   759 -        contentTypeDialogObj.finishChooseApp();
   765 +          }
   760 -      };
   766 +          this.finishChooseApp();
   761 -      appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback);
   767 +        });
   762 -      // The finishChooseApp is called from appChooserCallback
       
   763 -      return;
       
   764 +      } else {
   768 +      } else {
   765 +        var nsIApplicationChooser = Ci.nsIApplicationChooser;
   769 +        var nsIApplicationChooser = Ci.nsIApplicationChooser;
   766 +        var appChooser = Cc["@mozilla.org/applicationchooser;1"]
   770 +        var appChooser = Cc["@mozilla.org/applicationchooser;1"]
   767 +                           .createInstance(nsIApplicationChooser);
   771 +                           .createInstance(nsIApplicationChooser);
   768 +        appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
   772 +        appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
  1302 +        FILE* commandFile;
  1306 +        FILE* commandFile;
  1303 +        FILE* replyFile;
  1307 +        FILE* replyFile;
  1304 +    };
  1308 +    };
  1305 +
  1309 +
  1306 +#endif // nsKDEUtils
  1310 +#endif // nsKDEUtils
       
  1311 diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp
       
  1312 --- a/uriloader/exthandler/HandlerServiceParent.cpp
       
  1313 +++ b/uriloader/exthandler/HandlerServiceParent.cpp
       
  1314 @@ -1,16 +1,16 @@
       
  1315  #include "mozilla/Logging.h"
       
  1316  #include "HandlerServiceParent.h"
       
  1317  #include "nsIHandlerService.h"
       
  1318  #include "nsIMIMEInfo.h"
       
  1319  #include "ContentHandlerService.h"
       
  1320  #include "nsStringEnumerator.h"
       
  1321  #ifdef MOZ_WIDGET_GTK
       
  1322 -#include "unix/nsGNOMERegistry.h"
       
  1323 +#include "unix/nsCommonRegistry.h"
       
  1324  #endif
       
  1325  
       
  1326  using mozilla::dom::HandlerInfo;
       
  1327  using mozilla::dom::HandlerApp;
       
  1328  using mozilla::dom::ContentHandlerService;
       
  1329  using mozilla::dom::RemoteHandlerApp;
       
  1330  
       
  1331  namespace {
       
  1332 @@ -264,17 +264,17 @@ HandlerServiceParent::RecvExists(const H
       
  1333  }
       
  1334  
       
  1335  mozilla::ipc::IPCResult
       
  1336  HandlerServiceParent::RecvExistsForProtocol(const nsCString& aProtocolScheme,
       
  1337                                              bool* aHandlerExists)
       
  1338  {
       
  1339  #ifdef MOZ_WIDGET_GTK
       
  1340    // Check the GNOME registry for a protocol handler
       
  1341 -  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme.get());
       
  1342 +  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme.get());
       
  1343  #else
       
  1344    *aHandlerExists = false;
       
  1345  #endif
       
  1346    return IPC_OK();
       
  1347  }
       
  1348  
       
  1349  mozilla::ipc::IPCResult
       
  1350  HandlerServiceParent::RecvGetTypeFromExtension(const nsCString& aFileExtension,
  1307 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
  1351 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
  1308 --- a/uriloader/exthandler/moz.build
  1352 --- a/uriloader/exthandler/moz.build
  1309 +++ b/uriloader/exthandler/moz.build
  1353 +++ b/uriloader/exthandler/moz.build
  1310 @@ -77,17 +77,19 @@ else:
  1354 @@ -77,17 +77,19 @@ else:
  1311      SOURCES += [
  1355      SOURCES += [