Bug 392529 - delete key doesn't delete selected mail filter(s); SM part v2; r=mnyromyr sr=neil
authorJens Hatlak <jh@junetz.de>
Mon, 02 Feb 2009 00:44:33 +0100
changeset 1822 15c15e191d5852a5ae9f64ca1e60f9c48eb81f54
parent 1821 1fb281cf8e06721de19ca622e7e327e7dc5c0dc4
child 1823 c215a361c0dfbf6d69f22da98b539c7ea81fc3e0
push idunknown
push userunknown
push dateunknown
reviewersmnyromyr, neil
bugs392529
Bug 392529 - delete key doesn't delete selected mail filter(s); SM part v2; r=mnyromyr sr=neil
mailnews/base/search/resources/content/FilterListDialog.js
--- a/mailnews/base/search/resources/content/FilterListDialog.js
+++ b/mailnews/base/search/resources/content/FilterListDialog.js
@@ -632,29 +632,40 @@ function onFilterDoubleClick(event)
     // if the cell is in a "cycler" column (the enabled column)
     // don't open the edit filter dialog with the selected filter
     if (!col.value.cycler)
       onEditFilter();
 }
 
 function onFilterTreeKeyPress(event)
 {
-  // for now, only do something on space key
-  if (event.keyCode != KeyEvent.DOM_VK_SPACE)
-    return;
-
-  var rangeCount = gFilterTree.view.selection.getRangeCount();
-  for (var i = 0; i < rangeCount; ++i) {
-    var start = {}, end = {};
-    gFilterTree.view.selection.getRangeAt(i, start, end);
-    for (var k = start.value; k <= end.value; ++k) {
-      toggleFilter(k);
+  if (event.charCode == KeyEvent.DOM_VK_SPACE)
+  {
+    var rangeCount = gFilterTree.view.selection.getRangeCount();
+    for (var i = 0; i < rangeCount; ++i)
+    {
+      var start = {}, end = {};
+      gFilterTree.view.selection.getRangeAt(i, start, end);
+      for (var k = start.value; k <= end.value; ++k)
+        toggleFilter(k);
     }
+    gFilterTree.view.selection.invalidateSelection();
   }
-  gFilterTree.view.selection.invalidateSelection();
+  else switch (event.keyCode)
+  {
+    case KeyEvent.DOM_VK_DELETE:
+      if (!gDeleteButton.disabled)
+        onDeleteFilter();
+      break;
+    case KeyEvent.DOM_VK_ENTER:
+    case KeyEvent.DOM_VK_RETURN:
+      if (!gEditButton.disabled)
+        onEditFilter();
+      break;
+  }
 }
 
 function doHelpButton()
 {
   openHelp("mail-filters");
 }
 
 /**