[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Reading of KConfig bool entries with default values does not work
From:       Albert Astals Cid <aacid () kde ! org>
Date:       2008-11-10 0:09:08
Message-ID: 200811100109.08665.aacid () kde ! org
[Download RAW message or body]

To reproduce you need to have a langauge installed, in my case i'm using ca

Go to your .kde/share/config/kdeglobals and add

[foo]
bar[ca]=true

And now compile and compile the attached program.

You'll get

RE "true"
RE2 true
RE3 false

If you change the kdeglobals entry to

[foo]
bar=true

it'll correctly return 

RE "true"
RE2 true
RE3 true

Anyone that feels responsible enough?

And if there's noone, anyone that can help me a bit looking for where to fix 
it?

Albert

["main.cpp" (text/x-c++src)]

#include <kmainwindow.h>
#include <kapplication.h>
#include <kcmdlineargs.h>
#include <kdebug.h>
#include <kconfiggroup.h>
#include <kconfig.h>

int main(int argc, char *argv[])
{
    KCmdLineArgs::init(argc, argv, "kate", 0, ki18n("test"), "1.0");
    KApplication app;
    KConfig *config = KGlobal::config().data();
    KConfigGroup cg(config,"foo");
    qDebug() << "RE" << cg.readEntry("bar");
    qDebug() << "RE2" << QVariant(cg.readEntry("bar")).toBool();
    qDebug() << "RE3" << QVariant(cg.readEntry("bar", false)).toBool();
}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic