mirror of
https://github.com/moparisthebest/FireTray
synced 2024-12-22 05:48:49 -05:00
cleaning
This commit is contained in:
parent
de08f67324
commit
8c362f89f2
@ -352,7 +352,7 @@ var firetrayUIOptions = {
|
||||
firetray.Utils.prefService.setIntPref("excluded_folders_flags",
|
||||
excludedFoldersFlags);
|
||||
|
||||
firetray.Messaging.updateMsgCount();
|
||||
firetray.Messaging.updateMsgCountWithCb();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -395,7 +395,7 @@ var firetrayUIOptions = {
|
||||
document.getElementById("pane1")
|
||||
.userChangedValue(document.getElementById("ui_tree_mail_accounts"));
|
||||
|
||||
firetray.Messaging.updateMsgCount();
|
||||
firetray.Messaging.updateMsgCountWithCb();
|
||||
},
|
||||
|
||||
_userChangeValueTreeServerTypes: function(event) {
|
||||
|
@ -86,7 +86,7 @@ firetray.Handler = {
|
||||
Cu.import("resource://firetray/FiretrayMessaging.jsm");
|
||||
if (firetray.Utils.prefService.getBoolPref("mail_notification_enabled")) {
|
||||
firetray.Messaging.init();
|
||||
firetray.Messaging.updateMsgCount();
|
||||
firetray.Messaging.updateMsgCountWithCb();
|
||||
}
|
||||
} catch (x) {
|
||||
F.ERROR(x);
|
||||
@ -396,7 +396,7 @@ firetray.PrefListener = new PrefListener(
|
||||
firetray.StatusIcon.loadThemedIcons();
|
||||
case 'message_count_type':
|
||||
case 'folder_count_recursive':
|
||||
firetray.Messaging.updateMsgCount();
|
||||
firetray.Messaging.updateMsgCountWithCb();
|
||||
break;
|
||||
case 'app_mail_icon_names':
|
||||
case 'app_browser_icon_names':
|
||||
@ -404,7 +404,7 @@ firetray.PrefListener = new PrefListener(
|
||||
firetray.StatusIcon.loadThemedIcons();
|
||||
case 'app_icon_type':
|
||||
if (firetray.Handler.inMailApp)
|
||||
firetray.Messaging.updateMsgCount();
|
||||
firetray.Messaging.updateMsgCountWithCb();
|
||||
else
|
||||
firetray.Handler.setIconImageDefault();
|
||||
break;
|
||||
|
@ -47,8 +47,7 @@ firetray.Messaging = {
|
||||
},
|
||||
|
||||
shutdown: function() {
|
||||
if (!this.initialized)
|
||||
return;
|
||||
if (!this.initialized) return;
|
||||
F.LOG("Disabling Messaging");
|
||||
|
||||
this.cleaningTimer.cancel();
|
||||
@ -105,12 +104,12 @@ firetray.Messaging = {
|
||||
|
||||
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) { // TotalUnreadMessages, BiffState (per server)
|
||||
F.LOG("OnItemIntPropertyChanged "+property+" for folder "+item.prettyName+" was "+oldValue+" became "+newValue+" NEW MESSAGES="+item.getNumNewMessages(true));
|
||||
this.updateMsgCount(item, property, oldValue, newValue);
|
||||
this.onMsgCountChange(item, property, oldValue, newValue);
|
||||
},
|
||||
|
||||
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) { // NewMessages (per folder)
|
||||
F.LOG("OnItemBoolPropertyChanged "+property+" for folder "+item.prettyName+" was "+oldValue+" became "+newValue+" NEW MESSAGES="+item.getNumNewMessages(true));
|
||||
this.updateMsgCount(item, property, oldValue, newValue);
|
||||
this.onMsgCountChange(item, property, oldValue, newValue);
|
||||
},
|
||||
|
||||
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {
|
||||
@ -121,7 +120,7 @@ firetray.Messaging = {
|
||||
F.LOG("OnItemEvent"+event+" for folder "+item.prettyName);
|
||||
},
|
||||
|
||||
updateMsgCount: function(item, property, oldValue, newValue) {
|
||||
onMsgCountChange: function(item, property, oldValue, newValue) {
|
||||
let excludedFoldersFlags = firetray.Utils.prefService.getIntPref("excluded_folders_flags");
|
||||
let msgCountType = firetray.Utils.prefService.getIntPref("message_count_type");
|
||||
|
||||
@ -129,27 +128,32 @@ firetray.Messaging = {
|
||||
let prop = property.toString();
|
||||
if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD &&
|
||||
prop === "TotalUnreadMessages") {
|
||||
firetray.Messaging.updateMsgCount();
|
||||
firetray.Messaging.updateMsgCountWithCb();
|
||||
} else if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW &&
|
||||
prop === "NewMessages") {
|
||||
if (oldValue === true && newValue === false)
|
||||
item.setNumNewMessages(0); // https://bugzilla.mozilla.org/show_bug.cgi?id=727460
|
||||
firetray.Messaging.updateMsgCount();
|
||||
firetray.Messaging.updateMsgCountWithCb();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* computes and display new msg count
|
||||
* @param callback: optional callback to call when msgCount changed.
|
||||
*/
|
||||
updateMsgCount: function() {
|
||||
F.LOG("updateMsgCount");
|
||||
updateMsgCountWithCb: function(callback) {
|
||||
F.LOG("updateMsgCountWithCb");
|
||||
if (!this.initialized) return;
|
||||
|
||||
if (!this.initialized)
|
||||
return;
|
||||
if ("undefined" === typeof(callback) || !callback) callback = function() { // default
|
||||
firetray.Messaging.updateIcon(msgCount);
|
||||
|
||||
let mailChangeTriggerFile = firetray.Utils.prefService.getCharPref("mail_change_trigger");
|
||||
if (mailChangeTriggerFile)
|
||||
firetray.Messaging.runProcess(mailChangeTriggerFile, [msgCount.toString()]);
|
||||
};
|
||||
|
||||
// initialize
|
||||
let msgCount;
|
||||
let msgCountType = firetray.Utils.prefService.getIntPref("message_count_type");
|
||||
F.LOG("msgCountType="+msgCountType);
|
||||
@ -161,15 +165,8 @@ firetray.Messaging = {
|
||||
F.ERROR('unknown message count type');
|
||||
|
||||
if (msgCount !== this.currentMsgCount) {
|
||||
|
||||
this.updateIcon(msgCount);
|
||||
|
||||
let mailChangeTriggerFile = firetray.Utils.prefService.getCharPref("mail_change_trigger");
|
||||
if (mailChangeTriggerFile)
|
||||
this.runProcess(mailChangeTriggerFile, [msgCount.toString()]);
|
||||
|
||||
callback.call(this);
|
||||
this.currentMsgCount = msgCount;
|
||||
|
||||
} else {
|
||||
F.LOG("message count unchanged");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user