From f0badddaf18ade0f319c5c2561f07ac35c763da9 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 31 Aug 2006 21:18:41 +0000 Subject: [PATCH] Added support for deleting with forward-delete key, which may have worked before the treeviews were moved into XPCOM but didn't anymore --- chrome/chromeFiles/content/scholar/overlay.xul | 5 +++-- .../chromeFiles/content/scholar/xpcom/collectionTreeView.js | 5 ----- chrome/chromeFiles/content/scholar/xpcom/itemTreeView.js | 6 ++---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul index 4013d16d3..aa280c41b 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -75,7 +75,7 @@ onselect="ScholarPane.onCollectionSelected();" seltype="single" ondragdrop="nsDragAndDrop.drop(event,ScholarPane.getCollectionsView())" ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ScholarPane.getCollectionsView());" - onkeypress="if(event.keyCode == event.DOM_VK_BACK_SPACE){ ScholarPane.deleteSelectedCollection(); return false; }" + onkeypress="if (event.keyCode == event.DOM_VK_BACK_SPACE || event.keyCode == event.DOM_VK_DELETE){ ScholarPane.deleteSelectedCollection(); return false; }" flex="1"> 0); } Scholar.CollectionTreeCommandController.prototype.doCommand = function(cmd) { - if(cmd == 'cmd_delete') - ScholarPane.deleteSelectedCollection(); } Scholar.CollectionTreeCommandController.prototype.onEvent = function(evt) { - } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/chromeFiles/content/scholar/xpcom/itemTreeView.js b/chrome/chromeFiles/content/scholar/xpcom/itemTreeView.js index 5954234ae..ac934bfba 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/itemTreeView.js +++ b/chrome/chromeFiles/content/scholar/xpcom/itemTreeView.js @@ -634,20 +634,18 @@ Scholar.ItemTreeCommandController = function(tree) Scholar.ItemTreeCommandController.prototype.supportsCommand = function(cmd) { - return (cmd == 'cmd_selectAll' || cmd == 'cmd_delete'); + return (cmd == 'cmd_selectAll'); } Scholar.ItemTreeCommandController.prototype.isCommandEnabled = function(cmd) { - return (cmd == 'cmd_selectAll' || (cmd == 'cmd_delete' && this.tree.view.selection.count > 0)); + return (cmd == 'cmd_selectAll'); } Scholar.ItemTreeCommandController.prototype.doCommand = function(cmd) { if(cmd == 'cmd_selectAll') this.tree.view.selection.selectAll(); - else if(cmd == 'cmd_delete') - ScholarPane.deleteSelectedItem(); } Scholar.ItemTreeCommandController.prototype.onEvent = function(evt)