mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-28 00:39:43 -05:00
Fix bugs with preview widget
* Add configuration to hide TOTP in preview widget (shown by default). * Retain the visibility of TOTP and other fields when the same entry remains selected in the preview panel. * Fix disconnecting signals when switch entries / groups. This likely is going to fix crashes because we were compounding signals when focusing in on the main window.
This commit is contained in:
parent
c1720c3711
commit
58c4d1de1e
@ -596,6 +596,10 @@
|
||||
<source>Use DuckDuckGo service to download website icons</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Hide TOTP in the entry preview panel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AutoType</name>
|
||||
|
@ -139,6 +139,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> 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}},
|
||||
|
@ -119,6 +119,7 @@ public:
|
||||
Security_PasswordsHidden,
|
||||
Security_PasswordEmptyPlaceholder,
|
||||
Security_HidePasswordPreviewPanel,
|
||||
Security_HideTotpPreviewPanel,
|
||||
Security_AutoTypeAsk,
|
||||
Security_IconDownloadFallback,
|
||||
Security_NoConfirmMoveEntryToRecycleBin,
|
||||
|
@ -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,
|
||||
|
@ -211,6 +211,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hideTotpCheckBox">
|
||||
<property name="text">
|
||||
<string>Hide TOTP in the entry preview panel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hideNotesCheckBox">
|
||||
<property name="text">
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user