Set password hint on BSD, fill selection on macOS again (#8949)

This commit is contained in:
Klemens Nanni 2023-01-29 18:17:04 +04:00 committed by GitHub
parent 3e3e87d3c5
commit 93831f64a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,24 +52,19 @@ void Clipboard::setText(const QString& text, bool clear)
} }
auto* mime = new QMimeData; auto* mime = new QMimeData;
#ifdef Q_OS_MACOS
mime->setText(text); mime->setText(text);
#if defined(Q_OS_MACOS)
mime->setData("application/x-nspasteboard-concealed-type", text.toUtf8()); mime->setData("application/x-nspasteboard-concealed-type", text.toUtf8());
clipboard->setMimeData(mime, QClipboard::Clipboard); #elif defined(Q_OS_UNIX)
#else
mime->setText(text);
#ifdef Q_OS_LINUX
mime->setData("x-kde-passwordManagerHint", QByteArrayLiteral("secret")); mime->setData("x-kde-passwordManagerHint", QByteArrayLiteral("secret"));
#endif #elif defined(Q_OS_WIN)
#ifdef Q_OS_WIN
mime->setData("ExcludeClipboardContentFromMonitorProcessing", QByteArrayLiteral("1")); mime->setData("ExcludeClipboardContentFromMonitorProcessing", QByteArrayLiteral("1"));
#endif #endif
clipboard->setMimeData(mime, QClipboard::Clipboard);
if (clipboard->supportsSelection()) { if (clipboard->supportsSelection()) {
clipboard->setMimeData(mime, QClipboard::Selection); clipboard->setMimeData(mime, QClipboard::Selection);
} }
#endif clipboard->setMimeData(mime, QClipboard::Clipboard);
if (clear) { if (clear) {
m_lastCopied = text; m_lastCopied = text;