summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Gressmann <jean.gressmann@nokia.com>2012-03-16 15:16:04 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-19 11:05:27 +0100
commit0d9306d72b2d21542d0b128f53095ebf9b6748f4 (patch)
treef97aab100ee8caf4302a465c3633c96a6c6e36a0
parent44066a6bdee6a6f592ae1a881f813aceb7b52961 (diff)
downloadqtlocation-0d9306d72b2d21542d0b128f53095ebf9b6748f4.tar.gz
The Nokia plugin now handles cases where no route can be found.
Change-Id: I5908170d63e9eb63b4dfd72268fa6b82d468bf82 Reviewed-by: Cristian Adam <cristian.adam@nokia.com> Reviewed-by: Alex <alex.blasche@nokia.com>
-rw-r--r--src/plugins/geoservices/nokia/qgeoroutereply_nokia.cpp14
-rw-r--r--src/plugins/geoservices/nokia/qgeoroutexmlparser.cpp7
2 files changed, 20 insertions, 1 deletions
diff --git a/src/plugins/geoservices/nokia/qgeoroutereply_nokia.cpp b/src/plugins/geoservices/nokia/qgeoroutereply_nokia.cpp
index a0db40dd..a41d7016 100644
--- a/src/plugins/geoservices/nokia/qgeoroutereply_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeoroutereply_nokia.cpp
@@ -117,7 +117,19 @@ void QGeoRouteReplyNokia::networkError(QNetworkReply::NetworkError error)
if (!m_reply)
return;
- setError(QGeoRouteReply::CommunicationError, m_reply->errorString());
+ bool resolvedError = false;
+
+ if (QNetworkReply::UnknownContentError == error) {
+ QGeoRouteXmlParser parser(request());
+ if (parser.parse(m_reply)) {
+ setRoutes(parser.results());
+ setFinished(true);
+ resolvedError = true;
+ }
+ }
+
+ if (!resolvedError)
+ setError(QGeoRouteReply::CommunicationError, m_reply->errorString());
m_reply->deleteLater();
m_reply = 0;
diff --git a/src/plugins/geoservices/nokia/qgeoroutexmlparser.cpp b/src/plugins/geoservices/nokia/qgeoroutexmlparser.cpp
index ca5967ff..223fa733 100644
--- a/src/plugins/geoservices/nokia/qgeoroutexmlparser.cpp
+++ b/src/plugins/geoservices/nokia/qgeoroutexmlparser.cpp
@@ -100,6 +100,13 @@ bool QGeoRouteXmlParser::parseRootElement()
return false;
}
+ if (m_reader->name() == QLatin1String("Error")) {
+ QXmlStreamAttributes attributes = m_reader->attributes();
+ if (attributes.value(QLatin1String("type")) == QLatin1String("ApplicationError")
+ && attributes.value("subtype") == QLatin1String("NoRouteFound"))
+ return true;
+ }
+
bool updateroute = false;
if (m_reader->name() != "CalculateRoute" && m_reader->name() != "GetRoute") {
m_reader->raiseError(QString("The root element is expected to have the name \"CalculateRoute\" or \"GetRoute\" (root element was named \"%1\").").arg(m_reader->name().toString()));