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

KDECore

  • sources
  • kde-4.12
  • kdelibs
  • kdecore
  • config
kconfig_p.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_P_H
25 #define KCONFIG_P_H
26 
27 #include "kconfigdata.h"
28 #include <kglobal.h>
29 #include "kconfigbackend.h"
30 #include "kconfiggroup.h"
31 #include "kcomponentdata.h"
32 #include "kstandarddirs.h"
33 #include "klocale.h"
34 
35 #include <QtCore/QStringList>
36 #include <QtCore/QStack>
37 #include <QtCore/QFile>
38 #include <QtCore/QDir>
39 
40 #include <unistd.h>
41 
42 class KConfigPrivate
43 {
44  friend class KConfig;
45 public:
46  KConfig::OpenFlags openFlags;
47  const char* resourceType;
48 
49  void changeFileName(const QString& fileName, const char* resourceType);
50 
51  // functions for KConfigGroup
52  bool canWriteEntry(const QByteArray& group, const char* key, bool isDefault=false) const;
53  QString lookupData(const QByteArray& group, const char* key, KEntryMap::SearchFlags flags,
54  bool* expand) const;
55  QByteArray lookupData(const QByteArray& group, const char* key, KEntryMap::SearchFlags flags) const;
56 
57  void putData(const QByteArray& group, const char* key, const QByteArray& value,
58  KConfigBase::WriteConfigFlags flags, bool expand=false);
59  void revertEntry(const QByteArray& group, const char* key);
60  QStringList groupList(const QByteArray& group) const;
61  // copies the entries from @p source to @p otherGroup changing all occurrences
62  // of @p source with @p destination
63  void copyGroup(const QByteArray& source, const QByteArray& destination,
64  KConfigGroup *otherGroup, KConfigBase::WriteConfigFlags flags) const;
65  QStringList keyListImpl(const QByteArray& theGroup) const;
66  QSet<QByteArray> allSubGroups(const QByteArray& parentGroup) const;
67  bool hasNonDeletedEntries(const QByteArray& group) const;
68 
69  static QString expandString(const QString& value);
70 
71 protected:
72  KSharedPtr<KConfigBackend> mBackend;
73 
74  KConfigPrivate(const KComponentData &componentData_, KConfig::OpenFlags flags,
75  const char* resource);
76 
77  virtual ~KConfigPrivate()
78  {
79  }
80 
81  bool bDynamicBackend:1; // do we own the backend?
82 private:
83  bool bDirty:1;
84  bool bLocaleInitialized:1;
85  bool bReadDefaults:1;
86  bool bFileImmutable:1;
87  bool bForceGlobal:1;
88  bool bSuppressGlobal:1;
89 
90  QString sGlobalFileName;
91  static bool mappingsRegistered;
92 
93 
94  KEntryMap entryMap;
95  QString backendType;
96  QStack<QString> extraFiles;
97 
98  QString locale;
99  QString fileName;
100  QString etc_kderc;
101  KComponentData componentData;
102  KConfigBase::AccessMode configState;
103 
104  bool wantGlobals() const { return openFlags&KConfig::IncludeGlobals && !bSuppressGlobal; }
105  bool wantDefaults() const { return openFlags&KConfig::CascadeConfig; }
106  bool isSimple() const { return openFlags == KConfig::SimpleConfig; }
107  bool isReadOnly() const { return configState == KConfig::ReadOnly; }
108 
109  bool setLocale(const QString& aLocale);
110  QStringList getGlobalFiles() const;
111  void parseGlobalFiles();
112  void parseConfigFiles();
113  void initCustomized(KConfig*);
114  bool lockLocal();
115 };
116 
117 #endif // KCONFIG_P_H
KConfigPrivate::allSubGroups
QSet< QByteArray > allSubGroups(const QByteArray &parentGroup) const
Definition: kconfig.cpp:325
KConfigPrivate::~KConfigPrivate
virtual ~KConfigPrivate()
Definition: kconfig_p.h:77
KSharedPtr< KConfigBackend >
KConfig::IncludeGlobals
Blend kdeglobals into the config object.
Definition: kconfig.h:93
KConfigPrivate::copyGroup
void copyGroup(const QByteArray &source, const QByteArray &destination, KConfigGroup *otherGroup, KConfigBase::WriteConfigFlags flags) const
Definition: kconfig.cpp:109
KConfigPrivate::changeFileName
void changeFileName(const QString &fileName, const char *resourceType)
Definition: kconfig.cpp:535
KConfig::CascadeConfig
Cascade to system-wide config files.
Definition: kconfig.h:94
KConfigPrivate::KConfigPrivate
KConfigPrivate(const KComponentData &componentData_, KConfig::OpenFlags flags, const char *resource)
Definition: kconfig.cpp:56
KConfigPrivate::openFlags
KConfig::OpenFlags openFlags
Definition: kconfig_p.h:46
KEntryMap
Definition: kconfigdata.h:152
KMacroExpander::group
Definition: kmacroexpander_unix.cpp:34
KConfigPrivate::expandString
static QString expandString(const QString &value)
Definition: kconfig.cpp:155
KConfig::componentData
const KComponentData & componentData() const
Returns the component data this configuration is for.
Definition: kconfig.cpp:285
KConfigPrivate::bDynamicBackend
bool bDynamicBackend
Definition: kconfig_p.h:81
KConfig::SimpleConfig
Just a single config file.
Definition: kconfig.h:96
QString
KConfigPrivate::revertEntry
void revertEntry(const QByteArray &group, const char *key)
Definition: kconfig.cpp:884
klocale.h
KConfigBase::ReadOnly
Definition: kconfigbase.h:133
KConfig::entryMap
QMap< QString, QString > entryMap(const QString &aGroup=QString()) const
Returns a map (tree) of entries in a particular group.
Definition: kconfig.cpp:382
KConfig::locale
QString locale() const
locales
Definition: kconfig.cpp:716
kconfigbackend.h
kglobal.h
KConfigPrivate::canWriteEntry
bool canWriteEntry(const QByteArray &group, const char *key, bool isDefault=false) const
Definition: kconfig.cpp:858
KConfig::setLocale
bool setLocale(const QString &aLocale)
Sets the locale to aLocale.
Definition: kconfig.cpp:731
QStringList
KConfigPrivate
Definition: kconfig_p.h:42
KConfigPrivate::mBackend
KSharedPtr< KConfigBackend > mBackend
Definition: kconfig_p.h:72
kconfigdata.h
QSet< QByteArray >
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
KConfigPrivate::groupList
QStringList groupList(const QByteArray &group) const
Definition: kconfig.cpp:308
KConfigPrivate::lookupData
QString lookupData(const QByteArray &group, const char *key, KEntryMap::SearchFlags flags, bool *expand) const
Definition: kconfig.cpp:902
KConfigPrivate::keyListImpl
QStringList keyListImpl(const QByteArray &theGroup) const
Definition: kconfig.cpp:354
kstandarddirs.h
KConfigBase::AccessMode
AccessMode
Possible return values for accessMode().
Definition: kconfigbase.h:133
KConfigPrivate::resourceType
const char * resourceType
Definition: kconfig_p.h:47
kcomponentdata.h
KConfigPrivate::hasNonDeletedEntries
bool hasNonDeletedEntries(const QByteArray &group) const
Definition: kconfig.cpp:340
KConfigPrivate::putData
void putData(const QByteArray &group, const char *key, const QByteArray &value, KConfigBase::WriteConfigFlags flags, bool expand=false)
Definition: kconfig.cpp:866
KComponentData
Per component data.
Definition: kcomponentdata.h:46
kconfiggroup.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:08 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • 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