Bug 1482439 - Add a titlebar checkbox in customize dialog. r=mkmelin
authorRichard Marti <richard.marti@gmail.com>
Sat, 11 Aug 2018 14:40:58 +0200
changeset 24502 e96c399d61336437a63432f2ce0d4e804b3bb70f
parent 24501 47155e8ff10b40dbb47a612bb5623a2cfa144261
child 24503 e604cdcec085b32a5fce1a021ef047cc18d30133
push id14750
push usermozilla@jorgk.com
push dateFri, 17 Aug 2018 22:20:45 +0000
treeherdercomm-central@6307e1b793f2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1482439
Bug 1482439 - Add a titlebar checkbox in customize dialog. r=mkmelin
common/src/customizeToolbar.js
common/src/customizeToolbar.xul
mail/locales/en-US/chrome/messenger/customizeToolbar.dtd
--- a/common/src/customizeToolbar.js
+++ b/common/src/customizeToolbar.js
@@ -76,16 +76,26 @@ 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");
+    if (window.opener &&
+       (window.opener.document.documentElement.getAttribute("windowtype") ==
+        "mail:3pane")) {
+      titlebarCheckbox.hidden = false;
+      titlebarCheckbox.checked = !Services.prefs.getBoolPref("mail.tabs.drawInTitlebar");
+    }
+  }
+
   // Build up the palette of other items.
   buildPalette();
 
   // Wrap all the items on the toolbar in toolbarpaletteitems.
   wrapToolbarItems();
 }
 
 function repositionDialog(aWindow) {
@@ -527,16 +537,25 @@ function restoreDefaultSet() {
 
   toolboxChanged("reset");
 }
 
 function updateIconSize(aSize) {
   return updateToolboxProperty("iconsize", aSize, "large");
 }
 
+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(function() { 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
@@ -87,16 +87,19 @@
 #endif
       </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="&showTitltbar.label;" hidden="true"/>
+#endif
   </box>
 
   <separator class="groove"/>
 
   <hbox align="center" pack="end">
     <button id="donebutton" label="&saveChanges.label;" oncommand="onClose();"
             default="true" icon="close"/>
   </hbox>
--- a/mail/locales/en-US/chrome/messenger/customizeToolbar.dtd
+++ b/mail/locales/en-US/chrome/messenger/customizeToolbar.dtd
@@ -8,10 +8,11 @@
 <!ENTITY show.label               "Show:">
 <!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 showTitltbar.label       "Show Title Bar">
 <!ENTITY saveChanges.label        "Done">
 <!ENTITY undoChanges.label        "Undo Changes">