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 @@
+
+
diff --git a/mozilla/xpfe/components/download-manager/src/nsDownloadProxy.h b/mozilla/xpfe/components/download-manager/src/nsDownloadProxy.h
index 4a254a5f34f..45043349751 100644
--- a/mozilla/xpfe/components/download-manager/src/nsDownloadProxy.h
+++ b/mozilla/xpfe/components/download-manager/src/nsDownloadProxy.h
@@ -41,6 +41,10 @@
#include "nsIDownload.h"
#include "nsIDownloadManager.h"
+#include "nsIPrefBranch.h"
+#include "nsIPrefService.h"
+
+#define DOWNLOAD_MANAGER_BEHAVIOR_PREF "browser.downloadmanager.behavior"
class nsDownloadProxy : public nsIDownload,
public nsIWebProgressListener
@@ -64,12 +68,21 @@ public:
rv = dm->AddDownload(aSource, aTarget, aDisplayName, aOpeningWith, aStartTime, aPersist, getter_AddRefs(mInner));
if (NS_FAILED(rv)) return rv;
-
- char* path;
- rv = aTarget->GetPath(&path);
- if (NS_FAILED(rv)) return rv;
- return dm->OpenProgressDialogFor(path, nsnull);
+ PRInt32 behavior = 0;
+ nsCOMPtr prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
+ if (NS_FAILED(rv)) return rv;
+ nsCOMPtr branch = do_QueryInterface(prefs);
+
+ branch->GetIntPref(DOWNLOAD_MANAGER_BEHAVIOR_PREF, &behavior);
+ if (behavior == 0)
+ return dm->Open(nsnull);
+ if (behavior == 1) {
+ char* path;
+ aTarget->GetPath(&path);
+ return dm->OpenProgressDialogFor(path, nsnull);
+ }
+ return rv;
}
@@ -78,6 +91,7 @@ public:
return mInner->GetDisplayName(aDisplayName);
}
+
NS_IMETHODIMP SetDisplayName(const PRUnichar* aDisplayName)
{
return mInner->SetDisplayName(aDisplayName);
diff --git a/mozilla/xpfe/components/jar.mn b/mozilla/xpfe/components/jar.mn
index e2151a2794c..5f393a92db8 100644
--- a/mozilla/xpfe/components/jar.mn
+++ b/mozilla/xpfe/components/jar.mn
@@ -22,6 +22,8 @@ comm.jar:
content/communicator/pref/pref-cache.xul (prefwindow/resources/content/pref-cache.xul)
content/communicator/pref/pref-colors.js (prefwindow/resources/content/pref-colors.js)
content/communicator/pref/pref-colors.xul (prefwindow/resources/content/pref-colors.xul)
+ content/communicator/pref/pref-download.xul (prefwindow/resources/content/pref-download.xul)
+ content/communicator/pref/pref-download.js (prefwindow/resources/content/pref-download.js)
content/communicator/pref/pref-help.js (prefwindow/resources/content/pref-help.js)
content/communicator/pref/pref-themes.xul (prefwindow/resources/content/pref-themes.xul)
content/communicator/pref/pref-themes.js (prefwindow/resources/content/pref-themes.js)
@@ -115,6 +117,7 @@ en-US.jar:
locale/en-US/communicator/pref/pref-debug.dtd (prefwindow/resources/locale/en-US/pref-debug.dtd)
locale/en-US/communicator/pref/pref-debug1.dtd (prefwindow/resources/locale/en-US/pref-debug1.dtd)
locale/en-US/communicator/pref/pref-debug2.dtd (prefwindow/resources/locale/en-US/pref-debug2.dtd)
+ locale/en-US/communicator/pref/pref-download.dtd (prefwindow/resources/locale/en-US/pref-download.dtd)
locale/en-US/communicator/pref/pref-fonts.dtd (prefwindow/resources/locale/en-US/pref-fonts.dtd)
locale/en-US/communicator/pref/pref-history.dtd (prefwindow/resources/locale/en-US/pref-history.dtd)
locale/en-US/communicator/pref/pref-languages.dtd (prefwindow/resources/locale/en-US/pref-languages.dtd)