PolkitQt1::Gui::Action

Search for usage in LXR

PolkitQt1::Gui::Action Class Reference

#include <Action>

Inheritance diagram for PolkitQt1::Gui::Action:

Public Types

enum  State {
  None = 0, SelfBlocked = 1, Yes = 2, No = 4,
  Auth = 8, All = 512
}
 
typedef QFlags< State > States
 
- Public Types inherited from QAction
enum  ActionEvent
 
enum  MenuRole
 
enum  Priority
 

Signals

void authorized ()
 
void dataChanged ()
 

Public Slots

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

Public Member Functions

 Action (const QString &actionId=QString(), QObject *parent=nullptr)
 
QString actionId () const
 
QIcon icon (State state=None) const
 
bool is (const QString &actionId) const
 
bool isAllowed () const
 
bool isEnabled (State state=None) const
 
bool isVisible (State state=None) const
 
void setEnabled (bool enabled, States states=All)
 
void setIcon (const QIcon &icon, States states=All)
 
void setPolkitAction (const QString &actionId)
 
void setTargetPID (qint64 pid)
 
void setText (const QString &text, States states=All)
 
void setToolTip (const QString &toolTip, States states=All)
 
void setVisible (bool visible, States states=All)
 
void setWhatsThis (const QString &whatsThis, States states=All)
 
qint64 targetPID () const
 
QString text (State state=None) const
 
QString toolTip (State state=None) const
 
QString whatsThis (State state=None) const
 
- Public Member Functions inherited from QAction
 QAction (QObject *parent)
 
 QAction (const QString &text, QObject *parent)
 
 QAction (const QIcon &icon, const QString &text, QObject *parent)
 
QActionGroupactionGroup () const const
 
void activate (QAction::ActionEvent event)
 
QList< QGraphicsWidget * > associatedGraphicsWidgets () const const
 
QList< QWidget * > associatedWidgets () const const
 
bool autoRepeat () const const
 
void changed ()
 
QVariant data () const const
 
QFont font () const const
 
void hover ()
 
void hovered ()
 
QIcon icon () const const
 
QString iconText () const const
 
bool isCheckable () const const
 
bool isChecked () const const
 
bool isEnabled () const const
 
bool isIconVisibleInMenu () const const
 
bool isSeparator () const const
 
bool isShortcutVisibleInContextMenu () const const
 
bool isVisible () const const
 
QMenumenu () const const
 
QAction::MenuRole menuRole () const const
 
QWidgetparentWidget () const const
 
QAction::Priority priority () const const
 
void setActionGroup (QActionGroup *group)
 
void setAutoRepeat (bool)
 
void setCheckable (bool)
 
void setChecked (bool)
 
void setData (const QVariant &userData)
 
void setDisabled (bool b)
 
void setEnabled (bool)
 
void setFont (const QFont &font)
 
void setIcon (const QIcon &icon)
 
void setIconText (const QString &text)
 
void setIconVisibleInMenu (bool visible)
 
void setMenu (QMenu *menu)
 
void setMenuRole (QAction::MenuRole menuRole)
 
void setPriority (QAction::Priority priority)
 
void setSeparator (bool b)
 
void setShortcut (const QKeySequence &shortcut)
 
void setShortcutContext (Qt::ShortcutContext context)
 
void setShortcuts (const QList< QKeySequence > &shortcuts)
 
void setShortcuts (QKeySequence::StandardKey key)
 
void setShortcutVisibleInContextMenu (bool show)
 
void setStatusTip (const QString &statusTip)
 
void setText (const QString &text)
 
void setToolTip (const QString &tip)
 
void setVisible (bool)
 
void setWhatsThis (const QString &what)
 
QKeySequence shortcut () const const
 
Qt::ShortcutContext shortcutContext () const const
 
QList< QKeySequenceshortcuts () const const
 
bool showStatusText (QWidget *widget)
 
QString statusTip () const const
 
QString text () const const
 
void toggle ()
 
void toggled (bool checked)
 
QString toolTip () const const
 
void trigger ()
 
void triggered (bool checked)
 
QString whatsThis () const const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Properties inherited from QAction
 autoRepeat
 
 checkable
 
 checked
 
 enabled
 
 font
 
 icon
 
 iconText
 
 iconVisibleInMenu
 
 menuRole
 
 priority
 
 shortcut
 
 shortcutContext
 
 shortcutVisibleInContextMenu
 
 statusTip
 
 text
 
 toolTip
 
 visible
 
 whatsThis
 
- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QAction
 AboutQtRole
 
 AboutRole
 
 ApplicationSpecificRole
 
 HighPriority
 
 Hover
 
 LowPriority
 
 NormalPriority
 
 NoRole
 
 PreferencesRole
 
 QuitRole
 
 TextHeuristicRole
 
 Trigger
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QAction
virtual bool event (QEvent *e) override
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

Class used to manage actions.

Author
Daniel Nicoletti dantt[email protected]i85-[email protected][email protected][email protected]hoo.[email protected]com.b[email protected]r
Dario Freddi [email protected][email protected]de.o[email protected]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

Definition at line 40 of file polkitqt1-gui-action.h.

Constructor & Destructor Documentation

PolkitQt1::Gui::Action::Action ( const QString actionId = QString(),
QObject parent = nullptr 
)
explicit

Constructs a new Action item.

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

Definition at line 92 of file polkitqt1-gui-action.cpp.

Member Function Documentation

QString PolkitQt1::Gui::Action::actionId ( ) const

Returns the current action ID.

Returns
The action ID

Definition at line 493 of file polkitqt1-gui-action.cpp.

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()

Definition at line 112 of file polkitqt1-gui-action.cpp.

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()
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.

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

Definition at line 388 of file polkitqt1-gui-action.cpp.

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

Definition at line 244 of file polkitqt1-gui-action.cpp.

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

Definition at line 239 of file polkitqt1-gui-action.cpp.

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

Definition at line 426 of file polkitqt1-gui-action.cpp.

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

Definition at line 464 of file polkitqt1-gui-action.cpp.

void PolkitQt1::Gui::Action::revoke ( )
slot

This method can be used to revoke the authorization obtained for this action.

Definition at line 249 of file polkitqt1-gui-action.cpp.

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

Definition at line 139 of file polkitqt1-gui-action.cpp.

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

Definition at line 406 of file polkitqt1-gui-action.cpp.

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

Definition at line 368 of file polkitqt1-gui-action.cpp.

void PolkitQt1::Gui::Action::setPolkitAction ( const QString actionId)

Changes the action being tracked.

Parameters
actionIdThe new action ID

Definition at line 482 of file polkitqt1-gui-action.cpp.

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

Definition at line 231 of file polkitqt1-gui-action.cpp.

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

Definition at line 254 of file polkitqt1-gui-action.cpp.

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

Definition at line 292 of file polkitqt1-gui-action.cpp.

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

Definition at line 444 of file polkitqt1-gui-action.cpp.

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

Definition at line 330 of file polkitqt1-gui-action.cpp.

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

Definition at line 222 of file polkitqt1-gui-action.cpp.

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

Definition at line 274 of file polkitqt1-gui-action.cpp.

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

Definition at line 312 of file polkitqt1-gui-action.cpp.

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

Definition at line 350 of file polkitqt1-gui-action.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Apr 16 2021 23:06:38 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.