mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-01-05 10:35:47 -05:00
Add TOTP support
This commit is contained in:
parent
7040bef27e
commit
bf57a28654
22 changed files with 1120 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue