[Pkg-mozext-commits] [firetray] 76/399: * cleaning * options: prepare disabling rows (styling)

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:17 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 92180a91469f75c6cac1d14e382a580a815e2de8
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Wed Nov 2 19:57:17 2011 +0100

    * cleaning
    * options: prepare disabling rows (styling)
---
 src/chrome/content/options.js       |   70 ++++++++++++++++++++---------------
 src/chrome/content/options.xul      |   20 +++++-----
 src/chrome/locale/en-US/options.dtd |   12 +++---
 src/chrome/skin/overlay.css         |   23 +++++++++++-
 4 files changed, 78 insertions(+), 47 deletions(-)

diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 919cfe5..f71bc69 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -19,8 +19,7 @@ firetray.UIOptions = {
   onLoad: function() {
     if(firetray.Handler.inMailApp) {
       Cu.import("resource://firetray/FiretrayMessaging.jsm");
-      this.populateTreeServerTypes();
-      this.insertMailAccountsExcluded(this.accountBoxId);
+      this.populateTreeAccountsOrServerTypes();
     } else {
       this.hideElement("mail_tab");
     }
@@ -35,12 +34,12 @@ firetray.UIOptions = {
     let items = document.getElementById("ui_mail_accounts").childNodes;
     for (let i=0; i < items.length; i++) {
       let cells = items[i].getElementsByTagName("treecell");
-      // col 2 and 3: server_type_excluded, server_type_order
+      // col 2 and 3: account_or_server_type_excluded, account_or_server_type_order
       [cells[1], cells[2]].map(
         function(c) {
           LOG("i: "+i+", cell:"+c);
           c.removeEventListener(
-            'DOMAttrModified', that._userChangeValueTreeServerTypes, true);
+            'DOMAttrModified', that._userChangeValueTreeAccountsOrServerTypes, true);
         });
     }
   },
@@ -59,10 +58,20 @@ firetray.UIOptions = {
     }
   },
 
+  _disableRow: function(row) {
+    try {
+      let cells = row.childNodes; //.getElementsByTagName('treecell');
+      for (let i=0; i< cells.length; i++)
+        cells[i].setAttribute('properties', "disabled");
+    } catch(e) {
+      ERROR(e);
+    }
+  },
+
   /**
    * needed for triggering actual preference change and saving
    */
