2
* Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
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 version 2 as published by the Free Software Foundation.
8
* This library is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Library General Public License for more details.
13
* You should have received a copy of the GNU Library General Public License
14
* along with this library; see the file COPYING.LIB. If not, write to
15
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16
* Boston, MA 02110-1301, USA.
19
#ifndef ACTIVITIES_INFO_H_
20
#define ACTIVITIES_INFO_H_
25
#include <QStringList>
28
#include <kdemacros.h>
30
namespace KActivities {
35
* This class provides info about an activity. Most methods in it
36
* require a Nepomuk backend running.
38
* @see Consumer for info about activities
42
class KDE_EXPORT Info: public QObject
46
Q_PROPERTY(KUrl uri READ uri)
47
Q_PROPERTY(KUrl resourceUri READ resourceUri)
48
Q_PROPERTY(QString id READ id)
49
Q_PROPERTY(QString name READ name)
52
explicit Info(const QString & activityId, QObject *parent=0);
56
* @return true if the activity represented by this object exists and is valid
61
* Specifies which parts of this class are functional
64
Nothing = 0, ///< No activity info provided (isValid is false)
65
BasicInfo = 1, ///< Basic info is provided
66
Everything = 2 ///< Everything is available
70
* State of the activity
81
* @returns what info is provided by this instance of Info
83
Availability availability() const;
86
* @returns the URI of this activity. The same URI is used by
87
* activities KIO slave.
88
* @note Functional only when availability is Everything
93
* @returns the Nepomuk resource URI of this activity
94
* @note Functional only when availability is Everything
96
KUrl resourceUri() const;
99
* @returns the id of the activity
104
* @returns the name of the activity
105
* @note Functional when availability is BasicInfo or Everything
107
QString name() const;
110
* @returns the icon of the activity. Icon can be a
111
* freedesktop.org name or a file path. Or empty if
113
* @note Functional only when availability is Everything
115
QString icon() const;
118
* @returns the state of the activity
123
* This function is provided for convenience.
124
* @returns the name of the specified activity
125
* @param id id of the activity
127
static QString name(const QString & id);
131
* Emitted when the activity's name, icon or description is changed
136
* Emitted when the activity is added
141
* Emitted when the activity is removed
146
* Emitted when the activity is started
151
* Emitted when the activity is stopped
156
* Emitted when the activity changes state
157
* @param state new state of the activity
159
void stateChanged(Info::State state);
162
InfoPrivate * const d;
164
Q_PRIVATE_SLOT(d, void activityStateChanged(const QString &, int))
165
Q_PRIVATE_SLOT(d, void added(const QString &))
166
Q_PRIVATE_SLOT(d, void removed(const QString &))
167
Q_PRIVATE_SLOT(d, void started(const QString &))
168
Q_PRIVATE_SLOT(d, void stopped(const QString &))
169
Q_PRIVATE_SLOT(d, void infoChanged(const QString &))
171
friend class InfoPrivate;
174
} // namespace KActivities
176
#endif // ACTIVITIES_INFO_H_