KServiceAction Class
Represents an action in a .desktop file. More...
- Header:
#include <KServiceAction> - CMake:
find_package(KF6 REQUIRED COMPONENTS Service)
target_link_libraries(mytarget PRIVATE KF6::Service)
List of all members, including inherited members
Public Functions
- KServiceAction(const QString &name, const QString &text, const QString &icon, const QString &exec, bool noDisplay, const KServicePtr &service)
- QVariant data() const
- QString exec() const
- QString icon() const
- bool isSeparator() const
- QString name() const
- bool noDisplay() const
- template <typename T> T property(const QString &name) const (since 6.0)
- KServicePtr service() const
- void setData(const QVariant &userData)
- QString text() const
Detailed Description
Actions are defined with the config key Actions in the [Desktop Entry] group, followed by one group per action, as per the desktop entry standard.
See also KService::actions
Member Function Documentation
KServiceAction::KServiceAction(const QString &name, const QString &text, const QString &icon, const QString &exec, bool noDisplay, const KServicePtr &service)
Creates a KServiceAction.
Normally you don't have to do this, KService creates the actions when parsing the .desktop file.
QVariant KServiceAction::data() const
Returns the action's internal data.
See also setData()
QString KServiceAction::exec() const
Returns the action's exec command, as defined by the Exec key in the desktop action group
QString KServiceAction::icon() const
Returns the action's icon, as defined by the Icon key in the desktop action group
bool KServiceAction::isSeparator() const
Returns whether the action is a separator.
This is true when the Actions key contains "_SEPARATOR_".
QString KServiceAction::name() const
Returns the action's internal name
For instance Actions=Setup;... and the group [Desktop Action Setup] define an action with the name "Setup".
bool KServiceAction::noDisplay() const
Returns whether the action should be suppressed in menus.
This is useful for having actions with a known name that the code looks for explicitly, like Setup and Root for kscreensaver actions, and which should not appear in popup menus.
[since 6.0] template <typename T> T KServiceAction::property(const QString &name) const
Returns the requested property.
T the type of the requested property
name the name of the requested property
This function was introduced in Qt 6.0.
KServicePtr KServiceAction::service() const
Returns the service that this action comes from
void KServiceAction::setData(const QVariant &userData)
Sets the action's internal data to the given userData.
See also data()
QString KServiceAction::text() const
Returns the action's text, as defined by the Name key in the desktop action group