summary refs log tree commit diff
path: root/src/notifications
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-01-20 23:59:27 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-01-20 23:59:27 +0100
commit2605ce9a894217f5e6d51400498c0f67168187cd (patch)
treedcf4d7a849f9c24c544bdf8fb9a2b37938fd22ac /src/notifications
parentMerge branch 'fixBorkedDbus' of https://github.com/LorenDB/nheko into LorenDB... (diff)
downloadnheko-2605ce9a894217f5e6d51400498c0f67168187cd.tar.xz
Clean up notification watching a bit
Diffstat (limited to 'src/notifications')
-rw-r--r--src/notifications/ManagerLinux.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/notifications/ManagerLinux.cpp b/src/notifications/ManagerLinux.cpp

index 326803b2..8f7261e6 100644 --- a/src/notifications/ManagerLinux.cpp +++ b/src/notifications/ManagerLinux.cpp
@@ -52,8 +52,6 @@ NotificationsManager::postNotification(const QString &roomid, const QString &text, const QImage &icon) { - Q_UNUSED(icon) - QVariantMap hints; hints["image-data"] = icon; hints["sound-name"] = "message-new-instant"; @@ -75,8 +73,8 @@ NotificationsManager::postNotification(const QString &roomid, static QDBusInterface notifyApp("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications"); - auto call = notifyApp.asyncCallWithArgumentList("Notify", argumentList); - auto watcher = new QDBusPendingCallWatcher{QDBusPendingCall{QDBusPendingReply{call}}}; + QDBusPendingCall call = notifyApp.asyncCallWithArgumentList("Notify", argumentList); + auto watcher = new QDBusPendingCallWatcher{call, this}; connect( watcher, &QDBusPendingCallWatcher::finished, this, [watcher, this, roomid, eventid]() { if (watcher->reply().type() == QDBusMessage::ErrorMessage) @@ -91,14 +89,11 @@ NotificationsManager::postNotification(const QString &roomid, void NotificationsManager::closeNotification(uint id) { - QList<QVariant> argumentList; - argumentList << (uint)id; // replace_id - static QDBusInterface closeCall("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications"); - auto call = closeCall.asyncCallWithArgumentList("CloseNotification", argumentList); - auto watcher = new QDBusPendingCallWatcher{QDBusPendingCall{QDBusPendingReply{call}}}; + auto call = closeCall.asyncCall("CloseNotification", (uint)id); // replace_id + auto watcher = new QDBusPendingCallWatcher{call, this}; connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher, this]() { if (watcher->reply().type() == QDBusMessage::ErrorMessage) { qDebug() << "D-Bus Error:" << watcher->reply().errorMessage();