Bug 425451 - Make the message compose addressing widget defaults to 3 lines of recipients and make it resizable. r=mkmelin, ui-r=bwinton
authorThomas Duellmann <bugzilla2007@duellmann24.net>
Fri, 21 Jun 2013 19:15:29 +0200
changeset 15804 9311b3990406e1c5e580e9d46659395efbb5dc3c
parent 15803 c40e235d5144f5fe32018cebd857bb9970b7a92a
child 15805 67e02a3c68e1c1820e93813fd030061b6321132e
push idunknown
push userunknown
push dateunknown
reviewersmkmelin, bwinton
bugs425451
Bug 425451 - Make the message compose addressing widget defaults to 3 lines of recipients and make it resizable. r=mkmelin, ui-r=bwinton
mail/app/profile/all-thunderbird.js
mail/components/compose/content/MsgComposeCommands.js
mail/components/compose/content/addressingWidgetOverlay.js
mail/components/compose/content/messengercompose.xul
mail/themes/linux/mail/compose/messengercompose.css
mail/themes/windows/mail/compose/messengercompose-aero.css
mail/themes/windows/mail/compose/messengercompose.css
--- a/mail/app/profile/all-thunderbird.js
+++ b/mail/app/profile/all-thunderbird.js
@@ -490,16 +490,19 @@ pref("mail.spotlight.logging.dump", fals
 
 // Whether to use a panel that looks like an OS X sheet for customization
 #ifdef XP_MACOSX
 pref("toolbar.customization.usesheet", true);
 #else
 pref("toolbar.customization.usesheet", false);
 #endif
 
+// Number of recipient rows shown by default
+pref("mail.compose.addresswidget.numRowsShownDefault", 3);
+
 // Check for missing attachments?
 pref("mail.compose.attachment_reminder", true);
 // Words that should trigger a missing attachments warning.
 pref("mail.compose.attachment_reminder_keywords", "chrome://messenger/locale/messengercompose/composeMsgs.properties");
 // When no action is taken on the inline missing attachement notification,
 // show an alert on send?
 pref("mail.compose.attachment_reminder_aggressive", true);
 
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -2523,19 +2523,17 @@ function ComposeLoad()
 
   // initialize the customizeDone method on the customizeable toolbar
   var toolbox = document.getElementById("compose-toolbox");
   toolbox.customizeDone = function(aEvent) { MailToolboxCustomizeDone(aEvent, "CustomizeComposeToolbar"); };
 
   var toolbarset = document.getElementById('customToolbars');
   toolbox.toolbarset = toolbarset;
 
-  // Prevent resizing the subject and format toolbar over the addressswidget.
-  var headerToolbar = document.getElementById("MsgHeadersToolbar");
-  headerToolbar.minHeight = headerToolbar.boxObject.height;
+  awInitializeNumberOfRowsShown();
 }
 
 function ComposeUnload()
 {
   UnloadCommandUpdateHandlers();
 
   // Stop gSpellChecker so personal dictionary is saved
   enableInlineSpellCheck(false);
--- a/mail/components/compose/content/addressingWidgetOverlay.js
+++ b/mail/components/compose/content/addressingWidgetOverlay.js
@@ -1,13 +1,14 @@
 /* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource:///modules/mailServices.js");
 
 top.MAX_RECIPIENTS = 1; /* for the initial listitem created in the XUL */
 
 var inputElementType = "";
 var selectElementType = "";
 var selectElementIndexTable = null;
 
@@ -38,16 +39,42 @@ function awGetNumberOfCols()
     gNumberOfCols = listCols.length;
     if (!gNumberOfCols)
       gNumberOfCols = 1;  /* if no cols defined, that means we have only one! */
   }
 
   return gNumberOfCols;
 }
 
