File indexing completed on 2024-04-28 03:56:24
0001 /* 0002 SPDX-FileCopyrightText: 2016 Dan Leinir Turthra Jensen <admin@leinir.dk> 0003 0004 SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #ifndef FILECOPYJOB_H 0008 #define FILECOPYJOB_H 0009 0010 #include "jobbase.h" 0011 0012 #include <QUrl> 0013 0014 #include <memory> 0015 0016 namespace KNSCore 0017 { 0018 class FileCopyJobPrivate; 0019 class FileCopyJob : public KJob 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit FileCopyJob(const QUrl &source, const QUrl &destination, int permissions = -1, JobFlags flags = DefaultFlags, QObject *parent = nullptr); 0024 explicit FileCopyJob(QObject *parent = nullptr); 0025 ~FileCopyJob() override; 0026 0027 Q_SCRIPTABLE void start() override; 0028 0029 QUrl destUrl() const; 0030 QUrl srcUrl() const; 0031 0032 // This will create either a FileCopyJob, or an instance of 0033 // a subclass, depending on the nature of the URLs passed to 0034 // it 0035 static FileCopyJob *file_copy(const QUrl &source, const QUrl &destination, int permissions = -1, JobFlags flags = DefaultFlags, QObject *parent = nullptr); 0036 0037 protected Q_SLOTS: 0038 void handleProgressUpdate(qlonglong current, qlonglong total); 0039 void handleCompleted(); 0040 void handleError(const QString &errorMessage); 0041 0042 private: 0043 const std::unique_ptr<FileCopyJobPrivate> d; 0044 }; 0045 0046 } 0047 0048 #endif // FILECOPYJOB_H