1 | // SPDX-FileCopyrightText: 2018 Kitsune Ral <Kitsune-Ral@users.sf.net> |
2 | // SPDX-License-Identifier: LGPL-2.1-or-later |
3 | |
4 | #pragma once |
5 | |
6 | #include <Quotient/csapi/content-repo.h> |
7 | |
8 | namespace Quotient { |
9 | struct EncryptedFileMetadata; |
10 | |
11 | class QUOTIENT_API DownloadFileJob : public GetContentJob { |
12 | public: |
13 | using GetContentJob::makeRequestUrl; |
14 | static QUrl makeRequestUrl(QUrl baseUrl, const QUrl& mxcUri); |
15 | |
16 | DownloadFileJob(const QString& serverName, const QString& mediaId, |
17 | const QString& localFilename = {}); |
18 | |
19 | #ifdef Quotient_E2EE_ENABLED |
20 | DownloadFileJob(const QString& serverName, const QString& mediaId, |
21 | const EncryptedFileMetadata& file, |
22 | const QString& localFilename = {}); |
23 | #endif |
24 | QString targetFileName() const; |
25 | |
26 | private: |
27 | class Private; |
28 | ImplPtr<Private> d; |
29 | |
30 | void doPrepare() override; |
31 | void onSentRequest(QNetworkReply* reply) override; |
32 | void beforeAbandon() override; |
33 | Status prepareResult() override; |
34 | }; |
35 | } // namespace Quotient |
36 | |