From 0cfad9a42fa1974888a70679fd352b7b00b1d046 Mon Sep 17 00:00:00 2001 From: Waldo Bastian Date: Tue, 26 Nov 2002 22:18:52 +0000 Subject: * Add support for files other than kdeglobals * Better not create a KApplication since that starts kdeinit svn path=/trunk/kdebase/src/kreadconfig/; revision=190568 --- src/kreadconfig/kreadconfig.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/kreadconfig/kreadconfig.cpp b/src/kreadconfig/kreadconfig.cpp index a36e7abf..cb20e7a6 100644 --- a/src/kreadconfig/kreadconfig.cpp +++ b/src/kreadconfig/kreadconfig.cpp @@ -34,6 +34,7 @@ static KCmdLineOptions options[] = { + { "file ", I18N_NOOP("Use instead of global config"), 0 }, { "group ", I18N_NOOP("Group to look in"), "KDE" }, { "key ", I18N_NOOP("Key to look for"), 0 }, { "default ", I18N_NOOP("Default value"), 0 }, @@ -54,12 +55,18 @@ int main(int argc, char **argv) QString group=QString::fromLatin1(args->getOption("group")); QString key=QString::fromLatin1(args->getOption("key")); + QString file=QString::fromLatin1(args->getOption("file")); QCString dflt=args->getOption("default"); QCString type=args->getOption("type").lower(); - KApplication app( false, false ); // no styles, no gui + KInstance inst(&aboutData); - KConfig *konfig=KGlobal::config(); + KConfig *konfig; + if (file.isEmpty()) + konfig = KGlobal::config(); + else + konfig = new KConfig(file, true, false); + konfig->setGroup(group); if(type=="bool") { dflt=dflt.lower(); -- cgit v1.2.1