summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-12-22 18:17:19 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-07-05 06:09:56 +0000
commitf8df5799b68fcb8690462b6dce226e6ce9bac282 (patch)
treec88fbdc8b4bd28662cfe3c14d665c4744fc29057 /src/plugins/geoservices
parent5ccc595db4e9282f6a58f8712550eda935a6eecb (diff)
downloadqtlocation-f8df5799b68fcb8690462b6dce226e6ce9bac282.tar.gz
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 <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/plugins/geoservices')
-rw-r--r--src/plugins/geoservices/nokia/placesv2/qplacesearchreplyhere.cpp10
-rw-r--r--src/plugins/geoservices/osm/qplacemanagerengineosm.cpp2
-rw-r--r--src/plugins/geoservices/osm/qplacesearchreplyosm.cpp7
3 files changed, 18 insertions, 1 deletions
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 <QtLocation/QPlaceIcon>
#include <QtLocation/QPlaceResult>
#include <QtLocation/QPlaceProposedSearchResult>
+#include <QtLocation/private/qplacesearchrequest_p.h>
#include <QtCore/QDebug>
@@ -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);
}
diff --git a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp
index 3c201e41..be66414f 100644
--- a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp
+++ b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp
@@ -191,7 +191,7 @@ QPlaceSearchReply *QPlaceManagerEngineOsm::search(const QPlaceSearchRequest &req
this, SLOT(replyError(QPlaceReply::Error,QString)));
if (m_debugQuery)
- reply->requestUrl = requestUrl.toString();
+ reply->requestUrl = requestUrl.url(QUrl::None);
return reply;
}
diff --git a/src/plugins/geoservices/osm/qplacesearchreplyosm.cpp b/src/plugins/geoservices/osm/qplacesearchreplyosm.cpp
index 0228a975..80c50d1b 100644
--- a/src/plugins/geoservices/osm/qplacesearchreplyosm.cpp
+++ b/src/plugins/geoservices/osm/qplacesearchreplyosm.cpp
@@ -48,6 +48,7 @@
#include <QtPositioning/QGeoRectangle>
#include <QtLocation/QPlaceResult>
#include <QtLocation/QPlaceSearchRequest>
+#include <QtLocation/private/qplacesearchrequest_p.h>
QT_BEGIN_NAMESPACE
@@ -135,6 +136,9 @@ void QPlaceSearchReplyOsm::replyFinished()
parameters.insert(QStringLiteral("ExcludePlaceIds"), epi);
r.setSearchContext(parameters);
+ QPlaceSearchRequestPrivate *rpimpl = QPlaceSearchRequestPrivate::get(r);
+ rpimpl->related = true;
+ rpimpl->page--;
setPreviousPageRequest(r);
}
@@ -147,6 +151,9 @@ void QPlaceSearchReplyOsm::replyFinished()
parameters.insert(QStringLiteral("ExcludePlaceIds"), epi);
r.setSearchContext(parameters);
+ QPlaceSearchRequestPrivate *rpimpl = QPlaceSearchRequestPrivate::get(r);
+ rpimpl->related = true;
+ rpimpl->page++;
setNextPageRequest(r);
}