diff options
Diffstat (limited to 'saltoqd/notificationmanager.cpp')
-rw-r--r-- | saltoqd/notificationmanager.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/saltoqd/notificationmanager.cpp b/saltoqd/notificationmanager.cpp index c78fffb..f6b626f 100644 --- a/saltoqd/notificationmanager.cpp +++ b/saltoqd/notificationmanager.cpp @@ -14,7 +14,8 @@ NotificationManager::NotificationManager(CardManager *card, ToqManager *toq) : void NotificationManager::handleNotification(MonitoredNotification *n) { - Card *card = new Card(QString::number(qint64(n->id()))); + uint notificationId = n->id(); + Card *card = new Card(QString::number(qint64(notificationId))); card->setHeader(n->sender()); card->setTitle(n->summary()); @@ -25,15 +26,20 @@ void NotificationManager::handleNotification(MonitoredNotification *n) connect(n, &MonitoredNotification::closed, this, &NotificationManager::handleClosedNotification); + _cards.insert(notificationId, card); _deck->appendCard(card); } void NotificationManager::handleClosedNotification() { MonitoredNotification *n = static_cast<MonitoredNotification*>(sender()); - Card *card = _cards.take(n); + uint notificationId = n->id(); + Card *card = _cards.take(notificationId); if (card) { _deck->removeCard(card); card->deleteLater(); + } else { + qDebug() << "Notification" << notificationId << "does not have an attached card"; } + disconnect(n, 0, this, 0); } |