From ecc6ce609f4be0e4cf9bd6a0328cbbff2ad47d00 Mon Sep 17 00:00:00 2001 From: "sdwilsh@shawnwilsher.com" Date: Fri, 17 Aug 2007 15:19:08 -0700 Subject: [PATCH] Bug 392362 - Make a pref to control the number of days for which we display download history. Patch by Edward Lee . r=sdwilsh --- browser/app/profile/firefox.js | 1 + toolkit/mozapps/downloads/content/downloads.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 99726518d91..96a3f422169 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -213,6 +213,7 @@ pref("browser.download.manager.closeWhenDone", false); pref("browser.download.manager.openDelay", 0); pref("browser.download.manager.focusWhenStarting", false); pref("browser.download.manager.flashCount", 2); +pref("browser.download.manager.displayedHistoryDays", 7); // search engines URL pref("browser.search.searchEnginesURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/firefox/%VERSION%/search-engines/"); diff --git a/toolkit/mozapps/downloads/content/downloads.js b/toolkit/mozapps/downloads/content/downloads.js index 5c5bed71bec..0998cca0ccf 100644 --- a/toolkit/mozapps/downloads/content/downloads.js +++ b/toolkit/mozapps/downloads/content/downloads.js @@ -47,6 +47,8 @@ const PREF_BDM_CLOSEWHENDONE = "browser.download.manager.closeWhenDone"; const PREF_BDM_ALERTONEXEOPEN = "browser.download.manager.alertOnEXEOpen"; const PREF_BDM_RETENTION = "browser.download.manager.retention"; +const PREF_BDM_DISPLAYEDHISTORYDAYS = + "browser.download.manager.displayedHistoryDays"; const nsLocalFile = Components.Constructor("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath"); @@ -606,7 +608,11 @@ function openExternal(aFile) function buildDefaultView() { buildActiveDownloadsList(); - buildDownloadListWithTime(Date.now() - 24 * 3600 * 1000 * 7); // One week + + let pref = Cc["@mozilla.org/preferences-service;1"]. + getService(Ci.nsIPrefBranch); + let days = pref.getIntPref(PREF_BDM_DISPLAYEDHISTORYDAYS); + buildDownloadListWithTime(Date.now() - days * 24 * 60 * 60 * 1000); // select the first visible download item, if any var children = gDownloadsView.children;