Previously the "clear clipboard history?" dialog used `KMessageBox::questionYesNo`
which if "don't ask again" is ticked then saves the answer even if No was answered.
This can cause the user to not be able to ever clear the clipboard ever again. This
commit changes it to `KMessageBox::warningContinueCancel` which doesn't do that, and
is more appropriate for the kind of question we're asking.
BUG: 336053
FIXED-IN: 5.22
This is a mind-blowingly amazing feature, but nobody knows about it
because it's disabled by default since it has no default shortcut, and
there is no visible UI to tell you about it except for the shortcut
configuration view buried in Klipper's settings window.
A similar feature was just recently introduced in Microsoft Windows, and
users have started to ask why no equivalent KDE feature exists, because
they are unaware that it already does! The shortcut Microsoft chose is
Meta+V, which is a completely sensible one. If we set the same shortcut
for the Klipper feature, discoverability is automatically increased
because users familiar with Windows are already becoming accustomed to the
Meta+V shortcut. This is not an argument for deliberately copying
another platform, but rather making use of the user familiarity that
they have helpfully done the hard work of creating for us. Meta+V is
unused and is an appropriate shell-level global shortcut by virtue of
using the Meta key. So let's bind it to this Klipper feature by default.
We do this sometimes, but not consistenly.
The benefit is twofold.
First it improves the diff when adding new values since no existing line needs to be touched.
Second it prevents clang-format from collapsing the definition into a single line, which is undesired for large enums.
7bd9bea072 started using Prison
unconditionally via QML import. So if Prison isn't installed the
clipboard applet stops working, complaining that "org.kde.prison is
not installed".
While it would certainly be possible to add another call to
"find_package(KF5Prison)" with TYPE RUNTIME, the result in
feature_summary would be very confusing, because OPTIONAL has a higher
priority and the runtime hint would vanish if you build with e.g.
-DCMAKE_DISABLE_FIND_PACKAGE_KF5Prison=TRUE.
We have a situation where some clients drop their old offer before
creating a new one. This means klipper tries to fill in the empty
clipboard at the same time the client posts its new real contents.
This adds in a flag (via a hidden mimetype) that klipper is trying to
replace a null clipboard. If this flag is set and our clipboard is not
null because the client has updated it in the meantime we ignore the
klipper update.
It's a workaround, rather than an ideal fix at a data level, but it
solves the problem in the interim.
Summary:
Wayland has an entire new protocol for getting and setting clipboard
when we don't have focus. Unfortunately this means reinventing
QClipboard from the QPA.
Not mergable as-is, especially the hardcoded line in CMakeLists but
uploaded to show direction.
It uses the newly agreed approach of using QtWayland generated classes
in clients directly rather than writing full pimpl API-fixed wrappers
first,
as ultimately that didn't really help do anything.
Code is written so that it can be moved to KWindowSystem if needed by
KDEConnect or others.
Test Plan: Copying and pasting all over the place