Fix startup

This commit is contained in:
Ximi1970
2020-05-09 18:04:04 +02:00
parent dbfcc2b5bb
commit 95702daa71
2 changed files with 10 additions and 11 deletions

View File

@@ -45,18 +45,18 @@ SysTrayX.Messaging = {
}
*/
browser.folderChange.onUnreadMailChange.addListener(function (unread) {
console.debug("folderChangeListener: " + unread);
SysTrayX.Messaging.unreadCb(unread);
});
// Set the count type in the folderChange listener
browser.folderChange.setCountType(Number(SysTrayX.Messaging.countType));
// Set the filters in the folderChange listener
browser.folderChange.setFilters(SysTrayX.Messaging.filtersExt);
browser.folderChange.onUnreadMailChange.addListener(function (unread) {
console.debug("folderChangeListener: " + unread);
SysTrayX.Messaging.unreadCb(unread)
});
// Try to catch the window state
browser.windows.onFocusChanged.addListener(SysTrayX.Window.focusChanged);
},

View File

@@ -136,9 +136,6 @@ var SysTrayX = {
// Get the mail accounts using MailServices
this.getAccounts();
// Trigger first count
this.updateMsgCountWithCb();
// Start listener
MailServices.mailSession.AddFolderListener(
this.mailSessionListener,
@@ -162,11 +159,13 @@ var SysTrayX = {
},
setCountType: function (type) {
console.debug("setCountType: " + type);
if (type === 0) {
this.countType = this.MESSAGE_COUNT_TYPE_UNREAD;
} else if (type === 1) {
this.countType = this.MESSAGE_COUNT_TYPE_NEW;
} else console.log("Unknown count type");
} else console.log("Unknown count type: " + type);
// Update count
this.updateMsgCountWithCb();
@@ -281,7 +280,7 @@ var SysTrayX = {
this.countMessages("UnreadMessages");
} else if (msgCountType === SysTrayX.MESSAGE_COUNT_TYPE_NEW) {
this.countMessages("HasNewMessages");
} else console.error("Unknown message count type");
} else console.error("Unknown message count type: " + msgCountType);
// currentMsgCount and newMsgCount may be integers or bool, which do
// also support comparison operations