34 #include <QtCore/QDate>
35 #include <QtCore/QSharedData>
36 #include <QtCore/QFile>
37 #include <QtCore/QPoint>
38 #include <QtCore/QRect>
39 #include <QtCore/QString>
40 #include <QtCore/QTextStream>
41 #include <QtCore/QDir>
48 KConfigGroupPrivate(
KConfig* owner,
bool isImmutable,
bool isConst,
const QByteArray &name)
49 : mOwner(owner), mName(name), bImmutable(isImmutable), bConst(isConst)
54 : sOwner(owner), mOwner(sOwner.data()), mName(name),
55 bImmutable(name.isEmpty()? owner->isImmutable(): owner->isGroupImmutable(name)), bConst(false)
59 KConfigGroupPrivate(
KConfigGroup* parent,
bool isImmutable,
bool isConst,
const QByteArray& name)
60 : sOwner(parent->d->sOwner), mOwner(parent->d->mOwner), mName(name),
61 bImmutable(isImmutable), bConst(isConst)
63 if (!parent->d->mName.isEmpty())
67 KConfigGroupPrivate(
const KConfigGroupPrivate* other,
bool isImmutable,
const QByteArray &name)
68 : sOwner(other->sOwner), mOwner(other->mOwner), mName(name),
69 bImmutable(isImmutable), bConst(other->bConst)
71 if (!other->mName.isEmpty())
72 mParent = const_cast<KConfigGroupPrivate *>(other);
77 QExplicitlySharedDataPointer<KConfigGroupPrivate> mParent;
81 const bool bImmutable:1;
84 QByteArray fullName()
const
89 return mParent->fullName(mName);
92 QByteArray name()
const
99 QByteArray fullName(
const QByteArray& aGroup)
const
103 return fullName() +
'\x1d' + aGroup;
106 static QExplicitlySharedDataPointer<KConfigGroupPrivate> create(
KConfigBase *master,
107 const QByteArray &name,
111 QExplicitlySharedDataPointer<KConfigGroupPrivate> data;
112 if (dynamic_cast<KConfigGroup*>(master))
113 data =
new KConfigGroupPrivate(dynamic_cast<KConfigGroup*>(master), isImmutable, isConst, name);
115 data =
new KConfigGroupPrivate(dynamic_cast<KConfig*>(master), isImmutable, isConst, name);
125 QByteArray value =
"";
127 if (!list.isEmpty()) {
131 value = QByteArray(*it).replace(
'\\',
"\\\\").replace(
',',
"\\,");
133 while (++it != end) {
139 value += QByteArray(*it).replace(
'\\',
"\\\\").replace(
',',
"\\,");
154 if (data == QLatin1String(
"\\0"))
158 val.reserve(data.size());
160 for (
int p = 0; p < data.length(); p++) {
164 }
else if (data[p].unicode() ==
'\\') {
166 }
else if (data[p].unicode() ==
',') {
170 val.reserve(data.size() - p);
182 Q_FOREACH(
const QByteArray& s,
string.split(
','))
190 Q_FOREACH(
const QByteArray& s,
string.split(
','))
191 list << s.toDouble();
196 return QString::fromLatin1(
"\"%1\" - conversion of \"%3\" to %2 failed")
197 .arg(QString::fromLatin1(pKey))
198 .arg(QString::fromLatin1(QVariant::typeToName(aDefault.type())))
199 .arg(QString::fromLatin1(value));
203 return QString::fromLatin1(
" (wrong format: expected %1 items, got %2)").arg( expected ).arg( got );
206 QVariant KConfigGroup::convertToQVariant(
const char *pKey,
const QByteArray& value,
const QVariant& aDefault)
211 switch( aDefault.type() ) {
212 case QVariant::Invalid:
214 case QVariant::String:
218 return QString::fromUtf8(value);
220 case QVariant::StringList:
221 return KConfigGroupPrivate::deserializeList(QString::fromUtf8(value));
222 case QVariant::ByteArray:
224 case QVariant::Bool: {
225 const QByteArray lower(value.toLower());
226 if (lower ==
"false" || lower ==
"no" || lower ==
"off" || lower ==
"0")
230 case QVariant::Double:
231 case QMetaType::Float:
234 case QVariant::LongLong:
235 case QVariant::ULongLong: {
237 if ( !tmp.convert(aDefault.type()) )
241 case QVariant::Point: {
244 if ( list.count() != 2 ) {
249 return QPoint(list.at( 0 ), list.at( 1 ));
251 case QVariant::PointF: {
254 if ( list.count() != 2 ) {
259 return QPointF(list.at( 0 ), list.at( 1 ));
261 case QVariant::Rect: {
264 if ( list.count() != 4 ) {
269 const QRect rect(list.at( 0 ), list.at( 1 ), list.at( 2 ), list.at( 3 ));
270 if ( !rect.isValid() ) {
276 case QVariant::RectF: {
279 if ( list.count() != 4 ) {
284 const QRectF rect(list.at( 0 ), list.at( 1 ), list.at( 2 ), list.at( 3 ));
285 if ( !rect.isValid() ) {
291 case QVariant::Size: {
294 if ( list.count() != 2 ) {
299 const QSize size(list.at( 0 ), list.at( 1 ));
300 if ( !size.isValid() ) {
306 case QVariant::SizeF: {
309 if ( list.count() != 2 ) {
314 const QSizeF size(list.at( 0 ), list.at( 1 ));
315 if ( !size.isValid() ) {
321 case QVariant::DateTime: {
323 if ( list.count() != 6 ) {
328 const QDate date( list.at( 0 ), list.at( 1 ), list.at( 2 ) );
329 const QTime time( list.at( 3 ), list.at( 4 ), list.at( 5 ) );
331 if ( !dt.isValid() ) {
337 case QVariant::Date: {
339 if ( list.count() == 6 )
340 list = list.mid(0, 3);
341 if ( list.count() != 3 ) {
346 const QDate date( list.at( 0 ), list.at( 1 ), list.at( 2 ) );
347 if ( !date.isValid() ) {
353 case QVariant::Color:
355 kWarning() <<
"KConfigGroup::readEntry was passed GUI type '"
356 << aDefault.typeName()
357 <<
"' but kdeui isn't linked! If it is linked to your program, "
358 "this is a platform bug. Please inform the KDE developers";
361 return QUrl(QString::fromUtf8(value));
364 if( aDefault.canConvert<
KUrl>() ) {
365 const KUrl url(QString::fromUtf8(value));
366 return qVariantFromValue<KUrl>( url );
371 kWarning() <<
"unhandled type " << aDefault.typeName();
376 # include <QtCore/QDir>
381 #ifdef Q_WS_WIN //safer
382 if (!QDir::convertSeparators(path).startsWith(QDir::convertSeparators(homeDir)))
385 if (!path.startsWith(homeDir))
389 int len = homeDir.length();
391 if (len && (path.length() == len || path[len] == QLatin1Char(
'/'))) {
392 path.replace(0, len, QString::fromLatin1(
"$HOME"));
404 path.replace(QLatin1Char(
'$'), QLatin1String(
"$$"));
406 bool startsWithFile = path.startsWith(QLatin1String(
"file:"), Qt::CaseInsensitive);
410 if ((!startsWithFile && QFileInfo(path).isRelative()) ||
411 (startsWithFile && QFileInfo(path.mid(5)).isRelative()))
418 while (path[0] == QLatin1Char(
'/') && path[1] == QLatin1Char(
'/'))
425 const QString homeDir0 = QFile::decodeName(qgetenv(
"HOME"));
426 const QString homeDir1 = QDir::homePath();
427 const QString homeDir2 = QDir(homeDir1).canonicalPath();
435 path.prepend(QString::fromLatin1(
"file://"));
447 return 0 != d.constData();
455 return _kde_internal_KConfigGroupGui.
readEntryGui(data, key, input, output);
460 KConfigGroup::WriteConfigFlags flags)
463 return _kde_internal_KConfigGroupGui.
writeEntryGui(cg, key, input, flags);
468 : d(KConfigGroupPrivate::create(master, _group.toUtf8(), master->isGroupImmutable(_group), false))
473 : d(KConfigGroupPrivate::create(master, _group, master->isGroupImmutable(_group), false))
478 : d(KConfigGroupPrivate::create(const_cast<
KConfigBase*>(master), _group.toUtf8(), master->isGroupImmutable(_group), true))
483 : d(KConfigGroupPrivate::create(const_cast<
KConfigBase*>(master), _group, master->isGroupImmutable(_group), true))
488 : d(new KConfigGroupPrivate(master, _group.toUtf8()))
493 : d(new KConfigGroupPrivate(master, _group))
515 Q_ASSERT_X(
isValid(),
"KConfigGroup::groupImpl",
"accessing an invalid group");
516 Q_ASSERT_X(!aGroup.isEmpty(),
"KConfigGroup::groupImpl",
"can not have an unnamed child group");
527 Q_ASSERT_X(
isValid(),
"KConfigGroup::groupImpl",
"accessing an invalid group");
528 Q_ASSERT_X(!aGroup.isEmpty(),
"KConfigGroup::groupImpl",
"can not have an unnamed child group");
540 Q_ASSERT_X(
isValid(),
"KConfigGroup::parent",
"accessing an invalid group");
545 parentGroup.d = d->mParent;
547 parentGroup.d =
new KConfigGroupPrivate(d->mOwner, d->mOwner->isImmutable(), d->bConst,
"");
549 parentGroup.d->sOwner = d->sOwner;
557 Q_ASSERT_X(
isValid(),
"KConfigGroup::deleteGroup",
"accessing an invalid group");
558 Q_ASSERT_X(!d->bConst,
"KConfigGroup::deleteGroup",
"deleting a read-only group");
563 #ifndef KDE_NO_DEPRECATED
566 Q_ASSERT_X(
isValid(),
"KConfigGroup::changeGroup",
"accessing an invalid group");
568 d->mName = group.toUtf8();
572 #ifndef KDE_NO_DEPRECATED
575 Q_ASSERT_X(
isValid(),
"KConfigGroup::changeGroup",
"accessing an invalid group");
583 Q_ASSERT_X(
isValid(),
"KConfigGroup::name",
"accessing an invalid group");
585 return QString::fromUtf8(d->name());
590 Q_ASSERT_X(
isValid(),
"KConfigGroup::exists",
"accessing an invalid group");
597 Q_ASSERT_X(
isValid(),
"KConfigGroup::sync",
"accessing an invalid group");
605 Q_ASSERT_X(
isValid(),
"KConfigGroup::entryMap",
"accessing an invalid group");
612 Q_ASSERT_X(
isValid(),
"KConfigGroup::config",
"accessing an invalid group");
619 Q_ASSERT_X(
isValid(),
"KConfigGroup::config",
"accessing an invalid group");
626 Q_ASSERT_X(
isValid(),
"KConfigGroup::isEntryImmutable",
"accessing an invalid group");
644 Q_ASSERT_X(
isValid(),
"KConfigGroup::readEntryUntranslated",
"accessing an invalid group");
646 QString result =
config()->d_func()->lookupData(d->fullName(), key, KEntryMap::SearchFlags(), 0);
654 return readEntry(key, QString::fromUtf8(aDefault));
659 return readEntry(key.toUtf8().constData(), aDefault);
664 Q_ASSERT_X(
isValid(),
"KConfigGroup::readEntry",
"accessing an invalid group");
682 return readEntry(key.toUtf8().constData(), aDefault);
687 Q_ASSERT_X(
isValid(),
"KConfigGroup::readEntry",
"accessing an invalid group");
693 return KConfigGroupPrivate::deserializeList(data);
698 return readEntry( key.toUtf8().constData(), aDefault );
703 Q_ASSERT_X(
isValid(),
"KConfigGroup::readEntry",
"accessing an invalid group");
711 return convertToQVariant(key, data, aDefault);
718 return readEntry( key.toUtf8().constData(), aDefault );
723 Q_ASSERT_X(
isValid(),
"KConfigGroup::readEntry",
"accessing an invalid group");
730 foreach(
const QString& v, KConfigGroupPrivate::deserializeList(data))
738 return readEntry( key.toUtf8().constData(), aDefault );
748 Q_ASSERT_X(
isValid(),
"KConfigGroup::readXdgListEntry",
"accessing an invalid group");
756 val.reserve(data.size());
760 for (
int p = 0; p < data.length(); p++) {
764 }
else if (data[p] == QLatin1Char(
'\\')) {
766 }
else if (data[p] == QLatin1Char(
';')) {
769 val.reserve(data.size() - p);
774 if (!val.isEmpty()) {
775 kWarning() <<
"List entry" << key <<
"in" <<
config()->
name() <<
"is not compliant with XDG standard (missing trailing semicolon).";
788 Q_ASSERT_X(
isValid(),
"KConfigGroup::readPathEntry",
"accessing an invalid group");
807 Q_ASSERT_X(
isValid(),
"KConfigGroup::readPathEntry",
"accessing an invalid group");
813 return KConfigGroupPrivate::deserializeList(data);
818 Q_ASSERT_X(
isValid(),
"KConfigGroup::writeEntry",
"accessing an invalid group");
819 Q_ASSERT_X(!d->bConst,
"KConfigGroup::writeEntry",
"writing to a read-only group");
826 writeEntry(key.toUtf8().constData(), value, flags);
831 Q_ASSERT_X(
isValid(),
"KConfigGroup::writeEntry",
"accessing an invalid group");
832 Q_ASSERT_X(!d->bConst,
"KConfigGroup::writeEntry",
"writing to a read-only group");
843 WriteConfigFlags flags )
845 Q_ASSERT_X(
isValid(),
"KConfigGroup::writeEntry",
"accessing an invalid group");
846 Q_ASSERT_X(!d->bConst,
"KConfigGroup::writeEntry",
"writing to a read-only group");
848 config()->d_func()->putData(d->fullName(), key, value.isNull()? QByteArray(
""): value, flags);
852 WriteConfigFlags pFlags)
854 writeEntry(key.toUtf8().constData(), value, pFlags);
859 Q_ASSERT_X(
isValid(),
"KConfigGroup::writeEntry",
"accessing an invalid group");
860 Q_ASSERT_X(!d->bConst,
"KConfigGroup::writeEntry",
"writing to a read-only group");
864 foreach(
const QString &entry, list)
865 balist.append(entry.toUtf8());
867 writeEntry(key, KConfigGroupPrivate::serializeList(balist), flags);
872 writeEntry(key.toUtf8().constData(), list, flags);
877 Q_ASSERT_X(
isValid(),
"KConfigGroup::writeEntry",
"accessing an invalid group");
878 Q_ASSERT_X(!d->bConst,
"KConfigGroup::writeEntry",
"writing to a read-only group");
883 if (v.type() == QVariant::ByteArray)
884 data << v.toByteArray();
886 data << v.toString().toUtf8();
889 writeEntry(key, KConfigGroupPrivate::serializeList(data), flags);
893 WriteConfigFlags flags )
895 Q_ASSERT_X(
isValid(),
"KConfigGroup::writeEntry",
"accessing an invalid group");
896 Q_ASSERT_X(!d->bConst,
"KConfigGroup::writeEntry",
"writing to a read-only group");
905 switch( value.type() ) {
906 case QVariant::Invalid:
909 case QVariant::ByteArray:
910 data = value.toByteArray();
912 case QVariant::String:
915 case QVariant::Double:
916 case QMetaType::Float:
918 case QVariant::LongLong:
919 case QVariant::ULongLong:
920 data = value.toString().toUtf8();
923 kError(!value.canConvert(QVariant::StringList))
924 <<
"not all types in \"" << key <<
"\" can convert to QString,"
925 " information will be lost";
926 case QVariant::StringList:
929 case QVariant::Point: {
931 const QPoint rPoint = value.toPoint();
932 list.insert( 0, rPoint.x() );
933 list.insert( 1, rPoint.y() );
938 case QVariant::PointF: {
940 const QPointF point = value.toPointF();
941 list.insert( 0, point.x() );
942 list.insert( 1, point.y() );
947 case QVariant::Rect:{
949 const QRect rRect = value.toRect();
950 list.insert( 0, rRect.left() );
951 list.insert( 1, rRect.top() );
952 list.insert( 2, rRect.width() );
953 list.insert( 3, rRect.height() );
958 case QVariant::RectF:{
960 const QRectF rRectF = value.toRectF();
961 list.insert(0, rRectF.left());
962 list.insert(1, rRectF.top());
963 list.insert(2, rRectF.width());
964 list.insert(3, rRectF.height());
969 case QVariant::Size:{
971 const QSize rSize = value.toSize();
972 list.insert( 0, rSize.width() );
973 list.insert( 1, rSize.height() );
978 case QVariant::SizeF:{
980 const QSizeF rSizeF = value.toSizeF();
981 list.insert(0, rSizeF.width());
982 list.insert(1, rSizeF.height());
987 case QVariant::Date: {
989 const QDate date = value.toDate();
991 list.insert( 0, date.year() );
992 list.insert( 1, date.month() );
993 list.insert( 2, date.day() );
998 case QVariant::DateTime: {
1000 const QDateTime rDateTime = value.toDateTime();
1002 const QTime time = rDateTime.time();
1003 const QDate date = rDateTime.date();
1005 list.insert( 0, date.year() );
1006 list.insert( 1, date.month() );
1007 list.insert( 2, date.day() );
1009 list.insert( 3, time.hour() );
1010 list.insert( 4, time.minute() );
1011 list.insert( 5, time.second() );
1017 case QVariant::Color:
1018 case QVariant::Font:
1019 kWarning() <<
"KConfigGroup::writeEntry was passed GUI type '"
1021 <<
"' but kdeui isn't linked! If it is linked to your program, this is a platform bug. "
1022 "Please inform the KDE developers";
1025 data =
KUrl(value.toUrl()).url().toUtf8();
1028 if( value.canConvert<
KUrl>() ) {
1029 data = qvariant_cast<
KUrl>(value).url().toUtf8();
1032 kWarning() <<
"KConfigGroup::writeEntry - unhandled type" << value.typeName() <<
"in group" <<
name();
1040 writeEntry(key.toUtf8().constData(), value, flags);
1045 writeEntry(key.toUtf8().constData(), list, flags);
1055 Q_ASSERT_X(
isValid(),
"KConfigGroup::writeXdgListEntry",
"accessing an invalid group");
1056 Q_ASSERT_X(!d->bConst,
"KConfigGroup::writeXdgListEntry",
"writing to a read-only group");
1059 value.reserve(4096);
1063 QStringList::ConstIterator it = list.constBegin();
1064 const QStringList::ConstIterator end = list.constEnd();
1065 for (; it != end; ++it) {
1067 val.replace(QLatin1Char(
'\\'), QLatin1String(
"\\\\")).replace(QLatin1Char(
';'), QLatin1String(
"\\;"));
1069 value += QLatin1Char(
';');
1082 Q_ASSERT_X(
isValid(),
"KConfigGroup::writePathEntry",
"accessing an invalid group");
1083 Q_ASSERT_X(!d->bConst,
"KConfigGroup::writePathEntry",
"writing to a read-only group");
1085 config()->d_func()->putData(d->fullName(), pKey,
translatePath(path).toUtf8(), pFlags,
true);
1095 Q_ASSERT_X(
isValid(),
"KConfigGroup::writePathEntry",
"accessing an invalid group");
1096 Q_ASSERT_X(!d->bConst,
"KConfigGroup::writePathEntry",
"writing to a read-only group");
1099 foreach(
const QString& path, value)
1102 config()->d_func()->putData(d->fullName(), pKey, KConfigGroupPrivate::serializeList(list), pFlags,
true);
1107 Q_ASSERT_X(
isValid(),
"KConfigGroup::deleteEntry",
"accessing an invalid group");
1108 Q_ASSERT_X(!d->bConst,
"KConfigGroup::deleteEntry",
"deleting from a read-only group");
1110 config()->d_func()->putData(d->fullName(), key, QByteArray(), flags);
1120 Q_ASSERT_X(
isValid(),
"KConfigGroup::revertToDefault",
"accessing an invalid group");
1121 Q_ASSERT_X(!d->bConst,
"KConfigGroup::revertToDefault",
"writing to a read-only group");
1123 config()->d_func()->revertEntry(d->fullName(), key);
1133 Q_ASSERT_X(
isValid(),
"KConfigGroup::hasDefault",
"accessing an invalid group");
1137 return !
config()->d_func()->lookupData(d->fullName(), key, flags).isNull();
1147 Q_ASSERT_X(
isValid(),
"KConfigGroup::hasKey",
"accessing an invalid group");
1150 if (
config()->readDefaults() )
1153 return !
config()->d_func()->lookupData(d->fullName(), key, flags).isNull();
1158 return hasKey(key.toUtf8().constData());
1163 Q_ASSERT_X(
isValid(),
"KConfigGroup::isImmutable",
"accessing an invalid group");
1165 return d->bImmutable;
1170 Q_ASSERT_X(
isValid(),
"KConfigGroup::groupList",
"accessing an invalid group");
1177 Q_ASSERT_X(
isValid(),
"KConfigGroup::keyList",
"accessing an invalid group");
1184 Q_ASSERT_X(
isValid(),
"KConfigGroup::markAsClean",
"accessing an invalid group");
1191 Q_ASSERT_X(
isValid(),
"KConfigGroup::accessMode",
"accessing an invalid group");
1198 Q_ASSERT_X(
isValid(),
"KConfigGroup::hasGroupImpl",
"accessing an invalid group");
1205 Q_ASSERT_X(
isValid(),
"KConfigGroup::deleteGroupImpl",
"accessing an invalid group");
1206 Q_ASSERT_X(!d->bConst,
"KConfigGroup::deleteGroupImpl",
"deleting from a read-only group");
1213 Q_ASSERT_X(
isValid(),
"KConfigGroup::isGroupImmutableImpl",
"accessing an invalid group");
1216 return d->bImmutable;
1223 Q_ASSERT_X(
isValid(),
"KConfigGroup::copyTo",
"accessing an invalid group");
1224 Q_ASSERT(other != 0);
1226 if (
KConfigGroup *otherGroup = dynamic_cast<KConfigGroup*>(other)) {
1227 config()->d_func()->copyGroup(d->fullName(), otherGroup->d->fullName(), otherGroup, pFlags);
1228 }
else if (
KConfig* otherConfig = dynamic_cast<KConfig*>(other)) {
1230 otherConfig->d_func()->copyGroup(d->fullName(), d->fullName(), &newGroup, pFlags);
1232 Q_ASSERT_X(
false,
"KConfigGroup::copyTo",
"unknown type of KConfigBase");
1238 Q_ASSERT_X(
isValid(),
"KConfigGroup::reparent",
"accessing an invalid group");
1239 Q_ASSERT_X(!d->bConst,
"KConfigGroup::reparent",
"reparenting a read-only group");
1240 Q_ASSERT_X(!d->bImmutable,
"KConfigGroup::reparent",
"reparenting an immutable group");
1241 Q_ASSERT(parent != 0);
1245 d = KConfigGroupPrivate::create(parent, d->mName,
false,
false);
1246 oldGroup.
copyTo(
this, pFlags);
kWriteEntryGui writeEntryGui
QString readPathEntry(const QString &pKey, const QString &aDefault) const
Reads a path.
KConfigGroup groupImpl(const QByteArray &b)
void writePathEntry(const QString &pKey, const QString &path, WriteConfigFlags pFlags=Normal)
Writes a file path to the configuration.
QString name() const
Returns the filename used to store the configuration.
static QString errString(const char *pKey, const QByteArray &value, const QVariant &aDefault)
AccessMode accessMode() const
bool hasDefault(const QString &key) const
Whether a default is specified for an entry in either the system wide configuration file or the globa...
static QString translatePath(QString path)
KConfigGroup & operator=(const KConfigGroup &)
bool isEntryImmutable(const QString &key) const
Checks if it is possible to change the given entry.
void reparent(KConfigBase *parent, WriteConfigFlags pFlags=Normal)
Changes the configuration object that this group belongs to.
static QString expandString(const QString &value)
static bool cleanHomeDirPath(QString &path, const QString &homeDir)
void deleteGroup(const QByteArray &group, WriteConfigFlags flags=Normal)
Delete aGroup.
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
KConfigGroup parent() const
Returns the group that this group belongs to.
bool hasGroup(const QString &group) const
Returns true if the specified group is known about.
KConfigGroup group(const QByteArray &group)
Returns an object for the named subgroup.
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
Writes a value to the configuration object.
void changeGroup(const QString &group)
Changes the group of the object.
bool isValid() const
Whether the group is valid.
void deleteGroup(WriteConfigFlags pFlags=Normal)
Delete all entries in the entire group.
static QString formatError(int expected, int got)
Represents and parses a URL.
kReadEntryGui readEntryGui
QMap< QString, QString > entryMap(const QString &aGroup=QString()) const
Returns a map (tree) of entries in a particular group.
void deleteEntry(const QString &pKey, WriteConfigFlags pFlags=Normal)
Deletes the entry specified by pKey in the current group.
QString readEntryUntranslated(const QString &pKey, const QString &aDefault=QString()) const
Reads an untranslated string entry.
bool exists() const
Check whether the containing KConfig object acutally contains a group with this name.
AccessMode accessMode() const
QStringList groupList() const
bool isGroupImmutableImpl(const QByteArray &aGroup) const
void writeXdgListEntry(const QString &pKey, const QStringList &value, WriteConfigFlags pFlags=Normal)
Writes a list of strings to the config object, following XDG desktop entry spec separator semantics...
friend class KConfigGroupPrivate
QStringList readXdgListEntry(const QString &pKey, const QStringList &aDefault=QStringList()) const
Reads a list of strings from the config object, following XDG desktop entry spec separator semantics...
void copyTo(KConfigBase *other, WriteConfigFlags pFlags=Normal) const
Copies the entries in this group to another configuration object.
QStringList keyList() const
Returns a list of keys this group contains.
QString homeDir(const QString &user)
QString name() const
The name of this group.
bool hasKey(const QString &key) const
Checks whether the key has an entry in this group.
A class for one specific group in a KConfig object.
static bool writeEntryGui(KConfigGroup *cg, const char *key, const QVariant &input, KConfigGroup::WriteConfigFlags flags)
static QList< int > asIntList(const QByteArray &string)
The central class of the KDE configuration data system.
KConfig * config()
Return the config object that this group belongs to.
void output(QList< Action > actions, QHash< QString, QString > domain)
bool hasGroupImpl(const QByteArray &group) const
static QList< qreal > asRealList(const QByteArray &string)
KConfigGroupGui _kde_internal_KConfigGroupGui
AccessMode
Possible return values for accessMode().
bool isGroupImmutable(const QByteArray &aGroup) const
Can changes be made to the entries in aGroup?
static bool readEntryGui(const QByteArray &data, const char *key, const QVariant &input, QVariant &output)
bool isImmutable() const
Whether this group may be changed.
void deleteGroupImpl(const QByteArray &group, WriteConfigFlags flags)
T readEntry(const QString &key, const T &aDefault) const
Reads the value of an entry specified by pKey in the current group.
void revertToDefault(const QString &key)
Reverts an entry to the default settings.
QStringList groupList() const
QMap< QString, QString > entryMap() const
Returns a map (tree) of entries for all entries in this group.
KConfigGroup()
Constructs an invalid group.
bool readDefaults() const