-void SystrayNotificationBackend::notificationActivated(SystemTray::ActivationReason reason) {
- if(reason == SystemTray::Trigger) {
- notificationActivated(0);
- }
+void SystrayNotificationBackend::onNotificationActivated(uint notificationId)
+{
+ if (!_blockActivation) {
+ QList<Notification>::iterator i = _notifications.begin();
+ while (i != _notifications.end()) {
+ if (i->notificationId == notificationId) {
+ if (QtUi::mainWindow()->systemTray()->mode() == SystemTray::Legacy)
+ _blockActivation = true; // prevent double activation because both tray icon and bubble might send a signal
+ emit activated(notificationId);
+ break;
+ }
+ ++i;
+ }
+ }
+}
+
+void SystrayNotificationBackend::onNotificationActivated(SystemTray::ActivationReason reason)
+{
+ if (reason == SystemTray::Trigger) {
+ if (_notifications.count()) {
+ onNotificationActivated(_notifications.last().notificationId);
+ }
+ else {
+ GraphicalUi::toggleMainWidget();
+ }
+ }