diff --git a/src/core/Group.cpp b/src/core/Group.cpp index cf6ace710..506418f40 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -1,6 +1,6 @@ /* + * Copyright (C) 2025 KeePassXC Team * Copyright (C) 2010 Felix Geyer - * Copyright (C) 2021 KeePassXC Team * * 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 @@ -1128,6 +1128,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)) { diff --git a/src/core/Group.h b/src/core/Group.h index 54ba4ebed..9df144e92 100644 --- a/src/core/Group.h +++ b/src/core/Group.h @@ -1,6 +1,6 @@ /* + * Copyright (C) 2025 KeePassXC Team * Copyright (C) 2010 Felix Geyer - * Copyright (C) 2021 KeePassXC Team * * 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 @@ -97,6 +97,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; diff --git a/src/gui/group/EditGroupWidget.cpp b/src/gui/group/EditGroupWidget.cpp index 458d78c22..7b78c8042 100644 --- a/src/gui/group/EditGroupWidget.cpp +++ b/src/gui/group/EditGroupWidget.cpp @@ -1,6 +1,6 @@ /* + * Copyright (C) 2025 KeePassXC Team * Copyright (C) 2011 Felix Geyer - * Copyright (C) 2022 KeePassXC Team * * 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 @@ -202,11 +202,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); }