| 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 |
| 22 | * \inheaderfile KIO/RestoreJob |
| 23 | * \inmodule KIOCore |
| 24 | * |
| 25 | * \brief RestoreJob is used to restore files from the trash. |
| 26 | * |
| 27 | * Don't create the job directly, but use KIO::restoreFromTrash(). |
| 28 | * |
| 29 | * \sa KIO::trash() |
| 30 | * \sa KIO::copy() |
| 31 | * \since 5.2 |
| 32 | */ |
| 33 | class KIOCORE_EXPORT RestoreJob : public Job |
| 34 | { |
| 35 | Q_OBJECT |
| 36 | |
| 37 | public: |
| 38 | ~RestoreJob() override; |
| 39 | |
| 40 | /*! |
| 41 | * Returns the list of trash URLs to restore. |
| 42 | */ |
| 43 | QList<QUrl> trashUrls() const; |
| 44 | |
| 45 | Q_SIGNALS: |
| 46 | |
| 47 | protected Q_SLOTS: |
| 48 | void slotResult(KJob *job) override; |
| 49 | |
| 50 | protected: |
| 51 | KIOCORE_NO_EXPORT explicit RestoreJob(RestoreJobPrivate &dd); |
| 52 | |
| 53 | private: |
| 54 | Q_DECLARE_PRIVATE(RestoreJob) |
| 55 | }; |
| 56 | |
| 57 | /*! |
| 58 | * \relates KIO::RestoreJob |
| 59 | * |
| 60 | * Restore a set of trashed files or directories. |
| 61 | * |
| 62 | * \since 5.2 |
| 63 | * |
| 64 | * \a urls the trash:/ URLs to restore. The trash implementation |
| 65 | * will know where the files came from and will restore them to their |
| 66 | * original location. |
| 67 | * |
| 68 | * \a flags restoreFromTrash() supports HideProgressInfo. |
| 69 | * |
| 70 | * Returns the job handling the operation |
| 71 | */ |
| 72 | KIOCORE_EXPORT RestoreJob *restoreFromTrash(const QList<QUrl> &urls, JobFlags flags = DefaultFlags); |
| 73 | |
| 74 | } |
| 75 | |
| 76 | #endif |
| 77 | |