diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts
index d647e3c39..d4a880dfe 100644
--- a/share/translations/keepassxc_en.ts
+++ b/share/translations/keepassxc_en.ts
@@ -596,6 +596,10 @@
Use DuckDuckGo service to download website icons
+
+ Hide TOTP in the entry preview panel
+
+
AutoType
diff --git a/src/core/Config.cpp b/src/core/Config.cpp
index 2e81ad771..bb80f012b 100644
--- a/src/core/Config.cpp
+++ b/src/core/Config.cpp
@@ -139,6 +139,7 @@ static const QHash configStrings = {
{Config::Security_PasswordsHidden, {QS("Security/PasswordsHidden"), Roaming, true}},
{Config::Security_PasswordEmptyPlaceholder, {QS("Security/PasswordEmptyPlaceholder"), Roaming, false}},
{Config::Security_HidePasswordPreviewPanel, {QS("Security/HidePasswordPreviewPanel"), Roaming, true}},
+ {Config::Security_HideTotpPreviewPanel, {QS("Security/HideTotpPreviewPanel"), Roaming, false}},
{Config::Security_AutoTypeAsk, {QS("Security/AutotypeAsk"), Roaming, true}},
{Config::Security_IconDownloadFallback, {QS("Security/IconDownloadFallback"), Roaming, false}},
{Config::Security_NoConfirmMoveEntryToRecycleBin,{QS("Security/NoConfirmMoveEntryToRecycleBin"), Roaming, true}},
diff --git a/src/core/Config.h b/src/core/Config.h
index 28a32545c..d47362d9e 100644
--- a/src/core/Config.h
+++ b/src/core/Config.h
@@ -119,6 +119,7 @@ public:
Security_PasswordsHidden,
Security_PasswordEmptyPlaceholder,
Security_HidePasswordPreviewPanel,
+ Security_HideTotpPreviewPanel,
Security_AutoTypeAsk,
Security_IconDownloadFallback,
Security_NoConfirmMoveEntryToRecycleBin,
diff --git a/src/gui/ApplicationSettingsWidget.cpp b/src/gui/ApplicationSettingsWidget.cpp
index 901afeab9..9c97c8618 100644
--- a/src/gui/ApplicationSettingsWidget.cpp
+++ b/src/gui/ApplicationSettingsWidget.cpp
@@ -314,6 +314,7 @@ void ApplicationSettingsWidget::loadSettings()
m_secUi->passwordShowDotsCheckBox->setChecked(config()->get(Config::Security_PasswordEmptyPlaceholder).toBool());
m_secUi->passwordPreviewCleartextCheckBox->setChecked(
config()->get(Config::Security_HidePasswordPreviewPanel).toBool());
+ m_secUi->hideTotpCheckBox->setChecked(config()->get(Config::Security_HideTotpPreviewPanel).toBool());
m_secUi->passwordsRepeatVisibleCheckBox->setChecked(
config()->get(Config::Security_PasswordsRepeatVisible).toBool());
m_secUi->hideNotesCheckBox->setChecked(config()->get(Config::Security_HideNotes).toBool());
@@ -427,6 +428,7 @@ void ApplicationSettingsWidget::saveSettings()
config()->set(Config::Security_PasswordEmptyPlaceholder, m_secUi->passwordShowDotsCheckBox->isChecked());
config()->set(Config::Security_HidePasswordPreviewPanel, m_secUi->passwordPreviewCleartextCheckBox->isChecked());
+ config()->set(Config::Security_HideTotpPreviewPanel, m_secUi->hideTotpCheckBox->isChecked());
config()->set(Config::Security_PasswordsRepeatVisible, m_secUi->passwordsRepeatVisibleCheckBox->isChecked());
config()->set(Config::Security_HideNotes, m_secUi->hideNotesCheckBox->isChecked());
config()->set(Config::Security_NoConfirmMoveEntryToRecycleBin,
diff --git a/src/gui/ApplicationSettingsWidgetSecurity.ui b/src/gui/ApplicationSettingsWidgetSecurity.ui
index 5ca7d69e0..10d353e11 100644
--- a/src/gui/ApplicationSettingsWidgetSecurity.ui
+++ b/src/gui/ApplicationSettingsWidgetSecurity.ui
@@ -211,6 +211,13 @@
+ -
+
+
+ Hide TOTP in the entry preview panel
+
+
+
-
diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp
index a3eda3f37..13f00346c 100644
--- a/src/gui/EntryPreviewWidget.cpp
+++ b/src/gui/EntryPreviewWidget.cpp
@@ -119,38 +119,50 @@ void EntryPreviewWidget::clear()
void EntryPreviewWidget::setEntry(Entry* selectedEntry)
{
+ if (m_currentEntry == selectedEntry) {
+ return;
+ }
+
if (m_currentEntry) {
- disconnect(m_currentEntry);
+ disconnect(m_currentEntry, nullptr, this, nullptr);
}
if (m_currentGroup) {
- disconnect(m_currentGroup);
+ disconnect(m_currentGroup, nullptr, this, nullptr);
}
m_currentEntry = selectedEntry;
m_currentGroup = nullptr;
- if (!selectedEntry) {
+ if (!m_currentEntry) {
hide();
return;
}
- connect(selectedEntry, &Entry::modified, this, &EntryPreviewWidget::refresh);
+ connect(m_currentEntry, &Entry::modified, this, &EntryPreviewWidget::refresh);
refresh();
+
+ if (m_currentEntry->hasTotp()) {
+ m_ui->entryTotpButton->setChecked(!config()->get(Config::Security_HideTotpPreviewPanel).toBool());
+ }
}
void EntryPreviewWidget::setGroup(Group* selectedGroup)
{
+ if (m_currentGroup == selectedGroup) {
+ return;
+ }
+
if (m_currentEntry) {
- disconnect(m_currentEntry);
+ disconnect(m_currentEntry, nullptr, this, nullptr);
}
if (m_currentGroup) {
- disconnect(m_currentGroup);
+ disconnect(m_currentGroup, nullptr, this, nullptr);
}
m_currentEntry = nullptr;
m_currentGroup = selectedGroup;
- if (!selectedGroup) {
+ if (!m_currentGroup) {
hide();
return;
}
@@ -226,15 +238,15 @@ void EntryPreviewWidget::updateEntryTotp()
Q_ASSERT(m_currentEntry);
const bool hasTotp = m_currentEntry->hasTotp();
m_ui->entryTotpButton->setVisible(hasTotp);
- m_ui->entryTotpLabel->hide();
- m_ui->entryTotpProgress->hide();
- m_ui->entryTotpButton->setChecked(false);
if (hasTotp) {
m_totpTimer.start(1000);
m_ui->entryTotpProgress->setMaximum(m_currentEntry->totpSettings()->step);
updateTotpLabel();
} else {
+ m_ui->entryTotpLabel->hide();
+ m_ui->entryTotpProgress->hide();
+ m_ui->entryTotpButton->setChecked(false);
m_ui->entryTotpLabel->clear();
m_totpTimer.stop();
}