Bug 391863 - "clean up" functionality missing from download manager. r=sdwilsh, b-ff3=beltzner, a1.9=mconnor, aM9=mconnor

This commit is contained in:
edward.lee@engineering.uiuc.edu 2007-10-27 13:42:48 -07:00
parent edf9e625de
commit f26d95fd12
3 changed files with 26 additions and 10 deletions

View File

@ -40,9 +40,9 @@
<!ENTITY cmd.close.commandKey "w">
<!ENTITY cmd.close2.commandKey "j">
<!ENTITY cmd.close2Unix.commandKey "y">
<!ENTITY cmd.cleanUp.label "Clean Up">
<!ENTITY cmd.cleanUp.tooltip "Removes completed, canceled, and failed downloads from the list">
<!ENTITY cmd.cleanUp.accesskey "C">
<!ENTITY cmd.clearList.label "Clear List">
<!ENTITY cmd.clearList.tooltip "Removes completed, canceled, and failed downloads from the list">
<!ENTITY cmd.clearList.accesskey "C">
<!ENTITY closeWhenDone.label "Close when downloads complete">
<!ENTITY closeWhenDone.tooltip "Closes the Downloads window when all files are done downloading">

View File

@ -508,14 +508,14 @@ var gContextMenus = [
["menuitem_pause", "menuitem_cancel", "menuseparator_copy_location",
"menuitem_copyLocation"],
// DOWNLOAD_FINISHED
["menuitem_open", "menuitem_show", "menuitem_remove",
["menuitem_open", "menuitem_show", "menuitem_remove", "menuitem_clearList",
"menuseparator_copy_location", "menuitem_copyLocation"],
// DOWNLOAD_FAILED
["menuitem_retry", "menuitem_remove", "menuseparator_copy_location",
"menuitem_copyLocation"],
["menuitem_retry", "menuitem_remove", "menuitem_clearList",
"menuseparator_copy_location", "menuitem_copyLocation"],
// DOWNLOAD_CANCELED
["menuitem_retry", "menuitem_remove", "menuseparator_copy_location",
"menuitem_copyLocation"],
["menuitem_retry", "menuitem_remove", "menuitem_clearList",
"menuseparator_copy_location", "menuitem_copyLocation"],
// DOWNLOAD_PAUSED
["menuitem_resume", "menuitem_cancel", "menuseparator_copy_location",
"menuitem_copyLocation"],
@ -523,8 +523,8 @@ var gContextMenus = [
["menuitem_cancel", "menuseparator_copy_location",
"menuitem_copyLocation"],
// DOWNLOAD_BLOCKED
["menuitem_retry", "menuitem_remove", "menuseparator_copy_location",
"menuitem_copyLocation"],
["menuitem_retry", "menuitem_remove", "menuitem_clearList",
"menuseparator_copy_location", "menuitem_copyLocation"],
// DOWNLOAD_SCANNING
["menuitem_copyLocation"]
];
@ -600,6 +600,12 @@ var gDownloadViewController = {
if (!window.gDownloadsView)
return false;
// This switch statement is for commands that do not need a download object
switch (aCommand) {
case "cmd_clearList":
return gDownloadManager.canCleanUp;
}
var dl = gDownloadsView.selectedItem;
if (!dl)
return false;
@ -685,6 +691,9 @@ var gDownloadViewController = {
},
cmd_copyLocation: function(aSelectedItem) {
copySourceLocation(aSelectedItem);
},
cmd_clearList: function() {
gDownloadManager.cleanUp();
}
}
};

View File

@ -100,6 +100,8 @@
oncommand="gDownloadViewController.doCommand('cmd_showInfo');"/>
<command id="cmd_copyLocation"
oncommand="gDownloadViewController.doCommand('cmd_copyLocation');"/>
<command id="cmd_clearList"
oncommand="gDownloadViewController.doCommand('cmd_clearList');"/>
</commandset>
<keyset id="downloadKeys">
@ -156,6 +158,11 @@
label="&cmd.copyLocation.label;"
accesskey="&cmd.copyLocation.accesskey;"
command="cmd_copyLocation"/>
<menuitem id="menuitem_clearList"
label="&cmd.clearList.label;"
accesskey="&cmd.clearList.accesskey;"
command="cmd_clearList"/>
</vbox>
<menupopup id="downloadContextMenu" onpopupshowing="return buildContextMenu(event);"/>