Skip to content
Snippets Groups Projects
Commit 1479743e authored by Loren Burkholder's avatar Loren Burkholder
Browse files

Use async call in closeNotification

parent ac36e924
No related branches found
No related tags found
No related merge requests found
Pipeline #432 passed
......@@ -75,19 +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 watcher = new QDBusPendingCall{QDBusPendingReply{call}};
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};
delete watcher;
});
auto call = notifyApp.asyncCallWithArgumentList("Notify", argumentList);
auto watcher = new QDBusPendingCallWatcher{QDBusPendingCall{QDBusPendingReply{call}}};
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};
delete watcher;
});
}
void
......@@ -99,11 +97,13 @@ NotificationsManager::closeNotification(uint id)
static QDBusInterface closeCall("org.freedesktop.Notifications",
"/org/freedesktop/Notifications",
"org.freedesktop.Notifications");
QDBusMessage reply =
closeCall.callWithArgumentList(QDBus::AutoDetect, "CloseNotification", argumentList);
if (reply.type() == QDBusMessage::ErrorMessage) {
qDebug() << "D-Bus Error:" << reply.errorMessage();
}
auto call = closeCall.asyncCallWithArgumentList("CloseNotification", argumentList);
auto watcher = new QDBusPendingCallWatcher{QDBusPendingCall{QDBusPendingReply{call}}};
connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher, this]() {
if (watcher->reply().type() == QDBusMessage::ErrorMessage) {
qDebug() << "D-Bus Error:" << watcher->reply().errorMessage();
};
});
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment