From f8df5799b68fcb8690462b6dce226e6ce9bac282 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Fri, 22 Dec 2017 18:17:19 +0100 Subject: Enable incremental updates in PlaceSearchModel This way pages can be changed without resetting the model. To achieve this, new members into QPlaceSearchRequestPrivate are introduced, to keep the relationship between a request for one page, and the previous or the next page. In this way sparse population of the model becomes possible. Change-Id: Ic8db0281408f3500ba83f78c7e152ee0b68cd099 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../geoservices/nokia/placesv2/qplacesearchreplyhere.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/plugins/geoservices/nokia/placesv2') diff --git a/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyhere.cpp b/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyhere.cpp index 9808b539..28aa930f 100644 --- a/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyhere.cpp +++ b/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyhere.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include @@ -113,15 +114,24 @@ void QPlaceSearchReplyHere::replyFinished() results.append(parseSearchResult(item)); } + QPlaceSearchRequest r_orig = request(); + QPlaceSearchRequestPrivate *rpimpl_orig = QPlaceSearchRequestPrivate::get(r_orig); + if (resultsObject.contains(QStringLiteral("next"))) { QPlaceSearchRequest request; request.setSearchContext(QUrl(resultsObject.value(QStringLiteral("next")).toString())); + QPlaceSearchRequestPrivate *rpimpl = QPlaceSearchRequestPrivate::get(request); + rpimpl->related = true; + rpimpl->page = rpimpl_orig->page + 1; setNextPageRequest(request); } if (resultsObject.contains(QStringLiteral("previous"))) { QPlaceSearchRequest request; request.setSearchContext(QUrl(resultsObject.value(QStringLiteral("previous")).toString())); + QPlaceSearchRequestPrivate *rpimpl = QPlaceSearchRequestPrivate::get(request); + rpimpl->related = true; + rpimpl->page = rpimpl_orig->page - 1; setPreviousPageRequest(request); } -- cgit v1.2.1