Bug 1496752 - Part 2: Make it possible to enable the extra drag space in customize window. r=jorgk
authorRichard Marti <richard.marti@gmail.com>
Thu, 11 Oct 2018 19:29:10 +0200
changeset 33569 c19d24ccbc89c18e37cff5005bf80ef505a17c2f
parent 33568 50a2faafdfbfebbf5291d0df17b8976b1d957a31
child 33570 d3daa25948709eba3f0b07c887bf3d2738b7dbc0
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersjorgk
bugs1496752
Bug 1496752 - Part 2: Make it possible to enable the extra drag space in customize window. r=jorgk
common/src/customizeToolbar.js
common/src/customizeToolbar.xul
mail/locales/en-US/chrome/messenger/customizeToolbar.dtd
mail/themes/osx/mail/customizeToolbar.css
--- a/common/src/customizeToolbar.js
+++ b/common/src/customizeToolbar.js
@@ -77,22 +77,24 @@ function initDialog() {
   var mode = gToolbox.getAttribute("mode");
   document.getElementById("modelist").value = mode;
   var smallIconsCheckbox = document.getElementById("smallicons");
   smallIconsCheckbox.checked = gToolbox.getAttribute("iconsize") == "small";
   if (mode == "text")
     smallIconsCheckbox.disabled = true;
 
   if (AppConstants.MOZ_APP_NAME == "thunderbird") {
-    let titlebarCheckbox = document.getElementById("showTitlebar");
+      document.getElementById("showTitlebar").checked =
+        !Services.prefs.getBoolPref("mail.tabs.drawInTitlebar");
+      document.getElementById("showDragSpace").checked =
+        Services.prefs.getBoolPref("mail.tabs.extraDragSpace");
     if (window.opener &&
        (window.opener.document.documentElement.getAttribute("windowtype") ==
         "mail:3pane")) {
-      titlebarCheckbox.hidden = false;
-      titlebarCheckbox.checked = !Services.prefs.getBoolPref("mail.tabs.drawInTitlebar");
+      document.getElementById("titlebarSettings").hidden = false;
     }
   }
 
   // Build up the palette of other items.
   buildPalette();
 
   // Wrap all the items on the toolbar in toolbarpaletteitems.
   wrapToolbarItems();
@@ -546,16 +548,25 @@ function updateTitlebar() {
   let titlebarCheckbox = document.getElementById("showTitlebar");
   Services.prefs.setBoolPref("mail.tabs.drawInTitlebar", !titlebarCheckbox.checked);
 
   // Bring the customizeToolbar window to front (on linux it's behind the main
   // window). Otherwise the customization window gets left in the background.
   setTimeout(() => window.focus(), 100);
 }
 
+function updateDragSpace() {
+  let dragSpaceCheckbox = document.getElementById("showDragSpace");
+  Services.prefs.setBoolPref("mail.tabs.extraDragSpace", dragSpaceCheckbox.checked);
+
+  // Bring the customizeToolbar window to front (on linux it's behind the main
+  // window). Otherwise the customization window gets left in the background.
+  setTimeout(() => window.focus(), 100);
+}
+
 function updateToolbarMode(aModeValue) {
   var mode = updateToolboxProperty("mode", aModeValue, "icons");
 
   var iconSizeCheckbox = document.getElementById("smallicons");
   iconSizeCheckbox.disabled = mode == "text";
 
   return mode;
 }
--- a/common/src/customizeToolbar.xul
+++ b/common/src/customizeToolbar.xul
@@ -88,17 +88,20 @@
       </menupopup>
     </menulist>
 
     <checkbox id="smallicons" oncommand="updateIconSize(this.checked ? 'small' : 'large');" label="&useSmallIcons.label;"/>
 
     <button id="newtoolbar" label="&addNewToolbar.label;" oncommand="addNewToolbar();" icon="add"/>
     <button id="restoreDefault" label="&restoreDefaultSet.label;" oncommand="restoreDefaultSet();" icon="revert"/>
 #ifndef MOZ_SUITE
-    <checkbox id="showTitlebar" oncommand="updateTitlebar();" label="&showTitlebar.label;" hidden="true"/>
+    <vbox id="titlebarSettings" hidden="true">
+      <checkbox id="showTitlebar" oncommand="updateTitlebar();" label="&showTitlebar.label;"/>
+      <checkbox id="showDragSpace" oncommand="updateDragSpace();" label="&extraDragSpace.label;"/>
+    </vbox>
 #endif
   </box>
 
   <separator class="groove"/>
 
   <hbox align="center" pack="end">
     <button id="donebutton" label="&saveChanges.label;" oncommand="onClose();"
             default="true" icon="close"/>
--- a/mail/locales/en-US/chrome/messenger/customizeToolbar.dtd
+++ b/mail/locales/en-US/chrome/messenger/customizeToolbar.dtd
@@ -9,10 +9,11 @@
 <!ENTITY iconsAndText.label       "Icons and Text">
 <!ENTITY icons.label              "Icons">
 <!ENTITY text.label               "Text">
 <!ENTITY iconsBesideText.label    "Icons beside Text">
 <!ENTITY useSmallIcons.label      "Use Small Icons">
 <!ENTITY restoreDefaultSet.label  "Restore Default Set">
 <!ENTITY addNewToolbar.label      "Add New Toolbar">
 <!ENTITY showTitlebar.label       "Show Title Bar">
+<!ENTITY extraDragSpace.label     "Add Drag Space">
 <!ENTITY saveChanges.label        "Done">
 <!ENTITY undoChanges.label        "Undo Changes">
--- a/mail/themes/osx/mail/customizeToolbar.css
+++ b/mail/themes/osx/mail/customizeToolbar.css
@@ -32,11 +32,11 @@ hbox button {
   font: menu;
 }
 
 #main-box > box > button {
   min-height: 19px; /* aqua size for small buttons */
   font: message-box;
 }
 
-:root[toolboxId="mail-toolbox"] #showTitlebar {
+:root[toolboxId="mail-toolbox"] #titlebarSettings {
   display: -moz-box;
 }