QNetworkReplyWrapper::QNetworkReplyWrapper(QNetworkReplyHandlerCallQueue* queue, QNetworkReply* reply, bool sniffMIMETypes, QObject* parent) : QObject(parent) , m_reply(reply) , m_queue(queue) , m_responseContainsData(false) , m_sniffMIMETypes(sniffMIMETypes) { Q_ASSERT(m_reply); // setFinished() must be the first that we connect, so isFinished() is updated when running other slots. connect(m_reply, SIGNAL(finished()), this, SLOT(setFinished())); connect(m_reply, SIGNAL(finished()), this, SLOT(receiveMetaData())); connect(m_reply, SIGNAL(readyRead()), this, SLOT(receiveMetaData())); }
void QNetworkReplyWrapper::stopForwarding() { if (m_reply) { // Disconnect all connections that might affect the ResourceHandleClient. m_reply->disconnect(this, SLOT(receiveMetaData())); m_reply->disconnect(this, SLOT(didReceiveFinished())); m_reply->disconnect(this, SLOT(didReceiveReadyRead())); } QCoreApplication::removePostedEvents(this, QEvent::MetaCall); }
void QNetworkReplyWrapper::resetConnections() { if (m_reply) { // Disconnect all connections except the one to setFinished() slot. m_reply->disconnect(this, SLOT(receiveMetaData())); m_reply->disconnect(this, SLOT(didReceiveFinished())); m_reply->disconnect(this, SLOT(didReceiveReadyRead())); } QCoreApplication::removePostedEvents(this, QEvent::MetaCall); }
void QNetworkReplyWrapper::synchronousLoad() { setFinished(); receiveMetaData(); }