diff options
Diffstat (limited to 'Swift/QtUI/QtSystemTray.cpp')
-rw-r--r-- | Swift/QtUI/QtSystemTray.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Swift/QtUI/QtSystemTray.cpp b/Swift/QtUI/QtSystemTray.cpp index f1c8e27..e85f13f 100644 --- a/Swift/QtUI/QtSystemTray.cpp +++ b/Swift/QtUI/QtSystemTray.cpp @@ -5,8 +5,9 @@ #include <QResource> namespace Swift { -QtSystemTray::QtSystemTray() : standardIcon_(":icons/tray-standard.png"), newMessageIcon_(":icons/new-chat.png") { +QtSystemTray::QtSystemTray() : QObject(), standardIcon_(":icons/tray-standard.png"), newMessageIcon_(":icons/new-chat.png") { trayIcon_ = new QSystemTrayIcon(standardIcon_); + connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(handleIconActivated(QSystemTrayIcon::ActivationReason))); trayIcon_->show(); } @@ -18,4 +19,9 @@ void QtSystemTray::setUnreadMessages(bool some) { trayIcon_->setIcon(some ? newMessageIcon_ : standardIcon_); } +void QtSystemTray::handleIconActivated(QSystemTrayIcon::ActivationReason reason) { + if (reason == QSystemTrayIcon::Trigger) { + emit clicked(); + } +} } |