Fix inheriting browser group settings

This commit is contained in:
varjolintu 2025-08-06 21:59:26 +03:00 committed by Jonathan White
parent 56b63a9e0f
commit 93423eda30
3 changed files with 27 additions and 8 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2025 KeePassXC Team <team@keepassxc.org>
* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
* Copyright (C) 2021 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
@ -1142,6 +1142,24 @@ bool Group::resolveAutoTypeEnabled() const
}
}
bool Group::resolveBrowserOptionEnabled(const QString& option) const
{
switch (resolveCustomDataTriState(option, true)) {
case Inherit:
if (!m_parent) {
return false;
}
return m_parent->resolveBrowserOptionEnabled(option);
case Enable:
return true;
case Disable:
return false;
default:
Q_ASSERT(false);
return false;
}
}
Entry* Group::addEntryWithPath(const QString& entryPath)
{
if (entryPath.isEmpty() || findEntryByPath(entryPath)) {

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2025 KeePassXC Team <team@keepassxc.org>
* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
* Copyright (C) 2021 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
@ -94,6 +94,7 @@ public:
Group::MergeMode mergeMode() const;
bool resolveSearchingEnabled() const;
bool resolveAutoTypeEnabled() const;
bool resolveBrowserOptionEnabled(const QString& option) const;
Entry* lastTopVisibleEntry() const;
bool isExpired() const;
bool isRecycled() const;

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2025 KeePassXC Team <team@keepassxc.org>
* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
* Copyright (C) 2022 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
@ -200,11 +200,11 @@ void EditGroupWidget::loadGroup(Group* group, bool create, const QSharedPointer<
auto parent = group->parentGroup();
if (parent) {
inheritHideEntries = parent->resolveCustomDataTriState(BrowserService::OPTION_HIDE_ENTRY);
inheritSkipSubmit = parent->resolveCustomDataTriState(BrowserService::OPTION_SKIP_AUTO_SUBMIT);
inheritOnlyHttp = parent->resolveCustomDataTriState(BrowserService::OPTION_ONLY_HTTP_AUTH);
inheritNoHttp = parent->resolveCustomDataTriState(BrowserService::OPTION_NOT_HTTP_AUTH);
inheritOmitWww = parent->resolveCustomDataTriState(BrowserService::OPTION_OMIT_WWW);
inheritHideEntries = parent->resolveBrowserOptionEnabled(BrowserService::OPTION_HIDE_ENTRY);
inheritSkipSubmit = parent->resolveBrowserOptionEnabled(BrowserService::OPTION_SKIP_AUTO_SUBMIT);
inheritOnlyHttp = parent->resolveBrowserOptionEnabled(BrowserService::OPTION_ONLY_HTTP_AUTH);
inheritNoHttp = parent->resolveBrowserOptionEnabled(BrowserService::OPTION_NOT_HTTP_AUTH);
inheritOmitWww = parent->resolveBrowserOptionEnabled(BrowserService::OPTION_OMIT_WWW);
inheritRestrictKey = parent->resolveCustomDataString(BrowserService::OPTION_RESTRICT_KEY);
}