We ported units to use the PlasmaCore.Units singleton earlier; now it's
time to do the same thing for PlasmaCore.Theme.
There are no UI changes or regressions detected.
This allows a client to mark a notification as "resident" which means it will
not be closed by the sever when expired or an action is invoked, thus transferring
full control over notification life time to the client.
A notification popup still times out as normal (unless persistent, of course)
but the notification remains alive until the client revokes it or a user
explicitly closes it.
It is opt-in so that a client can expect the notification lifetime to be
indefinite and explicitly close it when an action is invoked on its end.
For example, show "Open with Gwenview" with its icon after downloading
an image file, and "Open with..." in case there is no associated application.
While at it also give an icon to the "Open Containing Folder" button.
Also, port it to use a `KIO::mimetypeJob` to make it asynchronous
and work on remote locations. To make for a less jarring transition (icon suddenly
appearing, causing text reflow and the dialog to resize), take an initial
guess about the mimetype using the file extension while the job is running.
Furthermore, hide the "Open" actions in case the job fails which likely means
the file doesn't exist anymore or cannot be accessed, and as as result
probably cannot be opened anyway.
The context property version is slower to access and won't be supported
in Qt6. Let's port away from it and use the singleton version instead.
Here was my full process for making this change:
1. Made the change with `find . -name '*.qml' | xargs perl -pi -e 's/units\./PlasmaCore\.Units\./g'`
2. Verified no more occurrences with `grep -r " units."`
3. Made sure this didn't change any comments in a silly way by inspecting the output of `git diff | grep "+ " | grep "//"`
4. Manually inspected the full git diff to make sure there were no other unintentional or silly changes (there were none)
5. verified that all changed files have the PlasmaCore import with the correct name with `for FILE in `git status | grep modified | cut -d ":" -f 3`; do grep -q "as PlasmaCore" $FILE || echo "$FILE needs the PlasmaCore import"; done`
The restriction on having an amount of files to be processed was to avoid
showing whatever last file had been copied as destination.
However, we already only fall back to using the "destination" label contents
when there is a single file (cf. `NotificationManager::JobPrivate::destUrl()`),
making it safe to assume destUrl is always a predicatble/useful location.
CCBUG: 408778
Ensures built-in functionality like double- and triple-clicking text works.
Also lets us get rid of the custom text selection handling, replacing it with
an even filter class.
BUG: 431398
FIXED-IN: 5.22.0
For some reason beyond me when all elements in the JobItem turn invisible,
e.g. when a job finishes (its progress bar hideS), and there are no action
buttons (e.g. when a job fails), the Loader does not collapse properly.
I find it weird that when I've just trashed some files - presumably to get rid
of them - it then offers me to open that file or the trash folder once done.
I've seen popup being null when spamming notification removal.
Perhaps when the model already yanked the item under us before the Instantiator
had a chance to update its count... Not sure about the implications, but it
silences a warning I observed.
Qt 5.14 introduced new restoreMode mandatory property. Fix warnings like this one:
QML Binding: Not restoring previous value because restoreMode has not been set.
To provide some more direct feedback that the job is paused and an easy to spot
place to click to resume.
I chose to check the button instead of changing the icon like is done in Media
Controller for more visual feedback. A job is also seldom paused so having it
more obvious when it is the case aids the user better.
Qt 5.15 introduced new syntax for defining Connections. Fix warnings like this one:
QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
the comboboix of a very rarely used feature right
in the header area is super noisy, looks misaligned and puts the feature
in a too much prominent role.
Put everything under a popup menu, mustually exclusive actions will be
shown as radiobuttons
So one can, for instance, quickly delete an unwanted screenshot.
It follows the usual Trash context menu actions, i.e. move to trash is only
shown for local files and locations that support moving, Delete is shown for
remote locations or when enabled in settings.
Swapping of the action when holding Shift is not implemented.
BUG: 428159
FIXED-IN: 5.21.0
The previous calculation multiplied the DPR by `units.smallSpacing`, which was not correct; we wanted DPR added to the existing margin, not multiplied by it.
Also using Math.floor is safer since Math.round sometimes rounds up (e.g. in case DPR is 2.501) which can cause undesirable effects.
BUG: 425911
In case a context menu is opened, we want to check the dialog it came from.
This fixes the case of notifications dancing around when opening a context menu in
System Tray but does not fix the case when opening a context menu in the notification
itself since there it cannot know that the still open System Tray popup is the one
we should evade and not the popup with the menu in it.
CCBUG: 426187
This brings the PlasmoidHeading used in the notification item into
visual consistency with other PlasmoidHeadings, once we merge
https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/98.
When using a color scheme that lacks Header colors, there is no visual
change whatsoever.