Bug 84410 --> properly show unknown time and put the progress bar in undetermined mode
when we don't know how large the download is. r=sspitzer sr=blake git-svn-id: svn://10.0.0.236/trunk@98621 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
d654296035
commit
c1f9ebd38a
@ -77,12 +77,16 @@ var progressListener = {
|
||||
if (!gRestartChecked)
|
||||
{
|
||||
gRestartChecked = true;
|
||||
// right now, all that supports restarting downloads is ftp (rfc959)
|
||||
ftpChannel = aRequest.QueryInterface(Components.interfaces.nsIFTPChannel);
|
||||
if (ftpChannel) {
|
||||
try
|
||||
{
|
||||
// right now, all that supports restarting downloads is ftp (rfc959)
|
||||
ftpChannel = aRequest.QueryInterface(Components.interfaces.nsIFTPChannel);
|
||||
if (ftpChannel) {
|
||||
dialog.pause.setAttribute("hidden", false);
|
||||
dialog.pause.setAttribute("label", getString("pause"));
|
||||
}
|
||||
}
|
||||
catch (ex) {}
|
||||
}
|
||||
|
||||
// this is so that we don't clobber the status text if
|
||||
@ -118,7 +122,7 @@ var progressListener = {
|
||||
|
||||
// Calculate percentage.
|
||||
var percent;
|
||||
if ( aMaxTotalProgress != "-1" )
|
||||
if ( aMaxTotalProgress > 0)
|
||||
{
|
||||
percent = parseInt( (overallProgress*100)/aMaxTotalProgress + .5 );
|
||||
if ( percent > 100 )
|
||||
@ -129,7 +133,7 @@ var progressListener = {
|
||||
}
|
||||
else
|
||||
{
|
||||
percent = "??";
|
||||
percent = -1;
|
||||
|
||||
// Progress meter should be barber-pole in this case.
|
||||
dialog.progress.setAttribute( "mode", "undetermined" );
|
||||
@ -183,20 +187,25 @@ var progressListener = {
|
||||
// Update status msg.
|
||||
dialog.status.setAttribute("value", status);
|
||||
|
||||
// Update percentage label on progress meter.
|
||||
var percentMsg = getString( "percentMsg" );
|
||||
percentMsg = replaceInsert( percentMsg, 1, percent );
|
||||
dialog.progressText.setAttribute("value", percentMsg);
|
||||
// Update percentage label on progress meter.
|
||||
if (percent < 0)
|
||||
dialog.progressText.setAttribute("value", "");
|
||||
else
|
||||
{
|
||||
var percentMsg = getString( "percentMsg" );
|
||||
percentMsg = replaceInsert( percentMsg, 1, percent );
|
||||
dialog.progressText.setAttribute("value", percentMsg);
|
||||
}
|
||||
|
||||
// Update time remaining.
|
||||
if ( rate && aMaxTotalProgress != "-1" )
|
||||
if ( rate && (aMaxTotalProgress > 0) )
|
||||
{
|
||||
var rem = ( aMaxTotalProgress - aCurTotalProgress ) / rate;
|
||||
rem = parseInt( rem + .5 );
|
||||
dialog.timeLeft.setAttribute("value", formatSeconds( rem ));
|
||||
rem = parseInt( rem + .5 );
|
||||
dialog.timeLeft.setAttribute("value", formatSeconds( rem ));
|
||||
}
|
||||
else
|
||||
dialog.timeLeft.setAttribute("value", getString( "unknownTime" ));
|
||||
dialog.timeLeft.setAttribute("value", getString( "unknownTime" ));
|
||||
},
|
||||
onLocationChange: function(aWebProgress, aRequest, aLocation)
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
<!-- LOCALIZATION NOTE (unknownTime):
|
||||
|
||||
This string is used when the time remaining is unknown. -->
|
||||
<!ENTITY unknownTime "">
|
||||
<!ENTITY unknownTime "Unknown">
|
||||
|
||||
<!-- LOCALIZATION NOTE (longTimeFormat):
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user