From d1d69edf30fec6edc8770a8fb345b9d486b8bcf7 Mon Sep 17 00:00:00 2001 From: "blakeross%telocity.com" Date: Mon, 22 Apr 2002 01:19:13 +0000 Subject: [PATCH] 131762 - can open multiple occurrences of download manager. r=hixie sr=ben --- xpfe/components/download-manager/src/Makefile.in | 1 + xpfe/components/download-manager/src/makefile.win | 1 + .../download-manager/src/nsDownloadManager.cpp | 12 +++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xpfe/components/download-manager/src/Makefile.in b/xpfe/components/download-manager/src/Makefile.in index 406e4c86d592..045c8aa8562b 100644 --- a/xpfe/components/download-manager/src/Makefile.in +++ b/xpfe/components/download-manager/src/Makefile.in @@ -39,6 +39,7 @@ REQUIRES = xpcom \ intl \ windowwatcher \ webbrowserpersist \ + appshell \ dom \ $(NULL) CPPSRCS = \ diff --git a/xpfe/components/download-manager/src/makefile.win b/xpfe/components/download-manager/src/makefile.win index ca902cebf065..13fc2550eaa7 100644 --- a/xpfe/components/download-manager/src/makefile.win +++ b/xpfe/components/download-manager/src/makefile.win @@ -30,6 +30,7 @@ REQUIRES = xpcom \ intl \ windowwatcher \ webbrowserpersist \ + appshell \ dom \ $(NULL) diff --git a/xpfe/components/download-manager/src/nsDownloadManager.cpp b/xpfe/components/download-manager/src/nsDownloadManager.cpp index b9c674ba0bca..c0f9a0978524 100644 --- a/xpfe/components/download-manager/src/nsDownloadManager.cpp +++ b/xpfe/components/download-manager/src/nsDownloadManager.cpp @@ -54,6 +54,7 @@ #include "nsIWebBrowserPersist.h" #include "nsIWindowWatcher.h" #include "nsIStringBundle.h" +#include "nsIWindowMediator.h" /* Outstanding issues/todo: * 1. Implement pause/resume. @@ -638,9 +639,18 @@ nsDownloadManager::Open(nsIDOMWindow* aParent) // if this fails, it fails -- continue. AssertProgressInfo(); + //check for an existing manager window and focus it + nsresult rv; + nsCOMPtr wm = do_GetService("@mozilla.org/rdf/datasource;1?name=window-mediator", &rv); + if (NS_FAILED(rv)) return rv; + + nsCOMPtr recentWindow; + wm->GetMostRecentWindow(NS_LITERAL_STRING("Download:Manager").get(), getter_AddRefs(recentWindow)); + if (recentWindow) + return recentWindow->Focus(); + // if we ever have the capability to display the UI of third party dl managers, // we'll open their UI here instead. - nsresult rv; nsCOMPtr ww = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv); if (NS_FAILED(rv)) return rv;