diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-09 19:54:01 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:41:44 +0200 |
commit | e3148b0a25df4975996e0c173768fa55aa2af4ec (patch) | |
tree | 6454e22e5a72b5ccbe2305caadecf057f080b3a1 /toolkit/mozapps | |
parent | fe6730c2192a27c73f80c9696a0ceeba6b9dd809 (diff) | |
download | UXP-e3148b0a25df4975996e0c173768fa55aa2af4ec.tar UXP-e3148b0a25df4975996e0c173768fa55aa2af4ec.tar.gz UXP-e3148b0a25df4975996e0c173768fa55aa2af4ec.tar.lz UXP-e3148b0a25df4975996e0c173768fa55aa2af4ec.tar.xz UXP-e3148b0a25df4975996e0c173768fa55aa2af4ec.zip |
Issue #65 - Correct nsHelperAppDlg.js for bad preprocessing conversion
Diffstat (limited to 'toolkit/mozapps')
-rw-r--r-- | toolkit/mozapps/downloads/nsHelperAppDlg.js | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js index 243db1c2f..90d38c90b 100644 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js @@ -638,6 +638,7 @@ nsUnknownContentTypeDialog.prototype = { // Returns true if opening the default application makes sense. openWithDefaultOK: function() { + // The checking is different on Windows... #ifdef XP_WIN // Windows presents some special cases. // We need to prevent use of "system default" when the file is @@ -675,7 +676,7 @@ nsUnknownContentTypeDialog.prototype = { // getPath: getPath: function (aFile) { #ifdef XP_MACOSX - return aFile.leafName || aFile.path; + return aFile.leafName || aFile.path; #else return aFile.path; #endif @@ -1007,11 +1008,13 @@ nsUnknownContentTypeDialog.prototype = { var otherHandler = this.dialogElement("otherHandler"); otherHandler.removeAttribute("hidden"); otherHandler.setAttribute("path", this.getPath(this.chosenApp.executable)); + #ifdef XP_WIN otherHandler.label = this.getFileDisplayName(this.chosenApp.executable); #else otherHandler.label = this.chosenApp.name; #endif + this.dialogElement("openHandler").selectedIndex = 1; this.dialogElement("openHandler").setAttribute("lastSelectedItemID", "otherHandler"); @@ -1069,43 +1072,42 @@ nsUnknownContentTypeDialog.prototype = { // Remember the file they chose to run. this.chosenApp = params.handlerApp; } -#else +#else // XP_WIN #if MOZ_WIDGET_GTK == 3 - var nsIApplicationChooser = Components.interfaces.nsIApplicationChooser; - var appChooser = Components.classes["@mozilla.org/applicationchooser;1"] - .createInstance(nsIApplicationChooser); - appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle")); - var contentTypeDialogObj = this; - let appChooserCallback = function appChooserCallback_done(aResult) { - if (aResult) { - contentTypeDialogObj.chosenApp = aResult.QueryInterface(Components.interfaces.nsILocalHandlerApp); - } - contentTypeDialogObj.finishChooseApp(); - }; - appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback); - // The finishChooseApp is called from appChooserCallback - return; -#else - var nsIFilePicker = Components.interfaces.nsIFilePicker; - var fp = Components.classes["@mozilla.org/filepicker;1"] - .createInstance(nsIFilePicker); - fp.init(this.mDialog, - this.dialogElement("strings").getString("chooseAppFilePickerTitle"), - nsIFilePicker.modeOpen); - - fp.appendFilters(nsIFilePicker.filterApps); - - if (fp.show() == nsIFilePicker.returnOK && fp.file) { - // Remember the file they chose to run. - var localHandlerApp = - Components.classes["@mozilla.org/uriloader/local-handler-app;1"]. - createInstance(Components.interfaces.nsILocalHandlerApp); - localHandlerApp.executable = fp.file; - this.chosenApp = localHandlerApp; + var nsIApplicationChooser = Components.interfaces.nsIApplicationChooser; + var appChooser = Components.classes["@mozilla.org/applicationchooser;1"] + .createInstance(nsIApplicationChooser); + appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle")); + var contentTypeDialogObj = this; + let appChooserCallback = function appChooserCallback_done(aResult) { + if (aResult) { + contentTypeDialogObj.chosenApp = aResult.QueryInterface(Components.interfaces.nsILocalHandlerApp); } + contentTypeDialogObj.finishChooseApp(); + }; + appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback); + // The finishChooseApp is called from appChooserCallback + return; +#else // MOZ_WIDGET_GTK == 3 + var nsIFilePicker = Components.interfaces.nsIFilePicker; + var fp = Components.classes["@mozilla.org/filepicker;1"] + .createInstance(nsIFilePicker); + fp.init(this.mDialog, + this.dialogElement("strings").getString("chooseAppFilePickerTitle"), + nsIFilePicker.modeOpen); + + fp.appendFilters(nsIFilePicker.filterApps); + + if (fp.show() == nsIFilePicker.returnOK && fp.file) { + // Remember the file they chose to run. + var localHandlerApp = + Components.classes["@mozilla.org/uriloader/local-handler-app;1"]. + createInstance(Components.interfaces.nsILocalHandlerApp); + localHandlerApp.executable = fp.file; + this.chosenApp = localHandlerApp; + } #endif // MOZ_WIDGET_GTK == 3 #endif // XP_WIN - } this.finishChooseApp(); }, |