Akonadi

itemmovejob.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 namespace Akonadi
13 {
14 class Collection;
15 class ItemMoveJobPrivate;
16 
17 /**
18  * @short Job that moves an item into a different collection in the Akonadi storage.
19  *
20  * This job takes an item and moves it to a collection in the Akonadi storage.
21  *
22  * @code
23  *
24  * Akonadi::Item item = ...
25  * Akonadi::Collection collection = ...
26  *
27  * Akonadi::ItemMoveJob *job = new Akonadi::ItemMoveJob( item, collection );
28  * connect( job, SIGNAL(result(KJob*)), this, SLOT(moveResult(KJob*)) );
29  *
30  * @endcode
31  *
32  * @author Volker Krause <[email protected]>
33  */
34 class AKONADICORE_EXPORT ItemMoveJob : public Job
35 {
36  Q_OBJECT
37 
38 public:
39  /**
40  * Move the given item into the given collection.
41  *
42  * @param item The item to move.
43  * @param destination The destination collection.
44  * @param parent The parent object.
45  */
46  ItemMoveJob(const Item &item, const Collection &destination, QObject *parent = nullptr);
47 
48  /**
49  * Move the given items into @p destination.
50  *
51  * @param items A list of items to move.
52  * @param destination The destination collection.
53  * @param parent The parent object.
54  */
55  ItemMoveJob(const Item::List &items, const Collection &destination, QObject *parent = nullptr);
56 
57  /**
58  * Move the given items from @p source to @p destination.
59  *
60  * @internal If the items are identified only by RID, then you MUST use this
61  * constructor to specify the source collection, otherwise the job will fail.
62  * RID-based moves are only allowed to resources.
63  *
64  * @since 4.14
65  */
66  ItemMoveJob(const Item::List &items, const Collection &source, const Collection &destination, QObject *parent = nullptr);
67 
68  /**
69  * Destroys the item move job.
70  */
71  ~ItemMoveJob() override;
72 
73  /**
74  * Returns the destination collection.
75  *
76  * @since 4.7
77  */
78  Q_REQUIRED_RESULT Collection destinationCollection() const;
79 
80  /**
81  * Returns the list of items that where passed in the constructor.
82  *
83  * @since 4.7
84  */
85  Q_REQUIRED_RESULT Akonadi::Item::List items() const;
86 
87 protected:
88  void doStart() override;
89  bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
90 
91 private:
92  Q_DECLARE_PRIVATE(ItemMoveJob)
93 };
94 
95 }
Represents a collection of PIM items.
Definition: collection.h:61
Job that moves an item into a different collection in the Akonadi storage.
Definition: itemmovejob.h:34
Base class for all actions in the Akonadi storage.
Definition: job.h:80
Represents a PIM item stored in Akonadi storage.
Definition: item.h:100
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 30 2023 04:01:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.