KDECore
kconfig.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KCONFIG_H
00025 #define KCONFIG_H
00026
00027 #include "kconfigbase.h"
00028
00029 #include <kdecore_export.h>
00030
00031 #include <QtCore/QString>
00032 #include <QtCore/QVariant>
00033 #include <QtCore/QByteArray>
00034 #include <QtCore/QList>
00035
00036 class KConfigGroup;
00037 class KComponentData;
00038 class KEntryMap;
00039 class KConfigPrivate;
00040
00070 class KDECORE_EXPORT KConfig : public KConfigBase
00071 {
00072 public:
00088 enum OpenFlag {
00089 IncludeGlobals = 0x01,
00090 CascadeConfig = 0x02,
00091
00094 SimpleConfig = 0x00,
00095 NoCascade = IncludeGlobals,
00096 NoGlobals = CascadeConfig,
00097 FullConfig = IncludeGlobals|CascadeConfig
00098 };
00099 Q_DECLARE_FLAGS(OpenFlags, OpenFlag)
00100
00101
00126 explicit KConfig(const QString& file = QString(), OpenFlags mode = FullConfig,
00127 const char* resourceType = "config");
00128
00156 explicit KConfig(const KComponentData& componentData, const QString& file = QString(),
00157 OpenFlags mode = FullConfig, const char* resourceType = "config");
00158
00171 KConfig(const QString& file, const QString& backend, const char* resourceType = "config");
00172
00173 virtual ~KConfig();
00174
00178 const KComponentData &componentData() const;
00179
00183 QString name() const;
00184
00186 void sync();
00187
00189 void markAsClean();
00190
00193 AccessMode accessMode() const;
00194
00213 bool isConfigWritable(bool warnUser);
00215
00233 KConfig* copyTo(const QString &file, KConfig *config = 0) const;
00234
00251 void checkUpdate(const QString &id, const QString &updateFile);
00252
00256 void reparseConfiguration();
00257
00259
00287 void addConfigSources(const QStringList &sources);
00288
00291
00294 QString locale() const;
00307 bool setLocale(const QString& aLocale);
00309
00311
00320 void setReadDefaults(bool b);
00325 bool readDefaults() const;
00327
00330 bool isImmutable() const;
00332
00334
00343 KDE_DEPRECATED void setForceGlobal(bool force);
00353 KDE_DEPRECATED bool forceGlobal() const;
00355
00357 QStringList groupList() const;
00358
00370 QMap<QString, QString> entryMap(const QString &aGroup=QString()) const;
00371
00372 protected:
00373 virtual bool hasGroupImpl(const QByteArray &group) const;
00374 virtual KConfigGroup groupImpl( const QByteArray &b);
00375 virtual const KConfigGroup groupImpl(const QByteArray &b) const;
00376 virtual void deleteGroupImpl(const QByteArray &group, WriteConfigFlags flags = Normal);
00377 virtual bool isGroupImmutableImpl(const QByteArray& aGroup) const;
00378
00379 friend class KConfigGroup;
00380 friend class KConfigGroupPrivate;
00381
00385 virtual void virtual_hook( int id, void* data );
00386
00387 KConfigPrivate *const d_ptr;
00388
00389 KConfig(KConfigPrivate &d);
00390
00391 private:
00392 QStringList keyList(const QString& aGroup=QString()) const;
00393
00394 Q_DISABLE_COPY(KConfig)
00395
00396 Q_DECLARE_PRIVATE(KConfig)
00397 };
00398 Q_DECLARE_OPERATORS_FOR_FLAGS( KConfig::OpenFlags )
00399
00400 #endif // KCONFIG_H