Polkit-Qt-1  0.95.0
Public Types | Public Slots | Signals | Public Member Functions
PolkitQt1::Gui::Action Class Reference

Class used to manage actions. More...

#include <Action>

Inheritance diagram for PolkitQt1::Gui::Action:
PolkitQt1::Gui::ActionButton PolkitQt1::Gui::ActionButtons

Public Types

enum  State {
  None = 0, SelfBlocked = 1, Yes = 2, No = 4,
  Auth = 8, All = 512
}
 

Public Slots

bool activate ()
 
void setChecked (bool checked)
 
void revoke ()
 

Signals

void dataChanged ()
 
void authorized ()
 

Public Member Functions

 Action (const QString &actionId=QString(), QObject *parent=0)
 
void setPolkitAction (const QString &actionId)
 
QString actionId () const
 
void setText (const QString &text, States states=All)
 
void setToolTip (const QString &toolTip, States states=All)
 
void setWhatsThis (const QString &whatsThis, States states=All)
 
void setIcon (const QIcon &icon, States states=All)
 
void setVisible (bool visible, States states=All)
 
void setEnabled (bool enabled, States states=All)
 
void setTargetPID (qint64 pid)
 
QString text (State state=None) const
 
QString toolTip (State state=None) const
 
QString whatsThis (State state=None) const
 
QIcon icon (State state=None) const
 
bool isVisible (State state=None) const
 
bool isEnabled (State state=None) const
 
qint64 targetPID () const
 
bool isAllowed () const
 
bool is (const QString &actionId) const
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Action()

PolkitQt1::Gui::Action::Action ( const QString &  actionId = QString(),
QObject *  parent = 0 
)
explicit

Constructs a new Action item

Parameters
actionIdthe PolicyKit action Id (e.g.: org.freedesktop.policykit.read)
parentthe object parent

Member Function Documentation

◆ 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
stateThe 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
actionIdthe 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
stateThe 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
stateThe 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
checkedthe 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
enabledwhether the Action will be enabled or not
statesthe 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
iconthe new icon for the action
statesthe 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
actionIdThe 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
pidThe 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
textthe new text for the action
statesthe 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
toolTipthe new tooltip for the action
statesthe 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
visiblevisibility of the action
statesthe 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
whatsThisthe new whatsthis for the action
statesthe states of the Polkit action on which the setting will be applied

◆ targetPID()

qint64 PolkitQt1::Gui::Action::targetPID ( ) const
See also
setTargetPID

◆ 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
stateThe 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
stateThe 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
stateThe 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: