diff options
author | Alexander Lohnau <alexander.lohnau@gmx.de> | 2021-09-14 07:30:32 +0200 |
---|---|---|
committer | Alexander Lohnau <alexander.lohnau@gmx.de> | 2021-09-19 07:50:10 +0200 |
commit | 0b0a4464fb3d1145eb612b1ab7edacfa9581c8c9 (patch) | |
tree | db94f2c4daba14f23e13aa65d55a05257f86ab41 /src/kconfig_compiler/KConfigSourceGenerator.cpp | |
parent | 782750149a0819053d47960fb144f17b7c719d13 (diff) | |
download | kconfig-0b0a4464fb3d1145eb612b1ab7edacfa9581c8c9.tar.gz kconfig-0b0a4464fb3d1145eb612b1ab7edacfa9581c8c9.tar.bz2 |
Allow KConfigXT to use KSharedConfig::openStateConfig
Otherwise we force consumers to use the config location for state data,
which is what we are trying to avoid.
Task: https://phabricator.kde.org/T12549
Diffstat (limited to 'src/kconfig_compiler/KConfigSourceGenerator.cpp')
-rw-r--r-- | src/kconfig_compiler/KConfigSourceGenerator.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/kconfig_compiler/KConfigSourceGenerator.cpp b/src/kconfig_compiler/KConfigSourceGenerator.cpp index a8a05f4b..45299a4f 100644 --- a/src/kconfig_compiler/KConfigSourceGenerator.cpp +++ b/src/kconfig_compiler/KConfigSourceGenerator.cpp @@ -170,7 +170,9 @@ void KConfigSourceGenerator::createSingletonImplementation() stream() << " return;\n"; stream() << " }\n"; stream() << " new " << cfg().className << "("; - if (isString) { + if (parseResult.cfgStateConfig) { + stream() << "KSharedConfig::openStateConfig(" << arg << ")"; + } else if (isString) { stream() << "KSharedConfig::openConfig(" << arg << ")"; } else { stream() << "std::move(" << arg << ")"; @@ -232,7 +234,9 @@ void KConfigSourceGenerator::createConstructorParameterList() void KConfigSourceGenerator::createParentConstructorCall() { stream() << cfg().inherits << "("; - if (!parseResult.cfgFileName.isEmpty()) { + if (parseResult.cfgStateConfig) { + stream() << " KSharedConfig::openStateConfig(QStringLiteral( \"" << parseResult.cfgFileName << "\") "; + } else if (!parseResult.cfgFileName.isEmpty()) { stream() << " QStringLiteral( \"" << parseResult.cfgFileName << "\" "; } if (parseResult.cfgFileNameArg) { |