2
* Copyright (C) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2,
6
* or (at your option) any later version, as published by the Free
9
* This program 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
12
* GNU General Public License for more details
14
* You should have received a copy of the GNU General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#ifndef ACTIVITY_MANAGER_H_
21
#define ACTIVITY_MANAGER_H_
23
#define ActivityManagerServicePath "org.kde.ActivityManager"
26
#include <QStringList>
28
#include <KUniqueApplication>
30
class ActivityManagerPrivate;
33
* Service for tracking the user actions and managing the
36
class ActivityManager: public KUniqueApplication {
38
Q_CLASSINFO("D-Bus Interface", "org.kde.ActivityManager")
43
* @note: Do not change the values, needed for bit-operations
66
* Creates new ActivityManager
71
* Destroys this interface
73
virtual ~ActivityManager();
75
static ActivityManager* self();
77
// service control methods
80
* Does nothing. If the service is not running, the D-Bus daemon
81
* will automatically create it
92
// workspace activities control
95
* @returns the id of the current activity, empty string if none
97
QString CurrentActivity() const;
100
* Sets the current activity
101
* @param id id of the activity to make current
103
bool SetCurrentActivity(const QString & id);
106
* Adds a new activity
107
* @param name name of the activity
108
* @returns id of the newly created activity
110
QString AddActivity(const QString & name);
113
* Starts the specified activity
114
* @param id id of the activity to stash
116
void StartActivity(const QString & id);
119
* Stops the specified activity
120
* @param id id of the activity to stash
122
void StopActivity(const QString & id);
125
* @returns the state of the activity
126
* @param id id of the activity
128
int ActivityState(const QString & id) const;
131
* Removes the specified activity
132
* @param id id of the activity to delete
134
void RemoveActivity(const QString & id);
137
* @returns the list of all existing activities
139
QStringList ListActivities() const;
142
* @returns the list of activities with the specified state
145
QStringList ListActivities(int state) const;
148
* @returns the name of the specified activity
149
* @param id id of the activity
151
QString ActivityName(const QString & id) const;
154
* Sets the name of the specified activity
155
* @param id id of the activity
156
* @param name name to be set
158
void SetActivityName(const QString & id, const QString & name);
161
* @returns the description of the specified activity
162
* @param id id of the activity
164
QString ActivityDescription(const QString & id) const;
167
* Sets the description of the specified activity
168
* @param id id of the activity
169
* @param description description to be set
171
void SetActivityDescription(const QString & id, const QString & description);
174
* @returns the icon of the specified activity
175
* @param id id of the activity
177
QString ActivityIcon(const QString & id) const;
180
* Sets the icon of the specified activity
181
* @param id id of the activity
182
* @param icon icon to be set
184
void SetActivityIcon(const QString & id, const QString & icon);
188
* @returns whether the backstore (Nepomuk) is available
190
bool IsBackstoreAvailable() const;
194
* This signal is emitted when the global
195
* activity is changed
196
* @param id id of the new current activity
198
void CurrentActivityChanged(const QString & id);
201
* This signal is emitted when a new activity is created
202
* @param id id of the activity
204
void ActivityAdded(const QString & id);
207
* This signal is emitted when an activity is started
208
* @param id id of the activity
210
void ActivityStarted(const QString & id);
213
* This signal is emitted when an activity is stashed
214
* @param id id of the activity
216
void ActivityStopped(const QString & id);
219
* This signal is emitted when an activity is deleted
220
* @param id id of the activity
222
void ActivityRemoved(const QString & id);
225
* Emitted when an activity name, description and/or icon are changed
226
* @param id id of the changed activity
228
void ActivityChanged(const QString & id);
231
* Emitted when the state of activity is changed
233
void ActivityStateChanged(const QString & id, int state);
235
// Resource related mothods
239
* Registers a new event
240
* @param application the name of application that sent the event. Ignored if the event is not of type Opened
241
* @param windowId ID of the window that displays the resource. Ignored if the event is of type Accessed
242
* @param uri URI of the resource on which the event happened
243
* @param event type of the event
244
* @param reason reason for opening the resource
246
void RegisterResourceEvent(const QString & application, uint windowId, const QString & uri, uint event, uint reason);
249
* Registers resource's mimetype. If not manually specified, it will
250
* be retrieved if needed from Nepomuk
252
* Note that this will be forgotten when the resource in question is closed.
253
* @param uri URI of the resource
255
void RegisterResourceMimeType(const QString & uri, const QString & mimetype);
258
* Registers resource's title. If not manually specified, it will be a shortened
261
* Note that this will be forgotten when the resource in question is closed.
262
* @param uri URI of the resource
264
void RegisterResourceTitle(const QString & uri, const QString & title);
267
* Links the specified resource to the activity
268
* @param uri URI of the resource
269
* @param uri activity id of the activity to link to. If empty, the resource
270
* is linked to the current activity
272
void LinkResourceToActivity(const QString & uri, const QString & activity = QString());
275
* Links the specified resource to the activity
276
* @param uri URI of the resource
277
* @param uri activity id of the activity to link to. If empty, the resource
278
* is linked to the current activity
280
// void UnlinkResourceFromActivity(const QString & uri, const QString & activity = QString());
284
friend class ActivityManagerPrivate;
285
class ActivityManagerPrivate * const d;
288
#endif // ACTIVITY_MANAGER_H_