Akonadi

itemdeletejob.h
1 /*
2  SPDX-FileCopyrightText: 2006 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 ItemDeleteJobPrivate;
17 
18 /**
19  * @short Job that deletes items from the Akonadi storage.
20  *
21  * This job removes the given items from the Akonadi storage.
22  *
23  * Example:
24  *
25  * @code
26  *
27  * const Akonadi::Item item = ...
28  *
29  * ItemDeleteJob *job = new ItemDeleteJob(item);
30  * connect(job, SIGNAL(result(KJob*)), this, SLOT(deletionResult(KJob*)));
31  *
32  * @endcode
33  *
34  * Example:
35  *
36  * @code
37  *
38  * const Akonadi::Item::List items = ...
39  *
40  * ItemDeleteJob *job = new ItemDeleteJob(items);
41  * connect(job, SIGNAL(result(KJob*)), this, SLOT(deletionResult(KJob*)));
42  *
43  * @endcode
44  *
45  * @author Volker Krause <[email protected]>
46  */
47 class AKONADICORE_EXPORT ItemDeleteJob : public Job
48 {
49  Q_OBJECT
50 
51 public:
52  /**
53  * Creates a new item delete job that deletes @p item. The item
54  * needs to have a unique identifier set.
55  *
56  * @internal
57  * For internal use only, the item may have a remote identifier set instead
58  * of a unique identifier. In this case, a collection or resource context
59  * needs to be selected using ResourceSelectJob.
60  * @endinternal
61  *
62  * @param item The item to delete.
63  * @param parent The parent object.
64  */
65  explicit ItemDeleteJob(const Item &item, QObject *parent = nullptr);
66 
67  /**
68  * Creates a new item delete job that deletes all items in the list
69  * @p items. Each item needs to have a unique identifier set. These items
70  * can be located in any collection.
71  *
72  * @internal
73  * For internal use only, the items may have remote identifiers set instead
74  * of unique identifiers. In this case, a collection or resource context
75  * needs to be selected using ResourceSelectJob.
76  * @endinternal
77  *
78  * @param items The items to delete.
79  * @param parent The parent object.
80  *
81  * @since 4.3
82  */
83  explicit ItemDeleteJob(const Item::List &items, QObject *parent = nullptr);
84 
85  /**
86  * Creates a new item delete job that deletes all items in the collection
87  * @p collection. The collection needs to have a unique identifier set.
88  *
89  * @internal
90  * For internal use only, the collection may have a remote identifier set
91  * instead of a unique identifier. In this case, a resource context needs
92  * to be selected using ResourceSelectJob.
93  * @endinternal
94  *
95  * @param collection The collection which content should be deleted.
96  * @param parent The parent object.
97  *
98  * @since 4.3
99  */
100  explicit ItemDeleteJob(const Collection &collection, QObject *parent = nullptr);
101 
102  /**
103  * Creates a new item delete job that deletes all items that have assigned
104  * the tag @p tag.
105  *
106  * @param tag The tag which content should be deleted.
107  * @param parent The parent object.
108  *
109  * @since 4.14
110  */
111  explicit ItemDeleteJob(const Tag &tag, QObject *parent = nullptr);
112 
113  /**
114  * Destroys the item delete job.
115  */
116  ~ItemDeleteJob() override;
117 
118  /**
119  * Returns the items passed on in the constructor.
120  * @since 4.4
121  */
122  Q_REQUIRED_RESULT Item::List deletedItems() const;
123 
124 protected:
125  void doStart() override;
126  bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
127 
128 private:
129  /// @cond PRIVATE
130  Q_DECLARE_PRIVATE(ItemDeleteJob)
131  /// @endcond
132 };
133 
134 }
135 
Job that deletes items from the Akonadi storage.
Definition: itemdeletejob.h:47
An Akonadi Tag.
Definition: tag.h:25
Represents a collection of PIM items.
Definition: collection.h:61
Base class for all actions in the Akonadi storage.
Definition: job.h:80
Represents a PIM item stored in Akonadi storage.
Definition: item.h:104
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jun 30 2022 03:51:46 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.