--- components/nsHelperAppDlg.js 2010-02-27 14:34:53.000000000 +0100 +++ components.old/nsHelperAppDlg.js 2010-02-27 13:30:53.000000000 +0100 @@ -397,24 +397,52 @@ // if always-save and is-executable and no-handler // then set up simple ui var mimeType = this.mLauncher.MIMEInfo.MIMEType; - this.initAppAndSaveToDiskValues(); - - // Initialize "always ask me" box. This should always be disabled - // and set to true for the ambiguous type application/octet-stream. - // We don't also check for application/x-msdownload here since we - // want users to be able to autodownload .exe files. - var rememberChoice = this.dialogElement("rememberChoice"); - - //@line 509 "/var/tmp/portage/net-libs/xulrunner-1.9.1.6/work/mozilla-1.9.1/toolkit/mozapps/downloads/src/nsHelperAppDlg.js.in" - rememberChoice.disabled = false; - rememberChoice.checked = !this.mLauncher.MIMEInfo.alwaysAskBeforeHandling; - this.toggleRememberChoice(rememberChoice); - - // XXXben - menulist won't init properly, hack. - var openHandler = this.dialogElement("openHandler"); - openHandler.parentNode.removeChild(openHandler); - var openHandlerBox = this.dialogElement("openHandlerBox"); - openHandlerBox.appendChild(openHandler); + var shouldntRememberChoice = (mimeType == "application/octet-stream" || + mimeType == "application/x-msdownload" || + this.mLauncher.targetFileIsExecutable); + if (shouldntRememberChoice && !this.openWithDefaultOK()) { + // hide featured choice + this.dialogElement("normalBox").collapsed = true; + // show basic choice + this.dialogElement("basicBox").collapsed = false; + // change button labels and icons; use "save" icon for the accept + // button since it's the only action possible + let acceptButton = this.mDialog.document.documentElement + .getButton("accept"); + acceptButton.label = this.dialogElement("strings") + .getString("unknownAccept.label"); + acceptButton.setAttribute("icon", "save"); + this.mDialog.document.documentElement.getButton("cancel").label = this.dialogElement("strings").getString("unknownCancel.label"); + // hide other handler + this.dialogElement("openHandler").collapsed = true; + // set save as the selected option + this.dialogElement("mode").selectedItem = this.dialogElement("save"); + } + else { + this.initAppAndSaveToDiskValues(); + + // Initialize "always ask me" box. This should always be disabled + // and set to true for the ambiguous type application/octet-stream. + // We don't also check for application/x-msdownload here since we + // want users to be able to autodownload .exe files. + var rememberChoice = this.dialogElement("rememberChoice"); + +//@line 509 "/var/tmp/portage/net-libs/xulrunner-1.9.1.6/work/mozilla-1.9.1/toolkit/mozapps/downloads/src/nsHelperAppDlg.js.in" + if (shouldntRememberChoice) { + rememberChoice.checked = false; + rememberChoice.disabled = true; + } + else { + rememberChoice.checked = !this.mLauncher.MIMEInfo.alwaysAskBeforeHandling; + } + this.toggleRememberChoice(rememberChoice); + + // XXXben - menulist won't init properly, hack. + var openHandler = this.dialogElement("openHandler"); + openHandler.parentNode.removeChild(openHandler); + var openHandlerBox = this.dialogElement("openHandlerBox"); + openHandlerBox.appendChild(openHandler); + } this.mDialog.setTimeout("dialog.postShowCallback()", 0); @@ -578,6 +606,17 @@ // from the browser at the moment because of security concerns. var openWithDefaultOK = this.openWithDefaultOK(); var mimeType = this.mLauncher.MIMEInfo.MIMEType; + if (this.mLauncher.targetFileIsExecutable || ( + (mimeType == "application/octet-stream" || + mimeType == "application/x-msdownload") && + !openWithDefaultOK)) { + this.dialogElement("open").disabled = true; + var openHandler = this.dialogElement("openHandler"); + openHandler.disabled = true; + openHandler.selectedItem = null; + modeGroup.selectedItem = this.dialogElement("save"); + return; + } // Fill in helper app info, if there is any. try { @@ -805,7 +844,7 @@ // type application/octet-stream. We do NOT do this for // application/x-msdownload since we want users to be able to // autodownload these to disk. - if (needUpdate) + if (needUpdate && this.mLauncher.MIMEInfo.MIMEType != "application/octet-stream") this.updateHelperAppPref(); } catch(e) { }