[Pkg-mozext-commits] [firetray] 84/399: options: UI for notification preferences
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 164c43453fb840314644b8fb2603799550f426a0
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Sun Nov 6 16:28:39 2011 +0100
options: UI for notification preferences
---
TODO | 2 --
src/chrome/content/options.js | 52 +++++++++++++++++++++++++++++++++-
src/chrome/content/options.xul | 48 ++++++++++++++++++++++++-------
src/chrome/locale/en-US/options.dtd | 12 ++++++++
src/chrome/skin/message-mail-new.png | Bin 0 -> 770 bytes
src/defaults/preferences/prefs.js | 4 +++
6 files changed, 104 insertions(+), 14 deletions(-)
diff --git a/TODO b/TODO
index 6edfcf1..d7beca0 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,5 @@
=TODO=
-* options: in mail_accounts, have serverTypes interact with excludedAccounts
-
* add "enable biff notification" option. And if true:
radio choice option with:
diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 0eeabf3..2090257 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -14,6 +14,7 @@ if ("undefined" == typeof(firetray)) {
var firetray = {};
};
+const NOTIFICATION_CUSTOM_ICON = 3;
const TREEROW_ACCOUNT_OR_SERVER_TYPE_NAME = 0;
const TREEROW_ACCOUNT_OR_SERVER_TYPE_EXCLUDED = 1;
const TREEROW_ACCOUNT_OR_SERVER_TYPE_ORDER = 2;
@@ -25,7 +26,7 @@ firetray.UIOptions = {
onLoad: function() {
if(firetray.Handler.inMailApp) {
Cu.import("resource://firetray/FiretrayMessaging.jsm");
- this.populateTreeAccountsOrServerTypes();
+ this.initMailControls();
} else {
this.hideElement("mail_tab");
}
@@ -58,6 +59,55 @@ firetray.UIOptions = {
targetNode.hidden = true;
},
+ disableGroup: function(group,disableval) {
+ try {
+ for(var i=0; i< group.childNodes.length; i++)
+ group.childNodes[i].disabled = disableval;
+ } catch(e) {}
+ },
+
+ initMailControls: function() {
+ this.initNotificationSettings();
+ this.populateTreeAccountsOrServerTypes();
+ },
+
+ initNotificationSettings: function() {
+ let radioMailNotify = document.getElementById("radiogroup_mail_notification");
+ let prefMailNotification = firetray.Utils.prefService.getIntPref("mail_notification");
+ radioMailNotify.selectedIndex = prefMailNotification;
+ let customIconGroup = document.getElementById("custom_mail_icon");
+ this.disableGroup(customIconGroup,
+ (prefMailNotification !== NOTIFICATION_CUSTOM_ICON));
+ },
+
+ updateNotificationSettings: function() {
+ let radioMailNotify = document.getElementById("radiogroup_mail_notification");
+ let prefMailNotification =
+ firetray.Utils.prefService.setIntPref("mail_notification", radioMailNotify.selectedIndex);
+ let customIconGroup = document.getElementById("custom_mail_icon");
+ this.disableGroup(customIconGroup,
+ (radioMailNotify.selectedIndex !== NOTIFICATION_CUSTOM_ICON));
+ },
+
+ chooseMailIconFile: function() {
+ var filepath = document.getElementById("custom_mail_icon_filename");
+ this._chooseIconFile(filepath);
+ },
+
+ _chooseIconFile: function(iconFilename) {
+ const nsIFilePicker = Ci.nsIFilePicker;
+ var filePicker = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ filePicker.init(window, "Select Icon", nsIFilePicker.modeOpen); // FIXME: i18n
+ filePicker.appendFilters(nsIFilePicker.filterImages);
+
+ var rv = filePicker.show();
+ if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
+ iconFilename.value = filePicker.file.path;
+ var prefpane = document.getElementById("pane1");
+ prefpane.userChangedValue(iconFilename);
+ }
+ },
+
/**
* should be called only for excludedAccounts
*/
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index bc38f08..e1b17a2 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -11,12 +11,10 @@
<prefpane id="pane1" label="&pane1.title;">
<preferences>
- <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"/>
+ <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_custom_mail_icon" name="extensions.firetray.custom_mail_icon" type="string" />
+ <preference id="pref_string_mail_accounts" name="extensions.firetray.mail_accounts" type="string"/>
</preferences>
@@ -31,8 +29,7 @@
<tabpanel id="general_tabpanel">
<groupbox flex="1">
- <caption label="&windows_behaviour;"
- tooltiptext="&windows_behaviour.tooltip;" />
+ <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;"
@@ -48,12 +45,40 @@
<tabpanel id="input_tabpanel" />
<tabpanel id="mail_tabpanel">
+ <vbox align="left" flex="1" >
+
+ <!-- <label value="&mail_notification;" class="header" /> -->
+ <groupbox flex="1">
+ <caption label="&mail_notification;" />
+ <radiogroup id="radiogroup_mail_notification">
+ <radio id="radio_mail_icon1" label="&mail_notification_disabled;"
+ accesskey="&mail_notification_disabled.accesskey;"
+ oncommand="firetray.UIOptions.updateNotificationSettings()" />
+ <radio id="radio_mail_icon2" label="&mail_notification_unread_count;"
+ accesskey="&mail_notification_unread_count.accesskey;"
+ oncommand="firetray.UIOptions.updateNotificationSettings()" />
+ <radio id="radio_mail_icon3" label="&mail_notification_newmail_icon;"
+ accesskey="&mail_notification_newmail_icon.accesskey;"
+ oncommand="firetray.UIOptions.updateNotificationSettings()" />
+ <radio id="radio_mail_icon4" label="&mail_notification_custom_mail_icon;"
+ accesskey="&mail_notification_custom_mail_icon.accesskey;"
+ oncommand="firetray.UIOptions.updateNotificationSettings()" />
+ </radiogroup>
+ </groupbox>
+
+ <hbox id="custom_mail_icon" align="center" flex="1" >
+ <textbox id="custom_mail_icon_filename" preference="pref_string_custom_mail_icon"
+ hidden="FALSE" flex="1" />
+ <button id="custom_mail_icon_select" label="&choose;"
+ accesskey="&choose.accesskey;"
+ oncommand="firetray.UIOptions.chooseMailIconFile()" />
+ </hbox>
<groupbox flex="1">
<caption label="&unread_count_account_exceptions;"
tooltiptext="&unread_count_account_exceptions.tooltip;" />
- <tree id="ui_tree_mail_accounts" flex="1" rows="10"
+ <tree id="ui_tree_mail_accounts" flex="1" rows="10" minwidth="300"
seltype="single" editable="true"
preference-editable="true"
preference="pref_string_mail_accounts"
@@ -68,8 +93,8 @@
tooltiptext="&account_or_server_type_excluded.tooltip;"/>
<splitter class="tree-splitter" resizeafter="grow"/>
<treecol id="account_or_server_type_order" editable="true"
- persist="width"
- flex="1" hidden= "true" label="&account_or_server_type_order;"
+ persist="width" flex="1" hidden= "true"
+ label="&account_or_server_type_order;"
tooltiptext="&account_or_server_type_order.tooltip;"/>
</treecols>
<treechildren id="ui_mail_accounts" flex="1" />
@@ -77,6 +102,7 @@
</groupbox>
+ </vbox>
</tabpanel>
</tabpanels>
diff --git a/src/chrome/locale/en-US/options.dtd b/src/chrome/locale/en-US/options.dtd
index 272fb9a..aaad682 100644
--- a/src/chrome/locale/en-US/options.dtd
+++ b/src/chrome/locale/en-US/options.dtd
@@ -15,6 +15,18 @@
<!ENTITY bool_hides_on_minimize.label "Minimize window hides to tray">
<!ENTITY bool_hides_on_minimize.accesskey "M">
+<!ENTITY mail_notification "Mail notification">
+<!ENTITY mail_notification_disabled "disabled">
+<!ENTITY mail_notification_disabled.accesskey "D">
+<!ENTITY mail_notification_unread_count "display unread messages count">
+<!ENTITY mail_notification_unread_count.accesskey "U">
+<!ENTITY mail_notification_newmail_icon "display newmail icon">
+<!ENTITY mail_notification_newmail_icon.accesskey "N">
+<!ENTITY mail_notification_custom_mail_icon "display custom icon">
+<!ENTITY mail_notification_custom_mail_icon.accesskey "I">
+<!ENTITY choose "Choose">
+<!ENTITY choose.accesskey "O">
+
<!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/message-mail-new.png b/src/chrome/skin/message-mail-new.png
new file mode 100644
index 0000000..3691cb7
Binary files /dev/null and b/src/chrome/skin/message-mail-new.png differ
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index 6723d04..486acb9 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -5,7 +5,11 @@ pref("extensions.{9533f794-00b4-4354-aa15-c2bbda6989f8}.description", "chrome://
pref("browser.tabs.warnOnClose", false);
// Extension prefs
+
pref("extensions.firetray.hides_on_close", true);
pref("extensions.firetray.hides_on_minimize", true);
+
+pref("extensions.firetray.mail_notification", 1);
+pref("extensions.firetray.custom_mail_icon", "");
// 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