Akonadi

unlinkjob.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 UnlinkJobPrivate;
17
18/**
19 * @short Job that unlinks items inside the Akonadi storage.
20 *
21 * This job allows you to remove references to a set of items in a virtual
22 * collection.
23 *
24 * Example:
25 *
26 * @code
27 *
28 * // Unlink the given items from the given collection
29 * const Akonadi::Collection virtualCollection = ...
30 * const Akonadi::Item::List items = ...
31 *
32 * Akonadi::UnlinkJob *job = new Akonadi::UnlinkJob( virtualCollection, items );
33 * connect( job, SIGNAL(result(KJob*)), SLOT(jobFinished(KJob*)) );
34 *
35 * ...
36 *
37 * MyClass::jobFinished( KJob *job )
38 * {
39 * if ( job->error() )
40 * qDebug() << "Error occurred";
41 * else
42 * qDebug() << "Unlinked items successfully";
43 * }
44 *
45 * @endcode
46 *
47 * @author Volker Krause <vkrause@kde.org>
48 * @since 4.2
49 * @see LinkJob
50 */
51class AKONADICORE_EXPORT UnlinkJob : public Job
52{
53 Q_OBJECT
54public:
55 /**
56 * Creates a new unlink job.
57 *
58 * The job will remove references to the given items from the given collection.
59 *
60 * @param collection The collection from which the references should be removed.
61 * @param items The items of which the references should be removed.
62 * @param parent The parent object.
63 */
64 UnlinkJob(const Collection &collection, const Item::List &items, QObject *parent = nullptr);
65
66 /**
67 * Destroys the unlink job.
68 */
69 ~UnlinkJob() override;
70
71protected:
72 void doStart() override;
73 bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
74
75private:
76 Q_DECLARE_PRIVATE(UnlinkJob)
77 template<typename T>
78 friend class LinkJobImpl;
79};
80
81}
Represents a collection of PIM items.
Definition collection.h:62
Base class for all actions in the Akonadi storage.
Definition job.h:81
Job that unlinks items inside the Akonadi storage.
Definition unlinkjob.h:52
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:03:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.