Registered Member
|
Hi all,
even if browsing some source code I cannot find a KDE-style way of getting the username and main group of the current logged in user. Is it possible that there is not another way than looking directly at the result of getpwuid and getgrouplist? |
Registered Member
|
Try looking at the kuser code.
|
Registered Member
|
Thanks, it was so simple! |
Registered Member
|
Do you mind sharing your findings?
You got me interested as well, and it would save me 10 minutes of searching |
Administrator
|
The code in question is likely the KUser class. You can find the api documentation for it at http://api.kde.org/
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
You can create a new KUser object that will be "attached" to the running user, and therefore you have access to the uid/gid and login name, as well as the list of group names. |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft