diff options
Diffstat (limited to 'src/gui/DatabaseWidget.cpp')
-rw-r--r-- | src/gui/DatabaseWidget.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 115c560f0..946757e40 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -42,6 +42,8 @@ #include "gui/ChangeMasterKeyWidget.h" #include "gui/Clipboard.h" #include "gui/CloneDialog.h" +#include "gui/SetupTotpDialog.h" +#include "gui/TotpDialog.h" #include "gui/DatabaseOpenWidget.h" #include "gui/DatabaseSettingsWidget.h" #include "gui/KeePass1OpenWidget.h" @@ -333,6 +335,48 @@ void DatabaseWidget::cloneEntry() return; } +void DatabaseWidget::showTotp() +{ + Entry* currentEntry = m_entryView->currentEntry(); + if (!currentEntry) { + Q_ASSERT(false); + return; + } + + TotpDialog* totpDialog = new TotpDialog(this, currentEntry); + totpDialog->open(); +} + +void DatabaseWidget::copyTotp() +{ + Entry* currentEntry = m_entryView->currentEntry(); + if (!currentEntry) { + Q_ASSERT(false); + return; + } + setClipboardTextAndMinimize(currentEntry->totp()); +} + +void DatabaseWidget::setupTotp() +{ + Entry* currentEntry = m_entryView->currentEntry(); + if (!currentEntry) { + Q_ASSERT(false); + return; + } + + SetupTotpDialog* setupTotpDialog = new SetupTotpDialog(this, currentEntry); + if (currentEntry->hasTotp()) { + setupTotpDialog->setSeed(currentEntry->totpSeed()); + setupTotpDialog->setStep(currentEntry->totpStep()); + setupTotpDialog->setDigits(currentEntry->totpDigits()); + } + + setupTotpDialog->open(); + +} + + void DatabaseWidget::deleteEntries() { const QModelIndexList selected = m_entryView->selectionModel()->selectedRows(); @@ -1225,6 +1269,17 @@ bool DatabaseWidget::currentEntryHasUrl() return !currentEntry->resolveMultiplePlaceholders(currentEntry->url()).isEmpty(); } + +bool DatabaseWidget::currentEntryHasTotp() +{ + Entry* currentEntry = m_entryView->currentEntry(); + if (!currentEntry) { + Q_ASSERT(false); + return false; + } + return currentEntry->hasTotp(); +} + bool DatabaseWidget::currentEntryHasNotes() { Entry* currentEntry = m_entryView->currentEntry(); |