Add desktop-entry hint to notifications
authorNicolas Fella <nicolas.fella@gmx.de>
Fri, 20 Mar 2020 23:20:51 +0000 (00:20 +0100)
committerNicolas Fella <nicolas.fella@gmx.de>
Fri, 20 Mar 2020 23:25:33 +0000 (00:25 +0100)
This allows the notification server to map a notification to the program's desktop file, which allows the server to do extra things. For example KDE Plasma adds the Nextcloud icon to the notification and allows to configure notifications from Nextcloud.

This is a standard hint from https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html#hints

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
src/gui/systray.cpp

index 081a90b0e17d00763450724e32f80c2110b8c2e5..0a5d7bfd542a418b81ac81a2b4f2a43ba6ededf4 100644 (file)
@@ -121,8 +121,9 @@ void Systray::showMessage(const QString &title, const QString &message, MessageI
 {
 #ifdef USE_FDO_NOTIFICATIONS
     if (QDBusInterface(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE).isValid()) {
+        const QVariantMap hints = {{QStringLiteral("desktop-entry"), QStringLiteral("com.nextcloud.desktopclient.nextcloud")}};
         QList<QVariant> args = QList<QVariant>() << APPLICATION_NAME << quint32(0) << APPLICATION_ICON_NAME
-                                                 << title << message << QStringList() << QVariantMap() << qint32(-1);
+                                                 << title << message << QStringList() << hints << qint32(-1);
         QDBusMessage method = QDBusMessage::createMethodCall(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE, "Notify");
         method.setArguments(args);
         QDBusConnection::sessionBus().asyncCall(method);