Bug 595888 - Show file size when attempting to download a file. r=sdwilsh, r=dolske, ui-r=faaborg

This commit is contained in:
Kailas 2011-08-15 12:53:03 -07:00
parent a32551add5
commit 332ca401eb
2 changed files with 15 additions and 2 deletions

View File

@ -22,6 +22,7 @@
# Contributor(s):
# Ben Goodger <ben@bengoodger.com>
# Rich Walsh <dragtext@e-vertise.com>
# Kailas Patil <patilkr24@gmail.com>
#
# 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
@ -49,6 +50,8 @@ selectDownloadDir=Select Download Folder
unknownAccept.label=Save File
unknownCancel.label=Cancel
fileType=%S file
# LOCALIZATION NOTE (fileSizeWithType): first %S is type, second %S is size, and third %S is unit
fileSizeWithType=%1S (%2S %3S)
# LOCALIZATION NOTE (wpsDefaultOS2): OS/2 only, WPS refers to the Workplace Shell and should probably not be translated
wpsDefaultOS2=WPS Default

View File

@ -29,6 +29,7 @@
# Dan Mosedale <dmose@mozilla.org>
# Jim Mathies <jmathies@mozilla.com>
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
# Kailas Patil <patilkr24@gmail.com>
#
# 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
@ -139,6 +140,7 @@ const nsITimer = Components.interfaces.nsITimer;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/DownloadLastDir.jsm");
Components.utils.import("resource://gre/modules/DownloadPaths.jsm");
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
/* ctor
*/
@ -609,8 +611,16 @@ nsUnknownContentTypeDialog.prototype = {
else
typeString = mimeInfo.MIMEType;
}
type.value = typeString;
if (this.mLauncher.contentLength) {
let [size, unit] = DownloadUtils.
convertByteUnits(this.mLauncher.contentLength);
type.value = this.dialogElement("strings")
.getFormattedString("fileSizeWithType",
[typeString, size, unit]);
}
else {
type.value = typeString;
}
},
_blurred: false,