Revert "QNetworkReply: deprecate the 'error' getter"
This reverts commitccb2cb84f5
and commit0f568d0a67
. The patches fix ambiguity between a getter and a signal by changing the getter name, but we still have to rename the signal to follow the signals naming convention. Revert the commits to keep the getter as is and change the signal name instead. Change-Id: Iddbab7c33eea03826ae7c114a01857ed45bde6db Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
c2a13ae501
commit
4c86e667d2
@ -144,7 +144,7 @@ public:
|
||||
private slots:
|
||||
|
||||
void handleNetworkData(QNetworkReply *networkReply) {
|
||||
if (!networkReply->networkError()) {
|
||||
if (!networkReply->error()) {
|
||||
if (!mapReplies.contains(networkReply)) {
|
||||
// Assume UTF-8 encoded
|
||||
QByteArray data = networkReply->readAll();
|
||||
|
@ -162,7 +162,7 @@ void SlippyMap::handleNetworkData(QNetworkReply *reply)
|
||||
{
|
||||
QImage img;
|
||||
QPoint tp = reply->request().attribute(QNetworkRequest::User).toPoint();
|
||||
if (!reply->networkError())
|
||||
if (!reply->error())
|
||||
if (!img.load(reply, 0))
|
||||
img = QImage();
|
||||
reply->deleteLater();
|
||||
|
@ -175,7 +175,7 @@ void DownloadManager::sslErrors(const QList<QSslError> &sslErrors)
|
||||
void DownloadManager::downloadFinished(QNetworkReply *reply)
|
||||
{
|
||||
QUrl url = reply->url();
|
||||
if (reply->networkError()) {
|
||||
if (reply->error()) {
|
||||
fprintf(stderr, "Download of %s failed: %s\n",
|
||||
url.toEncoded().constData(),
|
||||
qPrintable(reply->errorString()));
|
||||
|
@ -162,7 +162,7 @@ void DownloadManager::downloadFinished()
|
||||
progressBar.clear();
|
||||
output.close();
|
||||
|
||||
if (currentDownload->networkError()) {
|
||||
if (currentDownload->error()) {
|
||||
// download failed
|
||||
fprintf(stderr, "Failed: %s\n", qPrintable(currentDownload->errorString()));
|
||||
output.remove();
|
||||
|
@ -209,7 +209,7 @@ void GSuggestCompletion::preventSuggest()
|
||||
void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply)
|
||||
{
|
||||
QUrl url = networkReply->url();
|
||||
if (networkReply->networkError() == QNetworkReply::NoError) {
|
||||
if (networkReply->error() == QNetworkReply::NoError) {
|
||||
QVector<QString> choices;
|
||||
|
||||
QByteArray response(networkReply->readAll());
|
||||
|
@ -249,7 +249,7 @@ void HttpWindow::httpFinished()
|
||||
return;
|
||||
}
|
||||
|
||||
if (reply->networkError()) {
|
||||
if (reply->error()) {
|
||||
QFile::remove(fi.absoluteFilePath());
|
||||
statusLabel->setText(tr("Download failed:\n%1.").arg(reply->errorString()));
|
||||
downloadButton->setEnabled(true);
|
||||
|
@ -165,8 +165,8 @@ void TrackerClient::httpRequestDone(QNetworkReply *reply)
|
||||
return;
|
||||
}
|
||||
|
||||
if (reply->networkError() != QNetworkReply::NoError) {
|
||||
emit connectionError(reply->networkError());
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
emit connectionError(reply->error());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -554,32 +554,13 @@ QNetworkAccessManager::Operation QNetworkReply::operation() const
|
||||
return d_func()->operation;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\deprecated
|
||||
|
||||
Use networkError() instead.
|
||||
|
||||
Returns the error that was found during the processing of this
|
||||
request. If no error was found, returns NoError.
|
||||
|
||||
\sa setError(), networkError()
|
||||
*/
|
||||
QNetworkReply::NetworkError QNetworkReply::error() const
|
||||
{
|
||||
return networkError();
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Returns the error that was found during the processing of this
|
||||
request. If no error was found, returns NoError.
|
||||
|
||||
\sa setError()
|
||||
*/
|
||||
QNetworkReply::NetworkError QNetworkReply::networkError() const
|
||||
QNetworkReply::NetworkError QNetworkReply::error() const
|
||||
{
|
||||
return d_func()->errorCode;
|
||||
}
|
||||
@ -877,7 +858,7 @@ void QNetworkReply::setRequest(const QNetworkRequest &request)
|
||||
Calling setError() does not emit the error(QNetworkReply::NetworkError)
|
||||
signal.
|
||||
|
||||
\sa error(), errorString(), networkError()
|
||||
\sa error(), errorString()
|
||||
*/
|
||||
void QNetworkReply::setError(NetworkError errorCode, const QString &errorString)
|
||||
{
|
||||
|
@ -124,12 +124,7 @@ public:
|
||||
QNetworkAccessManager *manager() const;
|
||||
QNetworkAccessManager::Operation operation() const;
|
||||
QNetworkRequest request() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use networkError()") NetworkError error() const;
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
NetworkError networkError() const;
|
||||
|
||||
NetworkError error() const;
|
||||
bool isFinished() const;
|
||||
bool isRunning() const;
|
||||
QUrl url() const;
|
||||
|
@ -279,7 +279,7 @@ void tst_Http2::singleRequest()
|
||||
QVERIFY(prefaceOK);
|
||||
QVERIFY(serverGotSettingsACK);
|
||||
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
}
|
||||
|
||||
@ -444,7 +444,7 @@ void tst_Http2::pushPromise()
|
||||
QVERIFY(prefaceOK);
|
||||
QVERIFY(serverGotSettingsACK);
|
||||
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
|
||||
// Now, the most interesting part!
|
||||
@ -466,7 +466,7 @@ void tst_Http2::pushPromise()
|
||||
QCOMPARE(nSentRequests, 0);
|
||||
// Decreased by replyFinished():
|
||||
QCOMPARE(nRequests, 0);
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
}
|
||||
|
||||
@ -511,7 +511,7 @@ void tst_Http2::goaway()
|
||||
QNetworkRequest request(url);
|
||||
request.setAttribute(QNetworkRequest::Http2AllowedAttribute, QVariant(true));
|
||||
replies[i] = manager->get(request);
|
||||
QCOMPARE(replies[i]->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(replies[i]->error(), QNetworkReply::NoError);
|
||||
void (QNetworkReply::*errorSignal)(QNetworkReply::NetworkError) =
|
||||
&QNetworkReply::error;
|
||||
connect(replies[i], errorSignal, this, &tst_Http2::replyFinishedWithError);
|
||||
@ -671,7 +671,7 @@ void tst_Http2::connectToHost()
|
||||
connect(reply, &QNetworkReply::finished, [this, reply]() {
|
||||
--nRequests;
|
||||
eventLoop.exitLoop();
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
// Nothing received back:
|
||||
QVERIFY(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull());
|
||||
@ -698,7 +698,7 @@ void tst_Http2::connectToHost()
|
||||
QVERIFY(prefaceOK);
|
||||
QVERIFY(serverGotSettingsACK);
|
||||
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
}
|
||||
|
||||
@ -927,10 +927,10 @@ void tst_Http2::replyFinished()
|
||||
QVERIFY(nRequests);
|
||||
|
||||
if (const auto reply = qobject_cast<QNetworkReply *>(sender())) {
|
||||
if (reply->networkError() != QNetworkReply::NoError)
|
||||
if (reply->error() != QNetworkReply::NoError)
|
||||
stopEventLoop();
|
||||
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
|
||||
const QVariant http2Used(reply->attribute(QNetworkRequest::Http2WasUsedAttribute));
|
||||
if (!http2Used.isValid() || !http2Used.toBool())
|
||||
@ -967,9 +967,9 @@ void tst_Http2::replyFinishedWithError()
|
||||
if (const auto reply = qobject_cast<QNetworkReply *>(sender())) {
|
||||
// For now this is a 'generic' code, it just verifies some error was
|
||||
// reported without testing its type.
|
||||
if (reply->networkError() == QNetworkReply::NoError)
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
stopEventLoop();
|
||||
QVERIFY(reply->networkError() != QNetworkReply::NoError);
|
||||
QVERIFY(reply->error() != QNetworkReply::NoError);
|
||||
}
|
||||
|
||||
--nRequests;
|
||||
|
@ -322,10 +322,10 @@ void tst_QAbstractNetworkCache::runTest()
|
||||
|
||||
QByteArray secondData = reply2->readAll();
|
||||
if (!fetchFromCache && cacheLoadControl == QNetworkRequest::AlwaysCache) {
|
||||
QCOMPARE(reply2->networkError(), QNetworkReply::ContentNotFoundError);
|
||||
QCOMPARE(reply2->error(), QNetworkReply::ContentNotFoundError);
|
||||
QCOMPARE(secondData, QByteArray());
|
||||
} else {
|
||||
QCOMPARE(reply2->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply2->error(), QNetworkReply::NoError);
|
||||
QCOMPARE(QString(secondData), QString(goodData));
|
||||
QCOMPARE(secondData, goodData);
|
||||
QCOMPARE(reply2->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
|
||||
@ -375,12 +375,12 @@ void tst_QAbstractNetworkCache::checkSynchronous()
|
||||
|
||||
QByteArray secondData = reply2->readAll();
|
||||
if (!fetchFromCache && cacheLoadControl == QNetworkRequest::AlwaysCache) {
|
||||
QCOMPARE(reply2->networkError(), QNetworkReply::ContentNotFoundError);
|
||||
QCOMPARE(reply2->error(), QNetworkReply::ContentNotFoundError);
|
||||
QCOMPARE(secondData, QByteArray());
|
||||
} else {
|
||||
if (reply2->networkError() != QNetworkReply::NoError)
|
||||
if (reply2->error() != QNetworkReply::NoError)
|
||||
qDebug() << reply2->errorString();
|
||||
QCOMPARE(reply2->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply2->error(), QNetworkReply::NoError);
|
||||
QCOMPARE(QString(secondData), QString(goodData));
|
||||
QCOMPARE(secondData, goodData);
|
||||
QCOMPARE(reply2->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -275,7 +275,7 @@ void tst_Spdy::download()
|
||||
|
||||
QVERIFY(proxyAuthRequiredSpy.count() <= 1);
|
||||
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), true);
|
||||
QCOMPARE(reply->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool(), true);
|
||||
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
|
||||
@ -508,7 +508,7 @@ void tst_Spdy::upload()
|
||||
QVERIFY(uploadProgressSpy.count() > 0);
|
||||
QVERIFY(readyReadSpy.count() > 0);
|
||||
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), true);
|
||||
QCOMPARE(reply->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool(), true);
|
||||
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
|
||||
@ -591,7 +591,7 @@ void tst_Spdy::errors()
|
||||
QCOMPARE(finishedSpy.count(), 1);
|
||||
QCOMPARE(errorSpy.count(), 1);
|
||||
|
||||
QCOMPARE(reply->networkError(), static_cast<QNetworkReply::NetworkError>(expectedReplyError));
|
||||
QCOMPARE(reply->error(), static_cast<QNetworkReply::NetworkError>(expectedReplyError));
|
||||
|
||||
m_manager.setProxy(QNetworkProxy()); // reset
|
||||
m_manager.clearAccessCache(); // e.g. to get an SSL error we need a new connection
|
||||
@ -666,7 +666,7 @@ void tst_Spdy::multipleRequests()
|
||||
QByteArray(QSslConfiguration::NextProtocolSpdy3_0));
|
||||
#endif // QT_NO_OPENSSL
|
||||
|
||||
QCOMPARE(replies.at(a)->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(replies.at(a)->error(), QNetworkReply::NoError);
|
||||
QCOMPARE(replies.at(a)->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), true);
|
||||
QCOMPARE(replies.at(a)->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool(), true);
|
||||
QCOMPARE(replies.at(a)->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
|
||||
|
@ -149,7 +149,7 @@ public slots:
|
||||
|
||||
void requestFinished(QNetworkReply *reply)
|
||||
{
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ void tst_qnetworkreply::echoPerformance()
|
||||
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
|
||||
QTestEventLoop::instance().enterLoop(5);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
QVERIFY(reply->networkError() == QNetworkReply::NoError);
|
||||
QVERIFY(reply->error() == QNetworkReply::NoError);
|
||||
delete reply;
|
||||
}
|
||||
}
|
||||
@ -567,7 +567,7 @@ void tst_qnetworkreply::preConnectEncrypted()
|
||||
QPair<QNetworkReply *, qint64> normalResult = runGetRequest(&manager, request);
|
||||
QNetworkReply *normalReply = normalResult.first;
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
QVERIFY(normalReply->networkError() == QNetworkReply::NoError);
|
||||
QVERIFY(normalReply->error() == QNetworkReply::NoError);
|
||||
qint64 normalElapsed = normalResult.second;
|
||||
|
||||
// clear all caches again
|
||||
@ -591,7 +591,7 @@ void tst_qnetworkreply::preConnectEncrypted()
|
||||
QPair<QNetworkReply *, qint64> preConnectResult = runGetRequest(&manager, request);
|
||||
QNetworkReply *preConnectReply = normalResult.first;
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
QVERIFY(preConnectReply->networkError() == QNetworkReply::NoError);
|
||||
QVERIFY(preConnectReply->error() == QNetworkReply::NoError);
|
||||
bool spdyWasUsed = preConnectReply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool();
|
||||
QCOMPARE(spdyEnabled, spdyWasUsed);
|
||||
qint64 preConnectElapsed = preConnectResult.second;
|
||||
@ -664,7 +664,7 @@ void tst_qnetworkreply::uploadPerformance()
|
||||
QTimer::singleShot(5000, &generator, SLOT(stop()));
|
||||
|
||||
QTestEventLoop::instance().enterLoop(30);
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
}
|
||||
|
||||
@ -690,7 +690,7 @@ void tst_qnetworkreply::httpUploadPerformance()
|
||||
reader.exit();
|
||||
reader.wait();
|
||||
QVERIFY(reply->isFinished());
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
|
||||
qDebug() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, "
|
||||
@ -751,7 +751,7 @@ void tst_qnetworkreply::httpDownloadPerformance()
|
||||
QTime time;
|
||||
time.start();
|
||||
QTestEventLoop::instance().enterLoop(40);
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
|
||||
qint64 elapsed = time.elapsed();
|
||||
@ -833,7 +833,7 @@ void tst_qnetworkreply::httpDownloadPerformanceDownloadBuffer()
|
||||
|
||||
QBENCHMARK_ONCE {
|
||||
QTestEventLoop::instance().enterLoop(40);
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
}
|
||||
@ -868,7 +868,7 @@ public slots:
|
||||
}
|
||||
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
|
||||
if (reply) {
|
||||
QVERIFY(reply->networkError() == QNetworkReply::NoError);
|
||||
QVERIFY(reply->error() == QNetworkReply::NoError);
|
||||
qDebug() << "time =" << timeOneRequest.elapsed() << "ms";
|
||||
timeList.append(timeOneRequest.elapsed());
|
||||
}
|
||||
@ -923,7 +923,7 @@ void tst_qnetworkreply::runHttpsUploadRequest(const QByteArray &data, const QNet
|
||||
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
QTestEventLoop::instance().enterLoop(15);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
@ -963,7 +963,7 @@ void tst_qnetworkreply::preConnect()
|
||||
QPair<QNetworkReply *, qint64> normalResult = runGetRequest(&manager, request);
|
||||
QNetworkReply *normalReply = normalResult.first;
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
QVERIFY(normalReply->networkError() == QNetworkReply::NoError);
|
||||
QVERIFY(normalReply->error() == QNetworkReply::NoError);
|
||||
qint64 normalElapsed = normalResult.second;
|
||||
|
||||
// clear all caches again
|
||||
@ -983,7 +983,7 @@ void tst_qnetworkreply::preConnect()
|
||||
QPair<QNetworkReply *, qint64> preConnectResult = runGetRequest(&manager, request);
|
||||
QNetworkReply *preConnectReply = normalResult.first;
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
QVERIFY(preConnectReply->networkError() == QNetworkReply::NoError);
|
||||
QVERIFY(preConnectReply->error() == QNetworkReply::NoError);
|
||||
qint64 preConnectElapsed = preConnectResult.second;
|
||||
qDebug() << request.url().toString() << "full request:" << normalElapsed
|
||||
<< "ms, pre-connect request:" << preConnectElapsed << "ms, difference:"
|
||||
|
Loading…
Reference in New Issue
Block a user