mirror of
https://github.com/moparisthebest/FireTray
synced 2024-12-22 13:58:48 -05:00
* cleaner fix to binding problem for options also
* improve "hides" options behaviour
This commit is contained in:
parent
aadf727816
commit
bdfdf5294c
@ -7,27 +7,20 @@ const Cu = Components.utils;
|
|||||||
Cu.import("resource://firetray/FiretrayHandler.jsm");
|
Cu.import("resource://firetray/FiretrayHandler.jsm");
|
||||||
Cu.import("resource://firetray/commons.js");
|
Cu.import("resource://firetray/commons.js");
|
||||||
|
|
||||||
/**
|
|
||||||
* firetray namespace.
|
|
||||||
*/
|
|
||||||
if ("undefined" == typeof(firetray)) {
|
|
||||||
var firetray = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
const TREEROW_ACCOUNT_OR_SERVER_TYPE_NAME = 0;
|
const TREEROW_ACCOUNT_OR_SERVER_TYPE_NAME = 0;
|
||||||
const TREEROW_ACCOUNT_OR_SERVER_TYPE_EXCLUDED = 1;
|
const TREEROW_ACCOUNT_OR_SERVER_TYPE_EXCLUDED = 1;
|
||||||
const TREEROW_ACCOUNT_OR_SERVER_TYPE_ORDER = 2;
|
const TREEROW_ACCOUNT_OR_SERVER_TYPE_ORDER = 2;
|
||||||
const TREELEVEL_SERVER_TYPES = 0;
|
const TREELEVEL_SERVER_TYPES = 0;
|
||||||
const TREELEVEL_EXCLUDED_ACCOUNTS = 1;
|
const TREELEVEL_EXCLUDED_ACCOUNTS = 1;
|
||||||
|
|
||||||
firetray.UIOptions = {
|
var firetrayUIOptions = {
|
||||||
strings: null,
|
strings: null,
|
||||||
|
|
||||||
onLoad: function(e) {
|
onLoad: function(e) {
|
||||||
window.removeEventListener('load', arguments.callee, true);
|
|
||||||
|
|
||||||
this.strings = document.getElementById("firetray-options-strings");
|
this.strings = document.getElementById("firetray-options-strings");
|
||||||
|
|
||||||
|
this.initWindowAndIconControls();
|
||||||
|
|
||||||
if(firetray.Handler.inMailApp) {
|
if(firetray.Handler.inMailApp) {
|
||||||
Cu.import("resource://firetray/FiretrayMessaging.jsm");
|
Cu.import("resource://firetray/FiretrayMessaging.jsm");
|
||||||
this.initMailControls();
|
this.initMailControls();
|
||||||
@ -35,12 +28,9 @@ firetray.UIOptions = {
|
|||||||
let mailTab = document.getElementById("mail_tab");
|
let mailTab = document.getElementById("mail_tab");
|
||||||
this.hideElement(mailTab, true);
|
this.hideElement(mailTab, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onQuit: function(e) {
|
onQuit: function(e) {
|
||||||
window.removeEventListener('unload', arguments.callee, true);
|
|
||||||
|
|
||||||
// cleaning: removeEventListener on cells
|
// cleaning: removeEventListener on cells
|
||||||
// NOTE: not sure this is necessary on window close
|
// NOTE: not sure this is necessary on window close
|
||||||
let tree = document.getElementById("ui_tree_mail_accounts");
|
let tree = document.getElementById("ui_tree_mail_accounts");
|
||||||
@ -72,6 +62,16 @@ firetray.UIOptions = {
|
|||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
initWindowAndIconControls: function() {
|
||||||
|
this.disableHidesOptions(!firetray.Utils.prefService.getBoolPref('hides_on_close'));
|
||||||
|
},
|
||||||
|
|
||||||
|
disableHidesOptions: function(doDisable) {
|
||||||
|
LOG("doDisable="+doDisable);
|
||||||
|
document.getElementById('ui_hides_single_window').disabled = doDisable;
|
||||||
|
// TODO: NOT IMPLEMENTED YET: document.getElementById('ui_hides_on_minimize').disabled = doDisable;
|
||||||
|
},
|
||||||
|
|
||||||
initMailControls: function() {
|
initMailControls: function() {
|
||||||
this.populateExcludedFoldersList();
|
this.populateExcludedFoldersList();
|
||||||
this.populateTreeAccountsOrServerTypes();
|
this.populateTreeAccountsOrServerTypes();
|
||||||
@ -229,7 +229,7 @@ firetray.UIOptions = {
|
|||||||
'ancestor::xul:treeitem[1]/descendant::xul:treechildren//xul:treerow');
|
'ancestor::xul:treeitem[1]/descendant::xul:treechildren//xul:treerow');
|
||||||
LOG("subRows="+subRows);
|
LOG("subRows="+subRows);
|
||||||
for (let i=0; i<subRows.length; i++) {
|
for (let i=0; i<subRows.length; i++) {
|
||||||
firetray.UIOptions._disableTreeRow(
|
firetrayUIOptions._disableTreeRow(
|
||||||
subRows[i], (checkboxCell.getAttribute("value") === "false"));
|
subRows[i], (checkboxCell.getAttribute("value") === "false"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,5 +419,13 @@ firetray.UIOptions = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
window.addEventListener('load', firetray.UIOptions.onLoad, false);
|
window.addEventListener(
|
||||||
window.addEventListener('unload', firetray.UIOptions.onQuit, false);
|
'load', function (e) {
|
||||||
|
removeEventListener('load', arguments.callee, true);
|
||||||
|
firetrayUIOptions.onLoad(); },
|
||||||
|
false);
|
||||||
|
window.addEventListener(
|
||||||
|
'unload', function (e) {
|
||||||
|
removeEventListener('unload', arguments.callee, true);
|
||||||
|
firetrayUIOptions.onQuit(); },
|
||||||
|
false);
|
||||||
|
@ -42,14 +42,15 @@
|
|||||||
|
|
||||||
<checkbox id="ui_hides_on_close" preference="pref_bool_hides_on_close"
|
<checkbox id="ui_hides_on_close" preference="pref_bool_hides_on_close"
|
||||||
label="&bool_hides_on_close.label;"
|
label="&bool_hides_on_close.label;"
|
||||||
accesskey="&bool_hides_on_close.accesskey;"/>
|
accesskey="&bool_hides_on_close.accesskey;"
|
||||||
|
onclick="firetrayUIOptions.disableHidesOptions(this.checked);"/>
|
||||||
|
<checkbox id="ui_hides_single_window" preference="pref_bool_hides_single_window"
|
||||||
|
label="&bool_hides_single_window.label;"
|
||||||
|
accesskey="&bool_hides_single_window.accesskey;"/>
|
||||||
<checkbox id="ui_hides_on_minimize" preference="pref_bool_hides_on_minimize"
|
<checkbox id="ui_hides_on_minimize" preference="pref_bool_hides_on_minimize"
|
||||||
label="&bool_hides_on_minimize.label;"
|
label="&bool_hides_on_minimize.label;"
|
||||||
accesskey="&bool_hides_on_minimize.accesskey;"
|
accesskey="&bool_hides_on_minimize.accesskey;"
|
||||||
disabled="true" tooltiptext="&NOT_IMPLEMENTED_YET;"/>
|
disabled="true" tooltiptext="&NOT_IMPLEMENTED_YET;"/>
|
||||||
<checkbox id="ui_hides_single_window" preference="pref_bool_hides_single_window"
|
|
||||||
label="&bool_hides_single_window.label;"
|
|
||||||
accesskey="&bool_hides_single_window.accesskey;"/>
|
|
||||||
</groupbox>
|
</groupbox>
|
||||||
|
|
||||||
</tabpanel>
|
</tabpanel>
|
||||||
@ -65,11 +66,11 @@
|
|||||||
<radiogroup id="radiogroup_mail_notification">
|
<radiogroup id="radiogroup_mail_notification">
|
||||||
<radio id="radio_mail_icon1" label="&mail_notification_disabled.label;"
|
<radio id="radio_mail_icon1" label="&mail_notification_disabled.label;"
|
||||||
accesskey="&mail_notification_disabled.accesskey;"
|
accesskey="&mail_notification_disabled.accesskey;"
|
||||||
oncommand="firetray.UIOptions.updateNotificationSettings()" />
|
oncommand="firetrayUIOptions.updateNotificationSettings()" />
|
||||||
<hbox>
|
<hbox>
|
||||||
<radio id="radio_mail_icon2" label="&mail_notification_unread_count.label;"
|
<radio id="radio_mail_icon2" label="&mail_notification_unread_count.label;"
|
||||||
accesskey="&mail_notification_unread_count.accesskey;"
|
accesskey="&mail_notification_unread_count.accesskey;"
|
||||||
oncommand="firetray.UIOptions.updateNotificationSettings()" />
|
oncommand="firetrayUIOptions.updateNotificationSettings()" />
|
||||||
<hbox id="icon_text_color" align="center">
|
<hbox id="icon_text_color" align="center">
|
||||||
<label value="&icon_text_color;" accesskey="&icon_text_color.accesskey;"/>
|
<label value="&icon_text_color;" accesskey="&icon_text_color.accesskey;"/>
|
||||||
<colorpicker id="btn_icon_text_color" type="button"
|
<colorpicker id="btn_icon_text_color" type="button"
|
||||||
@ -79,17 +80,17 @@
|
|||||||
</hbox>
|
</hbox>
|
||||||
<radio id="radio_mail_icon3" label="&mail_notification_newmail_icon.label;"
|
<radio id="radio_mail_icon3" label="&mail_notification_newmail_icon.label;"
|
||||||
accesskey="&mail_notification_newmail_icon.accesskey;"
|
accesskey="&mail_notification_newmail_icon.accesskey;"
|
||||||
oncommand="firetray.UIOptions.updateNotificationSettings()" />
|
oncommand="firetrayUIOptions.updateNotificationSettings()" />
|
||||||
<hbox>
|
<hbox>
|
||||||
<radio id="radio_mail_icon4" label="&mail_notification_custom_mail_icon.label;"
|
<radio id="radio_mail_icon4" label="&mail_notification_custom_mail_icon.label;"
|
||||||
accesskey="&mail_notification_custom_mail_icon.accesskey;"
|
accesskey="&mail_notification_custom_mail_icon.accesskey;"
|
||||||
oncommand="firetray.UIOptions.updateNotificationSettings()" />
|
oncommand="firetrayUIOptions.updateNotificationSettings()" />
|
||||||
<hbox id="custom_mail_icon" align="center" flex="1" >
|
<hbox id="custom_mail_icon" align="center" flex="1" >
|
||||||
<textbox id="custom_mail_icon_filename" preference="pref_string_custom_mail_icon"
|
<textbox id="custom_mail_icon_filename" preference="pref_string_custom_mail_icon"
|
||||||
onblur="firetray.Messaging.updateUnreadMsgCount();" flex="1" />
|
onblur="firetray.Messaging.updateUnreadMsgCount();" flex="1" />
|
||||||
<button id="custom_mail_icon_select" label="&choose;"
|
<button id="custom_mail_icon_select" label="&choose;"
|
||||||
accesskey="&choose.accesskey;"
|
accesskey="&choose.accesskey;"
|
||||||
oncommand="firetray.UIOptions.chooseMailIconFile()" />
|
oncommand="firetrayUIOptions.chooseMailIconFile()" />
|
||||||
</hbox>
|
</hbox>
|
||||||
</hbox>
|
</hbox>
|
||||||
</radiogroup>
|
</radiogroup>
|
||||||
@ -106,7 +107,7 @@
|
|||||||
|
|
||||||
<listbox id="excluded_folders_list" rows="7" flex="1" seltype="multiple"
|
<listbox id="excluded_folders_list" rows="7" flex="1" seltype="multiple"
|
||||||
tooltiptext="&excluded_folders_list.tooltip;"
|
tooltiptext="&excluded_folders_list.tooltip;"
|
||||||
onselect="firetray.UIOptions.updateExcludedFoldersPref()"
|
onselect="firetrayUIOptions.updateExcludedFoldersPref()"
|
||||||
observes="broadcaster-notification-disabled" />
|
observes="broadcaster-notification-disabled" />
|
||||||
</groupbox>
|
</groupbox>
|
||||||
|
|
||||||
@ -123,7 +124,7 @@
|
|||||||
observes="broadcaster-notification-disabled"
|
observes="broadcaster-notification-disabled"
|
||||||
preference-editable="true"
|
preference-editable="true"
|
||||||
preference="pref_string_mail_accounts"
|
preference="pref_string_mail_accounts"
|
||||||
onsynctopreference="return firetray.UIOptions.saveTreeAccountsOrServerTypes();">
|
onsynctopreference="return firetrayUIOptions.saveTreeAccountsOrServerTypes();">
|
||||||
<treecols>
|
<treecols>
|
||||||
<treecol id="account_or_server_type_name" editable="false" flex="2"
|
<treecol id="account_or_server_type_name" editable="false" flex="2"
|
||||||
persist="width" primary="true" label="&account_or_server_type_name;"
|
persist="width" primary="true" label="&account_or_server_type_name;"
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
<!ENTITY bool_hides_on_close.label "Closing window hides to tray">
|
<!ENTITY bool_hides_on_close.label "Closing window hides to tray">
|
||||||
<!ENTITY bool_hides_on_close.accesskey "C">
|
<!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 bool_hides_single_window.label "Hide the current window only (not all windows)">
|
<!ENTITY bool_hides_single_window.label "Hide the current window only (not all windows)">
|
||||||
<!ENTITY bool_hides_single_window.accesskey "H">
|
<!ENTITY bool_hides_single_window.accesskey "H">
|
||||||
|
<!ENTITY bool_hides_on_minimize.label "Minimize window hides to tray">
|
||||||
|
<!ENTITY bool_hides_on_minimize.accesskey "M">
|
||||||
|
|
||||||
<!ENTITY mail_notification.label "Mail notification">
|
<!ENTITY mail_notification.label "Mail notification">
|
||||||
<!ENTITY mail_notification_disabled.label "disabled">
|
<!ENTITY mail_notification_disabled.label "disabled">
|
||||||
|
@ -8,7 +8,7 @@ pref("browser.tabs.warnOnClose", false);
|
|||||||
|
|
||||||
pref("extensions.firetray.hides_on_close", true);
|
pref("extensions.firetray.hides_on_close", true);
|
||||||
pref("extensions.firetray.hides_on_minimize", true);
|
pref("extensions.firetray.hides_on_minimize", true);
|
||||||
pref("extensions.firetray.hides_single_window", true); // FIXME: should default to 'false'
|
pref("extensions.firetray.hides_single_window", false);
|
||||||
|
|
||||||
pref("extensions.firetray.mail_notification", 1);
|
pref("extensions.firetray.mail_notification", 1);
|
||||||
pref("extensions.firetray.icon_text_color", "#000000");
|
pref("extensions.firetray.icon_text_color", "#000000");
|
||||||
|
Loading…
Reference in New Issue
Block a user