зеркало из https://github.com/mozilla/gecko-dev.git
Bug 570155: Make the helperApp dialog use the getFileDisplayname helper consistently (fixes a broken #ifdef exposed by bug 569373), and refactor some ifdefs to avoid code duplication, r=Neil
--HG-- extra : rebase_source : d13c45e747021f868ec608db62233fae54868441
This commit is contained in:
Родитель
d38f3cb61f
Коммит
b9d3e4d85b
|
@ -705,12 +705,7 @@ nsUnknownContentTypeDialog.prototype = {
|
|||
otherHandler.setAttribute("path",
|
||||
this.getPath(this.chosenApp.executable));
|
||||
|
||||
#if XP_MACOSX
|
||||
this.chosenApp.executable.QueryInterface(Components.interfaces.nsILocalFileMac);
|
||||
otherHandler.label = this.chosenApp.executable.bundleDisplayName;
|
||||
#else
|
||||
otherHandler.label = this.chosenApp.executable.leafName;
|
||||
#endif
|
||||
otherHandler.label = this.getFileDisplayName(this.chosenApp.executable);
|
||||
otherHandler.hidden = false;
|
||||
}
|
||||
|
||||
|
@ -1024,32 +1019,9 @@ nsUnknownContentTypeDialog.prototype = {
|
|||
if (params.handlerApp &&
|
||||
params.handlerApp.executable &&
|
||||
params.handlerApp.executable.isFile()) {
|
||||
// Show the "handler" menulist since we have a (user-specified)
|
||||
// application now.
|
||||
this.dialogElement("modeDeck").setAttribute("selectedIndex", "0");
|
||||
|
||||
// Remember the file they chose to run.
|
||||
this.chosenApp = params.handlerApp;
|
||||
|
||||
// Update dialog
|
||||
var otherHandler = this.dialogElement("otherHandler");
|
||||
otherHandler.removeAttribute("hidden");
|
||||
otherHandler.setAttribute("path",
|
||||
this.getPath(this.chosenApp.executable));
|
||||
otherHandler.label =
|
||||
this.getFileDisplayName(this.chosenApp.executable);
|
||||
this.dialogElement("openHandler").selectedIndex = 1;
|
||||
this.dialogElement("openHandler").setAttribute("lastSelectedItemID",
|
||||
"otherHandler");
|
||||
this.dialogElement("mode").selectedItem = this.dialogElement("open");
|
||||
} else {
|
||||
var openHandler = this.dialogElement("openHandler");
|
||||
var lastSelectedID = openHandler.getAttribute("lastSelectedItemID");
|
||||
if (!lastSelectedID)
|
||||
lastSelectedID = "defaultHandler";
|
||||
openHandler.selectedItem = this.dialogElement(lastSelectedID);
|
||||
}
|
||||
|
||||
#else
|
||||
var nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
||||
|
@ -1061,28 +1033,23 @@ nsUnknownContentTypeDialog.prototype = {
|
|||
fp.appendFilters(nsIFilePicker.filterApps);
|
||||
|
||||
if (fp.show() == nsIFilePicker.returnOK && fp.file) {
|
||||
// Show the "handler" menulist since we have a (user-specified)
|
||||
// application now.
|
||||
this.dialogElement("modeDeck").setAttribute("selectedIndex", "0");
|
||||
|
||||
// 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
|
||||
|
||||
// Show the "handler" menulist since we have a (user-specified)
|
||||
// application now.
|
||||
this.dialogElement("modeDeck").setAttribute("selectedIndex", "0");
|
||||
|
||||
// Update dialog.
|
||||
var otherHandler = this.dialogElement("otherHandler");
|
||||
otherHandler.removeAttribute("hidden");
|
||||
otherHandler.setAttribute("path", this.getPath(this.chosenApp.executable));
|
||||
#ifdef XP_MACOSX
|
||||
this.chosenApp.executable
|
||||
.QueryInterface(Components.interfaces.nsILocalFileMac);
|
||||
otherHandler.label = this.chosenApp.executable.bundleDisplayName;
|
||||
#else
|
||||
otherHandler.label = this.chosenApp.executable.leafName;
|
||||
#endif
|
||||
otherHandler.label = this.getFileDisplayName(this.chosenApp.executable);
|
||||
this.dialogElement("openHandler").selectedIndex = 1;
|
||||
this.dialogElement("openHandler").setAttribute("lastSelectedItemID", "otherHandler");
|
||||
|
||||
|
@ -1095,7 +1062,6 @@ nsUnknownContentTypeDialog.prototype = {
|
|||
lastSelectedID = "defaultHandler";
|
||||
openHandler.selectedItem = this.dialogElement(lastSelectedID);
|
||||
}
|
||||
#endif
|
||||
},
|
||||
|
||||
// Turn this on to get debugging messages.
|
||||
|
|
Загрузка…
Ссылка в новой задаче