This file is indexed.

/usr/include/akonadi/itemfetchjob.h is in kdepimlibs5-dev 4:4.14.10-1ubuntu7.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/*
    Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>

    This library is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published by
    the Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    This library is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
    License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to the
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
*/

#ifndef AKONADI_ITEMFETCHJOB_H
#define AKONADI_ITEMFETCHJOB_H

#include <akonadi/item.h>
#include <akonadi/job.h>

namespace Akonadi {

class Collection;
class ItemFetchJobPrivate;
class ItemFetchScope;

/**
 * @short Job that fetches items from the Akonadi storage.
 *
 * This class is used to fetch items from the Akonadi storage.
 * Which parts of the items (e.g. headers only, attachments or all)
 * can be specified by the ItemFetchScope.
 *
 * Note that ItemFetchJob does not refresh the Akonadi storage from the
 * backend; this is unnecessary due to the fact that backend updates
 * automatically trigger an update to the Akonadi database whenever they occur
 * (unless the resource is offline).
 *
 * Note that items can not be created in the root collection (Collection::root())
 * and therefore can not be fetched from there either. That is - an item fetch in
 * the root collection will yield an empty list.
 *
 *
 * Example:
 *
 * @code
 *
 * // Fetch all items with full payload from a collection
 *
 * const Collection collection = getCollection();
 *
 * Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(collection);
 * connect(job, SIGNAL(result(KJob*)), SLOT(jobFinished(KJob*)));
 * job->fetchScope().fetchFullPayload();
 *
 * ...
 *
 * MyClass::jobFinished(KJob *job)
 * {
 *   if (job->error()) {
 *     qDebug() << "Error occurred";
 *     return;
 *   }
 *
 *   Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob*>(job);
 *
 *   const Akonadi::Item::List items = fetchJob->items();
 *   foreach (const Akonadi::Item &item, items) {
 *     qDebug() << "Item ID:" << item.id();
 *   }
 * }
 *
 * @endcode
 *
 * @author Volker Krause <vkrause@kde.org>
 */
class AKONADI_EXPORT ItemFetchJob : public Job
{
    Q_OBJECT
    Q_FLAGS(DeliveryOptions)
public:
    /**
     * Creates a new item fetch job that retrieves all items inside the given collection.
     *
     * @param collection The parent collection to fetch all items from.
     * @param parent The parent object.
     */
    explicit ItemFetchJob(const Collection &collection, QObject *parent = 0);

    /**
     * Creates a new item fetch job that retrieves the specified item.
     * If the item has a uid set, this is used to identify the item on the Akonadi
     * server. If only a remote identifier is available, that is used.
     * However, as remote identifiers are not necessarily globally unique, you
     * need to specify the collection to search in in that case, using
     * setCollection().
     *
     * @internal
     * For internal use only when using remote identifiers, the resource search
     * context can be set globally by ResourceSelectJob.
     * @endinternal
     *
     * @param item The item to fetch.
     * @param parent The parent object.
     */
    explicit ItemFetchJob(const Item &item, QObject *parent = 0);

    /**
     * Creates a new item fetch job that retrieves the specified items.
     * If the items have a uid set, this is used to identify the item on the Akonadi
     * server. If only a remote identifier is available, that is used.
     * However, as remote identifiers are not necessarily globally unique, you
     * need to specify the collection to search in in that case, using
     * setCollection().
     *
     * @internal
     * For internal use only when using remote identifiers, the resource search
     * context can be set globally by ResourceSelectJob.
     * @endinternal
     *
     * @param items The items to fetch.
     * @param parent The parent object.
     * @since 4.4
     */
    explicit ItemFetchJob(const Item::List &items, QObject *parent = 0);

    /**
     * Convenience ctor equivalent to ItemFetchJob(const Item::List &items, QObject *parent = 0)
     * @since 4.8
     */
    explicit ItemFetchJob(const QList<Item::Id> &items, QObject *parent = 0);


