Kstars
13#include <QNetworkAccessManager>
14#include <QNetworkRequest>
15#include <QNetworkReply>
17#include <QTemporaryFile>
23class FileDownloader :
public QObject
28 ~FileDownloader()
override =
default;
30 void get(
const QUrl &fileUrl);
31 void post(
const QUrl &fileUrl, QByteArray &data);
32 void post(
const QUrl &fileUrl, QHttpMultiPart *parts);
34 QByteArray downloadedData()
const;
36 QUrl getDownloadedFileURL()
const;
37 bool setDownloadedFileURL(
const QUrl &DownloadedFile);
39 void setProgressDialogEnabled(
bool ShowProgressDialog,
const QString &textTitle = QString(),
40 const QString &textLabel = QString());
43 void registerDataVerification(std::function<
bool(
const QByteArray &data)> verifyFunc) { m_verifyData = verifyFunc; }
44 void registerFileVerification(std::function<
bool(
const QString &filename)> verifyFile){ m_verifyFile = verifyFile; }
49 void error(
const QString &errorString);
50 void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
53 void dataFinished(QNetworkReply *pReply);
56 void setDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
59 QNetworkAccessManager m_WebCtrl;
60 QByteArray m_DownloadedData;
63 QUrl m_DownloadedFileURL;
66 QTemporaryFile m_downloadTemporaryFile;
69 QNetworkReply *m_Reply {
nullptr };
72 bool m_ShowProgressDialog {
false };
75 QProgressDialog *progressDialog {
nullptr };
77 bool isCancelled {
false };
81 std::function<bool(
const QByteArray &data)> m_verifyData;
82 std::function<bool(
const QString &filename)> m_verifyFile;
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 11:53:44 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.