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 // Set the count type in the folderChange listener
browser.folderChange.setCountType(Number(SysTrayX.Messaging.countType)); browser.folderChange.setCountType(Number(SysTrayX.Messaging.countType));
// Set the filters in the folderChange listener // Set the filters in the folderChange listener
browser.folderChange.setFilters(SysTrayX.Messaging.filtersExt); 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 // Try to catch the window state
browser.windows.onFocusChanged.addListener(SysTrayX.Window.focusChanged); browser.windows.onFocusChanged.addListener(SysTrayX.Window.focusChanged);
}, },

View File

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