Bug 799451 - Can't remove attachment with keyboard in forwarded e-mail. r=squib,a=Standard8
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Mon, 10 Dec 2012 21:43:32 +0200
changeset 13610 bb0e6b6c5db88579d59bfd891dd682dcb0fc0da2
parent 13609 9d685c35a83982adfe96f8c74f32fb7db6dc5c35
child 13611 b72e2bda999c7f8fcd69456469289ef1e4ce0274
push id30
push userbugzilla@standard8.plus.com
push dateFri, 08 Feb 2013 19:06:23 +0000
reviewerssquib, Standard8
bugs799451
Bug 799451 - Can't remove attachment with keyboard in forwarded e-mail. r=squib,a=Standard8 What seems to happen is: cmd_delete is one of the commands that is updated when focus changes. When entering the attachments area using keyboard (Alt+M) the attachmentBucket gets focus, -> command updating, but at that point there's no selection so cmd_delete is disabled. When an item gets selected that doesn't cause the commands to get updated, so cmd_deleted is always disabled.
mail/components/compose/content/MsgComposeCommands.js
mail/components/compose/content/messengercompose.xul
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -3643,17 +3643,17 @@ function AddFileAttachment(file)
 function AddUrlAttachment(attachment)
 {
   AddAttachments([attachment]);
 }
 
 function MessageGetNumSelectedAttachments()
 {
   var bucketList = document.getElementById("attachmentBucket");
-  return (bucketList) ? bucketList.selectedItems.length : 0;
+  return (bucketList) ? bucketList.selectedCount : 0;
 }
 
 function AttachPage()
 {
    if (gPromptService)
    {
       var result = {value:"http://"};
       if (gPromptService.prompt(window,
@@ -4167,17 +4167,17 @@ function subjectKeyPress(event)
 {
   if (event.keyCode == KeyEvent.DOM_VK_RETURN)
     SetMsgBodyFrameFocus();
 }
 
 function AttachmentBucketClicked(event)
 {
   let boundTarget = document.getBindingParent(event.originalTarget);
-  if (event.button == 0 && boundTarget.localName == "scrollbox")
+  if (event.button == 0 && boundTarget && boundTarget.localName == "scrollbox")
     goDoCommand('cmd_attachFile');
 }
 
 // we can drag and drop addresses, files, messages and urls into the compose envelope
 var envelopeDragObserver = {
 
   canHandleMultipleItems: true,
 
--- a/mail/components/compose/content/messengercompose.xul
+++ b/mail/components/compose/content/messengercompose.xul
@@ -801,16 +801,17 @@
                    crop="right" accesskey="&attachments.accesskey;" flex="1"/>
             <label id="attachmentBucketSize"/>
           </hbox>
           <attachmentlist orient="vertical" id="attachmentBucket"
                           seltype="multiple" flex="1" height="0"
                           context="msgComposeAttachmentListContext"
                           itemcontext="msgComposeAttachmentItemContext"
                           onclick="AttachmentBucketClicked(event);"
+                          onselect="updateAttachmentItems();"
                           ondraggesture="nsDragAndDrop.startDrag(event, attachmentBucketDNDObserver);"/>
         </vbox>
       </hbox>
     </toolbar>
   </toolbox>
 
   <splitter id="compose-toolbar-sizer" onmousedown="awSizerListen()"/>