Commit cfe13a73 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Changed QSharedPointer<QIODevice> to <QTcpSocket>

So we don't need a separate pointer.
parent 2fd082f4
......@@ -24,25 +24,26 @@ DownloadJob::DownloadJob(QHostAddress address, QVariantMap transferInfo): KJob()
{
mAddress = address;
mPort = transferInfo["port"].toInt();
mSocket = new QTcpSocket();
mOutput = QSharedPointer<QIODevice>(mSocket);
mSocket = QSharedPointer<QTcpSocket>(new QTcpSocket);
}
void DownloadJob::start()
{
qDebug() << "start";
//qDebug() << "DownloadJob Start";
mSocket->connectToHost(mAddress, mPort, QIODevice::ReadOnly);
connect(mSocket, SIGNAL(disconnected()), this, SLOT(disconnected()));
connect(mSocket.data(), SIGNAL(disconnected()),
this, SLOT(disconnected()));
//TODO: Implement payload encryption somehow (create an intermediate iodevice to encrypt the payload here?)
}
void DownloadJob::disconnected()
{
//qDebug() << "DownloadJob End";
emitResult();
}
QSharedPointer<QIODevice> DownloadJob::getPayload()
{
qDebug() << "getPayload";
return mOutput;
//qDebug() << "getPayload";
return mSocket.staticCast<QIODevice>();
}
......@@ -41,8 +41,7 @@ public:
private:
QHostAddress mAddress;
qint16 mPort;
QTcpSocket* mSocket;
QSharedPointer<QIODevice> mOutput;
QSharedPointer<QTcpSocket> mSocket;
private Q_SLOTS:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment