KServiceAction

Search for usage in LXR

KServiceAction Class Reference

#include <KServiceAction>

Public Member Functions

 KServiceAction ()
 
 KServiceAction (const KServiceAction &other)
 
 KServiceAction (const QString &name, const QString &text, const QString &icon, const QString &exec, bool noDisplay, const KServicePtr &service)
 
 KServiceAction (const QString &name, const QString &text, const QString &icon, const QString &exec, bool noDisplay=false)
 
 ~KServiceAction ()
 
QVariant data () const
 
QString exec () const
 
QString icon () const
 
bool isSeparator () const
 
QString name () const
 
bool noDisplay () const
 
KServiceActionoperator= (const KServiceAction &other)
 
QVariant property (const QString &name, QMetaType::Type type) const
 
KServicePtr service () const
 
void setData (const QVariant &userData)
 
QString text () const
 

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 also
KService::actions

Definition at line 29 of file kserviceaction.h.

Constructor & Destructor Documentation

◆ KServiceAction() [1/4]

KServiceAction::KServiceAction ( const QString name,
const QString text,
const QString icon,
const QString exec,
bool  noDisplay = false 
)

Creates a KServiceAction.

Normally you don't have to do this, KService creates the actions when parsing the .desktop file.

Deprecated:
Since 5.69, use the 6-args constructor

Definition at line 46 of file kserviceaction.cpp.

◆ KServiceAction() [2/4]

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

Definition at line 52 of file kserviceaction.cpp.

◆ KServiceAction() [3/4]

KServiceAction::KServiceAction ( )

Needed for operator>>

Definition at line 40 of file kserviceaction.cpp.

◆ ~KServiceAction()

KServiceAction::~KServiceAction ( )

Destroys a KServiceAction.

Definition at line 58 of file kserviceaction.cpp.

◆ KServiceAction() [4/4]

KServiceAction::KServiceAction ( const KServiceAction other)

Copy constructor.

Definition at line 62 of file kserviceaction.cpp.

Member Function Documentation

◆ data()

QVariant KServiceAction::data ( ) const
Returns
the action's internal data.

Definition at line 73 of file kserviceaction.cpp.

◆ exec()

QString KServiceAction::exec ( ) const
Returns
the action's exec command, as defined by the Exec key in the desktop action group

Definition at line 98 of file kserviceaction.cpp.

◆ icon()

QString KServiceAction::icon ( ) const
Returns
the action's icon, as defined by the Icon key in the desktop action group

Definition at line 93 of file kserviceaction.cpp.

◆ isSeparator()

bool KServiceAction::isSeparator ( ) const

Returns whether the action is a separator.

This is true when the Actions key contains "_SEPARATOR_".

Definition at line 108 of file kserviceaction.cpp.

◆ name()

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".

Definition at line 83 of file kserviceaction.cpp.

◆ noDisplay()

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.

Returns
true to suppress this service

Definition at line 103 of file kserviceaction.cpp.

◆ operator=()

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

Assignment operator.

Definition at line 67 of file kserviceaction.cpp.

◆ property()

QVariant KServiceAction::property ( const QString name,
QMetaType::Type  type 
) const

Returns the requested property.

Parameters
namethe name of the property
typethe assumed type of the property
Returns
the property, or an invalid QVariant if not found
Since
5.102

Definition at line 147 of file kserviceaction.cpp.

◆ service()

KServicePtr KServiceAction::service ( ) const

Returns the service that this action comes from.

Since
5.69

Definition at line 113 of file kserviceaction.cpp.

◆ setData()

void KServiceAction::setData ( const QVariant userData)

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

Definition at line 78 of file kserviceaction.cpp.

◆ text()

QString KServiceAction::text ( ) const
Returns
the action's text, as defined by the Name key in the desktop action group

Definition at line 88 of file kserviceaction.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 6 2023 04:00:17 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.