Summary:
Fixed clearing the clipboard when clearing history
(bug #409366 caused by 3bd6ac34ed)
Properly synchronize clipboard content and history
(deleting last item in history didn't clear the clipboard).
Keep last image in history even if we are ignoring images, but without preview
(so that we can still clear history, and the tooltip says truth about clipboard content).
Fixed tray icon tooltip text.
Do not scale small images up in clipboard Plasmoid.
BUG: 409366
{F7168503}
Test Plan:
Spectacle -> [Copy to Clipboard]
Paste into Dolphin (clipboard content)
Deleting single items from clipboard
Clearing the entire history
Reviewers: #plasma, #plasma_workspaces, ngraham, davidedmundson
Reviewed By: #plasma, #plasma_workspaces, ngraham, davidedmundson
Subscribers: GB_2, davidre, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D22684
By invoking saveHistory after each change we ensure that the clipboard
doesn't lose data in case klipper (or in dataengine mode plasmashell)
crashes.
To not cause stalls, the saving is performed in a thread using
QtConcurrentRun. As klipper itself is not thread save a Mutex is
used to lock changes in the HistoryModel.
To not overload the system the save operations are delayed and queued.
Each save is delayed by five seconds since the last clipboard change.
So if the clipboard is changed multiple times in a short interval it
doesn't get synced to the disk till the interaction has settled.
BUG: 343333
FIXED-IN: 5.3.0
REVIEW: 122382
The UuidRole is mapped to a new data role which provides the item's
uuid base64 encoded. This is needed as the uuid will be passed through
the data engine and needs to be string convertable.
The HistoryModel provides the needed functionality to be hooked into
History. It's not setting up the chaining (that's implicit in a model)
and uses shared pointer. Both needs further adjustments in Klipper.