Count of new messages in systemtray tooltip corrected

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2872 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-05-09 08:01:52 +00:00
parent a726f3c063
commit 20908b2c48

View File

@ -358,25 +358,26 @@ void MainWindow::updateStatus()
std::list<MsgInfoSummary>::const_iterator it; std::list<MsgInfoSummary>::const_iterator it;
rsMsgs -> getMessageSummaries(msgList); rsMsgs -> getMessageSummaries(msgList);
bool new_msg = false ;
int newInboxCount = 0; int newInboxCount = 0;
for(it = msgList.begin(); it != msgList.end(); it++) for(it = msgList.begin(); it != msgList.end(); it++)
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_INBOX && ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW)) if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_INBOX && ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW))
new_msg = true ;
newInboxCount ++; newInboxCount ++;
if(new_msg) if(newInboxCount)
messageAction->setIcon(QIcon(QPixmap(":/images/messages_new.png"))) ; messageAction->setIcon(QIcon(QPixmap(":/images/messages_new.png"))) ;
else else
messageAction->setIcon(QIcon(QPixmap(":/images/evolution.png"))) ; messageAction->setIcon(QIcon(QPixmap(":/images/evolution.png"))) ;
if(new_msg) if(newInboxCount)
{ {
trayIcon->setIcon(QIcon(":/images/newmsg.png")); trayIcon->setIcon(QIcon(":/images/newmsg.png"));
trayIcon->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 new message").arg(newInboxCount)); if (newInboxCount > 1) {
} trayIcon->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 new messages").arg(newInboxCount));
} else {
trayIcon->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 new message").arg(newInboxCount));
}
}
else if (online == 0) else if (online == 0)
{ {
trayIcon->setIcon(QIcon(IMAGE_NOONLINE)); trayIcon->setIcon(QIcon(IMAGE_NOONLINE));