From 69b017a4a8fd1cf2caa14e0199cabc613b9fb469 Mon Sep 17 00:00:00 2001 From: "edward.lee@engineering.uiuc.edu" Date: Fri, 14 Dec 2007 02:00:16 -0800 Subject: [PATCH] Bug 405884 - List date/time of download for each download shown. r=sdwilsh, b-ff3=mconnor --- .../mozapps/downloads/downloads.properties | 5 ++ .../mozapps/downloads/content/download.xml | 86 ++++++++++--------- .../mozapps/downloads/content/downloads.js | 50 +++++++++++ .../mozapps/downloads/downloads.css | 4 + .../pinstripe/mozapps/downloads/downloads.css | 4 + .../winstripe/mozapps/downloads/downloads.css | 4 + 6 files changed, 113 insertions(+), 40 deletions(-) diff --git a/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties b/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties index 1cb662dbab4..cb4964b9647 100644 --- a/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties +++ b/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties @@ -68,6 +68,11 @@ stateCanceled=Canceled stateBlocked=Blocked by Parental Controls stateDirty=Blocked: Download may contain a virus or spyware +# LOCALIZATION NOTE (yesterday): Displayed time for files finished yesterday +yesterday=Yesterday +# LOCALIZATION NOTE (monthDate): #1 month name; #2 date number; e.g., January 22 +monthDate=#1 #2 + fileDoesNotExistOpenTitle=Cannot Open %S fileDoesNotExistShowTitle=Cannot Show %S fileDoesNotExistError=%S does not exist. It may have been renamed, moved, or deleted since it was downloaded. diff --git a/toolkit/mozapps/downloads/content/download.xml b/toolkit/mozapps/downloads/content/download.xml index 17bc3742ef5..557265b251a 100644 --- a/toolkit/mozapps/downloads/content/download.xml +++ b/toolkit/mozapps/downloads/content/download.xml @@ -25,6 +25,7 @@ # Ben Goodger (v2.0) # Blake Ross # Shawn Wilsher (v3.0) +# Edward Lee # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or @@ -186,14 +187,15 @@ xbl:inherits="src=image"/> - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + = today) { + // Download finished after today started, show the time + let dts = Cc["@mozilla.org/intl/scriptabledateformat;1"]. + getService(Ci.nsIScriptableDateFormat); + dateTime = dts.FormatTime("", dts.timeFormatNoSeconds, + end.getHours(), end.getMinutes(), 0); + } else if (today - end < (24 * 60 * 60 * 1000)) { + // Download finished after yesterday started, show yesterday + dateTime = gStr.yesterday; + } else if (today - end < (6 * 24 * 60 * 60 * 1000)) { + // Download finished after last week started, show day of week + dateTime = end.toLocaleFormat("%A"); + } else { + // Download must have been from some time ago.. show month/day + let month = end.toLocaleFormat("%B"); + let date = end.toLocaleFormat("%d"); + dateTime = replaceInsert(gStr.monthDate, 1, month); + dateTime = replaceInsert(dateTime, 2, date); + } + + aItem.setAttribute("dateTime", dateTime); +} + /** * Converts a number of bytes to the appropriate unit that results in a * number that needs fewer than 4 digits diff --git a/toolkit/themes/gnomestripe/mozapps/downloads/downloads.css b/toolkit/themes/gnomestripe/mozapps/downloads/downloads.css index 69e7c5bbae1..6f2bef0eb41 100644 --- a/toolkit/themes/gnomestripe/mozapps/downloads/downloads.css +++ b/toolkit/themes/gnomestripe/mozapps/downloads/downloads.css @@ -24,6 +24,10 @@ richlistitem[type="download"] .name { font-size: larger; } +richlistitem[type="download"] .dateTime { + font-size: smaller; +} + #information { -moz-appearance: none; background-color: white; diff --git a/toolkit/themes/pinstripe/mozapps/downloads/downloads.css b/toolkit/themes/pinstripe/mozapps/downloads/downloads.css index f4d586a5b7f..02846cc20b3 100644 --- a/toolkit/themes/pinstripe/mozapps/downloads/downloads.css +++ b/toolkit/themes/pinstripe/mozapps/downloads/downloads.css @@ -18,6 +18,10 @@ richlistitem[type="download"] .name { font-size: larger; } +richlistitem[type="download"] .dateTime { + font-size: smaller; +} + richlistitem[type="download"] button { -moz-appearance: none; min-height: 16px; diff --git a/toolkit/themes/winstripe/mozapps/downloads/downloads.css b/toolkit/themes/winstripe/mozapps/downloads/downloads.css index a569f32a534..df15438fe8d 100644 --- a/toolkit/themes/winstripe/mozapps/downloads/downloads.css +++ b/toolkit/themes/winstripe/mozapps/downloads/downloads.css @@ -24,6 +24,10 @@ richlistitem[type="download"] .name { font-size: larger; } +richlistitem[type="download"] .dateTime { + font-size: smaller; +} + #information { -moz-appearance: none; background-color: white;