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