Akonadi

itemcopyjob.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 ItemCopyJobPrivate;
17 
18 /**
19  * @short Job that copies a set of items to a target collection in the Akonadi storage.
20  *
21  * The job can be used to copy one or several Item objects to another collection.
22  *
23  * Example:
24  *
25  * @code
26  *
27  * Akonadi::Item::List items = ...
28  * Akonadi::Collection collection = ...
29  *
30  * Akonadi::ItemCopyJob *job = new Akonadi::ItemCopyJob( items, collection );
31  * connect( job, SIGNAL(result(KJob*)), SLOT(jobFinished(KJob*)) );
32  *
33  * ...
34  *
35  * MyClass::jobFinished( KJob *job )
36  * {
37  * if ( job->error() )
38  * qDebug() << "Error occurred";
39  * else
40  * qDebug() << "Items copied successfully";
41  * }
42  *
43  * @endcode
44  *
45  * @author Volker Krause <[email protected]>
46  */
47 class AKONADICORE_EXPORT ItemCopyJob : public Job
48 {
49  Q_OBJECT
50 
51 public:
52  /**
53  * Creates a new item copy job.
54  *
55  * @param item The item to copy.
56  * @param target The target collection.
57  * @param parent The parent object.
58  */
59  ItemCopyJob(const Item &item, const Collection &target, QObject *parent = nullptr);
60 
61  /**
62  * Creates a new item copy job.
63  *
64  * @param items A list of items to copy.
65  * @param target The target collection.
66  * @param parent The parent object.
67  */
68  ItemCopyJob(const Item::List &items, const Collection &target, QObject *parent = nullptr);
69 
70  /**
71  * Destroys the item copy job.
72  */
73  ~ItemCopyJob() override;
74 
75 protected:
76  void doStart() override;
77  bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
78 
79 private:
80  Q_DECLARE_PRIVATE(ItemCopyJob)
81 };
82 
83 }
84 
Represents a collection of PIM items.
Definition: collection.h:61
Base class for all actions in the Akonadi storage.
Definition: job.h:80
Job that copies a set of items to a target collection in the Akonadi storage.
Definition: itemcopyjob.h:47
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 Mon Jun 27 2022 04:01:06 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.