diff options
author | Balazs Gyurak <ba32107@gmail.com> | 2019-11-17 23:39:16 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2020-03-10 06:08:43 +0300 |
commit | 8ae718b747b99c6917fb55814304d6e263fb3414 (patch) | |
tree | 5a7776c773745111ecb9357001c712783ad631bc /src/gui/DatabaseWidget.cpp | |
parent | fb5173cebd98b4417966e8eeaa30f32b061923d5 (diff) |
Ignore focus when checking toolbar state
* Support copy shortcut when in QTextEdit to prevent inadvertently copying password when interacting with those elements.
Diffstat (limited to 'src/gui/DatabaseWidget.cpp')
-rw-r--r-- | src/gui/DatabaseWidget.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 5bda87be1..6434ba923 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -30,6 +30,7 @@ #include <QLineEdit> #include <QProcess> #include <QSplitter> +#include <QTextEdit> #include "autotype/AutoType.h" #include "core/Config.h" @@ -638,6 +639,14 @@ void DatabaseWidget::copyUsername() void DatabaseWidget::copyPassword() { + // QTextEdit does not properly trap Ctrl+C copy shortcut + // if a text edit has focus pass the copy operation to it + auto textEdit = qobject_cast<QTextEdit*>(focusWidget()); + if (textEdit) { + textEdit->copy(); + return; + } + auto currentEntry = currentSelectedEntry(); if (currentEntry) { setClipboardTextAndMinimize(currentEntry->resolveMultiplePlaceholders(currentEntry->password())); @@ -1566,11 +1575,6 @@ bool DatabaseWidget::isGroupSelected() const return m_groupView->currentGroup(); } -bool DatabaseWidget::currentEntryHasFocus() -{ - return m_entryView->numberOfSelectedEntries() > 0 && m_entryView->hasFocus(); -} - bool DatabaseWidget::currentEntryHasTitle() { auto currentEntry = currentSelectedEntry(); |