Akonadi

itemcopyjob.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 "item.h"
11#include "job.h"
12
13namespace Akonadi
14{
15class Collection;
16class 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 <vkrause@kde.org>
46 */
47class AKONADICORE_EXPORT ItemCopyJob : public Job
48{
49 Q_OBJECT
50
51public:
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
75protected:
76 void doStart() override;
77 bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
78
79private:
80 Q_DECLARE_PRIVATE(ItemCopyJob)
81};
82
83}
Represents a collection of PIM items.
Definition collection.h:62
Job that copies a set of items to a target collection in the Akonadi storage.
Definition itemcopyjob.h:48
Represents a PIM item stored in Akonadi storage.
Definition item.h:100
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 4 2024 16:31:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.