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

List:       kde-devel
Subject:    Re: Hosts kcm module
From:       Stefan Majewsky <majewsky () gmx ! net>
Date:       2008-05-27 14:25:07
Message-ID: 200805271625.07396.majewsky () gmx ! net
[Download RAW message or body]

On Tuesday 27 May 2008 16:16:16 Mike Dransfield wrote:
> Hi
>
> I am trying to learn a bit of C++ and Q, so I wrote a small KCM module
> for editing and viewing the hosts file.

First of all: Welcome to the project! I currently have no time to comment on 
your actual code, but I can perhaps answer your questions.

> It is mostly working, there are a couple of UI problems that I want to
> solve first.  What is the procedure to get this into the main tree
> (obviously once it is unfrozen and if it is acceptable)?

All new code is imported into trunk/playground first. Once it is working, you 
move your code to trunk/kdereview and from there to the main trunk. For all of 
these actions, you need an SVN account; techbase.kde.org has an article on 
that topic.

> The KCM module documents say that there is a .desktop file entry called
> X-KDE-RootOnly which will disable the entire module if it is not run as
> root.  I am looking for something a little more fine-grained because I
> want the user to be able to view the hosts but not change them unless
> they are root.  I think at the moment it would disable my combo box so
> they could not view all the different hosts.  Are there any plans to
> improve this feature or will I need to code that part individually?

To find out whether you are root, you can use:
#include <KUser>
...
comboBox.setEnabled(KUser().isSuperUser());

More details: http://api.kde.org/4.x-api/kdelibs-
apidocs/kdecore/html/classKUser.html

> I was thinking of something like a isRoot() method for KCModule, but there
> are situations where a user may not be root but will be able to write to
> the hosts file so we may need something more complicated where the
> module can set if the user has root abilities and what they can or
> cannot do (Maybe a signal sent when the user changes).

Perhaps you can check your writing permission on the hosts file?

I hope that helps.
Stefan Majewsky
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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