A decorator to add auth features to a button or an action.
More...
#include <KAuth/ObjectDecorator>
|
| ObjectDecorator (QObject *parent) |
| Instantiate a new decorator attached to an object.
|
|
| ~ObjectDecorator () override |
| Destructs the decorator.
|
|
KAuth::Action | authAction () const |
| Returns the action object associated with this decorator, or an invalid action if it does not have one.
|
|
void | setAuthAction (const KAuth::Action &action) |
| Sets the action object associated with this decorator.
|
|
void | setAuthAction (const QString &actionName) |
| Sets the action object associated with this decorator.
|
|
A decorator to add auth features to a button or an action.
- Author
- Dario Freddi drf@k.nosp@m.de.o.nosp@m.rg
◆ ObjectDecorator()
KAuth::ObjectDecorator::ObjectDecorator |
( |
QObject * |
parent | ) |
|
|
explicit |
Instantiate a new decorator attached to an object.
- Parameters
-
parent | The parent object this decorator will be attached to |
◆ ~ObjectDecorator()
KAuth::ObjectDecorator::~ObjectDecorator |
( |
| ) |
|
|
override |
◆ authAction()
Returns the action object associated with this decorator, or an invalid action if it does not have one.
- Returns
- the KAuth::Action associated with this decorator.
◆ authorized
void KAuth::ObjectDecorator::authorized |
( |
const KAuth::Action & |
action | ) |
|
|
signal |
Signal emitted when the action is authorized.
If the decorator needs authorization, whenever the user triggers it, the authorization process automatically begins. If it succeeds, this signal is emitted. The KAuth::Action object is provided for convenience if you have multiple Action objects, but of course it's always the same set with setAuthAction().
WARNING: If your button or action needs authorization you should connect eventual slots processing stuff to this signal, and NOT clicked/triggered. Clicked/triggered will be emitted even if the user has not been authorized
- Parameters
-
◆ setAuthAction() [1/2]
void KAuth::ObjectDecorator::setAuthAction |
( |
const KAuth::Action & |
action | ) |
|
Sets the action object associated with this decorator.
By setting a KAuth::Action, this decorator will become associated with it, and whenever the action or button it is attached to gets clicked, it will trigger the authorization and execution process for the action. Pass an invalid action to this function to disassociate the decorator.
- Parameters
-
◆ setAuthAction() [2/2]
void KAuth::ObjectDecorator::setAuthAction |
( |
const QString & |
actionName | ) |
|
Sets the action object associated with this decorator.
Overloaded member to allow creating the action by name
- Parameters
-
actionName | the name of the action to associate |