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
#include "kactivities_export.h"
32
namespace KActivities {
37
* This class provides info about an activity. Most methods in it
38
* require a Nepomuk backend running.
40
* @see Consumer for info about activities
44
class KACTIVITIES_EXPORT Info: public QObject
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
* @deprecated we don't guarantee that nepomuk is the backend
87
* @returns the URI of this activity. The same URI is used by
88
* activities KIO slave.
89
* @note Functional only when availability is Everything
95
* @deprecated we don't guarantee that nepomuk is the backend
96
* @returns the Nepomuk resource URI of this activity
97
* @note Functional only when availability is Everything
100
KUrl resourceUri() const;
103
* @returns the id of the activity
108
* @returns the name of the activity
109
* @note Functional when availability is BasicInfo or Everything
111
QString name() const;
114
* @returns the icon of the activity. Icon can be a
115
* freedesktop.org name or a file path. Or empty if
117
* @note Functional only when availability is Everything
119
QString icon() const;
122
* @returns the state of the activity
127
* @returns true if encrypted
130
bool isEncrypted() const;
133
* This function is provided for convenience.
134
* @returns the name of the specified activity
135
* @param id id of the activity
137
static QString name(const QString & id);
141
* Links the specified resource to the activity
142
* @param resourceUri resource URI
144
void linkResource(const KUrl & resourceUri);
148
* Unlinks the specified resource from the activity
149
* @param resourceUri resource URI
151
void unlinkResource(const KUrl & resourceUri);
155
* @returns the list of linked resources
157
KUrl::List linkedResources() const;
161
* Emitted when the activity's name, icon or description is changed
166
* Emitted when the activity is added
171
* Emitted when the activity is removed
176
* Emitted when the activity is started
181
* Emitted when the activity is stopped
186
* Emitted when the activity changes state
187
* @param state new state of the activity
189
void stateChanged(KActivities::Info::State state);
192
InfoPrivate * const d;
194
Q_PRIVATE_SLOT(d, void activityStateChanged(const QString &, int))
195
Q_PRIVATE_SLOT(d, void added(const QString &))
196
Q_PRIVATE_SLOT(d, void removed(const QString &))
197
Q_PRIVATE_SLOT(d, void started(const QString &))
198
Q_PRIVATE_SLOT(d, void stopped(const QString &))
199
Q_PRIVATE_SLOT(d, void infoChanged(const QString &))
201
friend class InfoPrivate;
204
} // namespace KActivities
206
#endif // ACTIVITIES_INFO_H