Akonadi

trashrestorejob.h
1/*
2 * SPDX-FileCopyrightText: 2011 Christian Mollekopf <chrigi_1@fastmail.fm>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#pragma once
8
9#include "akonadicore_export.h"
10#include "collection.h"
11#include "item.h"
12#include "job.h"
13
14namespace Akonadi
15{
16class TrashRestoreJobPrivate;
17/**
18 * @short Job that restores entities from trash
19 *
20 * This job restores the given entities from trash.
21 * The EntityDeletedAttribute is removed and the item is restored to the stored restore collection.
22 *
23 * If the stored restore collection is not available, the root collection of the original resource is used.
24 * If also this is not available, setTargetCollection has to be used to restore the item to a specific collection.
25 *
26 * Example:
27 *
28 * @code
29 *
30 * const Akonadi::Item::List items = ...
31 *
32 * TrashRestoreJob *job = new TrashRestoreJob( items );
33 * connect( job, SIGNAL(result(KJob*)), this, SLOT(restoreResult(KJob*)) );
34 *
35 * @endcode
36 *
37 * @author Christian Mollekopf <chrigi_1@fastmail.fm>
38 * @since 4.8
39 */
40class AKONADICORE_EXPORT TrashRestoreJob : public Job
41{
42 Q_OBJECT
43public:
44 /**
45 * All items need to be from the same resource
46 */
47 explicit TrashRestoreJob(const Item &item, QObject *parent = nullptr);
48
49 explicit TrashRestoreJob(const Item::List &items, QObject *parent = nullptr);
50
51 explicit TrashRestoreJob(const Collection &collection, QObject *parent = nullptr);
52
53 ~TrashRestoreJob() override;
54
55 /**
56 * Sets the target collection, where the item is moved to.
57 * If not set the item will be restored in the collection saved in the EntityDeletedAttribute.
58 * @param collection the collection to set as target
59 */
60 void setTargetCollection(const Collection &collection);
61
62 [[nodiscard]] Item::List items() const;
63
64protected:
65 void doStart() override;
66
67private:
68 /// @cond PRIVATE
69 Q_DECLARE_PRIVATE(TrashRestoreJob)
70 /// @endcond
71};
72
73}
Represents a collection of PIM items.
Definition collection.h:62
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
Job that restores entities from trash.
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.