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();">