summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@jollamobile.com>2014-01-20 10:57:08 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 01:47:34 +0100
commit0b36e73112b099090f5dcbbc21d172dcc7c97f30 (patch)
tree92779dfa9e00b8933e53dd0aafebf6947fbf5905 /src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp
parentbdcc97c444fadc566b4476f5f91b02bd8be21ec3 (diff)
downloadqtlocation-0b36e73112b099090f5dcbbc21d172dcc7c97f30.tar.gz
Remove offset attribute from place content requests.
This complements 1d0966c6924876655c52725e779a7aa24866ff60 Not all service providers support arbitrary offsets when requesting place content. The offset attribute has been removed, instead service providers can supply a previous and next content request query in the form of a QPlaceContentRequest. Change-Id: I6239b42c31bed5dcd6645d86d5a48d7e6a667f46 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp')
-rw-r--r--src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp
index e47bd4d5..1b5a1776 100644
--- a/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp
+++ b/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp
@@ -94,22 +94,29 @@ void QPlaceContentReplyImpl::setError(QPlaceReply::Error error_, const QString &
void QPlaceContentReplyImpl::replyFinished()
{
- QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll());
- if (!document.isObject()) {
- setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR));
- return;
+ if (m_reply->isOpen()) {
+ QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll());
+ if (!document.isObject()) {
+ setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR));
+ return;
+ }
+
+ QJsonObject object = document.object();
+
+ QPlaceContent::Collection collection;
+ int totalCount;
+ QPlaceContentRequest previous;
+ QPlaceContentRequest next;
+
+ parseCollection(request().contentType(), object, &collection, &totalCount,
+ &previous, &next, m_engine);
+
+ setTotalCount(totalCount);
+ setContent(collection);
+ setPreviousPageRequest(previous);
+ setNextPageRequest(next);
}
- QJsonObject object = document.object();
-
- QPlaceContent::Collection collection;
- int totalCount;
-
- parseCollection(request().contentType(), object, &collection, &totalCount, m_engine);
-
- setTotalCount(totalCount);
- setContent(collection);
-
m_reply->deleteLater();
m_reply = 0;