From 43710d6a5731778e28d907a3a264bcf74550073e Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 12 Jan 2018 22:07:33 +0900 Subject: DownloadFileJob Instead of exposing a QIODevice as GetContentJob does it gets a filename and saves the incoming payload into it. --- jobs/downloadfilejob.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 jobs/downloadfilejob.h (limited to 'jobs/downloadfilejob.h') diff --git a/jobs/downloadfilejob.h b/jobs/downloadfilejob.h new file mode 100644 index 00000000..d798506c --- /dev/null +++ b/jobs/downloadfilejob.h @@ -0,0 +1,27 @@ +#pragma once + +#include "generated/content-repo.h" + +namespace QMatrixClient +{ + class DownloadFileJob : public GetContentJob + { + public: + enum { FileError = BaseJob::UserDefinedError + 1 }; + + DownloadFileJob(const QString& serverName, const QString& mediaId, + const QString& localFilename = {}); + + QString targetFileName() const; + + private: + class Private; + QScopedPointer d; + + void beforeStart(const ConnectionData*) override; + void afterStart(const ConnectionData*, + QNetworkReply* reply) override; + void beforeAbandon(QNetworkReply*) override; + Status parseReply(QNetworkReply*) override; + }; +} -- cgit v1.2.3