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

KDECore

  • 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
42class KConfigPrivate
43{
44 friend class KConfig;
45public:
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
71protected:
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?
82private:
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
KComponentData
Per component data.
Definition: kcomponentdata.h:47
KConfigBase::AccessMode
AccessMode
Possible return values for accessMode().
Definition: kconfigbase.h:133
KConfigBase::ReadOnly
@ ReadOnly
Definition: kconfigbase.h:133
KConfigGroup
A class for one specific group in a KConfig object.
Definition: kconfiggroup.h:54
KConfigPrivate
Definition: kconfig_p.h:43
KConfigPrivate::allSubGroups
QSet< QByteArray > allSubGroups(const QByteArray &parentGroup) const
Definition: kconfig.cpp:303
KConfigPrivate::revertEntry
void revertEntry(const QByteArray &group, const char *key)
Definition: kconfig.cpp:858
KConfigPrivate::resourceType
const char * resourceType
Definition: kconfig_p.h:47
KConfigPrivate::copyGroup
void copyGroup(const QByteArray &source, const QByteArray &destination, KConfigGroup *otherGroup, KConfigBase::WriteConfigFlags flags) const
Definition: kconfig.cpp:109
KConfigPrivate::hasNonDeletedEntries
bool hasNonDeletedEntries(const QByteArray &group) const
Definition: kconfig.cpp:316
KConfigPrivate::expandString
static QString expandString(const QString &value)
Definition: kconfig.cpp:155
KConfigPrivate::groupList
QStringList groupList(const QByteArray &group) const
Definition: kconfig.cpp:278
KConfigPrivate::lookupData
QString lookupData(const QByteArray &group, const char *key, KEntryMap::SearchFlags flags, bool *expand) const
Definition: kconfig.cpp:876
KConfigPrivate::~KConfigPrivate
virtual ~KConfigPrivate()
Definition: kconfig_p.h:77
KConfigPrivate::canWriteEntry
bool canWriteEntry(const QByteArray &group, const char *key, bool isDefault=false) const
Definition: kconfig.cpp:832
KConfigPrivate::changeFileName
void changeFileName(const QString &fileName, const char *resourceType)
Definition: kconfig.cpp:509
KConfigPrivate::putData
void putData(const QByteArray &group, const char *key, const QByteArray &value, KConfigBase::WriteConfigFlags flags, bool expand=false)
Definition: kconfig.cpp:840
KConfigPrivate::keyListImpl
QStringList keyListImpl(const QByteArray &theGroup) const
Definition: kconfig.cpp:328
KConfigPrivate::bDynamicBackend
bool bDynamicBackend
Definition: kconfig_p.h:81
KConfigPrivate::openFlags
KConfig::OpenFlags openFlags
Definition: kconfig_p.h:46
KConfigPrivate::mBackend
KSharedPtr< KConfigBackend > mBackend
Definition: kconfig_p.h:72
KConfig
The central class of the KDE configuration data system.
Definition: kconfig.h:71
KConfig::SimpleConfig
@ SimpleConfig
Just a single config file.
Definition: kconfig.h:96
KConfig::CascadeConfig
@ CascadeConfig
Cascade to system-wide config files.
Definition: kconfig.h:94
KConfig::IncludeGlobals
@ IncludeGlobals
Blend kdeglobals into the config object.
Definition: kconfig.h:93
KEntryMap
type specifying a map of entries (key,value pairs).
Definition: kconfigdata.h:153
KSharedPtr
Can be used to control the lifetime of an object that has derived QSharedData.
Definition: ksharedptr.h:64
QSet
Definition: k3resolver.h:41
QStringList
QString
kcomponentdata.h
kconfigbackend.h
kconfigdata.h
kconfiggroup.h
kglobal.h
klocale.h
kstandarddirs.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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