KConfig
kconfig.cpp
54 Q_GLOBAL_STATIC_WITH_ARGS(QString, sGlobalFileName, (QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1String("/kdeglobals")))
70 KConfigPrivate::KConfigPrivate(KConfig::OpenFlags flags, QStandardPaths::StandardLocation resourceType)
87 *sGlobalFileName = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1String("/kdeglobals");
110 // QExplicitlySharedDataPointer<KConfigBackend> backend = KConfigBackend::create(etc_kderc, QLatin1String("INI"));
115 // QExplicitlySharedDataPointer<KConfigBackend> backend = KConfigBackend::create(kde5rc, QLatin1String("INI"));
141 void KConfigPrivate::copyGroup(const QByteArray &source, const QByteArray &destination, KConfigGroup *otherGroup, KConfigBase::WriteConfigFlags flags) const
151 entryMap.forEachEntryWhoseGroupStartsWith(source, [&source, &destination, flags, &otherMap, sameName, &dirtied](KEntryMapConstIterator entryMapIt) {
205 while (nEndPos < aValue.length() && (aValue[nEndPos].isNumber() || aValue[nEndPos].isLetter() || aValue[nEndPos] == QLatin1Char('_'))) {
247 KConfig::KConfig(const QString &file, OpenFlags mode, QStandardPaths::StandardLocation resourceType)
256 KConfig::KConfig(const QString &file, const QString &backend, QStandardPaths::StandardLocation resourceType)
293 // std::unordered_set rather than QSet is used because there is no qHash() overload for std::string_view in Qt 5.
300 std::transform(source.cbegin(), source.cend(), std::back_inserter(list), [](std::string_view view) {
313 if (isNonDeletedKey(entryMapIt) && !group.isEmpty() && group != "<default>" && group != "$Version") {
326 entryMap.forEachEntryWhoseGroupStartsWith(theGroup, [&theGroup, &groups](KEntryMapConstIterator entryMapIt) {
338 /// Returns @p parentGroup itself, all its subgroups, subsubgroups, and so on, including deleted groups.
343 entryMap.forEachEntryWhoseGroupStartsWith(parentGroup, [&parentGroup, &groups](KEntryMapConstIterator entryMapIt) {
355 return entryMap.anyEntryWhoseGroupStartsWith(group, [&group](KEntryMapConstIterator entryMapIt) {
502 void KConfigPrivate::notifyClients(const QHash<QString, QByteArrayList> &changes, const QString &path)
509 QDBusMessage message = QDBusMessage::createSignal(path, QStringLiteral("org.kde.kconfig.notify"), QStringLiteral("ConfigChanged"));
543 QProcess::execute(QStringLiteral(KCONF_UPDATE_INSTALL_LOCATION), QStringList{QStringLiteral("--check"), updateFile});
623 } else if (wantGlobals()) { // accessing "kdeglobals" by specifying no filename and NoCascade - XXX used anywhere?
688 const QStringList paths1 = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("kdeglobals"));
689 const QStringList paths2 = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("system.kdeglobals"));
735 KConfigBackend::ParseOptions parseOpts = KConfigBackend::ParseGlobal | KConfigBackend::ParseExpansions;
803 bFileImmutable = backend->parseConfig(utf8Locale, entryMap, parseOpts) == KConfigBackend::ParseImmutable;
960 // Note: We don't ask the user if we should not ask this question again because we can't save the answer.
961 errorMsg += QCoreApplication::translate("KConfig", "Please contact your system administrator.");
964 QProcess::execute(cmdToExec, QStringList{QStringLiteral("--title"), QCoreApplication::applicationName(), QStringLiteral("--msgbox"), errorMsg});
983 bool KConfigPrivate::canWriteEntry(const QByteArray &group, const char *key, bool isDefault) const
985 if (bFileImmutable || entryMap.getEntryOption(group, key, KEntryMap::SearchLocalized, KEntryMap::EntryImmutable)) {
991 void KConfigPrivate::putData(const QByteArray &group, const char *key, const QByteArray &value, KConfigBase::WriteConfigFlags flags, bool expand)
1012 void KConfigPrivate::revertEntry(const QByteArray &group, const char *key, KConfigBase::WriteConfigFlags flags)
1022 QByteArray KConfigPrivate::lookupData(const QByteArray &group, const char *key, KEntryMap::SearchFlags flags) const
1027 KEntry KConfigPrivate::lookupInternalEntry(const QByteArray &group, const char *key, KEntryMap::SearchFlags flags) const
1039 QString KConfigPrivate::lookupData(const QByteArray &group, const char *key, KEntryMap::SearchFlags flags, bool *expand) const
bool isNull() const const
bool contains(const Key &key) const const
void virtual_hook(int id, void *data) override
Virtual hook, used to add new "virtual" functions while maintaining binary compatibility.
Definition: kconfig.cpp:1053
QByteArray toLatin1() const const
QString fromUtf8(const char *str, int size)
bool forceGlobal() const
Returns whether all entries are being written to kdeglobals.
Definition: kconfig.cpp:895
CaseSensitivity
QVariant fromValue(const T &value)
void deleteGroupImpl(const QByteArray &group, WriteConfigFlags flags=Normal) override
Definition: kconfig.cpp:931
QString translate(const char *context, const char *sourceText, const char *disambiguation, int n)
int indexOf(char ch, int from) const const
int count(const T &value) const const
bool contains(const QString &str, Qt::CaseSensitivity cs) const const
bool testFlag(Enum flag) const const
QString name() const
Returns the filename used to store the configuration.
Definition: kconfig.cpp:567
QStringView mid(qsizetype start) const const
KConfig * copyTo(const QString &file, KConfig *config=nullptr) const
Copies all entries from this config object to a new config object that will save itself to file.
Definition: kconfig.cpp:548
QStringList additionalConfigSources() const
Returns a list of the additional configuration sources used in this object.
Definition: kconfig.cpp:831
QString writableLocation(QStandardPaths::StandardLocation type)
void reparseConfiguration()
Updates the state of this object to match the persistent storage.
Definition: kconfig.cpp:655
QString homePath()
KIOFILEWIDGETS_EXPORT QStringList list(const QString &fileClass)
bool exists() const const
@ Notify
Notify remote KConfigWatchers of changes (requires DBus support) Implied persistent.
Definition: kconfigbase.h:51
@ Global
Save the entry to the global KDE config file instead of the application specific config file.
Definition: kconfigbase.h:42
Q_GLOBAL_STATIC(Internal::StaticControl, s_instance) class ControlPrivate
bool send(const QDBusMessage &message) const const
QString findExecutable(const QString &executableName, const QStringList &paths)
void reserve(int alloc)
QMap::iterator insert(const Key &key, const T &value)
int size() const const
void prepend(const T &value)
QDBusConnection sessionBus()
QString fromLocal8Bit(const char *str, int size)
QMap< QString, QString > entryMap(const QString &aGroup=QString()) const
Returns a map (tree) of entries in a particular group.
Definition: kconfig.cpp:381
bool isEmpty() const const
const Key key(const T &value) const const
int execute(const QString &program, const QStringList &arguments)
QByteArray toUtf8() const const
QCA_EXPORT QString appName()
int length() const const
const T & at(int i) const const
bool startsWith(const QByteArray &ba) const const
Definition: kconfiggroup.h:38
T readEntry(const QString &key, const T &aDefault) const
Reads the value of an entry specified by pKey in the current group.
Definition: kconfiggroup.h:258
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name)
KSharedConfigPtr config()
applicationName
bool isAbsolutePath(const QString &path)
QString & replace(int position, int n, QChar after)
QString & remove(int position, int n)
LocaleWrapper locale()
bool isConfigWritable(bool warnUser)
Whether the configuration can be written to.
Definition: kconfig.cpp:949
QStandardPaths::StandardLocation locationType() const
Returns the standard location enum passed to the constructor.
Definition: kconfig.cpp:1047
GenericConfigLocation
bool isEmpty() const const
bool isEmpty() const const
QList::const_iterator constEnd() const const
const char * constData() const const
bool isEmpty() const const
QStringList locateAll(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options)
const char * name(StandardAction id)
const QChar at(int position) const const
KConfig * config()
Return the config object that this group belongs to.
Definition: kconfiggroup.cpp:621
int size() const const
KConfigGroup group(const QString &group)
Returns an object for the named subgroup.
Definition: kconfigbase.cpp:36
bool hasGroupImpl(const QByteArray &group) const override
Definition: kconfig.cpp:973
int compare(const QString &other, Qt::CaseSensitivity cs) const const
bool isGroupImmutableImpl(const QByteArray &aGroup) const override
Definition: kconfig.cpp:880
QDateTime lastModified() const const
void checkUpdate(const QString &id, const QString &updateFile)
Ensures that the configuration file contains a certain update.
Definition: kconfig.cpp:537
QStringList arguments()
QString message
KConfig(const QString &file=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation)
Creates a KConfig object to manipulate a configuration file for the current application.
Definition: kconfig.cpp:247
Q_D(Todo)
QString canonicalFilePath() const const
QString decodeName(const QByteArray &localFileName)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 2 2023 04:11:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 2 2023 04:11:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.