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
00041 class KDECORE_EXPORT KConfig : public KConfigBase
00042 {
00043 public:
00044 enum OpenFlag {
00045 IncludeGlobals = 0x01,
00046 CascadeConfig = 0x02,
00047
00050 SimpleConfig = 0x00,
00051 NoCascade = IncludeGlobals,
00052 NoGlobals = CascadeConfig,
00053 FullConfig = IncludeGlobals|CascadeConfig
00054 };
00055 Q_DECLARE_FLAGS(OpenFlags, OpenFlag)
00056
00057 explicit KConfig(const QString& file = QString(), OpenFlags mode = FullConfig,
00058 const char* resourceType = "config");
00059
00060 explicit KConfig(const KComponentData& componentData, const QString& file = QString(),
00061 OpenFlags mode = FullConfig, const char* resourceType = "config");
00062
00063 virtual ~KConfig();
00064
00065 const KComponentData &componentData() const;
00066
00070 QString name() const;
00071
00073 void sync();
00074
00076 void markAsClean();
00077
00080 AccessMode accessMode() const;
00081
00082 bool isConfigWritable(bool warnUser);
00084
00095 KConfig* copyTo(const QString &file, KConfig *config=0) const;
00096
00110 void checkUpdate(const QString &id, const QString &updateFile);
00111
00116 void reparseConfiguration();
00117
00119
00132 void addConfigSources(const QStringList &sources);
00133
00136
00139 QString locale() const;
00147 bool setLocale(const QString& aLocale);
00149
00151
00156 void setReadDefaults(bool b);
00157 bool readDefaults() const;
00159
00162 bool isImmutable() const;
00164
00166
00172 KDE_DEPRECATED void setForceGlobal(bool force);
00179 KDE_DEPRECATED bool forceGlobal() const;
00181
00183 QStringList groupList() const;
00184
00197 QMap<QString, QString> entryMap(const QString &aGroup=QString()) const;
00198
00199 protected:
00200 virtual bool hasGroupImpl(const QByteArray &group) const;
00201 virtual KConfigGroup groupImpl( const QByteArray &b);
00202 virtual const KConfigGroup groupImpl(const QByteArray &b) const;
00203 virtual void deleteGroupImpl(const QByteArray &group, WriteConfigFlags flags = Normal);
00204 virtual bool isGroupImmutableImpl(const QByteArray& aGroup) const;
00205
00206 friend class KConfigGroup;
00207 friend class KConfigGroupPrivate;
00208
00212 virtual void virtual_hook( int id, void* data );
00213
00214 KConfigPrivate *const d_ptr;
00215
00216 KConfig(KConfigPrivate &d);
00217
00218 private:
00219 QStringList keyList(const QString& aGroup=QString()) const;
00220
00221 Q_DISABLE_COPY(KConfig)
00222
00223 Q_DECLARE_PRIVATE(KConfig)
00224 };
00225 Q_DECLARE_OPERATORS_FOR_FLAGS( KConfig::OpenFlags )
00226
00227 #endif // KCONFIG_H