Akonadi

trashrestorejob.h
1 /*
2  * SPDX-FileCopyrightText: 2011 Christian Mollekopf <[email protected]>
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 
14 namespace Akonadi
15 {
16 class 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 <[email protected]>
38  * @since 4.8
39  */
40 class AKONADICORE_EXPORT TrashRestoreJob : public Job
41 {
42  Q_OBJECT
43 public:
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  Q_REQUIRED_RESULT Item::List items() const;
63 
64 protected:
65  void doStart() override;
66 
67 private:
68  /// @cond PRIVATE
69  Q_DECLARE_PRIVATE(TrashRestoreJob)
70  /// @endcond
71 };
72 
73 }
74 
Represents a collection of PIM items.
Definition: collection.h:61
Base class for all actions in the Akonadi storage.
Definition: job.h:80
Job that restores entities from trash.
Represents a PIM item stored in Akonadi storage.
Definition: item.h:104
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jun 30 2022 03:51:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.