From 0aa029d548e664ffaeed86a6c75a6ceb40c091c2 Mon Sep 17 00:00:00 2001 From: Ojas Anand Date: Tue, 28 Jul 2020 01:27:07 -0400 Subject: [PATCH] Clear clipboard on database lock - Always store the last copied text - clearCopiedText will always clear clipboard regardless of timer state --- src/gui/Clipboard.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gui/Clipboard.cpp b/src/gui/Clipboard.cpp index ae5d8290f..ddd07f29f 100644 --- a/src/gui/Clipboard.cpp +++ b/src/gui/Clipboard.cpp @@ -67,11 +67,13 @@ void Clipboard::setText(const QString& text, bool clear) } #endif - if (clear && 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); + if (clear) { + m_lastCopied = text; + if (config()->get(Config::Security_ClearClipboard).toBool()) { + int timeout = config()->get(Config::Security_ClearClipboardTimeout).toInt(); + if (timeout > 0) { + m_timer->start(timeout * 1000); + } } } } @@ -80,8 +82,9 @@ void Clipboard::clearCopiedText() { if (m_timer->isActive()) { m_timer->stop(); - clearClipboard(); } + + clearClipboard(); } void Clipboard::clearClipboard()