diff --git a/src/core/job_p.h b/src/core/job_p.h --- a/src/core/job_p.h +++ b/src/core/job_p.h @@ -298,6 +298,7 @@ bool m_closedBeforeStart; TransferJob *m_subJob; QPointer m_outgoingDataSource; + QMetaObject::Connection m_ongoingConn; /** * Flow control. Suspend data processing from the slave. diff --git a/src/core/transferjob.h b/src/core/transferjob.h --- a/src/core/transferjob.h +++ b/src/core/transferjob.h @@ -199,14 +199,8 @@ protected: TransferJob(TransferJobPrivate &dd); private: - Q_PRIVATE_SLOT(d_func(), void slotErrorPage()) - Q_PRIVATE_SLOT(d_func(), void slotCanResume(KIO::filesize_t offset)) - Q_PRIVATE_SLOT(d_func(), void slotPostRedirection()) - Q_PRIVATE_SLOT(d_func(), void slotNeedSubUrlData()) - Q_PRIVATE_SLOT(d_func(), void slotSubUrlData(KIO::Job *, const QByteArray &)) Q_PRIVATE_SLOT(d_func(), void slotDataReqFromDevice()) Q_PRIVATE_SLOT(d_func(), void slotIODeviceClosed()) - Q_PRIVATE_SLOT(d_func(), void slotIODeviceClosedBeforeStart()) Q_DECLARE_PRIVATE(TransferJob) // A FileCopyJob may control one or more TransferJobs diff --git a/src/core/transferjob.cpp b/src/core/transferjob.cpp --- a/src/core/transferjob.cpp +++ b/src/core/transferjob.cpp @@ -37,8 +37,8 @@ } if (d->m_outgoingDataSource) { - connect(d->m_outgoingDataSource, SIGNAL(readChannelFinished()), - SLOT(slotIODeviceClosedBeforeStart())); + d->m_ongoingConn = QObject::connect(d->m_outgoingDataSource, &QAbstractSocket::readChannelFinished, this, + [d](){d->slotIODeviceClosedBeforeStart();} ); } } @@ -311,46 +311,46 @@ Q_Q(TransferJob); Q_ASSERT(slave); JobPrivate::emitTransferring(q, m_url); - q->connect(slave, SIGNAL(data(QByteArray)), - SLOT(slotData(QByteArray))); + QObject::connect(slave, &Slave::data, q, + &TransferJob::slotData); if (m_outgoingDataSource) { if (m_extraFlags & JobPrivate::EF_TransferJobAsync) { - q->connect(m_outgoingDataSource, SIGNAL(readyRead()), - SLOT(slotDataReqFromDevice())); - q->connect(m_outgoingDataSource, SIGNAL(readChannelFinished()), - SLOT(slotIODeviceClosed())); // We don't really need to disconnect since we're never checking // m_closedBeforeStart again but it's the proper thing to do logically - QObject::disconnect(m_outgoingDataSource, SIGNAL(readChannelFinished()), - q, SLOT(slotIODeviceClosedBeforeStart())); + QObject::disconnect(m_ongoingConn); + QObject::connect(m_outgoingDataSource, &QAbstractSocket::readyRead, q, + [this](){slotDataReqFromDevice();}); + QObject::connect(m_outgoingDataSource, &QAbstractSocket::readChannelFinished, q, + [this](){slotIODeviceClosed();}); if (m_closedBeforeStart) { QMetaObject::invokeMethod(q, "slotIODeviceClosed", Qt::QueuedConnection); } else if (m_outgoingDataSource->bytesAvailable() > 0) { QMetaObject::invokeMethod(q, "slotDataReqFromDevice", Qt::QueuedConnection); } } else { - q->connect(slave, SIGNAL(dataReq()), - SLOT(slotDataReqFromDevice())); + QObject::connect(slave, &Slave::dataReq, q, + [this](){slotDataReqFromDevice();}); } - } else - q->connect(slave, SIGNAL(dataReq()), - SLOT(slotDataReq())); + } else { + QObject::connect(slave, &Slave::dataReq, q, + &TransferJob::slotDataReq); + } - q->connect(slave, SIGNAL(redirection(QUrl)), - SLOT(slotRedirection(QUrl))); + QObject::connect(slave, &Slave::redirection, q, + &TransferJob::slotRedirection); - q->connect(slave, SIGNAL(mimeType(QString)), - SLOT(slotMimetype(QString))); + QObject::connect(slave, &Slave::mimeType, q, + &TransferJob::slotMimetype); - q->connect(slave, SIGNAL(errorPage()), - SLOT(slotErrorPage())); + QObject::connect(slave, &Slave::errorPage, q, + [this](){slotErrorPage();}); - q->connect(slave, SIGNAL(needSubUrlData()), - SLOT(slotNeedSubUrlData())); + QObject::connect(slave, &Slave::needSubUrlData, q, + [this](){slotNeedSubUrlData();}); - q->connect(slave, SIGNAL(canResume(KIO::filesize_t)), - SLOT(slotCanResume(KIO::filesize_t))); + QObject::connect(slave, &Slave::canResume, q, + [this](const KIO::filesize_t size){slotCanResume(size);}); if (slave->suspended()) { m_mimetype = QStringLiteral("unknown");