KConfigSkeleton: Fix reading value for deleted entry with system default

We have two kinds of default values to consider:

  • system-wide config files, i.e. /etc/xdg etc
  • the built-in default value, i.e. from the kcfg file, if no entries are present for that key

When setting useDefaults(true) we want to consider both. The combined value is stored in mDefaultValue.

Entries can be marked as deleted. In that case system-wide entries are also ignored. The built-in default should not be ignored though. That is to be consistent with KConfigGroup::readEntry()

In readConfig, we pass mDefaultValue to readEntry(). That will override deleted values with the mDefaultValue if a system-wide default was set. We don't want that. We only want the built-in default value as fallback.

That means we need to keep track of the original default value. Unfortunately we can't add another member to KConfigSkeletonGenericItem (would break ABI), so add it to KConfigSkeletonItem's d-pointer as QVariant.

BUG: 509416

Merge request reports

Loading