https://bugs.kde.org/show_bug.cgi?id=386330

            Bug ID: 386330
           Summary: Ability for QML plasmoids to detect when a
                    notification action is clicked
           Product: plasmashell
           Version: 5.10.5
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: Notifications
          Assignee: k...@privat.broulik.de
          Reporter: zrenf...@gmail.com
                CC: plasma-b...@kde.org
  Target Milestone: 1.0

I'm abusing the notification dataengine to create notifications in my widgets.
Right now I can send notifications (with action buttons), but I can't tell what
button the user clicked.

The "invokeAction" operation (notifcation applet => dataengine), emits:

emit m_engine->ActionInvoked(id,
parameters()[QStringLiteral("actionId")].toString());

https://github.com/KDE/plasma-workspace/blob/master/dataengines/notifications/notificationaction.cpp#L53

however, a QML widget can't connect to that since the DataEngine isn't exposed.
PlasmaCore.DataSource wraps m_dataEngine, but doesn't expose it.

https://github.com/KDE/plasma-framework/blob/91eb0749ed7f0d1439a60e67bc7a23c41636c93c/src/declarativeimports/core/datasource.h#L190

I'm not sure what would be the best way to expose the ActionInvoked signal to
QML.

-----

If your wondering what I'm using:
https://github.com/Zren/plasma-applets/blob/master/org.kde.plasma.eventcalendar/package/contents/ui/NotificationManager.qml



I use dataSource.serviceForSource("notifications") to get a
Plasma::DataService. In our case, we get NotificationService.

https://github.com/KDE/plasma-workspace/blob/master/dataengines/notifications/notificationservice.h

Which also doesn't expose the DataEngine.

https://api.kde.org/frameworks/plasma-framework/html/service_8cpp_source.html#l00087

The NotificationService returns a NotiticationAction (which extends
Plasma::ServiceJob).
When we use the "createNotification" operation on that serviceJob, its "result"
is the notificationId, which is useful for later.

int rv = m_engine->createNotification(...);
setResult(rv);

https://github.com/KDE/plasma-workspace/blob/master/dataengines/notifications/notificationaction.cpp#L60

The NotificationAction/ServiceJob has a reference to the NotificationEngine, so
it might be possible to have it connect to the ActionInvoked/NotificationClosed
signals.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to