This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Doubts with KConfigGroup and saving/loading configuration

Tags: None
(comma "," separated)
pukyxd
Registered Member
Posts
5
Karma
0
I'm doing a plasmoid and I have doubts with the configuration part. I've done a Config Widget with designer and now I can use it in my plasmoid.

The doubt is related to saving and loading configuration. Seeing plasmoids of websvn and kde-apps.org all of them use a KConfigGroup initialitzed with the function config(). Then they use the readEntry method to read configuration entries.

Doing the same with my plasmoid to save and load configuration doesn't work. My question is if there is any extra thing I must do. Where are the config files?

Reading the KConfigXT tutorial in techbase talks about a .kfgc file but I don't see any of this files in the sources of the plasmoid I've looked at.

Thanks!

Last edited by pukyxd on Sun Feb 22, 2009 10:22 pm, edited 1 time in total.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Is there somewhere you can post your code? Without having a look at that it is difficult to tell why it isn't working.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
pukyxd
Registered Member
Posts
5
Karma
0
I've uploaded the code to pastebin:

http://pastebin.com/pastebin.php?dl=mbdb35ed -> plasma-timetable.h
http://pastebin.com/pastebin.php?dl=m2909c120 -> plasma-timetable.cpp

Last edited by pukyxd on Mon Feb 23, 2009 8:11 am, edited 1 time in total.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Read entry will return the information you desire in any number of formats, as specified by the KConfigGroup documentation ( available at api.kde.org ).

You need to save what it returns:
Code: Select all
QString var = cg.readEntry("configEntry", "configDefault");


Or in your case:
Code: Select all
consults = cg.readEntry("consults", QString());

Last edited by bcooksley on Mon Feb 23, 2009 8:40 am, edited 1 time in total.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
pukyxd
Registered Member
Posts
5
Karma
0
Thanks! Now it works! I missed the assignation...


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell