2013-09-14 16:30:12 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License or (at your option) version 3 or any later version
|
|
|
|
* accepted by the membership of KDE e.V. (or its successor approved
|
|
|
|
* by the membership of KDE e.V.), which shall act as a proxy
|
|
|
|
* defined in Section 14 of version 3 of the license.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DOWNLOADJOB_H
|
|
|
|
#define DOWNLOADJOB_H
|
|
|
|
|
|
|
|
#include <KJob>
|
|
|
|
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <QVariantMap>
|
|
|
|
#include <QHostAddress>
|
2013-09-24 13:13:02 +01:00
|
|
|
#include <QSharedPointer>
|
2015-07-05 22:49:58 +01:00
|
|
|
#include <QSslSocket>
|
2016-06-22 16:49:45 +01:00
|
|
|
#include <QBuffer>
|
2016-07-05 13:27:53 +01:00
|
|
|
|
|
|
|
#include "kdeconnectcore_export.h"
|
2013-09-14 16:30:12 +01:00
|
|
|
|
2016-06-10 14:07:33 +01:00
|
|
|
|
|
|
|
class KDECONNECTCORE_EXPORT DownloadJob
|
2013-09-14 16:30:12 +01:00
|
|
|
: public KJob
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-09-03 20:39:44 +01:00
|
|
|
DownloadJob(const QHostAddress& address, const QVariantMap& transferInfo);
|
2016-06-20 08:05:02 +01:00
|
|
|
~DownloadJob() override;
|
|
|
|
void start() override;
|
2013-09-24 13:13:02 +01:00
|
|
|
QSharedPointer<QIODevice> getPayload();
|
2013-09-14 16:30:12 +01:00
|
|
|
|
|
|
|
private:
|
2017-09-03 20:39:44 +01:00
|
|
|
QHostAddress m_address;
|
|
|
|
qint16 m_port;
|
|
|
|
QSharedPointer<QSslSocket> m_socket;
|
2013-09-24 13:13:02 +01:00
|
|
|
|
2013-09-14 16:30:12 +01:00
|
|
|
private Q_SLOTS:
|
2016-06-22 11:40:14 +01:00
|
|
|
void socketFailed(QAbstractSocket::SocketError error);
|
2017-08-01 23:35:24 +01:00
|
|
|
void socketConnected();
|
2013-09-14 16:30:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // UPLOADJOB_H
|