Bug 1461170 - Add attachment list context menu to composition's attachment pane header (attachment count/size); fixes bug 707432. r=aceman, ui-r=Paenglab a=jorgk
authorThomas Duellmann <bugzilla2007@duellmann24.net>
Sat, 26 May 2018 08:23:00 +0200
changeset 31573 09c1b1a693dc50ecf1d0270a8c9e86ffc4cb177a
parent 31572 c0336f118462692b6f05be55c136dc737e82f4bc
child 31574 09fc557ba799a589966040fc609562607db1228c
push id21
push usermozilla@hocat.ca
push dateFri, 13 Jul 2018 19:54:19 +0000
treeherdercomm-esr60@3c593339cb1d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman, Paenglab, jorgk
bugs1461170, 707432
Bug 1461170 - Add attachment list context menu to composition's attachment pane header (attachment count/size); fixes bug 707432. r=aceman, ui-r=Paenglab a=jorgk
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
@@ -5422,17 +5422,16 @@ function attachmentBucketOnClick(aEvent)
   }
 }
 
 function attachmentBucketOnSelect() {
   attachmentBucketUpdateTooltips();
   updateAttachmentItems();
 }
 
-
 function attachmentBucketUpdateTooltips() {
   let bucket = GetMsgAttachmentElement();
   let bucketHeader = document.getElementById("attachments-header-box");
 
   // Attachment pane whitespace tooltip
   if (attachmentsSelectedCount() > 0) {
     bucket.tooltipText=
       getComposeBundle().getString("attachmentBucketClearSelectionTooltip");
@@ -5441,16 +5440,20 @@ function attachmentBucketUpdateTooltips(
       getComposeBundle().getString("attachmentBucketAttachFilesTooltip");
   }
 }
 
 function attachmentBucketHeaderOnClick() {
   toggleAttachmentPane("focus");
 }
 
+function attachmentBucketCloseButtonOnCommand() {
+  toggleAttachmentPane("hide");
+}
+
 function attachmentBucketSizerOnMouseUp() {
   updateViewItems();
   if (document.getElementById("attachments-box").collapsed) {
     // If user collapsed the attachment pane, move focus to message body.
     SetMsgBodyFrameFocus();
   }
 }
 
@@ -6435,16 +6438,20 @@ function SwitchElementFocus(event)
         break;
       default: // gMsgIdentityElement
         SetMsgAddressingWidgetTreeElementFocus();
         break;
     }
   }
 }
 
+function sidebarCloseButtonOnCommand() {
+  toggleAddressPicker();
+}
+
 function toggleAddressPicker()
 {
   // Caveat: This function erroneously assumes that only abContactsPanel can
   // be shown in the sidebar browser, so it will fail if any other src is shown
   // as we do not reliably enforce abContactsPanel.xul as src of the sidebar
   // <browser>. Currently we don't show anything else in the sidebar, but
   // add-ons might.
   let sidebarBox = document.getElementById("sidebar-box");
--- a/mail/components/compose/content/messengercompose.xul
+++ b/mail/components/compose/content/messengercompose.xul
@@ -1130,17 +1130,19 @@
   <toolbarset id="customToolbars" context="toolbar-context-menu"/>
 </toolbox>
 
   <hbox flex="1" id="composeContentBox">
     <vbox id="sidebar-box" persist="sidebarVisible width" hidden="true">
       <sidebarheader id="sidebarHeader" align="center">
         <label id="sidebar-title" value="&addressesSidebarTitle.label;"/>
         <spacer flex="1"/>
-        <toolbarbutton class="ab-closebutton close-icon" oncommand="toggleAddressPicker();"/>
+        <toolbarbutton id="sidebarCloseButton"
+                       class="ab-closebutton close-icon"
+                       oncommand="sidebarCloseButtonOnCommand();"/>
       </sidebarheader>
       <browser id="sidebar" flex="1" src="" disablehistory="true"
                style="min-width: 150px; width: 200px; max-width: 400px;"/>
     </vbox>
 
     <splitter id="sidebar-splitter" hidden="true"/>
 
     <vbox id="headers-parent" flex="1">
@@ -1219,33 +1221,38 @@
           </hbox>
         </vbox>
         <splitter id="attachmentbucket-sizer"
                   collapsed="true"
                   collapse="after"
                   onmouseup="attachmentBucketSizerOnMouseUp();"/>
         <vbox id="attachments-box" collapsed="true" persist="width">
           <hbox id="attachments-header-box"
-                align="center"
+                align="stretch"
                 tooltiptext="&attachmentBucketHeader.tooltip;"
                 onclick="attachmentBucketHeaderOnClick();"
                 context="attachmentHeaderContext">
-            <label id="attachmentBucketCount"
-                   accesskey="&attachments.accesskey;"
-                   flex="1" crop="end"
-                   context=""
-                   control="attachmentBucket"/>
+            <hbox id="attachmentBucketCountBox"
+                  align="center"
+                  context="msgComposeAttachmentListContext">
+              <label id="attachmentBucketCount"
+                     accesskey="&attachments.accesskey;"
+                     flex="1" crop="end"/>
+            </hbox>
             <toolbarspring/>
-            <label id="attachmentBucketSize"
-                   context=""/>
+            <hbox id="attachmentBucketSizeBox"
+                  align="center"
+                  context="msgComposeAttachmentListContext">
+              <label id="attachmentBucketSize"/>
+            </hbox>
             <toolbarbutton id="attachmentBucketCloseButton"
                            class="ab-closebutton close-icon"
                            tooltiptext="&attachmentBucketCloseButton.tooltip;"
                            context=""
-                           oncommand="toggleAttachmentPane('hide');"/>
+                           oncommand="attachmentBucketCloseButtonOnCommand();"/>
           </hbox>
           <attachmentlist id="attachmentBucket"
                           tooltiptext=""
                           disableonsend="true"
                           seltype="multiple"
                           orient="vertical"
                           flex="1"
                           height="0"