![]() Registered Member ![]()
|
Hi,
of course I have read http://api.kde.org/4.x-api/kdelibs-apid ... Group.html but based on that I don't get a clue what a KServiceGroup is. So first question would be if anyone knows a better documentation? I wonder if KDE provides THE KServiceGroup or if there are many KServiceGroups for all differnt kind of things and before using it we have to create on ourselves somehow. From kmenuedit is this code, see my comments inside the code:
Would be great if someone has either a better documentation or can shed some light on what happens in the above code. I don't have an idea right know where to look. Thanks. |
![]() Administrator ![]()
|
You may find the following code helpful.
KServiceGroup's are created automatically by the Sycoca for you. To begin, simply call KServiceGroup::group( "" ); This gets you the "root" service group. You then retrieve all children of that group, by calling entries() on the root KServiceGroup object. Then you simply walk the tree. Only two types of item exist: KService: These represent actual applications in the menu. KServiceGroup: These represent the folders in the menu. You will need to repeat the above on them.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Your answer sounds a bit like that the KServiceGroup contains only menus and the only purpose why this KServiceGroups was invented is for menus. The API documentation talks about screensavers. So do I have to distingiush after the root element what part of the tree I want to read when I want to read the KDE menu and not something else?
Thanks for the code snippet. |
![]() Administrator ![]()
|
I do not know if ( or even how ) it is used for screensavers. The code snippet I posted most certainly only handles the menu.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Okay and the database is build by kbuildsycoca4, the input files to build the database are spread over multiple locations. One of them is for example /etc/xdg/menus:
It looks like that there are more menus than only the KDE startmenu. So I have to tell KServiceGroup which menu I want, don't I? My assumption is for example that kde4-settings.menu is for the "Kontrol Center" and not for the start menu. |
![]() Administrator ![]()
|
You do not need to worry where the information comes from. The KDE libraries and their associated applications such as kbuildsycoca4 gather the information and make it available to you, without you having to do any work other than making the needed function calls to retrieve the information.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
for reading this is correct. But I am trying to work through kmenuedit since it seems not to work very well.... and hence I need to understand where which data comes from to see where in the chain the problem lies.
|
![]() Administrator ![]()
|
The data in the service group is sourced from the Sycoca, which is built by "kbuildsycoca4" whenever changes to what it stores changes. The code of kbuildsycoca4 is not likely to contain a bug relevant to this, as virtually all KDE applications are heavily dependent on the Sycoca.
KBuildSycoca4 is part of KDE Libs.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]