From 20908b2c489746f9808b24b03e2b45949513763f Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 9 May 2010 08:01:52 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/MainWindow.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 1d22ba41f..9e72646b2 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -358,25 +358,26 @@ void MainWindow::updateStatus() std::list::const_iterator it; rsMsgs -> getMessageSummaries(msgList); - bool new_msg = false ; int newInboxCount = 0; 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)) - new_msg = true ; newInboxCount ++; - - if(new_msg) - messageAction->setIcon(QIcon(QPixmap(":/images/messages_new.png"))) ; - else - messageAction->setIcon(QIcon(QPixmap(":/images/evolution.png"))) ; + if(newInboxCount) + messageAction->setIcon(QIcon(QPixmap(":/images/messages_new.png"))) ; + else + messageAction->setIcon(QIcon(QPixmap(":/images/evolution.png"))) ; - if(new_msg) + if(newInboxCount) { 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) { trayIcon->setIcon(QIcon(IMAGE_NOONLINE));