File indexing completed on 2024-05-05 17:00:21
0001 /* 0002 SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "restapiabstractjob.h" 0010 0011 #include <QUrl> 0012 namespace RocketChatRestApi 0013 { 0014 class LIBROCKETCHATRESTAPI_QT_EXPORT DownloadFileJob : public RestApiAbstractJob 0015 { 0016 Q_OBJECT 0017 public: 0018 explicit DownloadFileJob(QObject *parent = nullptr); 0019 ~DownloadFileJob() override; 0020 0021 [[nodiscard]] bool start() override; 0022 [[nodiscard]] bool requireHttpAuthentication() const override; 0023 [[nodiscard]] bool canStart() const override; 0024 0025 [[nodiscard]] QUrl url() const; 0026 void setUrl(const QUrl &url); 0027 0028 [[nodiscard]] QByteArray mimeType() const; 0029 void setMimeType(const QByteArray &mimeType); 0030 0031 [[nodiscard]] QNetworkRequest request() const override; 0032 0033 [[nodiscard]] QUrl localFileUrl() const; 0034 void setLocalFileUrl(const QUrl &localFileUrl); 0035 0036 [[nodiscard]] bool requiredAuthentication() const; 0037 void setRequiredAuthentication(bool newRequiredAuthentication); 0038 0039 Q_SIGNALS: 0040 void downloadFileDone(const QUrl &url, const QUrl &localFileUrl); 0041 0042 private: 0043 Q_DISABLE_COPY(DownloadFileJob) 0044 LIBROCKETCHATRESTAPI_QT_NO_EXPORT void slotDownloadDone(); 0045 QUrl mUrl; 0046 QByteArray mMimeType; 0047 QUrl mLocalFileUrl; 0048 bool mRequiredAuthentication = true; 0049 }; 0050 }