+/**
+ * Adjust the default and minimum number of visible recipient rows for addressingWidget
+ */
+function awInitializeNumberOfRowsShown()
+{
+  let msgHeadersToolbar = document.getElementById("MsgHeadersToolbar");
+  let addressingWidget = document.getElementById("addressingWidget");
+  let awNumRowsShownDefault =
+    Services.prefs.getIntPref("mail.compose.addresswidget.numRowsShownDefault");
+
+  // Set minimum number of rows shown for address widget, per hardwired
+  // rows="1" attribute of addressingWidget, to prevent resizing the
+  // subject and format toolbar over the address widget.
+  // This lets users shrink the address widget to one row (with delicate UX)
+  // and thus maximize the space available for composition body,
+  // especially on small screens.
+  msgHeadersToolbar.minHeight = msgHeadersToolbar.boxObject.height;
+
+  // Set default number of rows shown for address widget.
+  addressingWidget.setAttribute("rows", awNumRowsShownDefault);
+  msgHeadersToolbar.height = msgHeadersToolbar.boxObject.height;
+
+  // Update addressingWidget internals.
+  awCreateOrRemoveDummyRows();
+}
+
 function awInputElementName()
 {
   if (inputElementType == "")
     inputElementType = document.getElementById("addressCol2#1").localName;
   return inputElementType;
 }
 
 function awSelectElementName()
--- a/mail/components/compose/content/messengercompose.xul
+++ b/mail/components/compose/content/messengercompose.xul
@@ -806,17 +806,17 @@
             <hbox align="center" pack="end" style="&headersSpace.style;">
               <label value="&fromAddr.label;" accesskey="&fromAddr.accesskey;" control="msgIdentity"/>
             </hbox>
             <menulist id="msgIdentity" type="description" flex="1"
                       oncommand="LoadIdentity(false);" disableonsend="true">
               <menupopup id="msgIdentityPopup"/>
             </menulist>
           </hbox>
-          <listbox id="addressingWidget" flex="1" seltype="multiple" rows="4"
+          <listbox id="addressingWidget" flex="1" seltype="multiple" rows="1"
                    onkeydown="awKeyDown(event, this)"
                    onclick="awClickEmptySpace(event.originalTarget, true)"
                    disableonsend="true">
             <listcols>
               <listcol id="typecol-addressingWidget" style="&headersSpace.style;"/>
               <listcol id="textcol-addressingWidget" flex="1"/>
             </listcols>
             <listitem class="addressingWidgetItem" allowevents="true">
--- a/mail/themes/linux/mail/compose/messengercompose.css
+++ b/mail/themes/linux/mail/compose/messengercompose.css
@@ -343,17 +343,16 @@ treechildren::-moz-tree-image(remote-err
 .aw-menulist > dropmarker {
   height: 11px;
 }
 
 #MsgHeadersToolbar {
   -moz-appearance: toolbar;
   color: WindowText;
   text-shadow: none;
-  min-height: 132px;
 }
 
 /* ::::: format toolbar ::::: */
 
 #FormatToolbar {
   -moz-appearance: toolbar;
   color: WindowText;
 }
--- a/mail/themes/windows/mail/compose/messengercompose-aero.css
+++ b/mail/themes/windows/mail/compose/messengercompose-aero.css
@@ -48,17 +48,16 @@ toolbar:not(:-moz-lwtheme) {
 
 @media (-moz-windows-default-theme) {
   #compose-toolbox:not(:-moz-lwtheme) {
     background-color: hsl(210, 75%, 92%);
   }
 }
 
 #MsgHeadersToolbar {
-  min-height: 132px;
   text-shadow: none;
   color: -moz-DialogText;
   background-color: -moz-Dialog;
 }
 
 @media (-moz-windows-default-theme) {
   #MsgHeadersToolbar  {
     background-color: hsl(210, 75%, 92%);
--- a/mail/themes/windows/mail/compose/messengercompose.css
+++ b/mail/themes/windows/mail/compose/messengercompose.css
@@ -447,20 +447,16 @@ treechildren::-moz-tree-image(remote-err
 .aw-menulist > .menulist-label-box > .menulist-icon {
   -moz-margin-start: 0;
 }
 
 .aw-menulist > .menulist-label-box > .menulist-label {
   margin: 0 1px !important;
 }
 
-#MsgHeadersToolbar {
-  min-height: 132px;
-}
-
 /* ::::: format toolbar ::::: */
 
 #FormatToolbox {
   border-top-width: 0;
   background-color: -moz-Dialog;
 }
 
 #FormatToolbar {