From 5a781b27a102f49e3248d13df2191c6ceb3ebead Mon Sep 17 00:00:00 2001 From: "blakeross%telocity.com" Date: Fri, 8 Nov 2002 01:01:07 +0000 Subject: [PATCH] Remove downloads prompt pref. --- browser/app/profile/all.js | 1 - browser/app/profile/firebird.js | 1 - browser/base/content/contentAreaUtils.js | 33 ++++++++++--------- .../downloads/content/downloadPanel.js | 2 +- .../prefwindow/content/pref-downloads.xul | 3 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/browser/app/profile/all.js b/browser/app/profile/all.js index 0317d7024ae..73a0739fa51 100644 --- a/browser/app/profile/all.js +++ b/browser/app/profile/all.js @@ -120,7 +120,6 @@ pref("browser.download.progressDnldDialog.keepAlive", true); // keep the dnload pref("browser.download.progressDnldDialog.enable_launch_reveal_buttons", true); pref("browser.download.useProgressDialogs", true); pref("browser.download.openSidebar", false); -pref("browser.download.promptWithFilepicker", true); // various default search settings pref("browser.search.defaulturl", "chrome://browser-region/locale/region.properties"); diff --git a/browser/app/profile/firebird.js b/browser/app/profile/firebird.js index 0317d7024ae..73a0739fa51 100644 --- a/browser/app/profile/firebird.js +++ b/browser/app/profile/firebird.js @@ -120,7 +120,6 @@ pref("browser.download.progressDnldDialog.keepAlive", true); // keep the dnload pref("browser.download.progressDnldDialog.enable_launch_reveal_buttons", true); pref("browser.download.useProgressDialogs", true); pref("browser.download.openSidebar", false); -pref("browser.download.promptWithFilepicker", true); // various default search settings pref("browser.search.defaulturl", "chrome://browser-region/locale/region.properties"); diff --git a/browser/base/content/contentAreaUtils.js b/browser/base/content/contentAreaUtils.js index d9f33531f2a..44fb74afd68 100644 --- a/browser/base/content/contentAreaUtils.js +++ b/browser/base/content/contentAreaUtils.js @@ -80,25 +80,28 @@ function getReferrer(doc) // - A linked document using Save Link As... // - A linked document using Alt-click Save Link As... // -function saveURL(aURL, aFileName, aFilePickerTitleKey, aShouldBypassCache) +function saveURL(aURL, aFileName, aFilePickerTitleKey, aShouldBypassCache, aSkipPrompt) { - saveInternal(aURL, null, aFileName, aFilePickerTitleKey, aShouldBypassCache); + saveInternal(aURL, null, aFileName, aFilePickerTitleKey, aShouldBypassCache, aSkipPrompt); } -function saveDocument(aDocument) +function saveDocument(aDocument, aSkipPrompt) { // In both cases here, we want to use cached data because the // document is currently visible. if (aDocument) - saveInternal(aDocument.location.href, aDocument, false); + saveInternal(aDocument.location.href, aDocument, false, aSkipPrompt); else - saveInternal(_content.location.href, null, false); + saveInternal(_content.location.href, null, false, aSkipPrompt); } function saveInternal(aURL, aDocument, aFileName, aFilePickerTitleKey, - aShouldBypassCache) + aShouldBypassCache, aSkipPrompt) { + if (aSkipPrompt == undefined) + aSkipPrompt = false; + var data = { url: aURL, fileName: aFileName, @@ -107,10 +110,10 @@ function saveInternal(aURL, aDocument, bypassCache: aShouldBypassCache, window: window }; - var sniffer = new nsHeaderSniffer(aURL, foundHeaderInfo, data); + var sniffer = new nsHeaderSniffer(aURL, foundHeaderInfo, data, aSkipPrompt); } -function foundHeaderInfo(aSniffer, aData) +function foundHeaderInfo(aSniffer, aData, aSkipPrompt) { var contentType = aSniffer.contentType; var contentEncodingType = aSniffer.contentEncodingType; @@ -154,8 +157,6 @@ function foundHeaderInfo(aSniffer, aData) const prefSvcContractID = "@mozilla.org/preferences-service;1"; const prefSvcIID = Components.interfaces.nsIPrefService; var prefs = Components.classes[prefSvcContractID].getService(prefSvcIID).getBranch("browser.download."); - if (isDocument) - prefs.setIntPref("save_converter_index", fp.filterIndex); const nsILocalFile = Components.interfaces.nsILocalFile; try { @@ -165,11 +166,9 @@ function foundHeaderInfo(aSniffer, aData) } const lfContractID = "@mozilla.org/file/local;1"; - - var prompt = prefs.getBoolPref("promptWithFilepicker"); var filterIndex = 0; var file; - if (prompt) { + if (!aSkipPrompt) { var fp = makeFilePicker(); var titleKey = aData.filePickerTitle || "SaveLinkTitle"; var bundle = getStringBundle(); @@ -205,6 +204,9 @@ function foundHeaderInfo(aSniffer, aData) file = dir; } + if (isDocument) + prefs.setIntPref("save_converter_index", filterIndex); + // If we're saving a document, and are saving either in complete mode or // as converted text, pass the document to the web browser persist component. // If we're just saving the HTML (second option in the list), send only the URI. @@ -267,10 +269,11 @@ function foundHeaderInfo(aSniffer, aData) } } -function nsHeaderSniffer(aURL, aCallback, aData) +function nsHeaderSniffer(aURL, aCallback, aData, aSkipPrompt) { this.mCallback = aCallback; this.mData = aData; + this.mSkipPrompt = aSkipPrompt; this.uri = makeURL(aURL); @@ -400,7 +403,7 @@ nsHeaderSniffer.prototype = { } } } - this.mCallback(this, this.mData); + this.mCallback(this, this.mData, this.mSkipPrompt); }, // ------------------------------------------------ diff --git a/browser/components/downloads/content/downloadPanel.js b/browser/components/downloads/content/downloadPanel.js index d13bfececd5..ee20b58cfc5 100644 --- a/browser/components/downloads/content/downloadPanel.js +++ b/browser/components/downloads/content/downloadPanel.js @@ -72,7 +72,7 @@ var downloadDNDObserver = var split = aXferData.data.split("\n"); var url = split[0]; var name = split[1]; - saveURL(url, name, null, true); + saveURL(url, name, null, true, true); }, _flavourSet: null, getSupportedFlavours: function () diff --git a/browser/components/prefwindow/content/pref-downloads.xul b/browser/components/prefwindow/content/pref-downloads.xul index 0f4d0f3be1e..fe1b56e6f65 100644 --- a/browser/components/prefwindow/content/pref-downloads.xul +++ b/browser/components/prefwindow/content/pref-downloads.xul @@ -27,7 +27,7 @@