• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • config
kconfig.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE libraries
3  Copyright (c) 2006, 2007 Thomas Braxton <kde.braxton@gmail.com>
4  Copyright (c) 2001 Waldo Bastian <bastian@kde.org>
5  Copyright (c) 1999 Preston Brown <pbrown@kde.org>
6  Copyright (c) 1997 Matthias Kalle Dalheimer <kalle@kde.org>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 
24 #ifndef KCONFIG_H
25 #define KCONFIG_H
26 
27 #include "kconfigbase.h"
28 
29 #include <kdecore_export.h>
30 
31 #include <QtCore/QString>
32 #include <QtCore/QVariant>
33 #include <QtCore/QByteArray>
34 #include <QtCore/QList>
35 
36 class KConfigGroup;
37 class KComponentData;
38 class KEntryMap;
39 class KConfigPrivate;
40 
70 class KDECORE_EXPORT KConfig : public KConfigBase
71 {
72 public:
92  enum OpenFlag {
93  IncludeGlobals = 0x01,
94  CascadeConfig = 0x02,
95 
96  SimpleConfig = 0x00,
97  NoCascade = IncludeGlobals,
98  NoGlobals = CascadeConfig,
99  FullConfig = IncludeGlobals|CascadeConfig
100  };
101  Q_DECLARE_FLAGS(OpenFlags, OpenFlag)
102 
103 
131  explicit KConfig(const QString& file = QString(), OpenFlags mode = FullConfig,
132  const char* resourceType = "config");
133 
164  explicit KConfig(const KComponentData& componentData, const QString& file = QString(),
165  OpenFlags mode = FullConfig, const char* resourceType = "config");
166 
179  KConfig(const QString& file, const QString& backend, const char* resourceType = "config");
180 
181  virtual ~KConfig();
182 
186  const KComponentData &componentData() const; // krazy:exclude=constref
187 
191  QString name() const;
192 
194  void sync();
195 
198  bool isDirty() const;
199 
201  void markAsClean();
202 
205  AccessMode accessMode() const;
206 
225  bool isConfigWritable(bool warnUser);
227 
245  KConfig* copyTo(const QString &file, KConfig *config = 0) const;
246 
263  void checkUpdate(const QString &id, const QString &updateFile);
264 
268  void reparseConfiguration();
269 
271 
299  void addConfigSources(const QStringList &sources);
300 
303 
306  QString locale() const;
319  bool setLocale(const QString& aLocale);
321 
323 
332  void setReadDefaults(bool b);
337  bool readDefaults() const;
339 
342  bool isImmutable() const;
344 
346 
355 #ifndef KDE_NO_DEPRECATED
356  KDE_DEPRECATED void setForceGlobal(bool force);
357 #endif
358 
367 #ifndef KDE_NO_DEPRECATED
368  KDE_DEPRECATED bool forceGlobal() const;
369 #endif
370 
373  QStringList groupList() const;
374 
386  QMap<QString, QString> entryMap(const QString &aGroup=QString()) const;
387 
388 protected:
389  virtual bool hasGroupImpl(const QByteArray &group) const;
390  virtual KConfigGroup groupImpl( const QByteArray &b);
391  virtual const KConfigGroup groupImpl(const QByteArray &b) const;
392  virtual void deleteGroupImpl(const QByteArray &group, WriteConfigFlags flags = Normal);
393  virtual bool isGroupImmutableImpl(const QByteArray& aGroup) const;
394 
395  friend class KConfigGroup;
396  friend class KConfigGroupPrivate;
397 
401  virtual void virtual_hook( int id, void* data );
402 
403  KConfigPrivate *const d_ptr;
404 
405  KConfig(KConfigPrivate &d);
406 
407 private:
408  friend class KConfigTest;
409 
410  QStringList keyList(const QString& aGroup=QString()) const;
411 
412  Q_DISABLE_COPY(KConfig)
413 
414  Q_DECLARE_PRIVATE(KConfig)
415 };
416 Q_DECLARE_OPERATORS_FOR_FLAGS( KConfig::OpenFlags )
417 
418 #endif // KCONFIG_H
KConfigBase::virtual_hook
virtual void virtual_hook(int id, void *data)
Virtual hook, used to add new "virtual" functions while maintaining binary compatibility.
Definition: kconfigbase.cpp:111
KEntryMap
Definition: kconfigdata.h:152
kdecore_export.h
QByteArray
KMacroExpander::group
Definition: kmacroexpander_unix.cpp:34
QMap
KGlobal::config
KSharedConfigPtr config()
Returns the general config object.
Definition: kglobal.cpp:139
KConfig::OpenFlag
OpenFlag
Determines how the system-wide and user's global settings will affect the reading of the configuratio...
Definition: kconfig.h:92
KGlobal::setLocale
void setLocale(KLocale *, CopyCatalogs copy=DoCopyCatalogs)
Definition: kglobal.cpp:256
KConfigBase::isGroupImmutableImpl
virtual bool isGroupImmutableImpl(const QByteArray &aGroup) const =0
KConfigPrivate
Definition: kconfig_p.h:42
QString
KConfigBase::groupImpl
virtual KConfigGroup groupImpl(const QByteArray &b)=0
KConfigBase
Definition: kconfigbase.h:38
QStringList
KConfigBase::deleteGroupImpl
virtual void deleteGroupImpl(const QByteArray &group, WriteConfigFlags flags=Normal)=0
KGlobal::locale
KLocale * locale()
Returns the global locale object.
Definition: kglobal.cpp:170
KConfigGroup
A class for one specific group in a KConfig object.
Definition: kconfiggroup.h:53
KConfig
The central class of the KDE configuration data system.
Definition: kconfig.h:70
KConfigBase::hasGroupImpl
virtual bool hasGroupImpl(const QByteArray &group) const =0
kconfigbase.h
KComponentData
Per component data.
Definition: kcomponentdata.h:46
KConfigBase::groupList
virtual QStringList groupList() const =0
Returns a list of groups that are known about.
KConfig::d_ptr
KConfigPrivate *const d_ptr
Definition: kconfig.h:403
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal