[Pkg-mozext-commits] [firetray] 83/399: * fixes in UIOptions (onQuit(), populateTreeAccountsOrServerTypes(), missing cbox-disabled.gif) * start implementing upcoming options
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:23:18 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 8ec5451c9411c933631cf68ac46b881fbaca49c9
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Fri Nov 4 01:02:36 2011 +0100
* fixes in UIOptions (onQuit(), populateTreeAccountsOrServerTypes(), missing
cbox-disabled.gif)
* start implementing upcoming options
---
src/chrome/content/options.js | 63 ++++++++++++++++++++++++-----------
src/chrome/content/options.xul | 26 ++++++++++-----
src/chrome/content/overlay.js | 6 ++--
src/chrome/locale/en-US/options.dtd | 11 ++++--
src/chrome/skin/cbox-disabled.gif | Bin 0 -> 59 bytes
src/defaults/preferences/prefs.js | 3 +-
6 files changed, 75 insertions(+), 34 deletions(-)
diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 237b35a..0eeabf3 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -14,6 +14,12 @@ if ("undefined" == typeof(firetray)) {
var firetray = {};
};
+const TREEROW_ACCOUNT_OR_SERVER_TYPE_NAME = 0;
+const TREEROW_ACCOUNT_OR_SERVER_TYPE_EXCLUDED = 1;
+const TREEROW_ACCOUNT_OR_SERVER_TYPE_ORDER = 2;
+const TREELEVEL_SERVER_TYPES = 0;
+const TREELEVEL_EXCLUDED_ACCOUNTS = 1;
+
firetray.UIOptions = {
onLoad: function() {
@@ -29,19 +35,20 @@ firetray.UIOptions = {
onQuit: function() {
// cleaning: removeEventListener on cells
// NOTE: not sure this is necessary on window close
- let tree = document.getElementById("ui_mail_accounts");
+ let tree = document.getElementById("ui_tree_mail_accounts");
+ let that = this;
for (let i=0; i < tree.view.rowCount; i++) {
let cells = tree.view.getItemAtIndex(i).getElementsByTagName("treecell");
- if (tree.view.getLevel(i) === 0) { // serverTypes
+ if (tree.view.getLevel(i) === TREELEVEL_SERVER_TYPES) {
// account_or_server_type_excluded, account_or_server_type_order
[cells[1], cells[2]].map(
function(c) {
c.removeEventListener(
'DOMAttrModified', that._userChangeValueTreeServerTypes, true);
});
- } else if (tree.view.getLevel(i) === 1) { // excludedAccounts
+ } else if (tree.view.getLevel(i) === TREELEVEL_EXCLUDED_ACCOUNTS) {
cells[1].removeEventListener(
- 'DOMAttrModified', that._userChangeValueTreeAccounts, true);
+ 'DOMAttrModified', that._userChangeValueTree, true);
}
}
},
@@ -51,6 +58,9 @@ firetray.UIOptions = {
targetNode.hidden = true;
},
+ /**
+ * should be called only for excludedAccounts
+ */
_disableTreeRow: function(row, disable) {
let that = this;
try {
@@ -60,14 +70,18 @@ firetray.UIOptions = {
LOG("i: "+i+", cell:"+cells[i]);
if (disable === true) {
cells[i].setAttribute('properties', "disabled");
- cells[i].removeEventListener(
- 'DOMAttrModified', that._userChangeValueTreeAccounts, true);
- cells[i].setAttribute('editable', "false");
+ if (i === TREEROW_ACCOUNT_OR_SERVER_TYPE_EXCLUDED) {
+ cells[i].removeEventListener(
+ 'DOMAttrModified', that._userChangeValueTree, true);
+ cells[i].setAttribute('editable', "false");
+ }
} else {
cells[i].removeAttribute('properties');
- cells[i].addEventListener(
- 'DOMAttrModified', that._userChangeValueTreeAccounts, true);
- cells[i].setAttribute('editable', "true");
+ if (i === TREEROW_ACCOUNT_OR_SERVER_TYPE_EXCLUDED) {
+ cells[i].addEventListener(
+ 'DOMAttrModified', that._userChangeValueTree, true);
+ cells[i].setAttribute('editable', "true");
+ }
}
}
} catch(e) {
@@ -78,7 +92,7 @@ firetray.UIOptions = {
/**
* needed for triggering actual preference change and saving
*/
- _userChangeValueTreeAccounts: function(event) {
+ _userChangeValueTree: function(event) {
if (event.attrName == "label") LOG("label changed!");
if (event.attrName == "value") LOG("value changed!");
document.getElementById("pane1")
@@ -105,8 +119,7 @@ firetray.UIOptions = {
// TODO: move row to new rank
}
-
- this._userChangeValueTreeAccounts(event);
+ this._userChangeValueTree(event);
},
/**
@@ -178,6 +191,7 @@ firetray.UIOptions = {
if (typeof(typeAccounts) == "undefined")
continue;
+ let rowDisabled = (cellExcluded.getAttribute("value") === "false");
for (let i=0; i<typeAccounts.length; i++) {
let subItem = document.createElement('treeitem');
let subRow = document.createElement('treerow');
@@ -187,22 +201,33 @@ firetray.UIOptions = {
cell.setAttribute('id', typeAccounts[i].key);
cell.setAttribute('label',typeAccounts[i].name);
cell.setAttribute('editable',false);
+ if (rowDisabled === true)
+ cell.setAttribute('properties', "disabled");
subRow.appendChild(cell);
// 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', that._userChangeValueTreeAccounts, true);
+ if (rowDisabled === true) {
+ cell.setAttribute('properties', "disabled");
+ cell.setAttribute('editable', "false");
+ } else {
+ cell.addEventListener( // CAUTION: removeEventListener in onQuit()
+ 'DOMAttrModified', that._userChangeValueTree, true);
+ }
subRow.appendChild(cell);
// account_or_server_type_order - UNUSED (added for consistency)
cell = document.createElement('treecell');
cell.setAttribute('editable',false);
+ if (rowDisabled === true)
+ cell.setAttribute('properties', "disabled");
subRow.appendChild(cell);
- this._disableTreeRow(
- subRow, (cellExcluded.getAttribute("value") === "false"));
+ // we must initialize sub-cells correctly to prevent prefsync at a
+ // stage where the pref will be incomplete
+ /* this._disableTreeRow(
+ subRow, (cellExcluded.getAttribute("value") === "false")); */
subItem.appendChild(subRow);
subChildren.appendChild(subItem);
}
@@ -236,11 +261,11 @@ firetray.UIOptions = {
LOG("account: "+accountOrServerTypeName+", "+accountOrServerTypeExcluded);
- if (tree.view.getLevel(i) === 0) { // serverTypes
+ if (tree.view.getLevel(i) === TREELEVEL_SERVER_TYPES) {
prefObj["serverTypes"][accountOrServerTypeName] =
{ order: accountOrServerTypeOrder, excluded: accountOrServerTypeExcluded };
- } else if (tree.view.getLevel(i) === 1) { // excludedAccounts
+ } else if (tree.view.getLevel(i) === TREELEVEL_EXCLUDED_ACCOUNTS) {
if (!accountOrServerTypeExcluded)
continue;
let rowNode = tree.view.getItemAtIndex(i).firstChild; // treerow
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index c5af964..bc38f08 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -11,8 +11,10 @@
<prefpane id="pane1" label="&pane1.title;">
<preferences>
- <preference id="pref_bool_close_hides"
- name="extensions.firetray.close_hides" type="bool"/>
+ <preference id="pref_bool_hides_on_close"
+ name="extensions.firetray.hides_on_close" type="bool"/>
+ <preference id="pref_bool_hides_on_minimize"
+ name="extensions.firetray.hides_on_minimize" type="bool"/>
<preference id="pref_string_mail_accounts"
name="extensions.firetray.mail_accounts" type="string"/>
</preferences>
@@ -21,23 +23,29 @@
<tabbox>
<tabs>
<tab label="&general_options;"/>
- <tab label="&input_options;"/>
+ <tab label="&input_options;" disabled="true" tooltiptext="&NOT_IMPLEMENTED_YET;"/>
<tab label="&mail_options;" id="mail_tab" />
</tabs>
<tabpanels>
<tabpanel id="general_tabpanel">
- <groupbox>
- <checkbox id="ui_close_hides" preference="pref_bool_close_hides"
- label="&bool_close_hides.label;"
- accesskey="&bool_close_hides.accesskey;"/>
+ <groupbox flex="1">
+ <caption label="&windows_behaviour;"
+ tooltiptext="&windows_behaviour.tooltip;" />
+
+ <checkbox id="ui_hides_on_close" preference="pref_bool_hides_on_close"
+ label="&bool_hides_on_close.label;"
+ accesskey="&bool_hides_on_close.accesskey;"/>
+ <checkbox id="ui_hides_on_minimize" preference="pref_bool_hides_on_minimize"
+ label="&bool_hides_on_minimize.label;"
+ accesskey="&bool_hides_on_minimize.accesskey;"
+ disabled="true" tooltiptext="&NOT_IMPLEMENTED_YET;"/>
</groupbox>
</tabpanel>
- <tabpanel id="input_tabpanel">
- </tabpanel>
+ <tabpanel id="input_tabpanel" />
<tabpanel id="mail_tabpanel">
diff --git a/src/chrome/content/overlay.js b/src/chrome/content/overlay.js
index 06b3ae0..b7c086a 100644
--- a/src/chrome/content/overlay.js
+++ b/src/chrome/content/overlay.js
@@ -57,9 +57,9 @@ firetray.Main = {
// (browser.tabs.warnOnClose)
onClose: function(event) {
LOG('Firetray CLOSE');
- let close_hides = firetray.Utils.prefService.getBoolPref('close_hides');
- LOG('close_hides: '+close_hides);
- if (close_hides) {
+ let hides_on_close = firetray.Utils.prefService.getBoolPref('hides_on_close');
+ LOG('hides_on_close: '+hides_on_close);
+ if (hides_on_close) {
firetray.Handler.showHideToTray();
event && event.preventDefault(); // no event when called directly (xul)
}
diff --git a/src/chrome/locale/en-US/options.dtd b/src/chrome/locale/en-US/options.dtd
index 2029acb..272fb9a 100644
--- a/src/chrome/locale/en-US/options.dtd
+++ b/src/chrome/locale/en-US/options.dtd
@@ -1,12 +1,19 @@
<!ENTITY prefwindow.title "FireTray preferences">
<!ENTITY pane1.title "FireTray preferences">
+<!ENTITY NOT_IMPLEMENTED_YET "NOT IMPLEMENTED YET">
+
<!ENTITY general_options "General">
<!ENTITY input_options "Input">
<!ENTITY mail_options "Mail">
-<!ENTITY bool_close_hides.label "Closing windows hides to tray">
-<!ENTITY bool_close_hides.accesskey "C">
+<!ENTITY windows_behaviour "Windows behaviour">
+<!ENTITY windows_behaviour.tooltip "">
+
+<!ENTITY bool_hides_on_close.label "Closing window hides to tray">
+<!ENTITY bool_hides_on_close.accesskey "C">
+<!ENTITY bool_hides_on_minimize.label "Minimize window hides to tray">
+<!ENTITY bool_hides_on_minimize.accesskey "M">
<!ENTITY unread_count_account_exceptions "Included accounts">
<!ENTITY unread_count_account_exceptions.tooltip "Included accounts for unread message count">
diff --git a/src/chrome/skin/cbox-disabled.gif b/src/chrome/skin/cbox-disabled.gif
new file mode 100644
index 0000000..12158e9
Binary files /dev/null and b/src/chrome/skin/cbox-disabled.gif differ
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index 1db0f44..6723d04 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -5,6 +5,7 @@ pref("extensions.{9533f794-00b4-4354-aa15-c2bbda6989f8}.description", "chrome://
pref("browser.tabs.warnOnClose", false);
// Extension prefs
-pref("extensions.firetray.close_hides", true);
+pref("extensions.firetray.hides_on_close", true);
+pref("extensions.firetray.hides_on_minimize", true);
// exposed in 1 tree, hence 2 branches: serverTypes, excludedAccounts
pref("extensions.firetray.mail_accounts", '{ "serverTypes": {"pop3":{"order":1,"excluded":false}, "imap":{"order":1,"excluded":false}, "movemail":{"order":2,"excluded":true}, "none":{"order":3,"excluded":false}, "rss":{"order":4,"excluded":true}, "nntp":{"order":5,"excluded":true}}, "excludedAccounts": [] }'); // JSON
--
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