File indexing completed on 2024-04-14 03:53:00

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2014 David Faure <faure@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KIO_RESTOREJOB_H
0009 #define KIO_RESTOREJOB_H
0010 
0011 #include <QObject>
0012 #include <QUrl>
0013 
0014 #include "job_base.h"
0015 #include "kiocore_export.h"
0016 
0017 namespace KIO
0018 {
0019 class RestoreJobPrivate;
0020 /**
0021  * @class KIO::RestoreJob restorejob.h <KIO/RestoreJob>
0022  *
0023  * RestoreJob is used to restore files from the trash.
0024  * Don't create the job directly, but use KIO::restoreFromTrash().
0025  *
0026  * @see KIO::trash()
0027  * @see KIO::copy()
0028  * @since 5.2
0029  */
0030 class KIOCORE_EXPORT RestoreJob : public Job
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     ~RestoreJob() override;
0036 
0037     /**
0038      * Returns the list of trash URLs to restore.
0039      */
0040     QList<QUrl> trashUrls() const;
0041 
0042 Q_SIGNALS:
0043 
0044 protected Q_SLOTS:
0045     void slotResult(KJob *job) override;
0046 
0047 protected:
0048     KIOCORE_NO_EXPORT explicit RestoreJob(RestoreJobPrivate &dd);
0049 
0050 private:
0051     Q_DECLARE_PRIVATE(RestoreJob)
0052 };
0053 
0054 /**
0055  * Restore a set of trashed files or directories.
0056  * @since 5.2
0057  *
0058  * @param urls the trash:/ URLs to restore. The trash implementation
0059  * will know where the files came from and will restore them to their
0060  * original location.
0061  *
0062  * @param flags restoreFromTrash() supports HideProgressInfo.
0063  *
0064  * @return the job handling the operation
0065  */
0066 KIOCORE_EXPORT RestoreJob *restoreFromTrash(const QList<QUrl> &urls, JobFlags flags = DefaultFlags);
0067 
0068 }
0069 
0070 #endif