diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/kconfigdata.cpp | 4 | ||||
-rw-r--r-- | src/core/kconfigdata.h | 7 | ||||
-rw-r--r-- | src/core/kconfigini.cpp | 5 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/core/kconfigdata.cpp b/src/core/kconfigdata.cpp index bfa662a0..5ead8167 100644 --- a/src/core/kconfigdata.cpp +++ b/src/core/kconfigdata.cpp @@ -100,6 +100,10 @@ bool KEntryMap::setEntry(const QByteArray &group, const QByteArray &key, const Q k = it.key(); e = *it; //qDebug() << "found existing entry for key" << k; + // If overridden entry is global and not default. And it's overridden by a non global + if (e.bGlobal && !(options & EntryGlobal) && !k.bDefault) { + e.bOverridesGlobal = true; + } } else { // make sure the group marker is in the map KEntryMap const *that = this; diff --git a/src/core/kconfigdata.h b/src/core/kconfigdata.h index d92076d9..2f36b1bb 100644 --- a/src/core/kconfigdata.h +++ b/src/core/kconfigdata.h @@ -24,7 +24,7 @@ struct KEntry { KEntry() : mValue(), bDirty(false), bGlobal(false), bImmutable(false), bDeleted(false), bExpand(false), bReverted(false), - bLocalizedCountry(false), bNotify(false) {} + bLocalizedCountry(false), bNotify(false), bOverridesGlobal(false) {} /** @internal */ QByteArray mValue; /** @@ -58,6 +58,11 @@ struct KEntry { bool bLocalizedCountry: 1; bool bNotify: 1; + + /** + * Entry will need to be written on a non global file even if it matches default value + */ + bool bOverridesGlobal: 1; }; // These operators are used to check whether an entry which is about 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; |