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

Help with implementing config dialog

Tags: None
(comma "," separated)
User avatar
beaverusiv
Registered Member
Posts
13
Karma
0
OS

Help with implementing config dialog

Thu Jun 24, 2010 10:35 pm
How do I implement my own settings in the settings dialog that shows up for my plasmoid? I can't find any documentation really, but I think I just don't know what to search...

I basically just want to draw up my own page to have a tree view like so:
Code: Select all
+Programs
|-+Recent
|-|-KMail
|-|-k3b
|-|-PS3 Media Server
|-+Games
|-|-Neverwinter Nights
+Places


etc that the user will customise, then it'll be parsed into this:

Code: Select all
[Tabs]
Programs=Recent,Games
Places=

[Recent]
Kmail=/usr/bin/kmail
k3b=/usr/bin/k3b
PS3 Media Server=pms

[Games]
Neverwinter Nights=cd ~/nwn && ./nwn



Any help appreciated.

PS: I currently have my plasmoid loading a config file formatted as above to execute those programs, just want to display a treeview in the settings dialog. Also some hints on how to read in Kickoff's menu would be nice, so the user can pick programs from there to put in my plasmoid.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
For this, I would recommend using Qt's Model View architecture. You can read your configuration file using KConfig, then provide this information to the QTreeView through the model.

With regards to reading Kickoff's menu, you need to look at the documentation for KServiceGroup and KService. Also, see kdebase/workspace/plasma/generic/dataengines/apps/appsengine.cpp an example.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
beaverusiv
Registered Member
Posts
13
Karma
0
OS
http://doc.qt.nokia.com/4.6/model-view- ... ction.html

Is that what you're talking about?

I want to add a category to this dialog:

Image

Applet::createConfigurationInterface() has something to do with it, I think.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Yes, that is the Model View documentation.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
beaverusiv
Registered Member
Posts
13
Karma
0
OS
I thought maybe I could do it all in a text editor (which I guess I can), but it looks like using QT Designer is the way to do it ala:

http://www.kdevelop.org/3.0/doc/tutorial_settings/#p4

Thanks for you help. While looking at the KDE Menu Editor for UI ideas I just decided to adapt their code to fit into a QWidget instead of making my own. Hopefully it goes somothly, lol.


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]