summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-07-23 09:59:14 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-07-23 09:59:14 (GMT)
commitcc8eb390a08580900ef2a00b1d3d45ce93a81785 (patch)
tree3ca3388b43ccfdae5bfda4dce9bcc3a86932c6a9 /Swift
parent4826b66b2ac6737c5c0834b6d8b347ddb578d77b (diff)
downloadswift-contrib-cc8eb390a08580900ef2a00b1d3d45ce93a81785.zip
swift-contrib-cc8eb390a08580900ef2a00b1d3d45ce93a81785.tar.bz2
Don't allow a status change to override the new message systray icon.
Resolves: #481
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtSystemTray.cpp27
-rw-r--r--Swift/QtUI/QtSystemTray.h1
2 files changed, 15 insertions, 13 deletions
diff --git a/Swift/QtUI/QtSystemTray.cpp b/Swift/QtUI/QtSystemTray.cpp
index 681e403..57bf20c 100644
--- a/Swift/QtUI/QtSystemTray.cpp
+++ b/Swift/QtUI/QtSystemTray.cpp
@@ -11,7 +11,7 @@
#include <QResource>
namespace Swift {
-QtSystemTray::QtSystemTray() : QObject(), onlineIcon_(":icons/online.png"), awayIcon_(":icons/away.png"), dndIcon_(":icons/dnd.png"), offlineIcon_(":icons/offline.png"), newMessageIcon_(":icons/new-chat.png") {
+QtSystemTray::QtSystemTray() : QObject(), onlineIcon_(":icons/online.png"), awayIcon_(":icons/away.png"), dndIcon_(":icons/dnd.png"), offlineIcon_(":icons/offline.png"), newMessageIcon_(":icons/new-chat.png"), unreadMessages_(false) {
trayIcon_ = new QSystemTrayIcon(offlineIcon_);
connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(handleIconActivated(QSystemTrayIcon::ActivationReason)));
trayIcon_->show();
@@ -22,11 +22,8 @@ QtSystemTray::~QtSystemTray() {
}
void QtSystemTray::setUnreadMessages(bool some) {
- if (some) {
- trayIcon_->setIcon(newMessageIcon_);
- } else {
- updateStatusIcon();
- }
+ unreadMessages_ = some;
+ updateStatusIcon();
}
void QtSystemTray::handleIconActivated(QSystemTrayIcon::ActivationReason reason) {
@@ -40,13 +37,17 @@ void QtSystemTray::setStatusType(StatusShow::Type type) {
}
void QtSystemTray::updateStatusIcon() {
- switch (statusType_) {
- case StatusShow::Online : trayIcon_->setIcon(onlineIcon_);break;
- case StatusShow::FFC : trayIcon_->setIcon(onlineIcon_);break;
- case StatusShow::Away : trayIcon_->setIcon(awayIcon_);break;
- case StatusShow::XA : trayIcon_->setIcon(awayIcon_);break;
- case StatusShow::DND : trayIcon_->setIcon(dndIcon_);break;
- case StatusShow::None : trayIcon_->setIcon(offlineIcon_);break;
+ if (unreadMessages_) {
+ trayIcon_->setIcon(newMessageIcon_);
+ } else {
+ switch (statusType_) {
+ case StatusShow::Online : trayIcon_->setIcon(onlineIcon_);break;
+ case StatusShow::FFC : trayIcon_->setIcon(onlineIcon_);break;
+ case StatusShow::Away : trayIcon_->setIcon(awayIcon_);break;
+ case StatusShow::XA : trayIcon_->setIcon(awayIcon_);break;
+ case StatusShow::DND : trayIcon_->setIcon(dndIcon_);break;
+ case StatusShow::None : trayIcon_->setIcon(offlineIcon_);break;
+ }
}
}
diff --git a/Swift/QtUI/QtSystemTray.h b/Swift/QtUI/QtSystemTray.h
index 136dd4c..c889ecf 100644
--- a/Swift/QtUI/QtSystemTray.h
+++ b/Swift/QtUI/QtSystemTray.h
@@ -33,5 +33,6 @@ namespace Swift {
QIcon dndIcon_;
QIcon offlineIcon_;
QIcon newMessageIcon_;
+ bool unreadMessages_;
};
}