7#include "downloadjob.h"
11#include "knewstuffcore_debug.h"
13using namespace KNSCore;
15class KNSCore::DownloadJobPrivate
18 DownloadJobPrivate() =
default;
23DownloadJob::DownloadJob(
const QUrl &source,
const QUrl &destination,
int permissions, JobFlags flags,
QObject *parent)
24 : FileCopyJob(source, destination, permissions, flags, parent)
25 , d(new DownloadJobPrivate)
28 d->destination = destination;
31DownloadJob::DownloadJob(
QObject *parent)
33 , d(new DownloadJobPrivate)
37DownloadJob::~DownloadJob() =
default;
39void DownloadJob::start()
41 qCDebug(KNEWSTUFFCORE) << Q_FUNC_INFO;
42 HTTPWorker *worker =
new HTTPWorker(d->source, d->destination, HTTPWorker::DownloadJob,
this);
43 connect(worker, &HTTPWorker::completed,
this, &DownloadJob::handleWorkerCompleted);
44 connect(worker, &HTTPWorker::error,
this, &DownloadJob::handleWorkerError);
45 worker->startRequest();
48void DownloadJob::handleWorkerCompleted()
53void KNSCore::DownloadJob::handleWorkerError(
const QString &error)
55 setError(KJob::UserDefinedError);
59#include "moc_downloadjob.cpp"
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)