Akonadi

collectioncopyjob.h
1/*
2 SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadicore_export.h"
10#include "job.h"
11
12namespace Akonadi
13{
14class Collection;
15class CollectionCopyJobPrivate;
16
17/**
18 * @short Job that copies a collection into another collection in the Akonadi storage.
19 *
20 * This job copies a single collection into a specified target collection.
21 *
22 * Example:
23 *
24 * @code
25 *
26 * Akonadi::Collection source = ...
27 * Akonadi::Collection target = ...
28 *
29 * auto job = new Akonadi::CollectionCopyJob(source, target);
30 * connect(job, &KJob::result, this, &MyClass::copyFinished);
31 *
32 * ...
33 *
34 * MyClass::copyFinished(KJob *job)
35 * {
36 * if (job->error()) {
37 * qDebug() << "Error occurred";
38 * } else {
39 * qDebug() << "Copied successfully";
40 * }
41 * }
42 *
43 * @endcode
44 *
45 * @author Volker Krause <vkrause@kde.org>
46 */
47class AKONADICORE_EXPORT CollectionCopyJob : public Job
48{
49 Q_OBJECT
50
51public:
52 /**
53 * Creates a new collection copy job to copy the given @p source collection into @p target.
54 *
55 * @param source The collection to copy.
56 * @param target The target collection.
57 * @param parent The parent object.
58 */
59 CollectionCopyJob(const Collection &source, const Collection &target, QObject *parent = nullptr);
60
61 /**
62 * Destroys the collection copy job.
63 */
64 ~CollectionCopyJob() override;
65
66protected:
67 void doStart() override;
68 bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
69
70private:
71 Q_DECLARE_PRIVATE(CollectionCopyJob)
72};
73
74}
Job that copies a collection into another collection in the Akonadi storage.
Represents a collection of PIM items.
Definition collection.h:62
Base class for all actions in the Akonadi storage.
Definition job.h:81
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:29 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.