diff options
author | David Faure <faure@kde.org> | 2014-03-04 22:15:59 +0100 |
---|---|---|
committer | David Faure <faure@kde.org> | 2014-03-13 23:42:22 +0100 |
commit | 66f0e0272cb86b08699b79c1f3bc15d221366f0e (patch) | |
tree | ba2b880cd174db558347c35a8d72c49a2b0b3309 | |
parent | 245e758cb94c0abd7e8a87c5349c49a5de1c146f (diff) | |
download | kconfig-66f0e0272cb86b08699b79c1f3bc15d221366f0e.tar.gz kconfig-66f0e0272cb86b08699b79c1f3bc15d221366f0e.tar.bz2 |
KCoreConfigSkeleton: delay parsing until the call to readConfig()
-rw-r--r-- | src/core/kconfig.cpp | 6 | ||||
-rw-r--r-- | src/core/kconfig.h | 3 | ||||
-rw-r--r-- | src/core/kcoreconfigskeleton.cpp | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index 5b51cce8..4695621a 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -259,8 +259,10 @@ KConfig::KConfig(const QString &file, OpenFlags mode, { d_ptr->changeFileName(file); // set the local file name - // read initial information off disk - reparseConfiguration(); + if ((mode & DelayedParsing) == 0) { + // read initial information off disk + reparseConfiguration(); + } } KConfig::KConfig(const QString &file, const QString &backend, QStandardPaths::StandardLocation resourceType) diff --git a/src/core/kconfig.h b/src/core/kconfig.h index d27eebe7..5685ebdb 100644 --- a/src/core/kconfig.h +++ b/src/core/kconfig.h @@ -95,7 +95,8 @@ public: SimpleConfig = 0x00, ///< Just a single config file. NoCascade = IncludeGlobals, ///< Include user's globals, but omit system settings. NoGlobals = CascadeConfig, ///< Cascade to system settings, but omit user's globals. - FullConfig = IncludeGlobals | CascadeConfig ///< Fully-fledged config, including globals and cascading to system settings + FullConfig = IncludeGlobals | CascadeConfig, ///< Fully-fledged config, including globals and cascading to system settings + DelayedParsing = 0x04 ///< Do not parse in the constructor, require a call to reparseConfiguration }; Q_DECLARE_FLAGS(OpenFlags, OpenFlag) diff --git a/src/core/kcoreconfigskeleton.cpp b/src/core/kcoreconfigskeleton.cpp index 9c5fb4a8..0c1a96fa 100644 --- a/src/core/kcoreconfigskeleton.cpp +++ b/src/core/kcoreconfigskeleton.cpp @@ -986,7 +986,7 @@ KCoreConfigSkeleton::KCoreConfigSkeleton(const QString &configname, QObject *par { //qDebug() << "Creating KCoreConfigSkeleton (" << (void *)this << ")"; - d->mConfig = KSharedConfig::openConfig(configname); + d->mConfig = KSharedConfig::openConfig(configname, KConfig::FullConfig | KConfig::DelayedParsing); } KCoreConfigSkeleton::KCoreConfigSkeleton(KSharedConfig::Ptr pConfig, QObject *parent) |