Bug 735347 - Prefing off the IM feature should also hide the Chat preference pane, r=bwinton, a=bienvenu.
authorFlorian Quèze <florian@queze.net>
Mon, 02 Apr 2012 12:44:01 +0200
changeset 11141 7fdb23d4f87bf60554b698842de46d95bd6bd3c6
parent 11140 a32b1a8e83a1f87e8262e6883d6fabe5f05c689c
child 11142 dd0fb5e15c63fd41ef0f2ec4780ef5f5d98cbbcf
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwinton, bienvenu
bugs735347
Bug 735347 - Prefing off the IM feature should also hide the Chat preference pane, r=bwinton, a=bienvenu.
mail/components/preferences/jar.mn
mail/components/preferences/preferences.js
mail/components/preferences/preferences.xul
--- a/mail/components/preferences/jar.mn
+++ b/mail/components/preferences/jar.mn
@@ -1,15 +1,17 @@
 messenger.jar:
 *   content/messenger/preferences/preferences.xul
+    content/messenger/preferences/preferences.js
 *   content/messenger/preferences/general.xul
 *   content/messenger/preferences/general.js
 *   content/messenger/preferences/display.xul
     content/messenger/preferences/display.js
 *   content/messenger/preferences/chat.xul
+    content/messenger/preferences/chat.js
 *   content/messenger/preferences/compose.xul
 *   content/messenger/preferences/compose.js
 *   content/messenger/preferences/sendoptions.xul
 *   content/messenger/preferences/sendoptions.js
 *   content/messenger/preferences/security.xul
 *   content/messenger/preferences/security.js
 *   content/messenger/preferences/junkLog.xul
 *   content/messenger/preferences/junkLog.js
new file mode 100644
--- /dev/null
+++ b/mail/components/preferences/preferences.js
@@ -0,0 +1,16 @@
+/* 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/. */
+
+window.addEventListener("load", function () {
+  let prefs = Components.classes["@mozilla.org/preferences-service;1"]
+                        .getService(Components.interfaces.nsIPrefService);
+  if (!prefs.getBoolPref("mail.chat.enabled")) {
+    let prefwindow = document.getElementById("MailPreferences");
+    let radio =
+      document.getAnonymousElementByAttribute(prefwindow, "pane", "paneChat");
+    if (radio.selected)
+      prefwindow.showPane(document.getElementById("paneGeneral"));
+    radio.hidden = true;
+  }
+});
--- a/mail/components/preferences/preferences.xul
+++ b/mail/components/preferences/preferences.xul
@@ -89,16 +89,17 @@
 #endif
 #endif
   <stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
   <stringbundle id="bundlePreferences"
                 src="chrome://messenger/locale/preferences/preferences.properties"/>
 
   <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
   <script type="application/javascript" src="chrome://communicator/content/contentAreaClick.js"/>
+  <script type="application/javascript" src="chrome://messenger/content/preferences/preferences.js"/>
 
   <prefpane id="paneGeneral" label="&paneGeneral.title;"
             src="chrome://messenger/content/preferences/general.xul"/>
   <prefpane id="paneDisplay" label="&paneDisplay.title;"
             src="chrome://messenger/content/preferences/display.xul"/>
   <prefpane id="paneCompose" label="&paneComposition.title;"
             src="chrome://messenger/content/preferences/compose.xul"/>
   <prefpane id="paneChat" label="&paneChat.title;"