1/*
2 SPDX-FileCopyrightText: 2016 Dan Leinir Turthra Jensen <admin@leinir.dk>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef FILECOPYJOB_H
8#define FILECOPYJOB_H
9
10#include "jobbase.h"
11
12#include <QUrl>
13
14#include <memory>
15
16namespace KNSCore
17{
18class FileCopyJobPrivate;
19class FileCopyJob : public KJob
20{
21 Q_OBJECT
22public:
23 explicit FileCopyJob(const QUrl &source, const QUrl &destination, int permissions = -1, JobFlags flags = DefaultFlags, QObject *parent = nullptr);
24 explicit FileCopyJob(QObject *parent = nullptr);
25 ~FileCopyJob() override;
26
27 Q_SCRIPTABLE void start() override;
28
29 QUrl destUrl() const;
30 QUrl srcUrl() const;
31
32 // This will create either a FileCopyJob, or an instance of
33 // a subclass, depending on the nature of the URLs passed to
34 // it
35 static FileCopyJob *file_copy(const QUrl &source, const QUrl &destination, int permissions = -1, JobFlags flags = DefaultFlags, QObject *parent = nullptr);
36
37protected Q_SLOTS:
38 void handleProgressUpdate(qlonglong current, qlonglong total);
39 void handleCompleted();
40 void handleError(const QString &errorMessage);
41
42private:
43 const std::unique_ptr<FileCopyJobPrivate> d;
44};
45
46}
47
48#endif // FILECOPYJOB_H
49

source code of knewstuff/src/core/jobs/filecopyjob.h