    /**
     * Creates a new item fetch job that retrieves all items tagged with specified @p tag.
     *
     * @param tag The tag to fetch all items from.
     * @param parent The parent object.
     *
     * @since 4.14
     */
    explicit ItemFetchJob(const Tag &tag, QObject *parent = 0);

    /**
     * Destroys the item fetch job.
     */
    virtual ~ItemFetchJob();

    /**
     * Returns the fetched items.
     *
     * This returns an empty list when not using the ItemGetter DeliveryOption.
     *
     * @note The items are invalid before the result(KJob*)
     *       signal has been emitted or if an error occurred.
     */
    Item::List items() const;

    /**
     * Save memory by clearing the fetched items.
     * @since 4.12
     */
    void clearItems();

    /**
     * Sets the item fetch scope.
     *
     * The ItemFetchScope controls how much of an item's data is fetched
     * from the server, e.g. whether to fetch the full item payload or
     * only meta data.
     *
     * @param fetchScope The new scope for item fetch operations.
     *
     * @see fetchScope()
     */
    void setFetchScope(ItemFetchScope &fetchScope);   // KDE5: remove

    /**
     * Sets the item fetch scope.
     *
     * The ItemFetchScope controls how much of an item's data is fetched
     * from the server, e.g. whether to fetch the full item payload or
     * only meta data.
     *
     * @param fetchScope The new scope for item fetch operations.
     *
     * @see fetchScope()
     * @since 4.4
     */
    void setFetchScope(const ItemFetchScope &fetchScope);

    /**
     * Returns the item fetch scope.
     *
     * Since this returns a reference it can be used to conveniently modify the
     * current scope in-place, i.e. by calling a method on the returned reference
     * without storing it in a local variable. See the ItemFetchScope documentation
     * for an example.
     *
     * @return a reference to the current item fetch scope
     *
     * @see setFetchScope() for replacing the current item fetch scope
     */
    ItemFetchScope &fetchScope();

    /**
     * Specifies the collection the item is in.
     * This is only required when retrieving an item based on its remote id
     * which might not be unique globally.
     *
     * @internal
     * @see ResourceSelectJob (for internal use only)
     * @endinternal
     */
    void setCollection(const Collection &collection);

    enum DeliveryOption {
        ItemGetter = 0x1,            ///< items available through items()
        EmitItemsIndividually = 0x2, ///< emitted via signal upon reception
        EmitItemsInBatches = 0x4,    ///< emitted via signal in bulk (collected and emitted delayed via timer)
        Default = ItemGetter | EmitItemsInBatches
    };
    Q_DECLARE_FLAGS(DeliveryOptions, DeliveryOption)

    /**
     * Sets the mechanisms by which the items should be fetched
     * @since 4.13
     */
    void setDeliveryOption(DeliveryOptions options);

    /**
     * Returns the delivery options
     * @since 4.13
     */
    DeliveryOptions deliveryOptions() const;

    /**
     * Returns the total number of retrieved items.
     * This works also without the ItemGetter DeliveryOption.
     * @since 4.14
     */
    int count() const;

Q_SIGNALS:
    /**
     * This signal is emitted whenever new items have been fetched completely.
     *
     * @note This is an optimization; instead of waiting for the end of the job
     *       and calling items(), you can connect to this signal and get the items
     *       incrementally.
     *
     * @param items The fetched items.
     */
    void itemsReceived(const Akonadi::Item::List &items);

protected:
    virtual void doStart();
    virtual void doHandleResponse(const QByteArray &tag, const QByteArray &data);

private:
    Q_DECLARE_PRIVATE(ItemFetchJob)

    //@cond PRIVATE
    Q_PRIVATE_SLOT(d_func(), void timeout())
    //@endcond
};

}

Q_DECLARE_OPERATORS_FOR_FLAGS(Akonadi::ItemFetchJob::DeliveryOptions)

#endif