Akonadi

unlinkjob.h
1 /*
2  SPDX-FileCopyrightText: 2008 Volker Krause <[email protected]>
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 
13 namespace Akonadi
14 {
15 class Collection;
16 class UnlinkJobPrivate;
17 
18 /**
19  * @short Job that unlinks items inside the Akonadi storage.
20  *
21  * This job allows you to remove references to a set of items in a virtual
22  * collection.
23  *
24  * Example:
25  *
26  * @code
27  *
28  * // Unlink the given items from the given collection
29  * const Akonadi::Collection virtualCollection = ...
30  * const Akonadi::Item::List items = ...
31  *
32  * Akonadi::UnlinkJob *job = new Akonadi::UnlinkJob( 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() << "Unlinked items successfully";
43  * }
44  *
45  * @endcode
46  *
47  * @author Volker Krause <[email protected]>
48  * @since 4.2
49  * @see LinkJob
50  */
51 class AKONADICORE_EXPORT UnlinkJob : public Job
52 {
53  Q_OBJECT
54 public:
55  /**
56  * Creates a new unlink job.
57  *
58  * The job will remove references to the given items from the given collection.
59  *
60  * @param collection The collection from which the references should be removed.
61  * @param items The items of which the references should be removed.
62  * @param parent The parent object.
63  */
64  UnlinkJob(const Collection &collection, const Item::List &items, QObject *parent = nullptr);
65 
66  /**
67  * Destroys the unlink job.
68  */
69  ~UnlinkJob() override;
70 
71 protected:
72  void doStart() override;
73  bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
74 
75 private:
76  Q_DECLARE_PRIVATE(UnlinkJob)
77  template<typename T> friend class LinkJobImpl;
78 };
79 
80 }
81 
Job that unlinks items inside the Akonadi storage.
Definition: unlinkjob.h:51
Represents a collection of PIM items.
Definition: collection.h:61
Base class for all actions in the Akonadi storage.
Definition: job.h:80
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Jun 27 2022 04:01:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.