From 96c031d72bbda63256905fc2403438212480a803 Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Fri, 7 Nov 2003 12:27:21 +0000 Subject: [PATCH] Bug 224918 When not using Download Manager, closing progress dialogs doesn't cancel download r=biesi sr=bz --- .../download-manager/public/nsIDownloadManager.idl | 7 ++++++- .../download-manager/resources/downloadmanager.js | 2 +- xpfe/components/download-manager/src/nsDownloadManager.cpp | 4 ++-- xpfe/components/download-manager/src/nsDownloadProxy.h | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/xpfe/components/download-manager/public/nsIDownloadManager.idl b/xpfe/components/download-manager/public/nsIDownloadManager.idl index b8b448440e7..515711d5b84 100644 --- a/xpfe/components/download-manager/public/nsIDownloadManager.idl +++ b/xpfe/components/download-manager/public/nsIDownloadManager.idl @@ -135,9 +135,14 @@ interface nsIDownloadManager : nsISupports { * display progress for. * * @param aParent The parent, or opener, of the front end (optional). + * + * @param aCancelDownloadOnClose Whether closing the dialog + * should cancel the download. */ - void openProgressDialogFor(in AUTF8String aTargetPath, in nsIDOMWindow aParent); + void openProgressDialogFor(in AUTF8String aTargetPath, + in nsIDOMWindow aParent, + in boolean aCancelDownloadOnClose); /** * Called when the download manager front end is closed. Useful for diff --git a/xpfe/components/download-manager/resources/downloadmanager.js b/xpfe/components/download-manager/resources/downloadmanager.js index 8e380921123..af6f7b9744f 100644 --- a/xpfe/components/download-manager/resources/downloadmanager.js +++ b/xpfe/components/download-manager/resources/downloadmanager.js @@ -206,7 +206,7 @@ var downloadViewController = { case "cmd_properties": selectedItem = getSelectedItem(); if (selectedItem && gDownloadManager.getDownload(selectedItem.id)) - gDownloadManager.openProgressDialogFor(selectedItem.id, window); + gDownloadManager.openProgressDialogFor(selectedItem.id, window, false); break; case "cmd_openfile": selectedItem = getSelectedItem(); diff --git a/xpfe/components/download-manager/src/nsDownloadManager.cpp b/xpfe/components/download-manager/src/nsDownloadManager.cpp index b21a2c440a1..62afdb2b19e 100644 --- a/xpfe/components/download-manager/src/nsDownloadManager.cpp +++ b/xpfe/components/download-manager/src/nsDownloadManager.cpp @@ -744,7 +744,7 @@ nsDownloadManager::Open(nsIDOMWindow* aParent, nsIDownload* aDownload) } NS_IMETHODIMP -nsDownloadManager::OpenProgressDialogFor(const nsACString & aTargetPath, nsIDOMWindow* aParent) +nsDownloadManager::OpenProgressDialogFor(const nsACString & aTargetPath, nsIDOMWindow* aParent, PRBool aCancelDownloadOnClose) { nsresult rv; nsCStringKey key(aTargetPath); @@ -774,7 +774,7 @@ nsDownloadManager::OpenProgressDialogFor(const nsACString & aTargetPath, nsIDOMW nsCOMPtr dialog(do_CreateInstance("@mozilla.org/progressdialog;1", &rv)); if (NS_FAILED(rv)) return rv; - dialog->SetCancelDownloadOnClose(PR_FALSE); + dialog->SetCancelDownloadOnClose(aCancelDownloadOnClose); nsCOMPtr dl = do_QueryInterface(dialog); diff --git a/xpfe/components/download-manager/src/nsDownloadProxy.h b/xpfe/components/download-manager/src/nsDownloadProxy.h index f8f2ce6e1ad..8dae2840c23 100644 --- a/xpfe/components/download-manager/src/nsDownloadProxy.h +++ b/xpfe/components/download-manager/src/nsDownloadProxy.h @@ -84,7 +84,7 @@ public: if (NS_FAILED(rv)) return rv; NS_ConvertUCS2toUTF8 utf8Path(path); - return dm->OpenProgressDialogFor(utf8Path, nsnull); + return dm->OpenProgressDialogFor(utf8Path, nsnull, PR_TRUE); } return rv; }