-  _userChangeValueTreeServerTypes: function(event) {
+  _userChangeValueTreeAccountsOrServerTypes: function(event) {
     if (event.attrName == "label") LOG("label changed!");
     if (event.attrName == "value") LOG("value changed!");
     document.getElementById("pane1")
@@ -73,7 +82,7 @@ firetray.UIOptions = {
    * NOTE: account exceptions for unread messages count are *stored* in
    * preferences as excluded, but *shown* as "not included"
    */
-  populateTreeServerTypes: function() {
+  populateTreeAccountsOrServerTypes: function() {
     let that = this;
     let prefPane = document.getElementById("pane1");
 
@@ -96,27 +105,27 @@ firetray.UIOptions = {
       let row = document.createElement('treerow');
       item.appendChild(row);
 
-      // server_type_name
+      // account_or_server_type_name
       let cell = document.createElement('treecell');
       cell.setAttribute('label',serverTypeName);
       cell.setAttribute('editable',false);
       row.appendChild(cell);
 
-      // server_type_excluded => checkbox
+      // account_or_server_type_excluded => checkbox
       cell = document.createElement('treecell');
       cell.setAttribute('value',!serverTypes[serverTypeName].excluded);
       cell.addEventListener(    // CAUTION: removeEventListener in onQuit()
         'DOMAttrModified', function(e) {
-          that._userChangeValueTreeServerTypes(e);
+          that._userChangeValueTreeAccountsOrServerTypes(e);
           firetray.Messaging.updateUnreadMsgCount();
         }, true);
       row.appendChild(cell);
 
-      // server_type_order
+      // account_or_server_type_order
       cell = document.createElement('treecell');
       cell.setAttribute('label',serverTypes[serverTypeName].order);
       cell.addEventListener(    // CAUTION: removeEventListener in onQuit()
-        'DOMAttrModified', that._userChangeValueTreeServerTypes, true);
+        'DOMAttrModified', that._userChangeValueTreeAccountsOrServerTypes, true);
       row.appendChild(cell);
 
       target.appendChild(item);
@@ -132,28 +141,29 @@ firetray.UIOptions = {
         let subItem = document.createElement('treeitem');
         let subRow = document.createElement('treerow');
 
-        // server_type_name
+        // account_or_server_type_name
         cell = document.createElement('treecell');
         cell.setAttribute('id', typeAccounts[i].key);
         cell.setAttribute('label',typeAccounts[i].name);
         cell.setAttribute('editable',false);
         subRow.appendChild(cell);
 
-        // server_type_excluded => checkbox
+        // account_or_server_type_excluded => checkbox
         let cell = document.createElement('treecell');
         cell.setAttribute('value',(accountsExcluded.indexOf(typeAccounts[i].key) < 0));
         cell.addEventListener(    // CAUTION: removeEventListener in onQuit()
           'DOMAttrModified', function(e) {
-            that._userChangeValueTreeServerTypes(e);
+            that._userChangeValueTreeAccountsOrServerTypes(e);
             firetray.Messaging.updateUnreadMsgCount();
           }, true);
         subRow.appendChild(cell);
 
-        // server_type_order - UNUSED (added for consistency)
+        // account_or_server_type_order - UNUSED (added for consistency)
         cell = document.createElement('treecell');
         cell.setAttribute('editable',false);
         subRow.appendChild(cell);
 
+        // this._disableRow(subRow);
         subItem.appendChild(subRow);
         subChildren.appendChild(subItem);
       }
@@ -162,37 +172,37 @@ firetray.UIOptions = {
     }
 
     let tree = document.getElementById("ui_tree_mail_accounts");
-    tree.addEventListener("keypress", that.onKeyPressTreeServerTypes, true);
+    tree.addEventListener("keypress", that.onKeyPressTreeAccountsOrServerTypes, true);
   },
 
   /*
    * Save the "mail_accounts" preference. This is called by the pref's system
    * when the GUI element is altered.
    */
-  saveTreeServerTypes: function() {
+  saveTreeAccountsOrServerTypes: function() {
     let tree = document.getElementById("ui_tree_mail_accounts");
 
     LOG("VIEW="+ tree.view + ", rowCount="+tree.view.rowCount);
     let prefObj = {"serverTypes":{}, "excludedAccounts":[]};
     for (let i=0; i < tree.view.rowCount; i++) {
-      // TODO: rename server_type_* to account_or_server_type
-      let serverTypeName = tree.view.getCellText(
-        i, tree.columns.getNamedColumn("server_type_name"));
-      let serverTypeExcluded = (
+      let accountOrServerTypeName = tree.view.getCellText(
+        i, tree.columns.getNamedColumn("account_or_server_type_name"));
+      let accountOrServerTypeExcluded = (
         tree.view.getCellValue(
-          i, tree.columns.getNamedColumn("server_type_excluded"))
+          i, tree.columns.getNamedColumn("account_or_server_type_excluded"))
         !== 'true');
-      let serverTypeOrder = parseInt(tree.view.getCellText(
-                                       i, tree.columns.getNamedColumn("server_type_order")));
+      let accountOrServerTypeOrder = parseInt(
+        tree.view.getCellText(
+          i, tree.columns.getNamedColumn("account_or_server_type_order")));
 
-      LOG("SUPER: "+serverTypeName+", "+serverTypeExcluded);
+      LOG("SUPER: "+accountOrServerTypeName+", "+accountOrServerTypeExcluded);
 
       if (tree.view.getLevel(i) === 0) { // serverTypes
-        prefObj["serverTypes"][serverTypeName] =
-          { order: serverTypeOrder, excluded: serverTypeExcluded };
+        prefObj["serverTypes"][accountOrServerTypeName] =
+          { order: accountOrServerTypeOrder, excluded: accountOrServerTypeExcluded };
 
       } else if (tree.view.getLevel(i) === 1) { // excludedAccounts
-        if (!serverTypeExcluded)
+        if (!accountOrServerTypeExcluded)
           continue;
         let rowNode = tree.view.getItemAtIndex(i).firstChild; // treerow
         let rowCells = rowNode.getElementsByTagName('treecell');
@@ -211,13 +221,13 @@ firetray.UIOptions = {
     return prefStr;
   },
 
-  onKeyPressTreeServerTypes: function(event) {
+  onKeyPressTreeAccountsOrServerTypes: function(event) {
     LOG("TREE KEYPRESS: "+event.originalTarget);
     let tree = document.getElementById("ui_tree_mail_accounts");
     let col = tree.editingColumn; // col.index
 
     // only int allowed
-    if (col == tree.columns.getNamedColumn("server_type_order")) {
+    if (col == tree.columns.getNamedColumn("account_or_server_type_order")) {
       let charCode = event.which || event.keyCode;
       let charStr = String.fromCharCode(charCode);
       if (!/\d/.test(charStr))
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index eaff639..70e1176 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -49,20 +49,20 @@
                   seltype="single" editable="true"
                   preference-editable="true"
                   preference="pref_string_mail_accounts"
-                  onsynctopreference="return firetray.UIOptions.saveTreeServerTypes();">
+                  onsynctopreference="return firetray.UIOptions.saveTreeAccountsOrServerTypes();">
               <treecols>
-                <treecol id="server_type_name" editable="false" flex="2"
-                         persist="width" primary="true" label="&server_type_name;"
-                         tooltiptext="&server_type_name.tooltip;"/>
+                <treecol id="account_or_server_type_name" editable="false" flex="2"
+                         persist="width" primary="true" label="&account_or_server_type_name;"
+                         tooltiptext="&account_or_server_type_name.tooltip;"/>
                 <splitter class="tree-splitter" resizeafter="grow"/>
-                <treecol id="server_type_excluded" type="checkbox" editable="true"
-                         label="&server_type_excluded;" flex="1" persist="width"
-                         tooltiptext="&server_type_excluded.tooltip;"/>
+                <treecol id="account_or_server_type_excluded" type="checkbox" editable="true"
+                         label="&account_or_server_type_excluded;" flex="1" persist="width"
+                         tooltiptext="&account_or_server_type_excluded.tooltip;"/>
                 <splitter class="tree-splitter" resizeafter="grow"/>
-                <treecol id="server_type_order" editable="true"
+                <treecol id="account_or_server_type_order" editable="true"
                          persist="width"
-                         flex="1" hidden= "true" label="&server_type_order;"
-                         tooltiptext="&server_type_name.tooltip;"/>
+                         flex="1" hidden= "true" label="&account_or_server_type_order;"
+                         tooltiptext="&account_or_server_type_name.tooltip;"/>
               </treecols>
               <treechildren id="ui_mail_accounts" flex="1" />
             </tree>
diff --git a/src/chrome/locale/en-US/options.dtd b/src/chrome/locale/en-US/options.dtd
index 43f3183..a7ee99a 100644
--- a/src/chrome/locale/en-US/options.dtd
+++ b/src/chrome/locale/en-US/options.dtd
@@ -11,9 +11,9 @@
 <!ENTITY unread_count_account_exceptions "Included accounts">
 <!ENTITY unread_count_account_exceptions.tooltip "Included accounts for unread message count">
 
-<!ENTITY server_type_name "Account">
-<!ENTITY server_type_name.tooltip "FIXME">
-<!ENTITY server_type_excluded "Excluded">
-<!ENTITY server_type_excluded.tooltip "FIXME">
-<!ENTITY server_type_order "Order">
-<!ENTITY server_type_order.tooltip "FIXME">
+<!ENTITY account_or_server_type_name "Account">
+<!ENTITY account_or_server_type_name.tooltip "FIXME">
+<!ENTITY account_or_server_type_excluded "Excluded">
+<!ENTITY account_or_server_type_excluded.tooltip "FIXME">
+<!ENTITY account_or_server_type_order "Order">
+<!ENTITY account_or_server_type_order.tooltip "FIXME">
diff --git a/src/chrome/skin/overlay.css b/src/chrome/skin/overlay.css
index e6a7426..e325411 100644
--- a/src/chrome/skin/overlay.css
+++ b/src/chrome/skin/overlay.css
@@ -1,4 +1,25 @@
+treechildren::-moz-tree-checkbox {
+  list-style-image: none;
+  -moz-box-align: center;
+}
+
 treechildren::-moz-tree-checkbox(checked) {
   /* css for checked cells */
-  list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif");
+  list-style-image: url("chrome://firetray/skin/cbox-check.gif");
+}
+
+treechildren::-moz-tree-checkbox(disabled) {
+  /* css for disabled checkboxes */
+  list-style-image: url("chrome://firetray/skin/cbox-disabled.gif");
+}
+
+/* properties="disabled" */
+treechildren::-moz-tree-cell-text(disabled) {
+        color: GrayText;
+}
+
+/*
+treechildren::-moz-tree-cell(disabled) {
+    background-color: #eeeeee;
 }
+*/

-- 
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