Class used to manage actions.
More...
#include <Action>
|
enum | State {
None = 0,
SelfBlocked = 1,
Yes = 2,
No = 4,
Auth = 8,
All = 512
} |
|
Class used to manage actions.
- Author
- Daniel Nicoletti dantt.nosp@m.i85-.nosp@m.pk@ya.nosp@m.hoo..nosp@m.com.b.nosp@m.r
-
Dario Freddi drf@k.nosp@m.de.o.nosp@m.rg
This class is an interface around PolicyKit Actions. By using this class, you are able to track the result of a given action.
Most of the times, you would want to use this class combined with a QAbstractButton. In this case, you can use the more comfortable ActionButton class that manages button's properties update for you.
- See also
- ActionButton
◆ Action()
PolkitQt1::Gui::Action::Action |
( |
const QString & |
actionId = QString() , |
|
|
QObject * |
parent = 0 |
|
) |
| |
|
explicit |
Constructs a new Action item
- Parameters
-
actionId | the PolicyKit action Id (e.g.: org.freedesktop.policykit.read) |
parent | the object parent |
◆ actionId()
QString PolkitQt1::Gui::Action::actionId |
( |
| ) |
const |
Returns the current action ID.
- Returns
- The action ID
◆ activate
bool PolkitQt1::Gui::Action::activate |
( |
| ) |
|
|
slot |
Use this slot if you want to activate the action. authorized() will be emitted if the action gets authorized.
- Returns
true
if the caller can do the action
- See also
- authorized()
◆ authorized
void PolkitQt1::Gui::Action::authorized |
( |
| ) |
|
|
signal |
Emitted when using this class as a proxy for a given action, It's only emitted if the activate() slot is called and the auth permits the action
- See also
- activate()
◆ dataChanged
void PolkitQt1::Gui::Action::dataChanged |
( |
| ) |
|
|
signal |
Emitted when the PolicyKit result (PolKitResult) for the given action or the internal data changes (i.e. the user called one of the set methods). You should connect to this signal if you want to track these changes.
◆ icon()
QIcon PolkitQt1::Gui::Action::icon |
( |
Action::State |
state = None | ) |
const |
Gets the icon of the action when it is in the specified state
- Note
- Passing None will return the current value
- Parameters
-
state | The state to be checked |
- Returns
- The icon shown when the action is in the specified state
◆ is()
bool PolkitQt1::Gui::Action::is |
( |
const QString & |
actionId | ) |
const |
This method compares a PolicyKit action Id with the current one of the object.
- See also
- actionId()
- Parameters
-
actionId | the action Id to compare |
- Returns
true
if the actionId is the same as this object's one
◆ isAllowed()
bool PolkitQt1::Gui::Action::isAllowed |
( |
| ) |
const |
This method can be used to check the if the current action can be performed (i.e. PolKitResult is YES).
- Note
- This method does not call the authentication dialog, use activate() instead
- Returns
true
if the action can be performed
◆ isEnabled()
bool PolkitQt1::Gui::Action::isEnabled |
( |
Action::State |
state = None | ) |
const |
Gets whether the action is enabled or not when it is in the specified state
- Note
- Passing None will return the current value
- Parameters
-
state | The state to be checked |
- Returns
- Whether the action is enabled or not in the specified state
◆ isVisible()
bool PolkitQt1::Gui::Action::isVisible |
( |
Action::State |
state = None | ) |
const |
Gets whether the action is visible or not when it is in the specified state
- Note
- Passing None will return the current value
- Parameters
-
state | The state to be checked |
- Returns
- Whether the action is visible or not in the specified state
◆ revoke
void PolkitQt1::Gui::Action::revoke |
( |
| ) |
|
|
slot |
This method can be used to revoke the authorization obtained for this action.
◆ setChecked
void PolkitQt1::Gui::Action::setChecked |
( |
bool |
checked | ) |
|
|
slot |
Defines the checked state. The opposite state will trigger authentication for this actions. For example, if you set this to true
, when the action's checked state will become false
, the authentication will be triggered.
- Parameters
-
checked | the new checked state |
◆ setEnabled()
void PolkitQt1::Gui::Action::setEnabled |
( |
bool |
enabled, |
|
|
States |
states = All |
|
) |
| |
Sets whether the current action is enabled or not. This will be shown only in the states specified in the states
parameter.
- Parameters
-
enabled | whether the Action will be enabled or not |
states | the states of the Polkit action on which the setting will be applied |
◆ setIcon()
void PolkitQt1::Gui::Action::setIcon |
( |
const QIcon & |
icon, |
|
|
States |
states = All |
|
) |
| |
Sets the icon for the current action. This will be shown only in the states specified in the states
parameter.
- Note
- You need to pass a QIcon here. You can easily create one from a Pixmap, or pass a KIcon
- Parameters
-
icon | the new icon for the action |
states | the states of the Polkit action on which the setting will be applied |
◆ setPolkitAction()
void PolkitQt1::Gui::Action::setPolkitAction |
( |
const QString & |
actionId | ) |
|
Changes the action being tracked
- Parameters
-
actionId | The new action ID |
◆ setTargetPID()
void PolkitQt1::Gui::Action::setTargetPID |
( |
qint64 |
pid | ) |
|
This function sets the process id of the target that should receive the authorization. Set this to 0 to set the current process as the target.
- Parameters
-
pid | The target process id; 0 if it is the current process |
◆ setText()
void PolkitQt1::Gui::Action::setText |
( |
const QString & |
text, |
|
|
States |
states = All |
|
) |
| |
Sets the text for the current action. This will be shown only in the states specified in the states
parameter.
- Parameters
-
text | the new text for the action |
states | the states of the Polkit action on which the setting will be applied |
◆ setToolTip()
void PolkitQt1::Gui::Action::setToolTip |
( |
const QString & |
toolTip, |
|
|
States |
states = All |
|
) |
| |
Sets the tooltip for the current action. This will be shown only in the states specified in the states
parameter.
- Parameters
-
toolTip | the new tooltip for the action |
states | the states of the Polkit action on which the setting will be applied |
◆ setVisible()
void PolkitQt1::Gui::Action::setVisible |
( |
bool |
visible, |
|
|
States |
states = All |
|
) |
| |
Sets whether the current action is visible or not. This will be applied only in the states specified in the states
parameter.
- Parameters
-
visible | visibility of the action |
states | the states of the Polkit action on which the setting will be applied |
◆ setWhatsThis()
void PolkitQt1::Gui::Action::setWhatsThis |
( |
const QString & |
whatsThis, |
|
|
States |
states = All |
|
) |
| |
Sets the whatsthis for the current action. This will be shown only in the states specified in the states
parameter.
- Parameters
-
whatsThis | the new whatsthis for the action |
states | the states of the Polkit action on which the setting will be applied |
◆ targetPID()
qint64 PolkitQt1::Gui::Action::targetPID |
( |
| ) |
const |
◆ text()
QString PolkitQt1::Gui::Action::text |
( |
Action::State |
state = None | ) |
const |
Gets the text of the action when it is in the specified state
- Note
- Passing None will return the current value
- Parameters
-
state | The state to be checked |
- Returns
- The text shown when the action is in the specified state
◆ toolTip()
QString PolkitQt1::Gui::Action::toolTip |
( |
Action::State |
state = None | ) |
const |
Gets the tooltip of the action when it is in the specified state
- Note
- Passing None will return the current value
- Parameters
-
state | The state to be checked |
- Returns
- The tooltip shown when the action is in the specified state
◆ whatsThis()
QString PolkitQt1::Gui::Action::whatsThis |
( |
Action::State |
state = None | ) |
const |
Gets the whatsThis of the action when it is in the specified state
- Parameters
-
state | The state to be checked |
- Returns
- The whatsThis shown when the action is in the specified state
The documentation for this class was generated from the following files: