mirror of
https://github.com/moparisthebest/FireTray
synced 2024-08-13 15:53:47 -04:00
fix tooltip for count type 'new messages'
This commit is contained in:
parent
45b56329c8
commit
56b0fe6332
@ -3,3 +3,4 @@ popupMenu.itemLabel.Quit=Quit
|
|||||||
popupMenu.itemLabel.NewWindow=New window
|
popupMenu.itemLabel.NewWindow=New window
|
||||||
popupMenu.itemLabel.NewMessage=New message
|
popupMenu.itemLabel.NewMessage=New message
|
||||||
tooltip.unread_messages=#1 unread message;#1 unread messages
|
tooltip.unread_messages=#1 unread message;#1 unread messages
|
||||||
|
tooltip.new_messages=New messages !
|
||||||
|
@ -109,7 +109,22 @@ firetray.Messaging = {
|
|||||||
if (!this.initialized)
|
if (!this.initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let newMsgCount = this.countMessages();
|
let msgCountType = firetray.Utils.prefService.getIntPref("message_count_type");
|
||||||
|
LOG("msgCountType="+msgCountType);
|
||||||
|
let folderCountFunction, localizedTooltip;
|
||||||
|
if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD) {
|
||||||
|
folderCountFunction = this.unreadMsgCountIterate;
|
||||||
|
localizedTooltip = PluralForm.get(
|
||||||
|
newMsgCount,
|
||||||
|
firetray.Utils.strings.GetStringFromName("tooltip.unread_messages"))
|
||||||
|
.replace("#1", newMsgCount);;
|
||||||
|
} else if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW) {
|
||||||
|
folderCountFunction = this.newMsgCountIterate;
|
||||||
|
localizedTooltip = firetray.Utils.strings.GetStringFromName("tooltip.new_messages");
|
||||||
|
} else
|
||||||
|
ERROR('unknown message count type');
|
||||||
|
|
||||||
|
let newMsgCount = this.countMessages(folderCountFunction);
|
||||||
|
|
||||||
// update icon
|
// update icon
|
||||||
if (newMsgCount == 0) {
|
if (newMsgCount == 0) {
|
||||||
@ -134,11 +149,14 @@ firetray.Messaging = {
|
|||||||
ERROR("Unknown notification mode: "+prefMailNotification);
|
ERROR("Unknown notification mode: "+prefMailNotification);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localizedMessage = PluralForm.get(
|
if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD) {
|
||||||
newMsgCount,
|
folderCountFunction = this.unreadMsgCountIterate;
|
||||||
firetray.Utils.strings.GetStringFromName("tooltip.unread_messages"))
|
} else if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW) {
|
||||||
.replace("#1", newMsgCount);;
|
folderCountFunction = this.newMsgCountIterate;
|
||||||
firetray.Handler.setIconTooltip(localizedMessage);
|
} else
|
||||||
|
ERROR('unknown message count type');
|
||||||
|
|
||||||
|
firetray.Handler.setIconTooltip(localizedTooltip);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw "negative message count"; // should never happen
|
throw "negative message count"; // should never happen
|
||||||
@ -149,18 +167,7 @@ firetray.Messaging = {
|
|||||||
/**
|
/**
|
||||||
* computes total unread or new message count.
|
* computes total unread or new message count.
|
||||||
*/
|
*/
|
||||||
countMessages: function() {
|
countMessages: function(folderCountFunction) {
|
||||||
let msgCountType = firetray.Utils.prefService.getIntPref("message_count_type");
|
|
||||||
LOG("msgCountType="+msgCountType);
|
|
||||||
|
|
||||||
let folderCountFunction;
|
|
||||||
if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD) {
|
|
||||||
folderCountFunction = this.unreadMsgCountIterate;
|
|
||||||
} else if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW) {
|
|
||||||
folderCountFunction = this.newMsgCountIterate;
|
|
||||||
} else
|
|
||||||
ERROR('unknown message count type');
|
|
||||||
|
|
||||||
let mailAccounts = firetray.Utils.getObjPref('mail_accounts');
|
let mailAccounts = firetray.Utils.getObjPref('mail_accounts');
|
||||||
LOG("mail accounts from pref: "+JSON.stringify(mailAccounts));
|
LOG("mail accounts from pref: "+JSON.stringify(mailAccounts));
|
||||||
let serverTypes = mailAccounts["serverTypes"];
|
let serverTypes = mailAccounts["serverTypes"];
|
||||||
|
@ -198,7 +198,8 @@ firetray.Window = {
|
|||||||
// better visual effect if visibility set here instead of before
|
// better visual effect if visibility set here instead of before
|
||||||
firetray.Window.setVisibility(xid, true);
|
firetray.Window.setVisibility(xid, true);
|
||||||
|
|
||||||
firetray.Window.restoreDesktop(xid); // after show
|
// after show
|
||||||
|
firetray.Window.restoreDesktop(xid);
|
||||||
firetray.Window.activate(xid);
|
firetray.Window.activate(xid);
|
||||||
|
|
||||||
firetray.PopupMenu.hideSingleWindowItemAndSeparatorMaybe(xid);
|
firetray.PopupMenu.hideSingleWindowItemAndSeparatorMaybe(xid);
|
||||||
|
Loading…
Reference in New Issue
Block a user