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_COLLECTIONCOPYJOB_H
21#define AKONADI_COLLECTIONCOPYJOB_H
22
23#include <akonadi/job.h>
24
25namespace Akonadi {
26
27class Collection;
28class CollectionCopyJobPrivate;
29
30/**
31 * @short Job that copies a collection into another collection in the Akonadi storage.
32 *
33 * This job copies a single collection into a specified target collection.
34 *
35 * @code
36 *
37 * Akonadi::Collection source = ...
38 * Akonadi::Collection target = ...
39 *
40 * Akonadi::CollectionCopyJob *job = new Akonadi::CollectionCopyJob( source, target );
41 * connect( job, SIGNAL(result(KJob*)), SLOT(copyFinished(KJob*)) );
42 *
43 * ...
44 *
45 * MyClass::copyFinished( KJob *job )
46 * {
47 * if ( job->error() )
48 * qDebug() << "Error occurred";
49 * else
50 * qDebug() << "Copied successfully";
51 * }
52 *
53 * @endcode
54 *
55 * @author Volker Krause <vkrause@kde.org>
56 */
57class AKONADI_EXPORT CollectionCopyJob : public Job
58{
59 Q_OBJECT
60
61public:
62 /**
63 * Creates a new collection copy job to copy the given @p source collection into @p target.
64 *
65 * @param source The collection to copy.
66 * @param target The target collection.
67 * @param parent The parent object.
68 */
69 CollectionCopyJob(const Collection &source, const Collection &target, QObject *parent = 0);
70
71 /**
72 * Destroys the collection copy job.
73 */
74 ~CollectionCopyJob();
75
76protected:
77 void doStart();
78
79private:
80 Q_DECLARE_PRIVATE(CollectionCopyJob)
81};
82
83}
84
85#endif
86