PolkitQt-1
You can find an example usage of Polkit-qt-1 in the examples/ dir. You can build it by passing -DBUILD_EXAMPLES=TRUE
to your cmake line. The structure consists of a .ui file and a main class, to demonstrate how easy it is to integrate polkit support in an existing application. Let's see some details about it:
This small paragraph sets up an action button using an existing button defined in the UI file, kickPB
. As you can see, you can set custom properties on your button depending on the action status/result. The code is mostly self-explainatory
This demonstrates the use of ActionButtons, that lets you associate multiple buttons with a single action with extreme ease. listenPB
and listenCB
, both defined in the ui file, are kept in sync with the action.
Those three signals are all you need to control the action and the activation. Action::triggered() lets you start the activation/revoke when needed, ActionButton::clicked() lets you do the same thing with even more ease, just by manually connecting the signal to ActionButton::activate() (see the docs to understand why this connection doesn't happen automatically), and Action::authorized() signal notifies you when polkit has authorized you to perform the action.
As you can see, usage of polkit-qt-1 is extremely simple. Have a look at the complete example and to the API Docs for more details.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.