-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58acaa4
commit 2992e10
Showing
4 changed files
with
14 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/* | ||
* Copyright (C) 2017 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2012 Felix Geyer <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -43,7 +44,7 @@ Clipboard::Clipboard(QObject* parent) | |
connect(qApp, SIGNAL(aboutToQuit()), SLOT(clearCopiedText())); | ||
} | ||
|
||
void Clipboard::setText(const QString& text, bool secret) | ||
void Clipboard::setText(const QString& text) | ||
{ | ||
QClipboard* clipboard = QApplication::clipboard(); | ||
|
||
|
@@ -53,24 +54,14 @@ void Clipboard::setText(const QString& text, bool secret) | |
mime->setData("application/x-nspasteboard-concealed-type", text.toUtf8()); | ||
clipboard->setMimeData(mime, QClipboard::Clipboard); | ||
#else | ||
if (secret) { | ||
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()) { | ||
QMimeData* mimeSelection = new QMimeData(); | ||
mimeSelection->setText(text); | ||
mimeSelection->setData("x-kde-passwordManagerHint", secretBa); | ||
clipboard->setMimeData(mimeSelection, QClipboard::Selection); | ||
} | ||
} else { | ||
clipboard->setText(text, QClipboard::Clipboard); | ||
if (clipboard->supportsSelection()) { | ||
clipboard->setText(text, QClipboard::Selection); | ||
} | ||
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->setMimeData(mime, QClipboard::Selection); | ||
} | ||
#endif | ||
|
||
|
@@ -83,11 +74,6 @@ void Clipboard::setText(const QString& text, bool secret) | |
} | ||
} | ||
|
||
void Clipboard::setSecretText(const QString& text) | ||
{ | ||
setText(text, true); | ||
} | ||
|
||
void Clipboard::clearCopiedText() | ||
{ | ||
if (m_timer->isActive()) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/* | ||
* Copyright (C) 2017 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2012 Felix Geyer <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -31,8 +32,7 @@ class Clipboard : public QObject | |
Q_OBJECT | ||
|
||
public: | ||
void setText(const QString& text, bool secret = false); | ||
void setSecretText(const QString& text); | ||
void setText(const QString& text); | ||
|
||
static Clipboard* instance(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters