Fix receiving payloads using a bluetooth connection

Summary:
This fixes receiving payloads using the bluetooth backend.

This looks like some bug in Qt, but I couldn't figure out what happens exactly (will report a bug though).

Test Plan: Receiving files now works!

Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: kdeconnect, nicolasfella, apol, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D12153
This commit is contained in:
Matthijs Tijink 2018-10-04 19:05:15 +02:00 committed by Nicolas Fella
parent f145ef8833
commit 7cab490cc5
2 changed files with 4 additions and 2 deletions

View file

@ -35,6 +35,7 @@ QSharedPointer<QIODevice> BluetoothDownloadJob::payload() const
void BluetoothDownloadJob::start()
{
connect(mSocket.data(), SIGNAL(disconnected()), this, SLOT(deleteLater()));
connect(mSocket.data(), &QBluetoothSocket::disconnected, mSocket.data(), &QBluetoothSocket::readyRead);
connect(mSocket.data(), &QBluetoothSocket::disconnected, mSocket.data(), &QBluetoothSocket::readChannelFinished);
mSocket->connectToService(mRemoteAddress, mTransferUuid, QIODevice::ReadOnly);
}

View file

@ -40,7 +40,8 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64
, m_size(size)
{
Q_ASSERT(m_origin);
Q_ASSERT(m_origin->isReadable());
//Disabled this assert: QBluetoothSocket doesn't report "->isReadable() == true" until it's connected
//Q_ASSERT(m_origin->isReadable());
if (m_destination.scheme().isEmpty()) {
qCWarning(KDECONNECT_CORE) << "Destination QUrl" << m_destination << "lacks a scheme. Setting its scheme to 'file'.";
m_destination.setScheme(QStringLiteral("file"));