KDECore
kconfig.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the KDE libraries 00003 Copyright (c) 2006, 2007 Thomas Braxton <kde.braxton@gmail.com> 00004 Copyright (c) 2001 Waldo Bastian <bastian@kde.org> 00005 Copyright (c) 1999 Preston Brown <pbrown@kde.org> 00006 Copyright (c) 1997 Matthias Kalle Dalheimer <kalle@kde.org> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 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: 00092 enum OpenFlag { 00093 IncludeGlobals = 0x01, 00094 CascadeConfig = 0x02, 00095 00096 SimpleConfig = 0x00, 00097 NoCascade = IncludeGlobals, 00098 NoGlobals = CascadeConfig, 00099 FullConfig = IncludeGlobals|CascadeConfig 00100 }; 00101 Q_DECLARE_FLAGS(OpenFlags, OpenFlag) 00102 00103 00131 explicit KConfig(const QString& file = QString(), OpenFlags mode = FullConfig, 00132 const char* resourceType = "config"); 00133 00164 explicit KConfig(const KComponentData& componentData, const QString& file = QString(), 00165 OpenFlags mode = FullConfig, const char* resourceType = "config"); 00166 00179 KConfig(const QString& file, const QString& backend, const char* resourceType = "config"); 00180 00181 virtual ~KConfig(); 00182 00186 const KComponentData &componentData() const; // krazy:exclude=constref 00187 00191 QString name() const; 00192 00194 void sync(); 00195 00197 void markAsClean(); 00198 00201 AccessMode accessMode() const; 00202 00221 bool isConfigWritable(bool warnUser); 00223 00241 KConfig* copyTo(const QString &file, KConfig *config = 0) const; 00242 00259 void checkUpdate(const QString &id, const QString &updateFile); 00260 00264 void reparseConfiguration(); 00265 00267 00295 void addConfigSources(const QStringList &sources); 00296 00299 00302 QString locale() const; 00315 bool setLocale(const QString& aLocale); 00317 00319 00328 void setReadDefaults(bool b); 00333 bool readDefaults() const; 00335 00338 bool isImmutable() const; 00340 00342 00351 #ifndef KDE_NO_DEPRECATED 00352 KDE_DEPRECATED void setForceGlobal(bool force); 00353 #endif 00354 00363 #ifndef KDE_NO_DEPRECATED 00364 KDE_DEPRECATED bool forceGlobal() const; 00365 #endif 00366 00367 00369 QStringList groupList() const; 00370 00382 QMap<QString, QString> entryMap(const QString &aGroup=QString()) const; 00383 00384 protected: 00385 virtual bool hasGroupImpl(const QByteArray &group) const; 00386 virtual KConfigGroup groupImpl( const QByteArray &b); 00387 virtual const KConfigGroup groupImpl(const QByteArray &b) const; 00388 virtual void deleteGroupImpl(const QByteArray &group, WriteConfigFlags flags = Normal); 00389 virtual bool isGroupImmutableImpl(const QByteArray& aGroup) const; 00390 00391 friend class KConfigGroup; 00392 friend class KConfigGroupPrivate; 00393 00397 virtual void virtual_hook( int id, void* data ); 00398 00399 KConfigPrivate *const d_ptr; 00400 00401 KConfig(KConfigPrivate &d); 00402 00403 private: 00404 QStringList keyList(const QString& aGroup=QString()) const; 00405 00406 Q_DISABLE_COPY(KConfig) 00407 00408 Q_DECLARE_PRIVATE(KConfig) 00409 }; 00410 Q_DECLARE_OPERATORS_FOR_FLAGS( KConfig::OpenFlags ) 00411 00412 #endif // KCONFIG_H
KDE 4.7 API Reference