File indexing completed on 2024-04-21 04:57:01

0001 /* This file is part of the KDE project
0002 
0003    Copyright (C) 2007 Lukas Appelhans <l.appelhans@gmx.de>
0004 
0005    This program is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 */
0010 
0011 #ifndef DOWNLOAD_H
0012 #define DOWNLOAD_H
0013 
0014 #include "kget_export.h"
0015 
0016 #include <QByteArray>
0017 #include <QObject>
0018 
0019 #include <QUrl>
0020 
0021 #include <KIO/TransferJob>
0022 
0023 class KGET_EXPORT Download : public QObject
0024 {
0025     Q_OBJECT
0026 public:
0027     Download(const QUrl &srcUrl, const QUrl &destUrl);
0028     ~Download() override;
0029 
0030 Q_SIGNALS:
0031     void finishedSuccessfully(QUrl dest, QByteArray data);
0032     void finishedWithError();
0033 
0034 private Q_SLOTS:
0035     void slotResult(KJob *job);
0036     void slotData(KIO::Job *job, const QByteArray &data);
0037 
0038 private:
0039     KIO::TransferJob *m_copyJob = nullptr;
0040     QUrl m_srcUrl;
0041     QUrl m_destUrl;
0042     QUrl m_destFile;
0043     QByteArray m_data;
0044 };
0045 
0046 #endif