Bug 477448 - Give some hardcoded key values in compose some DOM_VK_ lovin', r=Standard8, sr=neil
authorPhil Ringnalda <philringnalda@gmail.com>
Sat, 28 Feb 2009 19:07:57 -0800
changeset 2103 15bab19fc0f89bc82f1ed772a59a944d35d36366
parent 2102 7ce2cdb1e8852785ef2a64c528f34467d9bce29c
child 2104 1fae3f7dd9f268e87adc3971c58701ebd6256aa8
push idunknown
push userunknown
push dateunknown
reviewersStandard8, neil
bugs477448
Bug 477448 - Give some hardcoded key values in compose some DOM_VK_ lovin', r=Standard8, sr=neil
mail/components/compose/content/MsgComposeCommands.js
mail/components/compose/content/addressingWidgetOverlay.js
mailnews/compose/resources/content/MsgComposeCommands.js
mailnews/compose/resources/content/addressingWidgetOverlay.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -3077,23 +3077,23 @@ function setupAutocomplete()
           // fails, the entire compose window doesn't end up horked
       }
   }
 }
 
 function subjectKeyPress(event)
 {  
   switch(event.keyCode) {
-  case 9:
+  case KeyEvent.DOM_VK_TAB:
     if (!event.shiftKey) {
       SetMsgBodyFrameFocus();
       event.preventDefault();
     }
     break;
-  case 13:
+  case KeyEvent.DOM_VK_RETURN:
     SetMsgBodyFrameFocus();
     break;
   }
 }
 
 function AttachmentBucketClicked(event)
 {
   event.currentTarget.focus();
--- a/mail/components/compose/content/addressingWidgetOverlay.js
+++ b/mail/components/compose/content/addressingWidgetOverlay.js
@@ -892,52 +892,52 @@ function awArrowHit(inputElement, direct
     else if (inputElement.value)
       awAppendNewRow(true);
   }
 }
 
 function awRecipientKeyDown(event, element)
 {
   switch(event.keyCode) {
-  case 46:
-  case 8:
+  case KeyEvent.DOM_VK_DELETE:
+  case KeyEvent.DOM_VK_BACK_SPACE:
     /* do not query directly the value of the text field else the autocomplete widget could potentially
        alter it value while doing some internal cleanup, instead, query the value through the first child
     */
     if (!element.value)
       awDeleteHit(element);
 
     // We need to stop the event else the listbox will receive it and the
     // function awKeyDown will be executed!
     event.stopPropagation();
     break;
   }
 }
 
 function awKeyDown(event, listboxElement)
 {
   switch(event.keyCode) {
-  case 46:
-  case 8:
+  case KeyEvent.DOM_VK_DELETE:
+  case KeyEvent.DOM_VK_BACK_SPACE:
     /* Warning, the listboxElement.selectedItems will change everytime we delete a row */
     var selItems = listboxElement.selectedItems;
     var length = listboxElement.selectedItems.length;
     for (var i = 1; i <= length; i++) {
       var inputs = listboxElement.selectedItems[0].getElementsByTagName(awInputElementName());
       if (inputs && inputs.length == 1)
         awDeleteHit(inputs[0]);
     }
     break;
   }
 }
 
 function awMenulistKeyPress(event, element)
 {
   switch(event.keyCode) {
-  case 9:
+  case KeyEvent.DOM_VK_TAB:
     awTabFromMenulist(element, event);
     break;
   }
 }
 
 /* ::::::::::: addressing widget dummy rows ::::::::::::::::: */
 
 var gAWContentHeight = 0;
--- a/mailnews/compose/resources/content/MsgComposeCommands.js
+++ b/mailnews/compose/resources/content/MsgComposeCommands.js
@@ -2978,23 +2978,23 @@ function setupAutocomplete()
           // fails, the entire compose window doesn't end up horked
       }
   }
 }
 
 function subjectKeyPress(event)
 {
   switch(event.keyCode) {
-  case 9:
+  case KeyEvent.DOM_VK_TAB:
     if (!event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey) {
       SetMsgBodyFrameFocus();
       event.preventDefault();
     }
     break;
-  case 13:
+  case KeyEvent.DOM_VK_RETURN:
     SetMsgBodyFrameFocus();
     break;
   }
 }
 
 function AttachmentBucketClicked(event)
 {
   event.currentTarget.focus();
--- a/mailnews/compose/resources/content/addressingWidgetOverlay.js
+++ b/mailnews/compose/resources/content/addressingWidgetOverlay.js
@@ -881,52 +881,52 @@ function awArrowHit(inputElement, direct
     else if (inputElement.value)
       awAppendNewRow(true);
   }
 }
 
 function awRecipientKeyDown(event, element)
 {
   switch(event.keyCode) {
-  case 46:
-  case 8:
+  case KeyEvent.DOM_VK_DELETE:
+  case KeyEvent.DOM_VK_BACK_SPACE:
     /* do not query directly the value of the text field else the autocomplete widget could potentially
        alter it value while doing some internal cleanup, instead, query the value through the first child
     */
     if (!element.value)
       awDeleteHit(element);
 
     //We need to stop the event else the listbox will receive it and the function
     //awKeyDown will be executed!
     event.stopPropagation();
     break;
   }
 }
 
 function awKeyDown(event, listboxElement)
 {
   switch(event.keyCode) {
-  case 46:
-  case 8:
+  case KeyEvent.DOM_VK_DELETE:
+  case KeyEvent.DOM_VK_BACK_SPACE:
     /* Warning, the listboxElement.selectedItems will change everytime we delete a row */
     var selItems = listboxElement.selectedItems;
     var length = listboxElement.selectedItems.length;
     for (var i = 1; i <= length; i++) {
       var inputs = listboxElement.selectedItems[0].getElementsByTagName(awInputElementName());
       if (inputs && inputs.length == 1)
         awDeleteHit(inputs[0]);
     }
     break;
   }
 }
 
 function awMenulistKeyPress(event, element)
 {
   switch(event.keyCode) {
-  case 9:
+  case KeyEvent.DOM_VK_TAB:
     awTabFromMenulist(element, event);
     break;
   }
 }
 
 /* ::::::::::: addressing widget dummy rows ::::::::::::::::: */
 
 var gAWContentHeight = 0;