KServiceAction Class

Header: #include <KServiceAction>
CMake: find_package(KF6 REQUIRED COMPONENTS Service)
target_link_libraries(mytarget PRIVATE KF6::Service)

Public Functions

KServiceAction(const QString &name, const QString &text, const QString &icon, const QString &exec, bool noDisplay, const KServicePtr &service)
KServiceAction(const KServiceAction &other)
~KServiceAction()
QVariant data() const
QString exec() const
QString icon() const
bool isSeparator() const
QString name() const
bool noDisplay() const
KServicePtr service() const
void setData(const QVariant &userData)
QString text() const
KServiceAction &operator=(const KServiceAction &other)

Detailed Description

Represents an action in a .desktop file 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 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. @since 5.69

KServiceAction::KServiceAction(const KServiceAction &other)

Copy constructor

[noexcept] KServiceAction::~KServiceAction()

Destroys a KServiceAction.

QVariant KServiceAction::data() const

@return the action's internal data.

See also setData().

QString KServiceAction::exec() const

@return the action's exec command, as defined by the Exec key in the desktop action group

QString KServiceAction::icon() const

@return 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

@return 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. @return true to suppress this service

KServicePtr KServiceAction::service() const

Returns the service that this action comes from @since 5.69

void KServiceAction::setData(const QVariant &userData)

Sets the action's internal data to the given @p userData.

See also data().

QString KServiceAction::text() const

@return the action's text, as defined by the Name key in the desktop action group

KServiceAction &KServiceAction::operator=(const KServiceAction &other)

Assignment operator