|
|
|
@ -1,12 +1,12 @@ |
|
|
|
|
#include "notifications/Manager.h" |
|
|
|
|
|
|
|
|
|
#include <QDebug> |
|
|
|
|
#include <QImage> |
|
|
|
|
#include <QDBusConnection> |
|
|
|
|
#include <QDBusMessage> |
|
|
|
|
#include <QDBusMetaType> |
|
|
|
|
#include <QDBusPendingCallWatcher> |
|
|
|
|
#include <QDBusPendingReply> |
|
|
|
|
#include <QDebug> |
|
|
|
|
#include <QImage> |
|
|
|
|
|
|
|
|
|
NotificationsManager::NotificationsManager(QObject *parent) |
|
|
|
|
: QObject(parent) |
|
|
|
@ -75,14 +75,17 @@ NotificationsManager::postNotification(const QString &roomid, |
|
|
|
|
static QDBusInterface notifyApp("org.freedesktop.Notifications", |
|
|
|
|
"/org/freedesktop/Notifications", |
|
|
|
|
"org.freedesktop.Notifications"); |
|
|
|
|
auto call = |
|
|
|
|
notifyApp.asyncCallWithArgumentList("Notify", argumentList); |
|
|
|
|
auto call = notifyApp.asyncCallWithArgumentList("Notify", argumentList); |
|
|
|
|
QDBusPendingCallWatcher watcher{QDBusPendingReply{call}}; |
|
|
|
|
connect(&watcher, &QDBusPendingCallWatcher::finished, this, [&watcher, this, &roomid, &eventid]() { |
|
|
|
|
connect(&watcher, |
|
|
|
|
&QDBusPendingCallWatcher::finished, |
|
|
|
|
this, |
|
|
|
|
[&watcher, this, &roomid, &eventid]() { |
|
|
|
|
if (watcher.reply().type() == QDBusMessage::ErrorMessage) |
|
|
|
|
qDebug() << "D-Bus Error:" << watcher.reply().errorMessage(); |
|
|
|
|
else |
|
|
|
|
notificationIds[watcher.reply().arguments().first().toUInt()] = roomEventId{roomid, eventid}; |
|
|
|
|
notificationIds[watcher.reply().arguments().first().toUInt()] = |
|
|
|
|
roomEventId{roomid, eventid}; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|