зеркало из https://github.com/mozilla/pjs.git
Bug 303194: Pressing Delete key in Extension Manager should uninstall
extension. p=Simon Bunzli <zeniko@gmail.com> r=robstrong
This commit is contained in:
Родитель
186ae29d24
Коммит
f8e9781f89
|
@ -629,19 +629,47 @@ var gDownloadDNDObserver =
|
|||
var gDownloadViewController = {
|
||||
supportsCommand: function (aCommand)
|
||||
{
|
||||
return aCommand == "cmd_cleanUp";
|
||||
var commandNode = document.getElementById(aCommand);
|
||||
return commandNode && commandNode.parentNode == document.getElementById("downloadsCommands");
|
||||
},
|
||||
|
||||
isCommandEnabled: function (aCommand)
|
||||
{
|
||||
if (aCommand == "cmd_cleanUp")
|
||||
if (!window.gDownloadsView)
|
||||
return false;
|
||||
|
||||
switch (aCommand) {
|
||||
case "cmd_cleanup":
|
||||
return gDownloadManager.canCleanUp;
|
||||
case "cmd_remove":
|
||||
return gDownloadsView.selectedItem != null;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
doCommand: function (aCommand)
|
||||
{
|
||||
if (aCommand == "cmd_cleanUp" && this.isCommandEnabled(aCommand)) {
|
||||
if (this.isCommandEnabled(aCommand))
|
||||
this.commands[aCommand](gDownloadsView.selectedItem);
|
||||
},
|
||||
|
||||
onCommandUpdate: function ()
|
||||
{
|
||||
var downloadsCommands = document.getElementById("downloadsCommands");
|
||||
for (var i = 0; i < downloadsCommands.childNodes.length; ++i)
|
||||
this.updateCommand(downloadsCommands.childNodes[i]);
|
||||
},
|
||||
|
||||
updateCommand: function (command)
|
||||
{
|
||||
if (this.isCommandEnabled(command.id))
|
||||
command.removeAttribute("disabled");
|
||||
else
|
||||
command.setAttribute("disabled", "true");
|
||||
},
|
||||
|
||||
commands: {
|
||||
cmd_cleanup: function() {
|
||||
gDownloadManager.cleanUp();
|
||||
|
||||
// Update UI
|
||||
|
@ -655,15 +683,12 @@ var gDownloadViewController = {
|
|||
gDownloadsView.removeChild(gDownloadsView.children[i]);
|
||||
}
|
||||
|
||||
this.onCommandUpdate();
|
||||
gDownloadViewController.onCommandUpdate();
|
||||
},
|
||||
|
||||
cmd_remove: function(aSelectedItem) {
|
||||
fireEventForElement(aSelectedItem, 'remove');
|
||||
}
|
||||
},
|
||||
|
||||
onCommandUpdate: function ()
|
||||
{
|
||||
var command = "cmd_cleanUp";
|
||||
var enabled = this.isCommandEnabled(command);
|
||||
goSetCommandEnabled(command, enabled);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -78,10 +78,12 @@
|
|||
commandupdater="true"
|
||||
oncommandupdate="gDownloadViewController.onCommandUpdate();">
|
||||
<command id="cmd_cleanUp" oncommand="gDownloadViewController.doCommand('cmd_cleanUp');"/>
|
||||
<command id="cmd_remove" oncommand="gDownloadViewController.doCommand('cmd_remove');"/>
|
||||
</commandset>
|
||||
|
||||
<keyset id="downloadKeys">
|
||||
<key id="key_cleanUp" keycode="VK_DELETE" command="cmd_cleanUp" modifiers="accel,shift"/>
|
||||
<key id="key_remove" keycode="VK_DELETE" command="cmd_remove"/>
|
||||
<key id="key_close" key="&cmd.close.commandKey;" oncommand="closeWindow(true);" modifiers="accel"/>
|
||||
#ifdef XP_GNOME
|
||||
<key id="key_close2" key="&cmd.close2Unix.commandKey;" oncommand="closeWindow(true);" modifiers="accel"/>
|
||||
|
|
|
@ -79,6 +79,8 @@
|
|||
oncommand="gExtensionsViewController.doCommand('cmd_about');"/>
|
||||
<key id="key_options" key="&cmd.options.commandKey;" modifiers="accel" command="cmd_options"
|
||||
oncommand="gExtensionsViewController.doCommand('cmd_options');"/>
|
||||
<key id="key_uninstall" keycode="VK_DELETE" command="cmd_uninstall"
|
||||
oncommand="gExtensionsViewController.doCommand('cmd_uninstall');"/>
|
||||
</keyset>
|
||||
|
||||
<commandset id="extensionsCommands"
|
||||
|
|
Загрузка…
Ссылка в новой задаче