Bug 366479 - [mac] Copy command is broken in the JS console. r=gavin,neil. sr=neil.

This commit is contained in:
mozilla.mano@sent.com 2007-03-22 16:28:22 -07:00
parent b911c22408
commit 8d501d16ab
3 changed files with 39 additions and 29 deletions

View File

@ -97,21 +97,6 @@ function updateModeCommand(aMode)
bc.setAttribute("checked", true);
}
function copyItemToClipboard()
{
gConsole.copySelectedItem();
}
function isItemSelected()
{
return gConsole.selectedItem != null;
}
function updateCopyMenu()
{
goSetCommandEnabled("cmd_copy", isItemSelected())
}
function onEvalKeyPress(aEvent)
{
if (aEvent.keyCode == 13)

View File

@ -41,6 +41,7 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/console/console.css" type="text/css"?>
<?xml-stylesheet href="chrome://global/content/console.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<!DOCTYPE window [
<!ENTITY % console SYSTEM "chrome://global/locale/console.dtd"> %console;
@ -60,11 +61,9 @@
<stringbundle id="ConsoleBundle" src="chrome://global/locale/console.properties"/>
<commandset id="consoleCommands"
commandupdater="true"
events="select"
oncommandupdate="updateCopyMenu()">
<command id="cmd_copy" oncommand="copyItemToClipboard()"/>
<commandset id="editMenuCommands"/>
<commandset id="consoleCommands">
<command id="cmd_close" oncommand="closeWindow(true)"/>
</commandset>
@ -94,8 +93,6 @@
</broadcasterset>
<keyset id="consoleKeys">
<key id="key_copy" key="&copyCmd.commandkey;" modifiers="accel"
command="cmd_copy"/>
<key id="key_close" key="&closeCmd.commandkey;" modifiers="accel"
command="cmd_close"/>
<key keycode="VK_ESCAPE" command="cmd_close"/>
@ -110,7 +107,7 @@
<menuitem type="radio" observes="Console:sortAscend"/>
<menuitem type="radio" observes="Console:sortDescend"/>
<menuseparator/>
<menuitem id="menu_copy_cm" observes="cmd_copy" label="&copyCmd.label;" key="key_copy" accesskey="&copyCmd.accesskey;"/>
<menuitem id="menu_copy_cm" command="cmd_copy" label="&copyCmd.label;" accesskey="&copyCmd.accesskey;"/>
</popup>
</popupset>
@ -135,5 +132,3 @@
<iframe name="Evaluator" id="Evaluator" collapsed="true" src="chrome://global/content/blank.html"/>
</window>

View File

@ -63,6 +63,9 @@
this.mSelectedItem = val;
val.setAttribute("selected", "true");
// Update edit commands
window.updateCommands("focus");
]]></setter>
</property>
@ -92,15 +95,16 @@
this.mMode = this.getAttribute("mode") || "All";
this.appendInitialItems();
window.controllers.insertControllerAt(0, this._controller);
]]></body>
</method>
<method name="destroy">
<body><![CDATA[
this.mCService.unregisterListener(this.mConsoleListener);
]]></body>
</method>
<method name="appendInitialItems">
<body><![CDATA[
var out = {}; // Throwaway references to support 'out' parameters.
@ -278,6 +282,33 @@
<constructor> this.init(); </constructor>
<destructor> this.destroy(); </destructor>
<!-- Command controller for the copy command -->
<field name="_controller"><![CDATA[({
_outer: this,
QueryInterface: function(aIID) {
if (aIID.equals(Components.interfaces.nsIController) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
supportsCommand: function(aCommand) {
return aCommand == "cmd_copy";
},
isCommandEnabled: function(aCommand) {
return aCommand == "cmd_copy" && this._outer.selectedItem;
},
doCommand: function(aCommand) {
if (aCommand == "cmd_copy")
this._outer.copySelectedItem();
},
onEvent: function() { }
});]]></field>
</implementation>
<handlers>
@ -351,9 +382,8 @@
return msg;
]]></body>
</method>
</implementation>
</binding>
<binding id="message" extends="xul:box">