Bug 392529 - delete key doesn't delete selected mail filter(s); TB part v3; r=bienvenu
authorJens Hatlak <jh@junetz.de>
Mon, 02 Feb 2009 00:44:34 +0100
changeset 1823 c215a361c0dfbf6d69f22da98b539c7ea81fc3e0
parent 1822 15c15e191d5852a5ae9f64ca1e60f9c48eb81f54
child 1824 b7615869fd7b419fc2720ae0077e232340a0a839
push idunknown
push userunknown
push dateunknown
reviewersbienvenu
bugs392529
Bug 392529 - delete key doesn't delete selected mail filter(s); TB part v3; r=bienvenu
mail/base/content/FilterListDialog.js
--- a/mail/base/content/FilterListDialog.js
+++ b/mail/base/content/FilterListDialog.js
@@ -534,23 +534,34 @@ function onFilterDoubleClick(event)
     if (event.button != 0)
       return;
 
     onEditFilter();
 }
 
 function onFilterListKeyPress(event)
 {
-  // for now, only do something on space key
-  if (event.charCode != KeyEvent.DOM_VK_SPACE)
-    return;
-
-  var list = document.getElementById("filterList")
-  for each (var item in list.selectedItems)
-    toggleFilter(item, list.getIndexOfItem(item));
+  if (event.charCode == KeyEvent.DOM_VK_SPACE)
+  {
+    let list = document.getElementById("filterList");
+    for each (var item in list.selectedItems)
+      toggleFilter(item, list.getIndexOfItem(item));
+  }
+  else switch (event.keyCode)
+  {
+    case KeyEvent.DOM_VK_DELETE:
+      if (!document.getElementById("deleteButton").disabled)
+        onDeleteFilter();
+      break;
+    case KeyEvent.DOM_VK_ENTER:
+    case KeyEvent.DOM_VK_RETURN:
+      if (!document.getElementById("editButton").disabled)
+        onEditFilter();
+      break;
+  }
 }
 
 function onTargetSelect(event) {
   var menu = document.getElementById("runFiltersFolder");
   menu._folder = event.target._folder;
   menu.setAttribute("label", event.target._folder.prettyName);
 }