• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • kdecore
  • services
kserviceaction.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright 2007 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19#include "kserviceaction.h"
20#include <QVariant>
21
22class KServiceActionPrivate : public QSharedData
23{
24public:
25 KServiceActionPrivate(const QString& name, const QString& text,
26 const QString& icon, const QString& exec,
27 bool noDisplay)
28 : m_name(name), m_text(text), m_icon(icon), m_exec(exec), m_noDisplay(noDisplay) {}
29 QString m_name;
30 QString m_text;
31 QString m_icon;
32 QString m_exec;
33 QVariant m_data;
34 bool m_noDisplay;
35 // warning keep QDataStream operators in sync if adding data here
36};
37
38KServiceAction::KServiceAction()
39 : d(new KServiceActionPrivate(QString(), QString(), QString(), QString(), false))
40{
41}
42
43KServiceAction::KServiceAction(const QString& name, const QString& text,
44 const QString& icon, const QString& exec,
45 bool noDisplay)
46 : d(new KServiceActionPrivate(name, text, icon, exec, noDisplay))
47{
48}
49
50KServiceAction::~KServiceAction()
51{
52}
53
54KServiceAction::KServiceAction(const KServiceAction& other)
55 : d(other.d)
56{
57}
58
59KServiceAction& KServiceAction::operator=(const KServiceAction& other)
60{
61 d = other.d;
62 return *this;
63}
64
65QVariant KServiceAction::data() const
66{
67 return d->m_data;
68}
69
70void KServiceAction::setData( const QVariant& data )
71{
72 d->m_data = data;
73}
74
75QString KServiceAction::name() const
76{
77 return d->m_name;
78}
79
80QString KServiceAction::text() const
81{
82 return d->m_text;
83}
84
85QString KServiceAction::icon() const
86{
87 return d->m_icon;
88}
89
90QString KServiceAction::exec() const
91{
92 return d->m_exec;
93}
94
95bool KServiceAction::noDisplay() const
96{
97 return d->m_noDisplay;
98}
99
100bool KServiceAction::isSeparator() const
101{
102 return d->m_name == QLatin1String("_SEPARATOR_");
103}
104
105QDataStream& operator>>( QDataStream& str, KServiceAction& act )
106{
107 KServiceActionPrivate* d = act.d;
108 str >> d->m_name;
109 str >> d->m_text;
110 str >> d->m_icon;
111 str >> d->m_exec;
112 str >> d->m_data;
113 str >> d->m_noDisplay;
114 return str;
115}
116
117QDataStream& operator<<( QDataStream& str, const KServiceAction& act )
118{
119 const KServiceActionPrivate* d = act.d;
120 str << d->m_name;
121 str << d->m_text;
122 str << d->m_icon;
123 str << d->m_exec;
124 str << d->m_data;
125 str << d->m_noDisplay;
126 return str;
127}
KServiceAction
Represents an action in a .desktop file Actions are defined with the config key Actions in the [Deskt...
Definition: kserviceaction.h:35
KServiceAction::text
QString text() const
Definition: kserviceaction.cpp:80
KServiceAction::KServiceAction
KServiceAction()
Definition: kserviceaction.cpp:38
KServiceAction::name
QString name() const
Definition: kserviceaction.cpp:75
KServiceAction::operator=
KServiceAction & operator=(const KServiceAction &other)
Assignment operator.
Definition: kserviceaction.cpp:59
KServiceAction::isSeparator
bool isSeparator() const
Returns whether the action is a separator.
Definition: kserviceaction.cpp:100
KServiceAction::exec
QString exec() const
Definition: kserviceaction.cpp:90
KServiceAction::~KServiceAction
~KServiceAction()
Destroys a KServiceAction.
Definition: kserviceaction.cpp:50
KServiceAction::icon
QString icon() const
Definition: kserviceaction.cpp:85
KServiceAction::data
QVariant data() const
Definition: kserviceaction.cpp:65
KServiceAction::setData
void setData(const QVariant &userData)
Sets the action's internal data to the given userData.
Definition: kserviceaction.cpp:70
KServiceAction::noDisplay
bool noDisplay() const
Returns whether the action should be suppressed in menus.
Definition: kserviceaction.cpp:95
QString
QVariant
operator<<
QDataStream & operator<<(QDataStream &str, const KServiceAction &act)
Definition: kserviceaction.cpp:117
operator>>
QDataStream & operator>>(QDataStream &str, KServiceAction &act)
Definition: kserviceaction.cpp:105
kserviceaction.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal