diff --git a/xpfe/components/download-manager/resources/Makefile.in b/xpfe/components/download-manager/resources/Makefile.in
index 7a3c93ed6ce0..c7f343ccfe3c 100644
--- a/xpfe/components/download-manager/resources/Makefile.in
+++ b/xpfe/components/download-manager/resources/Makefile.in
@@ -26,8 +26,15 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
+
+ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+DIRS = win
+else
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
-DIRS = mac
+DIRS = mac
+else
+DIRS = unix
+endif
endif
include $(topsrcdir)/config/rules.mk
diff --git a/xpfe/components/download-manager/resources/downloadmanager.js b/xpfe/components/download-manager/resources/downloadmanager.js
index 762c1092218a..96ca6fa27ba5 100644
--- a/xpfe/components/download-manager/resources/downloadmanager.js
+++ b/xpfe/components/download-manager/resources/downloadmanager.js
@@ -61,8 +61,8 @@ function selectDownload(aDownload)
gDownloadView.treeBoxObject.ensureRowIsVisible(dlIndex);
}
-function Startup()
-{
+function DLManagerStartup()
+{
if (!window.arguments.length)
return;
@@ -162,7 +162,8 @@ var downloadViewController = {
if (!selectionCount) return false;
var selectedItem = getSelectedItem();
- var isDownloading = gDownloadManager.getDownload(selectedItem.id);
+ var isDownloading = selectedItem && gDownloadManager.getDownload(selectedItem.id);
+
switch (aCommand) {
case "cmd_openfile":
try {
@@ -187,7 +188,7 @@ var downloadViewController = {
case "cmd_remove":
// XXX ensure selection isn't still in progress
// and how to handle multiple selection?
- return !isDownloading;
+ return selectionCount > 0 && !isDownloading;
case "cmd_selectAll":
return gDownloadView.view.rowCount != selectionCount;
default:
@@ -203,28 +204,33 @@ var downloadViewController = {
switch (aCommand) {
case "cmd_properties":
selectedItem = getSelectedItem();
- gDownloadManager.openProgressDialogFor(selectedItem.id, window);
+ if (selectedItem)
+ gDownloadManager.openProgressDialogFor(selectedItem.id, window);
break;
case "cmd_openfile":
selectedItem = getSelectedItem();
- file = getFileForItem(selectedItem);
- file.launch();
+ if (selectedItem) {
+ file = getFileForItem(selectedItem);
+ file.launch();
+ }
break;
case "cmd_showinshell":
selectedItem = getSelectedItem();
- file = getFileForItem(selectedItem);
-
- // on unix, open a browser window rooted at the parent
- if (navigator.platform.indexOf("Win") == -1 && navigator.platform.indexOf("Mac") == -1) {
- file = file.QueryInterface(Components.interfaces.nsIFile);
- var parent = file.parent;
- if (parent) {
- const browserURL = "chrome://navigator/content/navigator.xul";
- window.openDialog(browserURL, "_blank", "chrome,all,dialog=no", parent.path);
+ if (selectedItem) {
+ file = getFileForItem(selectedItem);
+
+ // on unix, open a browser window rooted at the parent
+ if (navigator.platform.indexOf("Win") == -1 && navigator.platform.indexOf("Mac") == -1) {
+ file = file.QueryInterface(Components.interfaces.nsIFile);
+ var parent = file.parent;
+ if (parent) {
+ const browserURL = "chrome://navigator/content/navigator.xul";
+ window.openDialog(browserURL, "_blank", "chrome,all,dialog=no", parent.path);
+ }
+ }
+ else {
+ file.reveal();
}
- }
- else {
- file.reveal();
}
break;
case "cmd_pause":
@@ -296,7 +302,9 @@ var downloadViewController = {
function getSelectedItem()
{
- return gDownloadView.contentView.getItemAtIndex(gDownloadView.currentIndex);
+ if (gDownloadView.currentIndex != -1)
+ return gDownloadView.contentView.getItemAtIndex(gDownloadView.currentIndex);
+ return null;
}
function getSelectedItems()
@@ -334,7 +342,7 @@ function createLocalFile(aFilePath)
return lf;
}
-function Shutdown()
+function DLManagerShutdown()
{
try {
var observerService = Components.classes[kObserverServiceProgID]
diff --git a/xpfe/components/download-manager/resources/downloadmanager.xul b/xpfe/components/download-manager/resources/downloadmanager.xul
index e012bfb37426..a4d2b3b890c3 100644
--- a/xpfe/components/download-manager/resources/downloadmanager.xul
+++ b/xpfe/components/download-manager/resources/downloadmanager.xul
@@ -27,9 +27,6 @@
-
-
-
%downloadManagerDTD;
@@ -44,8 +41,8 @@
width="500" height="300" screenX="10" screenY="10"
persist="width height screenX screenY"
title="&downloadManager.title;"
- onload="Startup();"
- onunload="Shutdown();">
+ onload="DLManagerStartup();"
+ onunload="DLManagerShutdown();">
diff --git a/xpfe/components/download-manager/resources/mac/contents.rdf b/xpfe/components/download-manager/resources/mac/contents.rdf
index 36f3db49a4cb..10cd60524fa0 100644
--- a/xpfe/components/download-manager/resources/mac/contents.rdf
+++ b/xpfe/components/download-manager/resources/mac/contents.rdf
@@ -21,7 +21,8 @@
- chrome://global/content/hiddenWindow.xul
+ chrome://communicator/content/downloadmanager/dlmanagermenuoverlay.xul
+ chrome://navigator/content/navigatorOverlay.xul
diff --git a/xpfe/components/download-manager/resources/mac/dlmanagermenuoverlay.xul b/xpfe/components/download-manager/resources/mac/dlmanagermenuoverlay.xul
new file mode 100644
index 000000000000..ed436280f7a2
--- /dev/null
+++ b/xpfe/components/download-manager/resources/mac/dlmanagermenuoverlay.xul
@@ -0,0 +1,57 @@
+
+
+
+
+
+
diff --git a/xpfe/components/download-manager/resources/unix/Makefile.in b/xpfe/components/download-manager/resources/unix/Makefile.in
new file mode 100644
index 000000000000..8b0eb3500952
--- /dev/null
+++ b/xpfe/components/download-manager/resources/unix/Makefile.in
@@ -0,0 +1,45 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 2002
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
diff --git a/xpfe/components/download-manager/resources/unix/contents.rdf b/xpfe/components/download-manager/resources/unix/contents.rdf
new file mode 100644
index 000000000000..164385fee26b
--- /dev/null
+++ b/xpfe/components/download-manager/resources/unix/contents.rdf
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ chrome://communicator/content/tasksOverlay.xul
+ chrome://communicator/content/utilityOverlay.xul
+
+
+
diff --git a/xpfe/components/download-manager/resources/unix/jar.mn b/xpfe/components/download-manager/resources/unix/jar.mn
new file mode 100644
index 000000000000..a94665a70372
--- /dev/null
+++ b/xpfe/components/download-manager/resources/unix/jar.mn
@@ -0,0 +1,3 @@
+comm.jar:
+ content/communicator/downloadmanager/contents.rdf (contents.rdf)
+
diff --git a/xpfe/components/download-manager/resources/win/Makefile.in b/xpfe/components/download-manager/resources/win/Makefile.in
new file mode 100644
index 000000000000..8b0eb3500952
--- /dev/null
+++ b/xpfe/components/download-manager/resources/win/Makefile.in
@@ -0,0 +1,45 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 2002
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
diff --git a/xpfe/components/download-manager/resources/win/contents.rdf b/xpfe/components/download-manager/resources/win/contents.rdf
new file mode 100644
index 000000000000..8937b113d72d
--- /dev/null
+++ b/xpfe/components/download-manager/resources/win/contents.rdf
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ chrome://communicator/content/tasksOverlay.xul
+ chrome://communicator/content/utilityOverlay.xul
+
+
+
diff --git a/xpfe/components/download-manager/resources/win/jar.mn b/xpfe/components/download-manager/resources/win/jar.mn
new file mode 100644
index 000000000000..a94665a70372
--- /dev/null
+++ b/xpfe/components/download-manager/resources/win/jar.mn
@@ -0,0 +1,3 @@
+comm.jar:
+ content/communicator/downloadmanager/contents.rdf (contents.rdf)
+
diff --git a/xpfe/components/download-manager/src/nsDownloadManager.cpp b/xpfe/components/download-manager/src/nsDownloadManager.cpp
index b92eefd09102..6b2926857d36 100644
--- a/xpfe/components/download-manager/src/nsDownloadManager.cpp
+++ b/xpfe/components/download-manager/src/nsDownloadManager.cpp
@@ -428,12 +428,14 @@ nsDownloadManager::AddDownload(nsIURI* aSource,
internalDownload->SetSource(aSource);
// the persistent descriptor of the target is the unique identifier we use
- nsCAutoString path;
- rv = aTarget->GetNativePath(path);
+ nsAutoString path;
+ rv = aTarget->GetPath(path);
if (NS_FAILED(rv)) return rv;
+ NS_ConvertUCS2toUTF8 utf8Path(path);
+
nsCOMPtr downloadRes;
- gRDFService->GetResource(path.get(), getter_AddRefs(downloadRes));
+ gRDFService->GetResource(utf8Path.get(), getter_AddRefs(downloadRes));
nsCOMPtr node;
@@ -471,7 +473,7 @@ nsDownloadManager::AddDownload(nsIURI* aSource,
// Assert file information
nsCOMPtr fileResource;
- gRDFService->GetResource(path.get(), getter_AddRefs(fileResource));
+ gRDFService->GetResource(utf8Path.get(), getter_AddRefs(fileResource));
rv = mDataSource->Assert(downloadRes, gNC_File, fileResource, PR_TRUE);
if (NS_FAILED(rv)) return rv;
@@ -505,7 +507,7 @@ nsDownloadManager::AddDownload(nsIURI* aSource,
aPersist->SetProgressListener(listener);
}
- nsCStringKey key(path);
+ nsCStringKey key(utf8Path);
if (mCurrDownloads.Exists(&key))
mCurrDownloads.Remove(&key);
@@ -835,17 +837,19 @@ nsDownloadManager::Observe(nsISupports* aSubject, const char* aTopic, const PRUn
nsCOMPtr target;
dialog->GetTarget(getter_AddRefs(target));
- nsCAutoString path;
- rv = target->GetNativePath(path);
+ nsAutoString path;
+ rv = target->GetPath(path);
if (NS_FAILED(rv)) return rv;
+
+ NS_ConvertUCS2toUTF8 utf8Path(path);
- nsCStringKey key(path);
+ nsCStringKey key(utf8Path);
if (mCurrDownloads.Exists(&key)) {
// unset dialog since it's closing
nsDownload* download = NS_STATIC_CAST(nsDownload*, mCurrDownloads.Get(&key));
download->SetDialog(nsnull);
- return CancelDownload(path.get());
+ return CancelDownload(utf8Path.get());
}
}
else if (nsCRT::strcmp(aTopic, "quit-application") == 0) {
@@ -890,11 +894,11 @@ nsDownload::nsDownload():mDownloadState(NOTSTARTED),
nsDownload::~nsDownload()
{
- nsCAutoString path;
- nsresult rv = mTarget->GetNativePath(path);
+ nsAutoString path;
+ nsresult rv = mTarget->GetPath(path);
if (NS_FAILED(rv)) return;
- mDownloadManager->AssertProgressInfoFor(path.get());
+ mDownloadManager->AssertProgressInfoFor(NS_ConvertUCS2toUTF8(path).get());
}
nsresult
@@ -1016,12 +1020,12 @@ nsDownload::OnProgressChange(nsIWebProgress *aWebProgress,
mLastUpdate = now;
if (mDownloadState == NOTSTARTED) {
- nsCAutoString path;
- nsresult rv = mTarget->GetNativePath(path);
+ nsAutoString path;
+ nsresult rv = mTarget->GetPath(path);
if (NS_FAILED(rv)) return rv;
mDownloadState = DOWNLOADING;
- mDownloadManager->DownloadStarted(path.get());
+ mDownloadManager->DownloadStarted(NS_ConvertUCS2toUTF8(path).get());
}
if (aMaxTotalProgress > 0)
@@ -1081,10 +1085,10 @@ nsDownload::OnStatusChange(nsIWebProgress *aWebProgress,
{
if (NS_FAILED(aStatus)) {
mDownloadState = FAILED;
- nsCAutoString path;
- nsresult rv = mTarget->GetNativePath(path);
+ nsAutoString path;
+ nsresult rv = mTarget->GetPath(path);
if (NS_SUCCEEDED(rv))
- mDownloadManager->DownloadEnded(path.get(), aMessage);
+ mDownloadManager->DownloadEnded(NS_ConvertUCS2toUTF8(path).get(), aMessage);
}
if (mListener)
@@ -1158,11 +1162,11 @@ nsDownload::OnStateChange(nsIWebProgress* aWebProgress,
mCurrBytes = mMaxBytes;
mPercentComplete = 100;
- nsCAutoString path;
- nsresult rv = mTarget->GetNativePath(path);
+ nsAutoString path;
+ nsresult rv = mTarget->GetPath(path);
if (NS_FAILED(rv)) return rv;
- mDownloadManager->DownloadEnded(path.get(), nsnull);
+ mDownloadManager->DownloadEnded(NS_ConvertUCS2toUTF8(path).get(), nsnull);
}
// break the cycle we created in AddDownload
@@ -1218,11 +1222,11 @@ nsDownload::SetDisplayName(const PRUnichar* aDisplayName)
nsCOMPtr nameLiteral;
nsCOMPtr res;
- nsCAutoString path;
- nsresult rv = mTarget->GetNativePath(path);
+ nsAutoString path;
+ nsresult rv = mTarget->GetPath(path);
if (NS_FAILED(rv)) return rv;
- gRDFService->GetResource(path.get(), getter_AddRefs(res));
+ gRDFService->GetResource(NS_ConvertUCS2toUTF8(path).get(), getter_AddRefs(res));
gRDFService->GetLiteral(aDisplayName, getter_AddRefs(nameLiteral));
ds->Assert(res, gNC_Name, nameLiteral, PR_TRUE);
diff --git a/xpfe/components/download-manager/src/nsDownloadProgressListener.js b/xpfe/components/download-manager/src/nsDownloadProgressListener.js
index 271ed1679249..211924fd2758 100644
--- a/xpfe/components/download-manager/src/nsDownloadProgressListener.js
+++ b/xpfe/components/download-manager/src/nsDownloadProgressListener.js
@@ -59,7 +59,7 @@ nsDownloadProgressListener.prototype = {
{
if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP)
{
- var aDownloadID = aDownload.target.persistentDescriptor;
+ var aDownloadID = aDownload.target.path;
var elt = this.doc.getElementById(aDownloadID).firstChild.firstChild;
var timeRemainingCol = elt.nextSibling.nextSibling.nextSibling;
@@ -95,7 +95,7 @@ nsDownloadProgressListener.prototype = {
else
rate = 0;
- var aDownloadID = aDownload.target.persistentDescriptor;
+ var aDownloadID = aDownload.target.path
var elt = this.doc.getElementById(aDownloadID).firstChild.firstChild;
if (this.doc.getElementById("TimeElapsed").getAttribute("hidden") != "true") {
elapsedCol = elt.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling;