diff --git a/src/gui/Clipboard.cpp b/src/gui/Clipboard.cpp index b30fd64b7..9f4d7ed62 100644 --- a/src/gui/Clipboard.cpp +++ b/src/gui/Clipboard.cpp @@ -1,4 +1,5 @@ /* + * Copyright (C) 2017 KeePassXC Team * Copyright (C) 2012 Felix Geyer * * This program is free software: you can redistribute it and/or modify @@ -19,6 +20,7 @@ #include #include +#include #include #include "core/Config.h" @@ -46,15 +48,20 @@ void Clipboard::setText(const QString& text) { QClipboard* clipboard = QApplication::clipboard(); -#ifdef Q_OS_MAC QMimeData* mime = new QMimeData; +#ifdef Q_OS_MAC mime->setText(text); mime->setData("application/x-nspasteboard-concealed-type", text.toUtf8()); clipboard->setMimeData(mime, QClipboard::Clipboard); #else - clipboard->setText(text, QClipboard::Clipboard); + const QString secretStr = "secret"; + QByteArray secretBa = secretStr.toUtf8(); + mime->setText(text); + mime->setData("x-kde-passwordManagerHint", secretBa); + clipboard->setMimeData(mime, QClipboard::Clipboard); + if (clipboard->supportsSelection()) { - clipboard->setText(text, QClipboard::Selection); + clipboard->setMimeData(mime, QClipboard::Selection); } #endif diff --git a/src/gui/Clipboard.h b/src/gui/Clipboard.h index 60c66c885..062d360f0 100644 --- a/src/gui/Clipboard.h +++ b/src/gui/Clipboard.h @@ -1,4 +1,5 @@ /* + * Copyright (C) 2017 KeePassXC Team * Copyright (C) 2012 Felix Geyer * * This program is free software: you can redistribute it and/or modify