D12373: Klipper: Remove first history item on clipboard clear
Robert Hoffmann
noreply at phabricator.kde.org
Wed Apr 25 15:29:06 UTC 2018
hoffmannrobert added a comment.
In D12373#253569 <https://phabricator.kde.org/D12373#253569>, @davidedmundson wrote:
> mimeData is key value pairs, you can have many pieces of mimeData.
>
> So we have text/plain with the password as before
> and x-kde-passwordManagerHint data "secret"
>
> We still use the text/plain mimeData for context, but klipper ignores entries where that other mimeData is present.
Thanks, I wasn't aware of this.
It works well for mode QClipboard::Clipboard. In Klipper::applyClipChanges() these entries can be sorted out, so they aren't inserted into history.
But it doesn't work for QClipboard::Selection. As soon as there is some other mimeData present with unsupported type, the selection stays empty with the warning 'QClipboard: Cannot transfer data, no data available'.
This is run in Keepassx:
QClipboard* clipboard = QApplication::clipboard();
QMimeData* mimeData = new QMimeData();
const QString secretHint = "secret";
QByteArray ba = secretHint.toUtf8();
mimeData->setText(text);
mimeData->setData("x-kde-passwordManagerHint", ba);
clipboard->setMimeData(mimeData, QClipboard::Clipboard); // this works
if (clipboard->supportsSelection()) {
clipboard->setMimeData(mimeData, QClipboard::Selection); // this not, warning: QClipboard: Cannot transfer data, no data available
}
REPOSITORY
R120 Plasma Workspace
REVISION DETAIL
https://phabricator.kde.org/D12373
To: hoffmannrobert
Cc: graesslin, broulik, davidedmundson, plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180425/b3fb27b2/attachment.html>
More information about the Plasma-devel
mailing list