From be28e096c5337b61a5e2f6e048ea297b2cc4b916 Mon Sep 17 00:00:00 2001 From: Benjamin Port Date: Tue, 17 Mar 2020 15:13:11 +0100 Subject: Add force save behavior to KEntryMap Summary: Fix the following bug, if an entry is set on HOME/.config/kdeglobals and on a specific config file like kcmfonts When you hit restore defaults button and apply, value will be not wrote on the specific file, but then the value is the one from kdeglobals This patch ensure we write the key to the specific configuration file on those case with an empty value. KConfig will take default value automatically Test Plan: Added a test to ensure flag is working Tested using some KCM to ensure all is working fine Reviewers: ervin, dfaure, meven, crossi, hchain Reviewed By: ervin, dfaure, meven Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D28128 --- src/core/kconfigini.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/core/kconfigini.cpp') diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp index 2cea7338..9601d036 100644 --- a/src/core/kconfigini.cpp +++ b/src/core/kconfigini.cpp @@ -429,7 +429,10 @@ bool KConfigIniBackend::writeConfig(const QByteArray &locale, KEntryMap &entryMa // only write entries that have the same "globality" as the file if (it->bGlobal == bGlobal) { - if (it->bReverted) { + if (it->bReverted && it->bOverridesGlobal) { + it->bDeleted = true; + writeMap[key] = *it; + } else if (it->bReverted) { writeMap.remove(key); } else if (!it->bDeleted) { writeMap[key] = *it; -- cgit v1.2.1