libnotificationmanager: Implement XDG Notification portal version 1
- libnotificationmanager: Implement XDG Notification portal version 1
Rather than proxying via KNotification on xdg-desktop-portal-kde, implement the portal in plasmashell, so we get full control over all aspects of it.
This adds a dedicated "Portal" singleton doing the DBus stuff and a PortalNotificationsModel that is fed as another source model to the concatenate proxy model.
Since libnotificationmanager is built around notification IDs as "uint", this is kept, and the lookup back to appId+notificationId done on the portal handler side.
- libnotificationmanager: Avoid double lookup on image cache
Instead of contains+object, just get the value. It returns nullptr if there is no such object.
- libnotificationmanager: Set max cost of image cache in constructor
Ensures that it is always called, even if not using the DBus Server.
- libnotificationmanager: Move configure to AbstractNotificationsModel
It will be needed for portal notifications, too.
While at it, also fetch an XDG token and pass it to the command launcher job. It normally does that automatically when you have a focused window but with notifications we don't.
Reason for the change
We have to make a fair share of hacks and assumptions to make the Notification portal proxy via KNotification. Instead, implement the actual portal and give us full control over it.
See for example !5765 (closed) which this will adress properly™
Test plan
Tested with Spotify Flatpak, Telegram Flatpak, and xdg-portal-test-kde.
Notifications show, both with icons (though only tested the string case) and pixmaps. Default action works and action buttons, too. Apps can revoke them, and they time out.
It sucks that you can't add any vendor properties though so we'll never be able to transition to portal notifications despite some of the shortcomings of fdo notifications.
Screenshots or screen recordings
Looks literally the same as a regular notification :) It should no longer show a random Plasma icon, though, which happens because we abuse the plasma_workspace.notifyrc for the portal.