Bug 402452 - Some download manager preferences should be assumed, not required. r=Mardak, r=mfinkle, a=schrep

This commit is contained in:
sdwilsh@shawnwilsher.com 2008-02-08 14:22:35 -08:00
parent 979604b65e
commit 2683b199f5
4 changed files with 21 additions and 7 deletions

View File

@ -94,7 +94,6 @@
#define PREF_BDM_SHOWALERTINTERVAL "browser.download.manager.showAlertInterval"
#define PREF_BDM_RETENTION "browser.download.manager.retention"
#define PREF_BDM_QUITBEHAVIOR "browser.download.manager.quitBehavior"
#define PREF_BDM_CLOSEWHENDONE "browser.download.manager.closeWhenDone"
#define PREF_BDM_ADDTORECENTDOCS "browser.download.manager.addToRecentDocs"
#define PREF_BDM_SCANWHENDONE "browser.download.manager.scanWhenDone"
#define PREF_BH_DELETETEMPFILEONEXIT "browser.helperApps.deleteTempFileOnExit"

View File

@ -108,7 +108,11 @@ nsDownloadManagerUI.prototype = {
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
var flashCount = prefs.getIntPref(PREF_FLASH_COUNT);
// This preference may not be set, so defaulting to two.
let flashCount = 2;
try {
flashCount = prefs.getIntPref(PREF_FLASH_COUNT);
} catch (e) { }
var win = this.recentWindow.QueryInterface(Ci.nsIDOMChromeWindow);
win.getAttentionWithCycleCount(flashCount);

View File

@ -182,8 +182,13 @@ function autoRemoveAndClose(aDownload)
// For the moment, just use the simple heuristic that if this window was
// opened by the download process, rather than by the user, it should
// auto-close if the pref is set that way. If the user opened it themselves,
// it should not close until they explicitly close it.
var autoClose = pref.getBoolPref(PREF_BDM_CLOSEWHENDONE);
// it should not close until they explicitly close it. Additionally, the
// preference to control the feature may not be set, so defaulting to
// keeping the window open.
let autoClose = false;
try {
autoClose = pref.getBoolPref(PREF_BDM_CLOSEWHENDONE);
} catch (e) { }
var autoOpened =
!window.opener || window.opener.location.href == window.location.href;
if (autoClose && autoOpened && !gUserInteracted) {

View File

@ -54,6 +54,7 @@
* nsUnknownContentTypeDialog component.
*/
const PREF_BD_USEDOWNLOADDIR = "browser.download.useDownloadDir";
/* ctor
*/
@ -138,9 +139,14 @@ nsUnknownContentTypeDialog.prototype = {
this.mLauncher = aLauncher;
// Check to see if the user wishes to auto save to the default download
// folder without prompting.
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var autodownload = prefs.getBoolPref("browser.download.useDownloadDir");
// folder without prompting. This preferences may not be set, so default
// to not prompting.
let prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
let autodownload = true;
try {
autodownload = prefs.getBoolPref(PREF_BD_USEDOWNLOADDIR);
} catch (e) { }
if (autodownload) {
// Retrieve the user's default download directory