1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2014 David Faure <faure@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef KIO_RESTOREJOB_H |
9 | #define KIO_RESTOREJOB_H |
10 | |
11 | #include <QObject> |
12 | #include <QUrl> |
13 | |
14 | #include "job_base.h" |
15 | #include "kiocore_export.h" |
16 | |
17 | namespace KIO |
18 | { |
19 | class RestoreJobPrivate; |
20 | /** |
21 | * @class KIO::RestoreJob restorejob.h <KIO/RestoreJob> |
22 | * |
23 | * RestoreJob is used to restore files from the trash. |
24 | * Don't create the job directly, but use KIO::restoreFromTrash(). |
25 | * |
26 | * @see KIO::trash() |
27 | * @see KIO::copy() |
28 | * @since 5.2 |
29 | */ |
30 | class KIOCORE_EXPORT RestoreJob : public Job |
31 | { |
32 | Q_OBJECT |
33 | |
34 | public: |
35 | ~RestoreJob() override; |
36 | |
37 | /** |
38 | * Returns the list of trash URLs to restore. |
39 | */ |
40 | QList<QUrl> trashUrls() const; |
41 | |
42 | Q_SIGNALS: |
43 | |
44 | protected Q_SLOTS: |
45 | void slotResult(KJob *job) override; |
46 | |
47 | protected: |
48 | KIOCORE_NO_EXPORT explicit RestoreJob(RestoreJobPrivate &dd); |
49 | |
50 | private: |
51 | Q_DECLARE_PRIVATE(RestoreJob) |
52 | }; |
53 | |
54 | /** |
55 | * Restore a set of trashed files or directories. |
56 | * @since 5.2 |
57 | * |
58 | * @param urls the trash:/ URLs to restore. The trash implementation |
59 | * will know where the files came from and will restore them to their |
60 | * original location. |
61 | * |
62 | * @param flags restoreFromTrash() supports HideProgressInfo. |
63 | * |
64 | * @return the job handling the operation |
65 | */ |
66 | KIOCORE_EXPORT RestoreJob *restoreFromTrash(const QList<QUrl> &urls, JobFlags flags = DefaultFlags); |
67 | |
68 | } |
69 | |
70 | #endif |
71 | |