Fix setting browser related values to customData (#13026)

Co-authored-by: varjolintu <sami.vanttinen@ahmala.org>
This commit is contained in:
Sami Vänttinen 2026-03-08 13:47:29 +02:00 committed by GitHub
parent ec034eaf7d
commit 6f6076ab81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 KeePassXC Team <team@keepassxc.org>
* Copyright (C) 2026 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -158,7 +158,6 @@ void CustomData::copyDataFrom(const CustomData* other)
m_data = other->m_data;
updateLastModified();
emit reset();
emitModified();
}

View file

@ -350,25 +350,31 @@ void EditEntryWidget::updateBrowser()
return;
}
auto changeValue = [&](const QString& option, const bool newValue) {
// If value is false and no customData exists, make no edits
if (!m_customData->hasKey(option) && !newValue) {
return;
}
// If customData exists, set the value
m_customData->set(option, (newValue ? TRUE_STR : FALSE_STR));
};
// Only update the custom data if no group level settings are used (checkbox is enabled)
if (m_browserUi->hideEntryCheckbox->isEnabled()) {
auto hide = m_browserUi->hideEntryCheckbox->isChecked();
m_customData->set(BrowserService::OPTION_HIDE_ENTRY, (hide ? TRUE_STR : FALSE_STR));
changeValue(BrowserService::OPTION_HIDE_ENTRY, m_browserUi->hideEntryCheckbox->isChecked());
}
if (m_browserUi->skipAutoSubmitCheckbox->isEnabled()) {
auto skip = m_browserUi->skipAutoSubmitCheckbox->isChecked();
m_customData->set(BrowserService::OPTION_SKIP_AUTO_SUBMIT, (skip ? TRUE_STR : FALSE_STR));
changeValue(BrowserService::OPTION_SKIP_AUTO_SUBMIT, m_browserUi->skipAutoSubmitCheckbox->isChecked());
}
if (m_browserUi->onlyHttpAuthCheckbox->isEnabled()) {
auto onlyHttpAuth = m_browserUi->onlyHttpAuthCheckbox->isChecked();
m_customData->set(BrowserService::OPTION_ONLY_HTTP_AUTH, (onlyHttpAuth ? TRUE_STR : FALSE_STR));
changeValue(BrowserService::OPTION_ONLY_HTTP_AUTH, m_browserUi->onlyHttpAuthCheckbox->isChecked());
}
if (m_browserUi->notHttpAuthCheckbox->isEnabled()) {
auto notHttpAuth = m_browserUi->notHttpAuthCheckbox->isChecked();
m_customData->set(BrowserService::OPTION_NOT_HTTP_AUTH, (notHttpAuth ? TRUE_STR : FALSE_STR));
changeValue(BrowserService::OPTION_NOT_HTTP_AUTH, m_browserUi->notHttpAuthCheckbox->isChecked());
}
}
@ -810,7 +816,6 @@ void EditEntryWidget::addKeyToAgent()
if (!sshAgent()->addIdentity(key, settings, m_db->uuid())) {
showMessage(sshAgent()->errorString(), MessageWidget::Error);
return;
}
}
@ -824,7 +829,6 @@ void EditEntryWidget::removeKeyFromAgent()
if (!sshAgent()->removeIdentity(key)) {
showMessage(sshAgent()->errorString(), MessageWidget::Error);
return;
}
}
@ -1080,6 +1084,7 @@ void EditEntryWidget::setForms(Entry* entry, bool restore)
setupBrowser();
}
m_browserSettingsChanged = false;
auto hideEntriesCheckBoxEnabled = true;
auto skipAutoSubmitCheckBoxEnabled = true;
auto onlyHttpAuthCheckBoxEnabled = true;