diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2021-12-09 23:27:00 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2021-12-09 23:27:00 +0900 |
commit | 416bed9bc124e24cc1351c7d8e5810ca7570a023 (patch) | |
tree | fbb25a82365c24f80874fe0d7190533b27a4df3b /Mainpage.dox | |
parent | 855818127b02c367fb187e67b9bb9b229b916304 (diff) | |
download | polkit-tqt-416bed9bc124e24cc1351c7d8e5810ca7570a023.tar.gz polkit-tqt-416bed9bc124e24cc1351c7d8e5810ca7570a023.zip |
Updated documentation and clean up.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'Mainpage.dox')
-rw-r--r-- | Mainpage.dox | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/Mainpage.dox b/Mainpage.dox index 0ee4ab5f3..83718a18f 100644 --- a/Mainpage.dox +++ b/Mainpage.dox @@ -4,7 +4,7 @@ \section polkit-tqt_overview Overview polkit-tqt aims to make it easy for TQt developers to take advantage of -polkit API. It is a convenience wrapper around QAction and QAbstractButton +polkit API. It is a convenience wrapper around TQAction and TQButton that lets you integrate those two components easily with polkit. polkit-tqt is split in three libraries: polkit-tqt-core, polkit-tqt-gui and polkit-tqt-agent @@ -14,76 +14,75 @@ simple functions. It also lets you retrieve and control useful informations on t authority. You will be mostly interested in the \c Authority class. \b polkit-tqt-gui lets you easily associate GUI items with polkit actions. Through some simple -wrapper classes you are able to associate QAction and QAbstractButton to a polkit action, +wrapper classes you are able to associate TQAction and TQButton to a polkit action, and get their properties changed accordingly to polkit's result. It includes the classes Action, ActionButton and ActionButtons \b polkit-tqt-agent lets you write your own polkit authentication agents in a very simple way. -\li A sample usage of polkit-tqt can be found in \ref polkittqt1_example -\li <a href="classes.html">Alphabetical Class List</a> -\li <a href="hierarchy.html">Class Hierarchy</a> +\b A sample usage of polkit-tqt can be found in \ref polkit-tqt_example - - -\page polkittqt1_example Polkit-tqt usage example +\page polkit-tqt-example Polkit-tqt usage example You can find an example usage of Polkit-tqt in the examples/ dir. You can -build it by passing \c -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: +build it by passing \c -DBUILD_EXAMPLES=TRUE to your cmake line. It demonstrates +how easy it is to integrate polkit support in an existing application. +Let's see some details about it: \code +// Previously defined TQPushButton +kickPB = new TQPushButton(privateLayoutWidget, "kickPB"); +... +// Setup polkit tqt action +ActionButton *bt; bt = new ActionButton(kickPB, "org.tqt.policykit.examples.kick", this); -bt->setText("Kick... (long)"); -// here we set the behavior of PolKitResul = No +bt->setText("Kick!"); +// here we set the behavior of PolKitResult = No +bt->setText("Can't kick", Action::No); bt->setVisible(true, Action::No); bt->setEnabled(true, Action::No); -bt->setText("Kick (long)", Action::No); -bt->setIcon(TQPixmap(":/Icons/custom-no.png"), Action::No); +bt->setIconSet(TQPixmap("./icons/custom-no.png"), Action::No); bt->setToolTip("If your admin wasn't annoying, you could do this", Action::No); -// here we set the behavior of PolKitResul = Auth +// here we set the behavior of PolKitResult = Auth bt->setVisible(true, Action::Auth); bt->setEnabled(true, Action::Auth); -bt->setText("Kick... (long)", Action::Auth); -bt->setIcon(TQPixmap(":/Icons/action-locked-default.png"), Action::Auth); +bt->setText("Kick?", Action::Auth); +bt->setIcon(TQPixmap("./icons/action-locked-default.png"), Action::Auth); bt->setToolTip("Only card carrying tweakers can do this!", Action::Auth); -// here we set the behavior of PolKitResul = Yes +// here we set the behavior of PolKitResult = Yes bt->setVisible(true, Action::Yes); bt->setEnabled(true, Action::Yes); -bt->setText("Kick! (long)", Action::Yes); -bt->setIcon(TQPixmap(":/Icons/custom-yes.png"), Action::Yes); +bt->setText("Kick!", Action::Yes); +bt->setIcon(TQPixmap("./icons/custom-yes.png"), Action::Yes); bt->setToolTip("Go ahead, kick kick kick!", Action::Yes); \endcode -This small paragraph sets up an action button using an existing button defined in the -UI file, \c 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 small paragraph sets up an action button using an existing button already +defined, \c 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. \code -bt = new ActionButtons(TQList<TQButton*>() << listenPB << listenCB, - "org.tqt.policykit.examples.listen", this); -bt->setIcon(TQPixmap(":/Icons/action-locked.png")); -bt->setIcon(TQPixmap(":/Icons/action-unlocked.png"), Action::Yes); +bt = new ActionButtons(TQValueList<TQButton*>() << listenPB << listenCB, + "org.tqt.policykit.examples.listen", this); +bt->setIcon(TQPixmap("./icons/action-locked.png")); +bt->setIcon(TQPixmap("./icons/action-unlocked.png"), Action::Yes); bt->setText("Click to make changes..."); \endcode This demonstrates the use of ActionButtons, that lets you associate multiple buttons with a -single action with extreme ease. \c listenPB and \c listenCB, both defined in the ui file, -are kept in sync with the action. +single action with extreme ease. \c listenPB and \c listenCB are kept in sync with the action. \code -connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); -connect(bt, SIGNAL(clicked(TQButton*,bool)), bt, SLOT(activate())); +connect(bt, SIGNAL(activated()), this, SLOT(activateAction())); +connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); \endcode -Those three signals are all you need to control the action and the activation. Action::triggered() +Those three signals are all you need to control the action and the activation. Action::activated() 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. +with even more ease, just by manually connecting the signal to ActionButton::activate(), and +Action::authorized() signal notifies you when polkit has authorized you to perform the action. As you can see, usage of polkit-tqt is extremely simple. Have a look at the complete example and to the API Docs for more details. |