From cf32d4770d21fb9805f0eb629032244d132bba83 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 5 Jan 2009 23:27:29 +0000 Subject: [PATCH] make it easy to get at items and values by name svn path=/trunk/KDE/kdelibs/; revision=906335 --- configloader.cpp | 16 ++++++++++++++++ configloader.h | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/configloader.cpp b/configloader.cpp index f48154f44..0a5e981b7 100644 --- a/configloader.cpp +++ b/configloader.cpp @@ -387,6 +387,22 @@ KConfigSkeletonItem *ConfigLoader::findItem(const QString &group, const QString return KConfigSkeleton::findItem(d->keysToNames[group + key]); } +KConfigSkeletonItem *ConfigLoader::findItemByName(const QString &name) +{ + return KConfigSkeleton::findItem(name); +} + +QVariant ConfigLoader::property(const QString &name) +{ + KConfigSkeletonItem *item = KConfigSkeleton::findItem(name); + + if (item) { + return item->property(); + } + + return QVariant(); +} + bool ConfigLoader::hasGroup(const QString &group) const { return d->groups.contains(group); diff --git a/configloader.h b/configloader.h index e9860511b..4ae0ef0f8 100644 --- a/configloader.h +++ b/configloader.h @@ -115,6 +115,16 @@ public: */ KConfigSkeletonItem *findItem(const QString &group, const QString &key); + /** + * Finds an item by its name + */ + KConfigSkeletonItem *findItemByName(const QString &name); + + /** + * Returns the property (variantized value) of the named item + */ + QVariant property(const QString &name); + /** * Check to see if a group exists *