Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/TotpDialog.cpp')
-rw-r--r--src/gui/TotpDialog.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/TotpDialog.cpp b/src/gui/TotpDialog.cpp
index a9e4272d2..3f438e9ae 100644
--- a/src/gui/TotpDialog.cpp
+++ b/src/gui/TotpDialog.cpp
@@ -22,6 +22,9 @@
#include "core/Clock.h"
#include "core/Config.h"
#include "gui/Clipboard.h"
+#include "gui/MainWindow.h"
+
+#include <QShortcut>
TotpDialog::TotpDialog(QWidget* parent, Entry* entry)
: QDialog(parent)
@@ -39,6 +42,7 @@ TotpDialog::TotpDialog(QWidget* parent, Entry* entry)
resetCounter();
updateProgressBar();
+ connect(parent, SIGNAL(lockedDatabase()), SLOT(close()));
connect(&m_totpUpdateTimer, SIGNAL(timeout()), this, SLOT(updateProgressBar()));
connect(&m_totpUpdateTimer, SIGNAL(timeout()), this, SLOT(updateSeconds()));
m_totpUpdateTimer.start(m_step * 10);
@@ -46,6 +50,8 @@ TotpDialog::TotpDialog(QWidget* parent, Entry* entry)
setAttribute(Qt::WA_DeleteOnClose);
+ new QShortcut(QKeySequence(QKeySequence::Copy), this, SLOT(copyToClipboard()));
+
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Copy"));
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
@@ -59,8 +65,13 @@ TotpDialog::~TotpDialog()
void TotpDialog::copyToClipboard()
{
clipboard()->setText(m_entry->totp());
- if (config()->get("MinimizeOnCopy").toBool()) {
- qobject_cast<DatabaseWidget*>(parent())->window()->showMinimized();
+ if (config()->get("HideWindowOnCopy").toBool()) {
+ if (config()->get("MinimizeOnCopy").toBool()) {
+ getMainWindow()->showMinimized();
+ } else if (config()->get("DropToBackgroundOnCopy").toBool()) {
+ getMainWindow()->lower();
+ window()->lower();
+ }
}
}