void NotificationServerInfo::init()
{
QDBusMessage query = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.Notifications"),
QStringLiteral("/org/freedesktop/Notifications"),
QStringLiteral("org.freedesktop.Notifications"),
QStringLiteral("GetCapabilities"));
QDBusPendingReply reply = QDBusConnection::sessionBus().asyncCall(query);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, reply, watcher] {
watcher->deleteLater();
if (reply.isError()) {
qCWarning(KDECONNECT_CORE) << "Could not query capabilities from notifications server";
return;
}
if (reply.value().contains(QLatin1String("x-kde-display-appname"))) {
m_supportedHints |= X_KDE_DISPLAY_APPNAME;
}
if (reply.value().contains(QLatin1String("x-kde-origin-name"))) {
m_supportedHints |= X_KDE_ORIGIN_NAME;
}
});
}
This method is responsible for retrieving the capabilities from the notifications server.