This commit is contained in:
blakeross%telocity.com 2002-11-08 01:01:07 +00:00
Родитель 2a0afd7964
Коммит 5a781b27a1
5 изменённых файлов: 20 добавлений и 20 удалений

Просмотреть файл

@ -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");

Просмотреть файл

@ -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");

Просмотреть файл

@ -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);
},
// ------------------------------------------------

Просмотреть файл

@ -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 ()

Просмотреть файл

@ -27,7 +27,7 @@
<script type="application/x-javascript">
<![CDATA[
var _elementIDs = ["defaultDir", "prompt", "useProgressDialogs", "openDownloadsSidebar"];
var _elementIDs = ["defaultDir", "useProgressDialogs", "openDownloadsSidebar"];
function selectFolder()
{
const nsIFilePicker = Components.interfaces.nsIFilePicker;
@ -69,7 +69,6 @@
</groupbox>
<groupbox>
<caption label="&whenStarting.label;"/>
<checkbox id="prompt" label="&prompt.label;" prefstring="browser.download.promptWithFilepicker"/>
<checkbox id="useProgressDialogs" label="&useProgressDialogs.label;" accesskey="&useProgressDialogs.accesskey;"
prefstring="browser.download.useProgressDialogs"/>
<checkbox id="openDownloadsSidebar" label="&openSidebar.label;"