~ubuntu-branches/ubuntu/saucy/kactivities/saucy-proposed

« back to all changes in this revision

Viewing changes to lib/info.h

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Jonathan Riddell, Scott Kitterman
  • Date: 2012-11-20 13:47:27 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20121120134727-vqzk04slqjoay3de
Tags: 4:4.9.80-0ubuntu1
[ Jonathan Riddell ]
* New upstream beta release

[ Scott Kitterman ]
* Add new libkactivities-models1 library package (debian/control, .install,
  and .symbols)
* Add nepomuk-core-dev to build-depends
* Wildcard libkactivities6.install so that soversion changes don't cause
  build failures
* Update libkactivities6.symbols
* Update libkactivities-dev.install for new files for libkactivies-models
* Add new files to libkactivities-bin.install, including Activities kcm

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)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 version 2 as published by the Free Software Foundation.
7
 
 *
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.
12
 
 *
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.
17
 
 */
18
 
 
19
 
#ifndef ACTIVITIES_INFO_H
20
 
#define ACTIVITIES_INFO_H
21
 
 
22
 
#include <QObject>
23
 
#include <QWidget>
24
 
#include <QString>
25
 
#include <QStringList>
26
 
 
27
 
#include <kurl.h>
28
 
#include <kdemacros.h>
29
 
 
30
 
#include "kactivities_export.h"
31
 
 
32
 
namespace KActivities {
33
 
 
34
 
class InfoPrivate;
35
 
 
36
 
/**
37
 
 * This class provides info about an activity. Most methods in it
38
 
 * require a Nepomuk backend running.
39
 
 *
40
 
 * @see Consumer for info about activities
41
 
 *
42
 
 * @since 4.5
43
 
 */
44
 
class KACTIVITIES_EXPORT Info: public QObject
45
 
{
46
 
    Q_OBJECT
47
 
 
48
 
    Q_PROPERTY(QString id READ id)
49
 
    Q_PROPERTY(QString name READ name)
50
 
 
51
 
public:
52
 
    explicit Info(const QString & activityId, QObject *parent=0);
53
 
    ~Info();
54
 
 
55
 
    /**
56
 
     * @return true if the activity represented by this object exists and is valid
57
 
     */
58
 
    bool isValid() const;
59
 
 
60
 
    /**
61
 
     * Specifies which parts of this class are functional
62
 
     */
63
 
    enum Availability {
64
 
        Nothing = 0,             ///< No activity info provided (isValid is false)
65
 
        BasicInfo = 1,           ///< Basic info is provided
66
 
        Everything = 2           ///< Everything is available
67
 
    };
68
 
 
69
 
    /**
70
 
     * State of the activity
71
 
     */
72
 
    enum State {
73
 
        Invalid  = 0,
74
 
        Running  = 2,
75
 
        Starting = 3,
76
 
        Stopped  = 4,
77
 
        Stopping = 5
78
 
    };
79
 
 
80
 
    /**
81
 
     * @returns what info is provided by this instance of Info
82
 
     */
83
 
    Availability availability() const;
84
 
 
85
 
    /**
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
90
 
     */
91
 
    KDE_DEPRECATED
92
 
    KUrl uri() const;
93
 
 
94
 
    /**
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
98
 
     */
99
 
    KDE_DEPRECATED
100
 
    KUrl resourceUri() const;
101
 
 
102
 
    /**
103
 
     * @returns the id of the activity
104
 
     */
105
 
    QString id() const;
106
 
 
107
 
    /**
108
 
     * @returns the name of the activity
109
 
     * @note Functional when availability is BasicInfo or Everything
110
 
     */
111
 
    QString name() const;
112
 
 
113
 
    /**
114
 
     * @returns the icon of the activity. Icon can be a
115
 
     * freedesktop.org name or a file path. Or empty if
116
 
     * no icon is set.
117
 
     * @note Functional only when availability is Everything
118
 
     */
119
 
    QString icon() const;
120
 
 
121
 
    /**
122
 
     * @returns the state of the activity
123
 
     */
124
 
    State state() const;
125
 
 
126
 
    /**
127
 
     * @returns true if encrypted
128
 
     * @since 4.8
129
 
     */
130
 
    bool isEncrypted() const;
131
 
 
132
 
    /**
133
 
     * This function is provided for convenience.
134
 
     * @returns the name of the specified activity
135
 
     * @param id id of the activity
136
 
     */
137
 
    static QString name(const QString & id);
138
 
 
139
 
 
140
 
    /**
141
 
     * Links the specified resource to the activity
142
 
     * @param resourceUri resource URI
143
 
     */
144
 
    void linkResource(const KUrl & resourceUri);
145
 
 
146
 
 
147
 
    /**
148
 
     * Unlinks the specified resource from the activity
149
 
     * @param resourceUri resource URI
150
 
     */
151
 
    void unlinkResource(const KUrl & resourceUri);
152
 
 
153
 
 
154
 
    /**
155
 
     * @returns the list of linked resources
156
 
     */
157
 
    KUrl::List linkedResources() const;
158
 
 
159
 
Q_SIGNALS:
160
 
    /**
161
 
     * Emitted when the activity's name, icon or description is changed
162
 
     */
163
 
    void infoChanged();
164
 
 
165
 
    /**
166
 
     * Emitted when the activity is added
167
 
     */
168
 
    void added();
169
 
 
170
 
    /**
171
 
     * Emitted when the activity is removed
172
 
     */
173
 
    void removed();
174
 
 
175
 
    /**
176
 
     * Emitted when the activity is started
177
 
     */
178
 
    void started();
179
 
 
180
 
    /**
181
 
     * Emitted when the activity is stopped
182
 
     */
183
 
    void stopped();
184
 
 
185
 
    /**
186
 
     * Emitted when the activity changes state
187
 
     * @param state new state of the activity
188
 
     */
189
 
    void stateChanged(KActivities::Info::State state);
190
 
 
191
 
private:
192
 
    InfoPrivate * const d;
193
 
 
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 &))
200
 
 
201
 
    friend class InfoPrivate;
202
 
};
203
 
 
204
 
} // namespace KActivities
205
 
 
206
 
#endif // ACTIVITIES_INFO_H
207