1 | /* |
2 | Copyright (c) 2008 Volker Krause <vkrause@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or modify it |
5 | under the terms of the GNU Library General Public License as published by |
6 | the Free Software Foundation; either version 2 of the License, or (at your |
7 | option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, but WITHOUT |
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
12 | License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to the |
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
17 | 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef AKONADI_ITEMCOPYJOB_H |
21 | #define AKONADI_ITEMCOPYJOB_H |
22 | |
23 | #include <akonadi/item.h> |
24 | #include <akonadi/job.h> |
25 | |
26 | namespace Akonadi { |
27 | |
28 | class Collection; |
29 | class ItemCopyJobPrivate; |
30 | |
31 | /** |
32 | * @short Job that copies a set of items to a target collection in the Akonadi storage. |
33 | * |
34 | * The job can be used to copy one or several Item objects to another collection. |
35 | * |
36 | * Example: |
37 | * |
38 | * @code |
39 | * |
40 | * Akonadi::Item::List items = ... |
41 | * Akonadi::Collection collection = ... |
42 | * |
43 | * Akonadi::ItemCopyJob *job = new Akonadi::ItemCopyJob( items, collection ); |
44 | * connect( job, SIGNAL(result(KJob*)), SLOT(jobFinished(KJob*)) ); |
45 | * |
46 | * ... |
47 | * |
48 | * MyClass::jobFinished( KJob *job ) |
49 | * { |
50 | * if ( job->error() ) |
51 | * qDebug() << "Error occurred"; |
52 | * else |
53 | * qDebug() << "Items copied successfully"; |
54 | * } |
55 | * |
56 | * @endcode |
57 | * |
58 | * @author Volker Krause <vkrause@kde.org> |
59 | */ |
60 | class AKONADI_EXPORT ItemCopyJob : public Job |
61 | { |
62 | Q_OBJECT |
63 | |
64 | public: |
65 | /** |
66 | * Creates a new item copy job. |
67 | * |
68 | * @param item The item to copy. |
69 | * @param target The target collection. |
70 | * @param parent The parent object. |
71 | */ |
72 | ItemCopyJob(const Item &item, const Collection &target, QObject *parent = 0); |
73 | |
74 | /** |
75 | * Creates a new item copy job. |
76 | * |
77 | * @param items A list of items to copy. |
78 | * @param target The target collection. |
79 | * @param parent The parent object. |
80 | */ |
81 | ItemCopyJob(const Item::List &items, const Collection &target, QObject *parent = 0); |
82 | |
83 | /** |
84 | * Destroys the item copy job. |
85 | */ |
86 | ~ItemCopyJob(); |
87 | |
88 | protected: |
89 | void doStart(); |
90 | |
91 | private: |
92 | Q_DECLARE_PRIVATE(ItemCopyJob) |
93 | }; |
94 | |
95 | } |
96 | |
97 | #endif |
98 | |