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:
00073 enum OpenFlag {
00074 IncludeGlobals = 0x01,
00075 CascadeConfig = 0x02,
00076
00079 SimpleConfig = 0x00,
00080 NoCascade = IncludeGlobals,
00081 NoGlobals = CascadeConfig,
00082 FullConfig = IncludeGlobals|CascadeConfig
00083 };
00084 Q_DECLARE_FLAGS(OpenFlags, OpenFlag)
00085
00086 explicit KConfig(const QString& file = QString(), OpenFlags mode = FullConfig,
00087 const char* resourceType = "config");
00088
00089 explicit KConfig(const KComponentData& componentData, const QString& file = QString(),
00090 OpenFlags mode = FullConfig, const char* resourceType = "config");
00091
00102 KConfig(const QString& file, const QString& backend, const char* resourceType = "config");
00103
00104 virtual ~KConfig();
00105
00106 const KComponentData &componentData() const;
00107
00111 QString name() const;
00112
00114 void sync();
00115
00117 void markAsClean();
00118
00121 AccessMode accessMode() const;
00122
00129 bool isConfigWritable(bool warnUser);
00131
00145 KConfig* copyTo(const QString &file, KConfig *config=0) const;
00146
00160 void checkUpdate(const QString &id, const QString &updateFile);
00161
00166 void reparseConfiguration();
00167
00169
00185 void addConfigSources(const QStringList &sources);
00186
00189
00192 QString locale() const;
00200 bool setLocale(const QString& aLocale);
00202
00204
00209 void setReadDefaults(bool b);
00210 bool readDefaults() const;
00212
00215 bool isImmutable() const;
00217
00219
00225 KDE_DEPRECATED void setForceGlobal(bool force);
00232 KDE_DEPRECATED bool forceGlobal() const;
00234
00236 QStringList groupList() const;
00237
00248 QMap<QString, QString> entryMap(const QString &aGroup=QString()) const;
00249
00250 protected:
00251 virtual bool hasGroupImpl(const QByteArray &group) const;
00252 virtual KConfigGroup groupImpl( const QByteArray &b);
00253 virtual const KConfigGroup groupImpl(const QByteArray &b) const;
00254 virtual void deleteGroupImpl(const QByteArray &group, WriteConfigFlags flags = Normal);
00255 virtual bool isGroupImmutableImpl(const QByteArray& aGroup) const;
00256
00257 friend class KConfigGroup;
00258 friend class KConfigGroupPrivate;
00259
00263 virtual void virtual_hook( int id, void* data );
00264
00265 KConfigPrivate *const d_ptr;
00266
00267 KConfig(KConfigPrivate &d);
00268
00269 private:
00270 QStringList keyList(const QString& aGroup=QString()) const;
00271
00272 Q_DISABLE_COPY(KConfig)
00273
00274 Q_DECLARE_PRIVATE(KConfig)
00275 };
00276 Q_DECLARE_OPERATORS_FOR_FLAGS( KConfig::OpenFlags )
00277
00278 #endif // KCONFIG_H