mirror of
https://github.com/moparisthebest/FireTray
synced 2024-11-10 19:15:08 -05:00
Merge branch 'master' of https://github.com/SeniorSpielbergo/FireTray into SeniorSpielbergo-master
This commit is contained in:
commit
5a591834cc
@ -31,6 +31,8 @@ var firetrayUIOptions = {
|
||||
this.updateScrollOptions();
|
||||
this.initAppIconType();
|
||||
this.initAppIconNames();
|
||||
this.initNewMailScript();
|
||||
this.initNoNewMailScript();
|
||||
if (firetray.Handler.inMailApp)
|
||||
this.initNewMailIconNames();
|
||||
},
|
||||
@ -207,6 +209,26 @@ var firetrayUIOptions = {
|
||||
return -1;
|
||||
},
|
||||
|
||||
initNewMailScript : function() {
|
||||
document.getElementById("ui_new_mail_script").value =
|
||||
firetray.Utils.prefService.getCharPref("new_mail_script");
|
||||
},
|
||||
|
||||
initNoNewMailScript : function() {
|
||||
document.getElementById("ui_no_new_mail_script").value =
|
||||
firetray.Utils.prefService.getCharPref("no_new_mail_script");
|
||||
},
|
||||
|
||||
updateNewMailScript : function() {
|
||||
let newMailScript = document.getElementById("ui_new_mail_script").value;
|
||||
firetray.Utils.prefService.setCharPref("new_mail_script", newMailScript);
|
||||
},
|
||||
|
||||
updateNoNewMailScript : function() {
|
||||
let noNewMailScript = document.getElementById("ui_no_new_mail_script").value;
|
||||
firetray.Utils.prefService.setCharPref("no_new_mail_script", noNewMailScript);
|
||||
},
|
||||
|
||||
updateNotificationSettings: function() {
|
||||
F.LOG("updateNotificationSettings");
|
||||
let radioMailNotify = document.getElementById("ui_radiogroup_mail_notification");
|
||||
|
@ -36,6 +36,8 @@
|
||||
<preference id="pref_folder_count_recursive" name="extensions.firetray.folder_count_recursive" type="bool" />
|
||||
<preference id="pref_custom_mail_icon" name="extensions.firetray.custom_mail_icon" type="string" />
|
||||
<preference id="pref_mail_accounts" name="extensions.firetray.mail_accounts" type="string"/>
|
||||
<preference id="pref_new_mail_script" name="extensions.firetray.new_mail_script" type="string"/>
|
||||
<preference id="pref_no_new_mail_script" name="extensions.firetray.no_new_mail_script" type="string"/>
|
||||
</preferences>
|
||||
|
||||
<tabbox>
|
||||
@ -219,6 +221,33 @@
|
||||
preference="pref_folder_count_recursive"
|
||||
observes="broadcaster-notification-disabled"/>
|
||||
|
||||
<groupbox id="mail_scripts" flex="1">
|
||||
|
||||
<caption>
|
||||
<label id="ui_mail_scripts_label"
|
||||
value="&mail_scripts.label;"
|
||||
observes="broadcaster-notification-disabled" />
|
||||
</caption>
|
||||
|
||||
<vbox>
|
||||
<label id="ui_new_mail_script_label"
|
||||
value="&new_mail_script.label;"
|
||||
observes="broadcaster-notification-disabled" />
|
||||
<textbox id="ui_new_mail_script" size="18"
|
||||
onchange="firetrayUIOptions.updateNewMailScript();" flex="1" />
|
||||
</vbox>
|
||||
|
||||
<vbox>
|
||||
<label id="ui_no_new_mail_script_label"
|
||||
value="&no_new_mail_script.label;"
|
||||
observes="broadcaster-notification-disabled" />
|
||||
<textbox id="ui_no_new_mail_script" size="18"
|
||||
onchange="firetrayUIOptions.updateNoNewMailScript();" flex="1"
|
||||
label="&no_new_mail_script.label;" />
|
||||
</vbox>
|
||||
|
||||
</groupbox>
|
||||
|
||||
<!-- NOTE: groupbox and caption don't have a 'disabled' attribute !! -->
|
||||
<groupbox id="unread_count_folder_exceptions" flex="1">
|
||||
<!-- label extracted from caption so we can disable it -->
|
||||
|
@ -41,6 +41,10 @@
|
||||
<!ENTITY hide "hide" >
|
||||
<!ENTITY restore "restore" >
|
||||
|
||||
<!ENTITY mail_scripts.label "Scripts run on new mail / no new mail event" >
|
||||
<!ENTITY new_mail_script.label "Script for new mail event:" >
|
||||
<!ENTITY no_new_mail_script.label "Script for no new mail event:" >
|
||||
|
||||
<!ENTITY mail_notification_enabled.label "Enable mail notification">
|
||||
<!ENTITY mail_notification_enabled.accesskey "a">
|
||||
<!ENTITY mail_notification_type.label "Mail notification type">
|
||||
|
@ -27,6 +27,8 @@ pref("extensions.firetray.mail_notification_enabled", true);
|
||||
pref("extensions.firetray.mail_notification_type", 0);
|
||||
pref("extensions.firetray.icon_text_color", "#000000");
|
||||
pref("extensions.firetray.custom_mail_icon", "");
|
||||
pref("extensions.firetray.new_mail_script", "");
|
||||
pref("extensions.firetray.no_new_mail_script", "");
|
||||
// Ci.nsMsgFolderFlags.Archive|Drafts|Junk|Queue|SentMail|Trash|Virtual
|
||||
pref("extensions.firetray.excluded_folders_flags", 1077956384);
|
||||
// exposed in 1 tree, hence 2 branches: serverTypes, excludedAccounts
|
||||
|
@ -25,6 +25,7 @@ const FLDRS_UNINTERESTING = {
|
||||
firetray.Messaging = {
|
||||
initialized: false,
|
||||
cleaningTimer: null,
|
||||
oldMsgCount: 0,
|
||||
|
||||
init: function() {
|
||||
if (this.initialized) {
|
||||
@ -139,6 +140,36 @@ firetray.Messaging = {
|
||||
}
|
||||
},
|
||||
|
||||
runNewMailScript: function() {
|
||||
// create a file for the process
|
||||
var file = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
file.initWithPath(firetray.Utils.prefService.getCharPref("new_mail_script"));
|
||||
|
||||
// create the process
|
||||
var process = Components.classes["@mozilla.org/process/util;1"]
|
||||
.createInstance(Components.interfaces.nsIProcess);
|
||||
process.init(file);
|
||||
|
||||
var args = [ ];
|
||||
process.run(false, args, args.length);
|
||||
},
|
||||
|
||||
runNoNewMailScript: function() {
|
||||
// create a file for the process
|
||||
var file = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
file.initWithPath(firetray.Utils.prefService.getCharPref("no_new_mail_script"));
|
||||
|
||||
// create the process
|
||||
var process = Components.classes["@mozilla.org/process/util;1"]
|
||||
.createInstance(Components.interfaces.nsIProcess);
|
||||
process.init(file);
|
||||
|
||||
var args = [ ];
|
||||
process.run(false, args, args.length);
|
||||
},
|
||||
|
||||
/**
|
||||
* computes and display new msg count
|
||||
*/
|
||||
@ -168,8 +199,12 @@ firetray.Messaging = {
|
||||
if (newMsgCount == 0) {
|
||||
firetray.Handler.setIconImageDefault();
|
||||
firetray.Handler.setIconTooltipDefault();
|
||||
if (this.oldMsgCount > 0) {
|
||||
this.runNoNewMailScript();
|
||||
}
|
||||
|
||||
} else if (newMsgCount > 0) {
|
||||
this.runNewMailScript();
|
||||
let prefMailNotification = firetray.Utils.prefService.getIntPref('mail_notification_type');
|
||||
switch (prefMailNotification) {
|
||||
case FIRETRAY_NOTIFICATION_UNREAD_MESSAGE_COUNT:
|
||||
@ -192,6 +227,7 @@ firetray.Messaging = {
|
||||
} else {
|
||||
throw "negative message count"; // should never happen
|
||||
}
|
||||
this.oldMsgCount = newMsgCount;
|
||||
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user