aboutsummaryrefslogtreecommitdiff
path: root/src/kconfig_compiler/KConfigHeaderGenerator.cpp
diff options
context:
space:
mode:
authorAlexander Lohnau <alexander.lohnau@gmx.de>2021-09-14 07:30:32 +0200
committerAlexander Lohnau <alexander.lohnau@gmx.de>2021-09-19 07:50:10 +0200
commit0b0a4464fb3d1145eb612b1ab7edacfa9581c8c9 (patch)
treedb94f2c4daba14f23e13aa65d55a05257f86ab41 /src/kconfig_compiler/KConfigHeaderGenerator.cpp
parent782750149a0819053d47960fb144f17b7c719d13 (diff)
downloadkconfig-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/KConfigHeaderGenerator.cpp')
-rw-r--r--src/kconfig_compiler/KConfigHeaderGenerator.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/kconfig_compiler/KConfigHeaderGenerator.cpp b/src/kconfig_compiler/KConfigHeaderGenerator.cpp
index 9938599c..ea5a2c75 100644
--- a/src/kconfig_compiler/KConfigHeaderGenerator.cpp
+++ b/src/kconfig_compiler/KConfigHeaderGenerator.cpp
@@ -324,10 +324,17 @@ void KConfigHeaderGenerator::createConstructor()
if (parseResult.cfgFileNameArg) {
if (cfg().forceStringFilename) {
stream() << " const QString &cfgfilename" << (parseResult.parameters.isEmpty() ? " = QString()" : ", ");
+ } else if (parseResult.cfgStateConfig) {
+ stream() << " KSharedConfig::Ptr config" << (parseResult.parameters.isEmpty() ? " = KSharedConfig::openStateConfig()" : ", ");
} else {
stream() << " KSharedConfig::Ptr config" << (parseResult.parameters.isEmpty() ? " = KSharedConfig::openConfig()" : ", ");
}
}
+ if (cfg().forceStringFilename && parseResult.cfgStateConfig) {
+ std::cerr << "One can not use ForceStringFilename and use the stateConfig attribute, consider "
+ "removing the ForceStringFilename kcfgc option if you want to use state data"
+ << std::endl;
+ }
bool first = true;
for (const auto &parameter : std::as_const(parseResult.parameters)) {