Clear clipboard on database lock

- Always store the last copied text
- clearCopiedText will always clear clipboard
  regardless of timer state
This commit is contained in:
Ojas Anand 2020-07-28 01:27:07 -04:00 committed by Jonathan White
parent c511cb518c
commit 0aa029d548
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01

View File

@ -67,21 +67,24 @@ void Clipboard::setText(const QString& text, bool clear)
}
#endif
if (clear && config()->get(Config::Security_ClearClipboard).toBool()) {
if (clear) {
m_lastCopied = text;
if (config()->get(Config::Security_ClearClipboard).toBool()) {
int timeout = config()->get(Config::Security_ClearClipboardTimeout).toInt();
if (timeout > 0) {
m_lastCopied = text;
m_timer->start(timeout * 1000);
}
}
}
}
void Clipboard::clearCopiedText()
{
if (m_timer->isActive()) {
m_timer->stop();
clearClipboard();
}
clearClipboard();
}
void Clipboard::clearClipboard()