Registered Member
|
Hi, I'm trying to configure the K-Menu, I've been able to work where to add buttons into the actions(lower section) of the K-Menu.
I understand that if i type 'poweroff' in the terminal, it will complete shut down the computer. But I'm not sure how to implement this action in code. I've tried kapp->quit(); but this only closes the kicker panel, and doesn't shut down the computer. also the default kapp->requestShutDown, only shuts down the kde interface and not the computer. Any help much appreciated |
KDE Developer
|
You are almost there. Check the ShutdownType parameter.
See also http://api.kde.org/4.x-api/kdebase-work ... Space.html Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
Registered Member
|
Thanks for the quick reply.
So am I correct in saying that requestShutDown(0,2,2). Will force a shutdown of the whole system without user confirmation? (if according to the URL you provided) I understand the principal, just trying to get the syntax correct Thanks again. |
KDE Developer
|
Yes, that looks right, though you probably will want to use the enums for better readability.
Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
Registered Member
|
Just tried to compile it and got a few errors.
The errors were all because of the conversion for int to bool. seems to not like me using (0,2,2) as the parameters I'm a little new to using enums, can you explain please how to use enums in this case. thanks [EDIT] Oh, did you mean using the string values instead? eg. requestShutDown(ShutdownConfirmNo,ShutdownTypeHalt,ShutdownModeForceNow) ?
Last edited by SoulPiano on Sun Apr 12, 2009 1:54 pm, edited 1 time in total.
|
KDE Developer
|
Yes, but you need to prefix it with the class the values are defined it
Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft