131762 - can open multiple occurrences of download manager.
also adds a pref in Navigator > Downloads to set the behavior when starting a download (open DM, open progress dialog, open nothing). r=hewitt sr=ben a=asa git-svn-id: svn://10.0.0.236/trunk@116894 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -61,6 +61,12 @@ interface nsIProgressDialog : nsIDownload {
|
||||
* open yet, or has been closed.
|
||||
*/
|
||||
attribute nsIDOMWindow dialog;
|
||||
|
||||
/**
|
||||
* Whether or not to cancel the download when the progress dialog is closed.
|
||||
* If set, the Cancel button will also be hidden.
|
||||
*/
|
||||
attribute boolean cancelOnClose;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ function nsProgressDialog() {
|
||||
// Initialize data properties.
|
||||
this.mParent = null;
|
||||
this.mOperation = null;
|
||||
this.mCancelOnClose = null;
|
||||
this.mStartTime = ( new Date() ).getTime();
|
||||
this.observer = null;
|
||||
this.mLastUpdate = Number.MIN_VALUE; // To ensure first onProgress causes update.
|
||||
@@ -90,6 +91,8 @@ nsProgressDialog.prototype = {
|
||||
set parent(newval) { return this.mParent = newval; },
|
||||
get operation() { return this.mOperation; },
|
||||
set operation(newval) { return this.mOperation = newval; },
|
||||
get cancelOnClose() { return this.mCancelOnClose; },
|
||||
set cancelOnClose(newval) { return this.mCancelOnClose = newval; },
|
||||
get observer() { return this.mObserver; },
|
||||
set observer(newval) { return this.mObserver = newval; },
|
||||
get startTime() { return this.mStartTime; },
|
||||
@@ -404,6 +407,10 @@ nsProgressDialog.prototype = {
|
||||
this.dialogElement( "keep" ).checked = prefs.getBoolPref( "browser.download.progressDnldDialog.keepAlive" );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !this.cancelOnClose ) {
|
||||
this.hide( "cancel" );
|
||||
}
|
||||
|
||||
// Initialize title.
|
||||
this.setTitle();
|
||||
@@ -443,7 +450,9 @@ nsProgressDialog.prototype = {
|
||||
}
|
||||
}
|
||||
this.dialog = null; // The dialog is history.
|
||||
this.onCancel();
|
||||
if ( this.cancelOnClose ) {
|
||||
this.onCancel();
|
||||
}
|
||||
},
|
||||
|
||||
// onpause event means the user pressed the pause/resume button
|
||||
@@ -750,8 +759,11 @@ nsProgressDialog.prototype = {
|
||||
// Hide a given dialog field.
|
||||
hide: function( field ) {
|
||||
this.dialogElement( field ).setAttribute( "style", "display: none;" );
|
||||
// Hide the associated separator, too.
|
||||
this.dialogElement( field+"Separator" ).setAttribute( "style", "display: none;" );
|
||||
// Hide the associated separator, too, if one exists.
|
||||
var separator = this.dialogElement( field+"Separator" );
|
||||
if ( separator ) {
|
||||
separator.setAttribute( "style", "display: none;" );
|
||||
}
|
||||
},
|
||||
|
||||
// Return input in hex, prepended with "0x" and leading zeros (to 8 digits).
|
||||
|
||||
@@ -156,10 +156,12 @@
|
||||
</hbox>
|
||||
<separator id="keepSeparator"/>
|
||||
<hbox>
|
||||
<spacer/>
|
||||
<button id="cancel" label="&cancel;" oncommand="notifyObserver( 'oncancel' )"/>
|
||||
<button id="pauseResume" label="&pause;" oncommand="window.notifyObserver( 'onpause' )"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="launch" label="&launch;" disabled="true" oncommand="window.notifyObserver( 'onlaunch' )"/>
|
||||
<button id="reveal" label="&reveal;" disabled="true" oncommand="window.notifyObserver( 'onreveal' )"/>
|
||||
<spacer/>
|
||||
</hbox>
|
||||
</window>
|
||||
|
||||
Reference in New Issue
Block a user