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_CONSUMER_H_
20
#define ACTIVITIES_CONSUMER_H_
25
#include <QStringList>
30
#include <kdemacros.h>
32
namespace KActivities {
34
class ConsumerPrivate;
37
* Contextual information can be, from the user's point of view, divided
38
* into three aspects - "who am I?", "where am I?" (what are my surroundings?)
39
* and "what am I doing?".
41
* Activities deal with the last one - "what am I doing?". The current activity
42
* refers to what the user is doing at the moment, while the other activities represent
43
* things that he/she was doing before, and probably will be doing again.
45
* Activity is an abstract concept whose meaning can differ from one user to another.
46
* Typical examples of activities are "developing a KDE project", "studying the
47
* 19th century art", "composing music", "lazing on a Sunday afternoon" etc.
49
* Every activity can have applications, documents, or other types of resources
52
* Consumer provides an entry-level API for supporting activities in an
53
* application - to react to the changes to the current activity as well as
54
* registering the resources with its windows.
56
* Resource can be anything that is identifiable by an URI (for example,
57
* a local file or a web page)
61
class KDE_EXPORT Consumer: public QObject {
64
Q_PROPERTY(QString currentActivity READ currentActivity)
65
Q_PROPERTY(QStringList activities READ listActivities)
69
* Different states of the activities service
72
NotRunning, ///< Service is not running
73
BareFunctionality, ///< Service is running without a sane backend
74
FullFunctionality ///< Service is running, and a backend is available
77
explicit Consumer(QObject * parent = 0);
82
* @returns the id of the current activity
84
QString currentActivity() const;
87
* @returns the list of activities filtered by state
88
* @param state state of the activity
90
QStringList listActivities(Info::State state) const;
93
* @returns the list of all existing activities
95
QStringList listActivities() const;
98
* @returns status of the activities service
100
static ServiceStatus serviceStatus();
103
* Links a resource to the activity
104
* @param uri URI of the resource
105
* @activityId id of the activity to link to. If empty, the
106
* resource is linked to the current activity.
108
void linkResourceToActivity(const QUrl & uri, const QString & activityId = QString());
112
* This signal is emitted when the global
113
* activity is changed
114
* @param id id of the new current activity
116
void currentActivityChanged(const QString & id);
119
* This signal is emitted when the activity service
120
* goes online or offline
121
* @param status new status of the service
123
void serviceStatusChanged(Consumer::ServiceStatus status);
126
* This signal is emitted when a new activity is added
127
* @param id id of the new activity
129
void activityAdded(const QString & id);
132
* This signal is emitted when the activity
134
* @param id id of the removed activity
136
void activityRemoved(const QString & id);
139
ConsumerPrivate * const d;
142
} // namespace KActivities
144
#endif // ACTIVITIES_CONSUMER_H_