[Pkg-mozext-commits] [firetray] 97/399: options UI: when notification disabled, disable excluded folders and accounts

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:21 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch dfsg-clean
in repository firetray.

commit 9718b72232b07f340ddafb2a1554b0db087c5645
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Thu Nov 24 20:54:55 2011 +0100

    options UI: when notification disabled, disable excluded folders and accounts
---
 src/chrome/content/options.js  |   42 ++++++++++++++++++++++++++--------------
 src/chrome/content/options.xul |   19 ++++++++++++------
 2 files changed, 41 insertions(+), 20 deletions(-)

diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 48a7b35..c2b47ac 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -30,7 +30,8 @@ firetray.UIOptions = {
       Cu.import("resource://firetray/FiretrayMessaging.jsm");
       this.initMailControls();
     } else {
-      this.hideElement("mail_tab");
+      let mailTab = document.getElementById("mail_tab");
+      this.hideElement(mailTab, true);
     }
 
   },
@@ -56,12 +57,11 @@ firetray.UIOptions = {
     }
   },
 
-  hideElement: function(parentId) {
-    let targetNode = document.getElementById(parentId);
-    targetNode.hidden = true;
+  hideElement: function(targetNode, hiddenval) {
+    targetNode.hidden = hiddenval;
   },
 
-  disableGroup: function(group,disableval) {
+  disableGroup: function(group, disableval) {
     try {
       for(var i=0; i< group.childNodes.length; i++)
         group.childNodes[i].disabled = disableval;
@@ -87,14 +87,6 @@ firetray.UIOptions = {
     let prefMailNotification =
       firetray.Utils.prefService.setIntPref("mail_notification", notificationSetting);
     this._disableNotificationMaybe(notificationSetting);
-
-    if (notificationSetting === NOTIFICATION_DISABLED)
-      firetray.Messaging.disable();
-    else {
-      firetray.Messaging.enable();
-      firetray.Messaging.updateUnreadMsgCount();
-    }
-
   },
 
   _disableNotificationMaybe: function(notificationSetting) {
@@ -105,6 +97,28 @@ firetray.UIOptions = {
     let customIconGroup = document.getElementById("custom_mail_icon");
     this.disableGroup(customIconGroup,
                       (notificationSetting !== NOTIFICATION_CUSTOM_ICON));
+
+    let isNotificationDisabled = (notificationSetting === NOTIFICATION_DISABLED);
+
+    // update UI
+    // NOTE: groupbox and caption don't have a 'disabled' attribute !!
+    let excludedFoldersList = document.getElementById('excluded_folders_list');
+    excludedFoldersList.disabled = isNotificationDisabled;
+    let folderGroupboxCaption = document.getElementById('unread_count_folder_exceptions_caption_label');
+    folderGroupboxCaption.disabled = isNotificationDisabled;
+    this.disableGroup(excludedFoldersList, isNotificationDisabled); // disable listitems also
+    let mailAccountsTree = document.getElementById('ui_tree_mail_accounts');
+    mailAccountsTree.disabled = isNotificationDisabled;
+    let accountsGroupboxCaption = document.getElementById('unread_count_account_exceptions_caption_label');
+    accountsGroupboxCaption.disabled = isNotificationDisabled;
+
+    if (isNotificationDisabled)
+      firetray.Messaging.disable();
+    else {
+      firetray.Messaging.enable();
+      firetray.Messaging.updateUnreadMsgCount();
+    }
+
   },
 
   chooseMailIconFile: function() {
@@ -138,7 +152,7 @@ firetray.UIOptions = {
       let item = excludedFoldersList.appendItem(localizedFolderType, folderType);
       LOG("folder: "+folderType);
       if (FLDRS_UNINTERESTING[folderType] & prefExcludedFoldersFlags)
-        excludedFoldersList.addItemToSelection(item);
+        excludedFoldersList.addItemToSelection(item); // doesn't trigger onselect
     }
   },
 
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index d5b4bc9..80e9c93 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -88,18 +88,25 @@
             </radiogroup>
           </groupbox>
 
-          <groupbox flex="1">
-            <caption label="&unread_count_folder_exceptions.label;"
-                     tooltiptext="&unread_count_folder_exceptions.tooltip;" />
+          <groupbox id="unread_count_folder_exceptions" flex="1">
+            <!-- label extracted from caption so we can disable it -->
+            <caption tooltiptext="&unread_count_folder_exceptions.tooltip;">
+              <label id="unread_count_folder_exceptions_caption_label"
+                     value="&unread_count_folder_exceptions.label;" />
+            </caption>
+
 
             <listbox id="excluded_folders_list" rows="7" flex="1" seltype="multiple"
                      tooltiptext="&excluded_folders_list.tooltip;"
                      onselect="firetray.UIOptions.updateExcludedFoldersPref()"/>
           </groupbox>
 
-          <groupbox flex="1">
-            <caption label="&unread_count_account_exceptions.label;"
-                     tooltiptext="&unread_count_account_exceptions.tooltip;" />
+          <groupbox id="unread_count_account_exceptions" flex="1">
+            <!-- label extracted from caption so we can disable it -->
+            <caption tooltiptext="&unread_count_account_exceptions.tooltip;">
+              <label id="unread_count_account_exceptions_caption_label"
+                     value="&unread_count_account_exceptions.label;" />
+            </caption>
 
             <tree id="ui_tree_mail_accounts" flex="1" rows="10" minwidth="400"
                   seltype="single" editable="true" hidecolumnpicker="false"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git



More information about the Pkg-mozext-commits mailing list