From de2c9fd87e68a30c4f6325738ff26f302fd6cabd Mon Sep 17 00:00:00 2001 From: "blakeross%telocity.com" Date: Tue, 19 Mar 2002 22:19:39 +0000 Subject: [PATCH] 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 --- .../ui/progressDlg/nsIProgressDialog.idl | 6 +++++ .../ui/progressDlg/nsProgressDialog.js | 18 +++++++++++--- .../ui/progressDlg/nsProgressDialog.xul | 2 ++ .../download-manager/src/nsDownloadProxy.h | 24 +++++++++++++++---- mozilla/xpfe/components/jar.mn | 3 +++ 5 files changed, 45 insertions(+), 8 deletions(-) diff --git a/mozilla/embedding/components/ui/progressDlg/nsIProgressDialog.idl b/mozilla/embedding/components/ui/progressDlg/nsIProgressDialog.idl index 7b1f5df7fc8..53f3e7c9693 100644 --- a/mozilla/embedding/components/ui/progressDlg/nsIProgressDialog.idl +++ b/mozilla/embedding/components/ui/progressDlg/nsIProgressDialog.idl @@ -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; }; diff --git a/mozilla/embedding/components/ui/progressDlg/nsProgressDialog.js b/mozilla/embedding/components/ui/progressDlg/nsProgressDialog.js index 10c1c816762..0158adcdf9e 100644 --- a/mozilla/embedding/components/ui/progressDlg/nsProgressDialog.js +++ b/mozilla/embedding/components/ui/progressDlg/nsProgressDialog.js @@ -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). diff --git a/mozilla/embedding/components/ui/progressDlg/nsProgressDialog.xul b/mozilla/embedding/components/ui/progressDlg/nsProgressDialog.xul index 320fe801c35..c23482feaec 100644 --- a/mozilla/embedding/components/ui/progressDlg/nsProgressDialog.xul +++ b/mozilla/embedding/components/ui/progressDlg/nsProgressDialog.xul @@ -156,10 +156,12 @@ +