Akonadi

linkjob.h
1/*
2 SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadicore_export.h"
10#include "item.h"
11#include "job.h"
12
13namespace Akonadi
14{
15class Collection;
16class LinkJobPrivate;
17
18/**
19 * @short Job that links items inside the Akonadi storage.
20 *
21 * This job allows you to create references to a set of items in a virtual
22 * collection.
23 *
24 * Example:
25 *
26 * @code
27 *
28 * // Links the given items to the given virtual collection
29 * const Akonadi::Collection virtualCollection = ...
30 * const Akonadi::Item::List items = ...
31 *
32 * Akonadi::LinkJob *job = new Akonadi::LinkJob( virtualCollection, items );
33 * connect( job, SIGNAL(result(KJob*)), SLOT(jobFinished(KJob*)) );
34 *
35 * ...
36 *
37 * MyClass::jobFinished( KJob *job )
38 * {
39 * if ( job->error() )
40 * qDebug() << "Error occurred";
41 * else
42 * qDebug() << "Linked items successfully";
43 * }
44 *
45 * @endcode
46 *
47 * @author Volker Krause <vkrause@kde.org>
48 * @since 4.2
49 * @see UnlinkJob
50 */
51class AKONADICORE_EXPORT LinkJob : public Job
52{
53 Q_OBJECT
54public:
55 /**
56 * Creates the link job.
57 *
58 * The job will create references to the given items in the given collection.
59 *
60 * @param collection The collection in which the references should be created.
61 * @param items The items of which the references should be created.
62 * @param parent The parent object.
63 */
64 LinkJob(const Collection &collection, const Item::List &items, QObject *parent = nullptr);
65
66 /**
67 * Destroys the link job.
68 */
69 ~LinkJob() override;
70
71protected:
72 void doStart() override;
73 bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
74
75private:
76 Q_DECLARE_PRIVATE(LinkJob)
77 template<typename T>
78 friend class LinkJobImpl;
79};
80
81}
Represents a collection of PIM items.
Definition collection.h:62
Base class for all actions in the Akonadi storage.
Definition job.h:81
Job that links items inside the Akonadi storage.
Definition linkjob.h:52
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.