summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.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/qplacemanagerengine_nokiav2.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/qplacemanagerengine_nokiav2.cpp')
-rw-r--r--src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp92
1 files changed, 40 insertions, 52 deletions
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
index c0b265d2..5543d001 100644
--- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
+++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
@@ -261,75 +261,63 @@ QPlaceDetailsReply *QPlaceManagerEngineNokiaV2::getPlaceDetails(const QString &p
return reply;
}
-QPlaceContentReply *QPlaceManagerEngineNokiaV2::getPlaceContent(const QString &placeId,
- const QPlaceContentRequest &request)
+QPlaceContentReply *QPlaceManagerEngineNokiaV2::getPlaceContent(const QPlaceContentRequest &request)
{
- QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
- QLatin1String("/places/v1/places/") + placeId + QLatin1String("/media/"));
-
QNetworkReply *networkReply = 0;
- QUrlQuery queryItems;
+ if (request.contentContext().userType() == qMetaTypeId<QUrl>()) {
+ QUrl u = request.contentContext().value<QUrl>();
- switch (request.contentType()) {
- case QPlaceContent::ImageType:
- requestUrl.setPath(requestUrl.path() + QLatin1String("images"));
+ networkReply = sendRequest(u);
+ } else {
+ QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
+ QLatin1String("/places/v1/places/") + request.placeId() +
+ QLatin1String("/media/"));
- queryItems.addQueryItem(QLatin1String("tf"), QLatin1String("html"));
+ QUrlQuery queryItems;
- if (request.limit() > 0) {
- queryItems.addQueryItem(QLatin1String("size"),
- QString::number(request.limit()));
- }
- if (request.offset() > -1) {
- queryItems.addQueryItem(QLatin1String("offset"),
- QString::number(request.offset()));
- }
+ switch (request.contentType()) {
+ case QPlaceContent::ImageType:
+ requestUrl.setPath(requestUrl.path() + QLatin1String("images"));
- //queryItems.append(qMakePair<QString, QString>(QLatin1String("image_dimensions"), QLatin1String("w64-h64,w100")));
+ queryItems.addQueryItem(QLatin1String("tf"), QLatin1String("html"));
- requestUrl.setQuery(queryItems);
+ if (request.limit() > 0)
+ queryItems.addQueryItem(QLatin1String("size"), QString::number(request.limit()));
- networkReply = sendRequest(requestUrl);
- break;
- case QPlaceContent::ReviewType:
- requestUrl.setPath(requestUrl.path() + QLatin1String("reviews"));
+ //queryItems.append(qMakePair<QString, QString>(QLatin1String("image_dimensions"), QLatin1String("w64-h64,w100")));
- queryItems.addQueryItem(QLatin1String("tf"), QLatin1String("html"));
+ requestUrl.setQuery(queryItems);
- if (request.limit() > 0) {
- queryItems.addQueryItem(QLatin1String("size"),
- QString::number(request.limit()));
- }
- if (request.offset() > -1) {
- queryItems.addQueryItem(QLatin1String("offset"),
- QString::number(request.offset()));
- }
+ networkReply = sendRequest(requestUrl);
+ break;
+ case QPlaceContent::ReviewType:
+ requestUrl.setPath(requestUrl.path() + QLatin1String("reviews"));
- requestUrl.setQuery(queryItems);
+ queryItems.addQueryItem(QLatin1String("tf"), QLatin1String("html"));
- networkReply = sendRequest(requestUrl);
- break;
- case QPlaceContent::EditorialType:
- requestUrl.setPath(requestUrl.path() + QLatin1String("editorials"));
+ if (request.limit() > 0)
+ queryItems.addQueryItem(QLatin1String("size"), QString::number(request.limit()));
- queryItems.addQueryItem(QLatin1String("tf"), QLatin1String("html"));
+ requestUrl.setQuery(queryItems);
- if (request.limit() > 0) {
- queryItems.addQueryItem(QLatin1String("size"),
- QString::number(request.limit()));
- }
- if (request.offset() > -1) {
- queryItems.addQueryItem(QLatin1String("offset"),
- QString::number(request.offset()));
- }
+ networkReply = sendRequest(requestUrl);
+ break;
+ case QPlaceContent::EditorialType:
+ requestUrl.setPath(requestUrl.path() + QLatin1String("editorials"));
- requestUrl.setQuery(queryItems);
+ queryItems.addQueryItem(QLatin1String("tf"), QLatin1String("html"));
- networkReply = sendRequest(requestUrl);
- break;
- case QPlaceContent::NoType:
- ;
+ if (request.limit() > 0)
+ queryItems.addQueryItem(QLatin1String("size"), QString::number(request.limit()));
+
+ requestUrl.setQuery(queryItems);
+
+ networkReply = sendRequest(requestUrl);
+ break;
+ case QPlaceContent::NoType:
+ ;
+ }
}
QPlaceContentReply *reply = new QPlaceContentReplyImpl(request, networkReply, this);