Bug 1482351 - Add placeholder for calendar preferences, and remove it if Lightning is not enabled. r=aceman,MakeMyDay
authorGeoff Lankow <geoff@darktrojan.net>
Sun, 09 Sep 2018 15:21:58 +1200
changeset 33108 a8d134e692bdbc0efc034cb66c0583bca9df5f8c
parent 33107 fe142027bfffda203150e155d1d0747242e11fb0
child 33109 4eec6def8a100730fef0fcd861272998640189ab
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersaceman, MakeMyDay
bugs1482351
Bug 1482351 - Add placeholder for calendar preferences, and remove it if Lightning is not enabled. r=aceman,MakeMyDay
calendar/lightning/content/messenger-overlay-preferences.js
mail/components/preferences/aboutPreferences.xul
mail/components/preferences/preferences.js
--- a/calendar/lightning/content/messenger-overlay-preferences.js
+++ b/calendar/lightning/content/messenger-overlay-preferences.js
@@ -11,23 +11,18 @@ var gLightningPane = {
         let preference = document.getElementById("calendar.preferences.lightning.selectedTabIndex");
         let ltnPrefs = document.getElementById("calPreferencesTabbox");
         if (preference.value) {
             ltnPrefs.selectedIndex = preference.value;
         }
         ltnPrefs.addEventListener("select", gLightningPane.tabSelectionChanged.bind(this));
         this.mInitialized = true;
 
-        let prefTab = document.documentElement;
-        let lightningButton = prefTab._makePaneButton(document.getElementById("paneLightning"));
-        let advancedButton = document.querySelector('#category-box radio[pane="paneAdvanced"]');
-        advancedButton.parentNode.insertBefore(lightningButton, advancedButton);
-
-        // We probably messed this up just by existing. Fix it.
-        prefTab._paneDeck.selectedIndex = prefTab._selector.selectedIndex;
+        let categoryButton = document.querySelector('#category-box radio[pane="paneLightning"]');
+        categoryButton.label = document.getElementById("paneLightning").label;
 
         let elements = document.querySelectorAll("#paneLightning preference");
         for (let element of elements) {
             element.updateElements();
         }
     },
 
     tabSelectionChanged: function() {
--- a/mail/components/preferences/aboutPreferences.xul
+++ b/mail/components/preferences/aboutPreferences.xul
@@ -47,10 +47,11 @@
 
 #include general.inc.xul
 #include display.inc.xul
 #include compose.inc.xul
 #include chat.inc.xul
 #include privacy.inc.xul
 #include security.inc.xul
 #include applications.inc.xul
+  <prefpane id="paneLightning"/>
 #include advanced.inc.xul
 </preftab>
--- a/mail/components/preferences/preferences.js
+++ b/mail/components/preferences/preferences.js
@@ -1,25 +1,33 @@
 /* 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/. */
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
+ChromeUtils.import("resource:///modules/extensionSupport.jsm");
 
 window.addEventListener("load", function() {
   let prefWindow = document.getElementById("MailPreferences");
   if (!Services.prefs.getBoolPref("mail.chat.enabled")) {
     let radio =
       document.getAnonymousElementByAttribute(prefWindow, "pane", "paneChat");
     if (radio.selected)
       prefWindow.showPane(document.getElementById("paneGeneral"));
     radio.hidden = true;
   }
+  if (!ExtensionSupport.loadedLegacyExtensions.has("{e2fda1a4-762b-4020-b5ad-a41df1933103}")) {
+    let radio =
+      document.getAnonymousElementByAttribute(prefWindow, "pane", "paneLightning");
+    if (radio.selected)
+      prefWindow.showPane(document.getElementById("paneGeneral"));
+    radio.hidden = true;
+  }
 });
 
 /**
  * Selects the specified preferences pane
  *
  * @param prefWindow    the prefwindow element to operate on
  * @param aPaneID       ID of prefpane to select
  * @param aTabID        ID of tab to select on the prefpane