summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabcd <amos.choy@nokia.com>2012-06-18 17:45:59 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-21 07:42:36 +0200
commit9e6adfbec01e164793cbd08684524547f31972e1 (patch)
tree966dc3903b4b548e3f7c1245e3aea36056a136aa
parent7343a401cd740a65d430fba4fa01abd7c601f4ef (diff)
downloadqtlocation-9e6adfbec01e164793cbd08684524547f31972e1.tar.gz
Refactor recommendations
Recommendations can be incorporated into ordinary searches. this is more convenient for the developer. Change-Id: Ifd3e040b6b7a964227981175b074ca4f52d7579c Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
-rw-r--r--doc/src/examples/declarative-places.qdoc22
-rw-r--r--doc/src/places.qdoc17
-rw-r--r--doc/src/plugins/nokia.qdoc2
-rw-r--r--doc/src/snippets/declarative/places.qml17
-rw-r--r--doc/src/snippets/places/requesthandler.h30
-rw-r--r--examples/declarative/places/content/places/SearchResultView.qml24
-rw-r--r--examples/declarative/places/places.qml28
-rw-r--r--src/imports/location/declarativeplaces/declarativeplaces.pri4
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativerecommendationmodel.cpp329
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativerecommendationmodel_p.h76
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeresultmodelbase.cpp310
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeresultmodelbase_p.h109
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp252
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h50
-rw-r--r--src/imports/location/location.cpp2
-rw-r--r--src/imports/location/plugins.qmltypes41
-rw-r--r--src/location/places/qplacemanager.cpp11
-rw-r--r--src/location/places/qplacemanager.h2
-rw-r--r--src/location/places/qplacemanagerengine.cpp14
-rw-r--r--src/location/places/qplacemanagerengine.h2
-rw-r--r--src/location/places/qplacesearchrequest.cpp33
-rw-r--r--src/location/places/qplacesearchrequest.h3
-rw-r--r--src/plugins/geoservices/nokia/placesv2/placesv2.pri2
-rw-r--r--src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.cpp180
-rw-r--r--src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.h82
-rw-r--r--src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp15
-rw-r--r--src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.h3
-rw-r--r--src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp60
-rw-r--r--src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.h1
-rw-r--r--src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp9
-rw-r--r--src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h1
-rw-r--r--tests/auto/declarative_core/tst_placerecommendationmodel.qml108
-rw-r--r--tests/auto/geotestplugin/qplacemanagerengine_test.h8
-rw-r--r--tests/auto/qplacemanager_unsupported/tst_qplacemanager_unsupported.cpp8
34 files changed, 394 insertions, 1461 deletions
diff --git a/doc/src/examples/declarative-places.qdoc b/doc/src/examples/declarative-places.qdoc
index c3a3cd19..2aea92ea 100644
--- a/doc/src/examples/declarative-places.qdoc
+++ b/doc/src/examples/declarative-places.qdoc
@@ -179,28 +179,6 @@
\snippet declarative/places/content/places/SearchResultDelegate.qml PlaceSearchModel place delegate
-
- \section1 Recommending Similar Places
-
- The \l PlaceRecommendationModel is used to find similar places to a given place. The model
- should be set up similarly to the \l PlaceSearchModel. Here we use a \l GeoCircle with a
- center that is linked to the current location displayed on the \l Map. The search area may be
- different if the map is panned between when the place search and the place recommendation
- search are performed.
-
- \snippet declarative/places/places.qml PlaceRecommendationModel model
-
- The place recommendation search is performed by setting the
- \l {PlaceRecommendationModel::placeId}{placeId} property of the model and invoking the
- \l {PlaceRecommendationModel::execute()}{execute()} method. The search results are displayed
- in a \l ListView.
-
- \snippet declarative/places/content/places/SearchResultView.qml PlaceRecommendationModel place list
-
- We reuse the same delegate that was used for displaying the results of the
- \l {Searching for places}{place search}.
-
-
\section1 Displaying Place Content
Places can have additional rich content, including editorials, reviews and images. Rich
diff --git a/doc/src/places.qdoc b/doc/src/places.qdoc
index c59b0b48..0228ad4c 100644
--- a/doc/src/places.qdoc
+++ b/doc/src/places.qdoc
@@ -88,8 +88,7 @@
\section2 Learn More
The above quickstart tutorial only exhibits a subset of Places functionality.
- Refer to the \l {Places Elements} shown below for richer content such as \l {PlaceRecommendationModel} {recommendations},
- \l {ImageModel} {images}, \l {ReviewModel} {reviews} etc, as well as more indepth descriptions and explanations.
+ Refer to the \l {Places Elements} shown below for richer content such as \l {ImageModel} {images}, \l {ReviewModel} {reviews} etc, as well as more indepth descriptions and explanations.
See also the \l {Places (QML)}{QML Places Example} for a more comprehensive demonstration on how
to use the API.
@@ -144,6 +143,10 @@
which have further details that can be fetched on a place by place basis. To fetch these other details
see \l {Fetching Place Details}.
+ \section3 Recommendations
+ Recommendations can be retrieved by supplying a place id via QPlaceSearchRequest::setRecommendationId().
+ Any places similar to the given place are retrieved.
+
\section3 Paging
If the plugin supports paging, limit and offset parameters may be provided to the search request.
\snippet snippets/places/requesthandler.h Search paging
@@ -185,16 +188,6 @@
And when the request is done, we can use the reply to show the suggestions.
\snippet snippets/places/requesthandler.h Suggestion handler
- \section2 Recommendations
- Recommendations are suggestions for places that are similar to a specified place.
- The retrieval of recommendations is very similar to retrieving search term suggestions or
- performing a place search.
-
- \snippet snippets/places/requesthandler.h Recommendation
- \dots
- \dots
- \snippet snippets/places/requesthandler.h Recommendation handler
-
\target Saving a place cpp
\section2 Saving a Place
The saving of a new place is performed as follows, we create a QPlace instance
diff --git a/doc/src/plugins/nokia.qdoc b/doc/src/plugins/nokia.qdoc
index ef26e1ed..985f109c 100644
--- a/doc/src/plugins/nokia.qdoc
+++ b/doc/src/plugins/nokia.qdoc
@@ -250,7 +250,7 @@ Both search term and search center \e {must} be provided when retrieving search
\section3 Recommendations
Only a given \e {place identifier} is supported as a parameter for a recommendations. No other parameters
such as limit, offset, and search area are supported. This limitation applies when using the
-\c nokia plugin with \l PlaceRecommendationModel and QPlaceManager::recommendations().
+\c nokia plugin with \l PlaceSearchModel and QPlaceManager::search().
\section3 Icons themes, base urls and variants
Icons are provided in the form of "base urls" which reference valid icon images.
diff --git a/doc/src/snippets/declarative/places.qml b/doc/src/snippets/declarative/places.qml
index b5e568c1..2fe1648e 100644
--- a/doc/src/snippets/declarative/places.qml
+++ b/doc/src/snippets/declarative/places.qml
@@ -140,23 +140,6 @@ Item {
}
//! [PlaceSearchModel]
- //! [RecommendationModel]
- PlaceRecommendationModel {
- id: recommendationModel
-
- plugin: myPlugin
-
- placeId: place.placeId
-
- Component.onCompleted: update()
- }
-
- ListView {
- model: recommendationModel
- delegate: Text { text: 'Name: ' + place.name }
- }
- //! [RecommendationModel]
-
//! [SearchSuggestionModel]
PlaceSearchSuggestionModel {
id: suggestionModel
diff --git a/doc/src/snippets/places/requesthandler.h b/doc/src/snippets/places/requesthandler.h
index 046811ee..0c34d1db 100644
--- a/doc/src/snippets/places/requesthandler.h
+++ b/doc/src/snippets/places/requesthandler.h
@@ -142,17 +142,6 @@ public:
//! [Suggestion request]
}
- void recommendation()
- {
- //! [Recommendation]
- QPlaceSearchRequest request;
- request.setSearchArea(QGeoCircle(QGeoCoordinate(12.34, 56.78)));
-
- /* QPlaceSearchReply * */ recommendationReply = manager->recommendations(place.placeId(), request);
- connect(recommendationReply, SIGNAL(finished()), this, SLOT(handleRecommendationReply()));
- //! [Recommendation]
- }
-
void savePlace()
{
//! [Save place pt1]
@@ -400,24 +389,6 @@ public slots:
//! [Suggestion handler]
- //! [Recommendation handler]
- void handleRecommendationReply() {
- if (recommendationReply->error() == QPlaceReply::NoError) {
- foreach (const QPlaceSearchResult &result, searchReply->results()) {
- if (result.type() == QPlaceSearchResult::PlaceResult) {
- QPlaceResult placeResult = result;
- qDebug() << "Name: " << placeResult.place().name();
- qDebug() << "Coordinates" << placeResult.place().location().coordinate().toString();
- }
- }
- }
- recommendationReply->deleteLater(); //discard reply
- recommendationReply = 0;
- }
-
-
- //! [Recommendation handler]
-
//! [Save place handler]
void handleSavePlaceReply() {
if (savePlaceReply->error() == QPlaceReply::NoError)
@@ -529,7 +500,6 @@ public slots:
//! [Match places handler]
QPlaceSearchReply *searchReply;
-QPlaceSearchReply *recommendationReply;
QPlaceManager *manager;
QPlaceDetailsReply *detailsReply;
QPlaceContentReply *contentReply;
diff --git a/examples/declarative/places/content/places/SearchResultView.qml b/examples/declarative/places/content/places/SearchResultView.qml
index 874f5a98..98bb0ba8 100644
--- a/examples/declarative/places/content/places/SearchResultView.qml
+++ b/examples/declarative/places/content/places/SearchResultView.qml
@@ -78,10 +78,6 @@ Item {
target: placeSearchModel
onStatusChanged: searchView.visible = true
}
- Connections {
- target: recommendationModel
- onStatusChanged: searchView.visible = false
- }
//! [PlaceSearchModel place list]
ListView {
@@ -122,22 +118,6 @@ Item {
}
}
//! [PlaceSearchModel place list]
-
- //! [PlaceRecommendationModel place list]
- ListView {
- id: similarView
-
- anchors.fill: parent
-
- spacing: 5
-
- visible: !searchView.visible
- model: recommendationModel
- delegate: SearchResultDelegate {
- onDisplayPlaceDetails: showPlaceDetails(data)
- }
- }
- //! [PlaceRecommendationModel place list]
}
Item {
// place details (page 1)
@@ -186,9 +166,7 @@ Item {
//! [PlaceRecommendationModel search]
onSearchForSimilar: {
placeContentList.source = "";
- recommendationModel.placeId = place.placeId;
- recommendationModel.update();
- view.currentIndex = 0;
+ placeSearchModel.searchForRecommendations(place.placeId);
}
//! [PlaceRecommendationModel search]
diff --git a/examples/declarative/places/places.qml b/examples/declarative/places/places.qml
index be4ad07d..2293c984 100644
--- a/examples/declarative/places/places.qml
+++ b/examples/declarative/places/places.qml
@@ -333,10 +333,8 @@ Item {
favoritesPlugin = Qt.createQmlObject('import QtLocation 5.0; Plugin { name: "nokia_places_jsondb" }', page);
favoritesPlugin.parameters = pluginParametersFromMap(pluginParameters);
placeSearchModel.favoritesPlugin = favoritesPlugin;
- recommendationModel.favoritesPlugin = favoritesPlugin;
} else {
placeSearchModel.favoritesPlugin = null;
- recommendationModel.favoritesPlugin = null;
}
placeSearchModel.relevanceHint = orderByDistance ? PlaceSearchModel.DistanceHint :
@@ -368,6 +366,7 @@ Item {
function searchForCategory(category) {
searchTerm = "";
categories = category;
+ recommendationId = "";
limit = -1;
offset = 0;
update();
@@ -376,6 +375,16 @@ Item {
function searchForText(text) {
searchTerm = text;
categories = null;
+ recommendationId = "";
+ limit = -1;
+ offset = 0;
+ update();
+ }
+
+ function searchForRecommendations(placeId) {
+ searchTerm = "";
+ categories = null;
+ recommendationId = placeId;
limit = -1;
offset = 0;
update();
@@ -402,15 +411,6 @@ Item {
}
//! [PlaceSearchModel model]
- //! [PlaceRecommendationModel model]
- PlaceRecommendationModel {
- id: recommendationModel
- plugin: placesPlugin
-
- searchArea: searchRegion
- }
- //! [PlaceRecommendationModel model]
-
//! [CategoryModel model]
CategoryModel {
id: categoryModel
@@ -488,17 +488,17 @@ Item {
states: [
State {
name: ""
- when: placeSearchModel.count == 0 && recommendationModel.count == 0
+ when: placeSearchModel.count == 0
PropertyChanges { target: searchResultTab; open: false }
},
State {
name: "Close"
- when: (placeSearchModel.count > 0 || recommendationModel.count > 0) && !searchResultTab.open
+ when: (placeSearchModel.count > 0) && !searchResultTab.open
PropertyChanges { target: searchResultTab; opacity: 1 }
},
State {
name: "Open"
- when: (placeSearchModel.count > 0 || recommendationModel.count > 0) && searchResultTab.open
+ when: (placeSearchModel.count > 0) && searchResultTab.open
PropertyChanges { target: searchResultTab; y: mainMenu.height; opacity: 1 }
}
]
diff --git a/src/imports/location/declarativeplaces/declarativeplaces.pri b/src/imports/location/declarativeplaces/declarativeplaces.pri
index a55d8340..b580ee4b 100644
--- a/src/imports/location/declarativeplaces/declarativeplaces.pri
+++ b/src/imports/location/declarativeplaces/declarativeplaces.pri
@@ -2,8 +2,6 @@ INCLUDEPATH *= $$PWD
SOURCES += \
#models
declarativeplaces/qdeclarativeplacecontentmodel.cpp \
- declarativeplaces/qdeclarativerecommendationmodel.cpp \
- declarativeplaces/qdeclarativeresultmodelbase.cpp \
declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp \
declarativeplaces/qdeclarativesearchsuggestionmodel.cpp \
declarativeplaces/qdeclarativesearchresultmodel.cpp \
@@ -24,8 +22,6 @@ SOURCES += \
HEADERS += \
#models
declarativeplaces/qdeclarativeplacecontentmodel.h \
- declarativeplaces/qdeclarativerecommendationmodel_p.h \
- declarativeplaces/qdeclarativeresultmodelbase_p.h \
declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h \
declarativeplaces/qdeclarativesearchsuggestionmodel_p.h \
declarativeplaces/qdeclarativesearchresultmodel_p.h \
diff --git a/src/imports/location/declarativeplaces/qdeclarativerecommendationmodel.cpp b/src/imports/location/declarativeplaces/qdeclarativerecommendationmodel.cpp
deleted file mode 100644
index 60808da3..00000000
--- a/src/imports/location/declarativeplaces/qdeclarativerecommendationmodel.cpp
+++ /dev/null
@@ -1,329 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativerecommendationmodel_p.h"
-#include "qdeclarativeplace_p.h"
-
-#include <QtQml/QQmlEngine>
-#include <QtQml/QQmlInfo>
-#include <QtLocation/QGeoServiceProvider>
-#include <QtLocation/QPlaceManager>
-
-#include <QtLocation/QPlaceSearchReply>
-#include <QtLocation/QPlaceMatchRequest>
-#include <QtLocation/QPlaceMatchReply>
-
-QT_USE_NAMESPACE
-
-/*!
- \qmlclass PlaceRecommendationModel QDeclarativeRecommendationModel
- \inqmlmodule QtLocation 5.0
- \ingroup qml-QtLocation5-places
- \ingroup qml-QtLocation5-places-models
- \since Qt Location 5.0
-
- \brief The PlaceRecommendationModel element provides a model of place recommendations.
-
- PlaceRecommendationModel provides a model of place recommendation results that are
- similar to the place identified by the \l placeId property.
-
- The following roles can be used to access each recommendation result:
- \table
- \header
- \li Role
- \li Type
- \li Description
- \row
- \li title
- \li string
- \li A string describing the search result.
- \row
- \li icon
- \li PlaceIcon
- \li Icon representing the search result.
- \row
- \li distance
- \li real
- \li If a search area has been specified and is supported by the \l plugin,
- the distance is from the recommended place to the search center, otherwise the distance is
- from the recommended place to the place identified by \l placeId. If no area has been
- specified, the distance is NaN.
- \row
- \li place
- \li \l Place
- \li The recommended place.
- \endtable
-
- The following example shows how to use the PlaceRecommendationModel to search for recommendations in
- similar to a given place by providing a place identifier. Note that model does not incrementally fetch
- recommendations but rather performs a single fetch when \l execute() is run. The \l count is set to the
- number of recommendations returned during the fetch.
-
- \snippet snippets/declarative/places.qml QtQuick import
- \snippet snippets/declarative/places.qml QtLocation import
- \codeline
- \snippet snippets/declarative/places.qml RecommendationModel
-
- \sa PlaceSearchModel, CategoryModel, {QPlaceManager}
-
- \section1 Paging
- The PlaceRecommendationModel API has some limited support
- for paging. The \l offset and \l limit properties can be used to access
- paged search results. When the \l offset and \l limit properties are set
- the search results between \l offset and (\l offset + \l limit - 1) will be
- returned. For example, if the backend has 5 recommendations in total
- [a,b,c,d,e], an offset of 0 specifies that the first item returned in the
- model will be 'a'. An offset of 1 secifies that the first item in the model
- will be 'b' and so on. The limit specifies the maximum number of items to
- be returned. For example, assuming an offset of 0 and limit of 3 then a,b,c is
- returned. If the offset exceeds (or equals) the total number of items, then
- 0 results are returned in the model. Note that the API currently does not
- support a means to retrieve the total number of items available from the
- backed. Also note that support for \l offset and \l limit can vary
- according to the \l plugin.
-*/
-
-/*!
- \qmlproperty Plugin PlaceRecommendationModel::plugin
-
- This property holds the \l Plugin which will be used to perform the search.
-*/
-
-/*!
- \qmlproperty Plugin PlaceRecommendationModel::favoritesPlugin
-
- This property holds the \l Plugin which will be used to look for favorites.
- Any places from the recommendation search which can be cross-referenced or matched
- in the favoritesPlugin will have their \l {Place::favorite}{favorite} property
- set to the corresponding \l Place from the favoritesPlugin.
-
- If the favoritesPlugin is not set, the \l {Place::favorite}{favorite} property
- of the places in the results will always be null.
-
- \sa Favorites
-*/
-
-/*!
- \qmlproperty VariantMap PlaceRecommendationModel::favoritesMatchParameters
-
- This property holds a set of parameters used to specify how recommended places
- are matched to favorites in the favoritesPlugin.
-
- By default the parameter map is empty and implies that the favorites plugin
- matches by \l {Alternative Identifier Cross-Referencing}{alternative identifiers}. Generally,
- an application developer will not need to set this property.
-
- In cases where the favorites plugin does not support matching by alternative identifiers,
- then the \l {Information about plugins} {backend plugin documentation} should be consulted
- to see precisely what key-value parameters to set.
-*/
-
-/*!
- \qmlproperty GeoShape PlaceRecommendationModel::searchArea
-
- This property holds the search area. Search results returned by the model will be within the
- search area.
-
- If this property is set to a \l GeoCircle its \l {GeoCircle::radius}{radius} property
- may be left unset, in which case the \l Plugin will choose an appropriate radius for the
- search.
-
- Support for specifying a search area can vary according according to the \l plugin backend
- implementation. For example, some may support a search center only while others may only
- support geo rectangles.
-*/
-
-/*!
- \qmlproperty int PlaceRecommendationModel::offset
-
- This property holds the index of the first search result in the model.
-
- \sa limit
-*/
-
-/*!
- \qmlproperty int PlaceRecommendationModel::limit
-
- This property holds the maximum number of items that will be returned.
-
- \sa offset
-*/
-
-/*!
- \qmlproperty enum PlaceRecommendationModel::status
-
- This property holds the status of the model. It can be one of:
-
- \table
- \row
- \li PlaceRecommendationModel.Null
- \li No search query has been executed. The model is empty.
- \row
- \li PlaceRecommendationModel.Ready
- \li The search query has completed and the result are available.
- \row
- \li PlaceRecommendationModel.Loading
- \li A search query is currently being executed.
- \row
- \li PlaceRecommendationModel.Error
- \li An error occurred when executing the previous search query.
- \endtable
-*/
-
-/*!
- \qmlmethod PlaceRecommendationModel::update()
-
- Updates the model based on the provided query parameters. The model will be populated with a
- list of places similar to the place identified by the \l placeId property. If the \l plugin
- supports it, additional parameters such as \l limit and \l offset may be specified and then
- \c update() submits the set of criteria to the \l plugin to process.
-
- While the model is updating the \l status of the model is set to
- \c PlaceRecommendationModel.Loading. If the model is successfully updated the \l status is set
- to \c PlaceRecommendationModel.Ready, while if it unsuccessfully completes, the \l status is
- set to \c PlaceRecommendationModel.Error and the model is cleared.
-
- \code
- PlaceRecomendationModel {
- id: model
- plugin: backendPlugin
- ...
- }
-
- MouseArea {
- ...
- onClicked: {
- model.placeId = place.placeId
- limit = -1;
- offset = 0;
- model.update();
- }
- }
- \endcode
-
- \sa cancel(), status
-*/
-
-/*!
- \qmlmethod PlaceRecommendationModel::cancel()
-
- Cancels an ongoing search query.
-
- \sa execute(), status
-*/
-
-/*!
- \qmlmethod PlaceRecommendationModel::reset()
-
- Resets the model. All place recommendations are cleared, any outstanding requests are aborted
- and possible errors are cleared. Model status will be set to PlaceRecommendationModel.Null.
-*/
-
-/*!
- \qmlproperty string QtLocation5::PlaceRecommendationModel::errorString
-
- This read-only property holds the textual presentation of latest place recommendation model error.
- If no error has occurred or if the model was cleared, an empty string is returned.
-
- An empty string may also be returned if an error occurred which has no associated
- textual representation.
-*/
-
-QDeclarativeRecommendationModel::QDeclarativeRecommendationModel(QObject *parent)
-: QDeclarativeResultModelBase(parent)
-{
-}
-
-QDeclarativeRecommendationModel::~QDeclarativeRecommendationModel()
-{
-}
-
-/*!
- \qmlproperty string PlaceRecommendationModel::placeId
-
- This property holds place identifier used in the recommendation search query.
-*/
-QString QDeclarativeRecommendationModel::placeId() const
-{
- return m_placeId;
-}
-
-void QDeclarativeRecommendationModel::setPlaceId(const QString &placeId)
-{
- if (m_placeId == placeId)
- return;
-
- m_placeId = placeId;
- emit placeIdChanged();
-}
-
-/*!
- \qmlproperty int PlaceRecommendationModel::count
-
- This property holds the number of results the model has.
-
- Note that it does not refer to the total number of recommendations
- available in the backend. The total number of recommendations
- is not currently supported by the API.
-*/
-
-/*!
- \qmlmethod PlaceRecommendationModel::data(int index, string role)
-
- Returns the data for a given \a role at the specified row \a index.
-*/
-
-QPlaceReply *QDeclarativeRecommendationModel::sendQuery(QPlaceManager *manager,
- const QPlaceSearchRequest &request)
-{
- return manager->recommendations(m_placeId, request);
-}
-
-/*!
- \qmlsignal PlaceRecommendationModel::dataChanged()
-
- Indicates that significant changes have been made to the underlying datastore.
-
- Applications should act on this signal at their own discretion. The data
- provided by the model could be out of date and so the model should be reupdated
- sometime, however an immediate reupdate may be disconcerting to users if the results
- change without any action on their part.
-*/
diff --git a/src/imports/location/declarativeplaces/qdeclarativerecommendationmodel_p.h b/src/imports/location/declarativeplaces/qdeclarativerecommendationmodel_p.h
deleted file mode 100644
index 6222985c..00000000
--- a/src/imports/location/declarativeplaces/qdeclarativerecommendationmodel_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVERECOMMENDATIONMODEL_P_H
-#define QDECLARATIVERECOMMENDATIONMODEL_P_H
-
-#include <QtQml/QQmlParserStatus>
-#include "qdeclarativeresultmodelbase_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeRecommendationModel : public QDeclarativeResultModelBase
-{
- Q_OBJECT
-
- Q_PROPERTY(QString placeId READ placeId WRITE setPlaceId NOTIFY placeIdChanged)
- Q_INTERFACES(QQmlParserStatus)
-
-public:
- explicit QDeclarativeRecommendationModel(QObject *parent = 0);
- ~QDeclarativeRecommendationModel();
-
- QString placeId() const;
- void setPlaceId(const QString &placeId);
-
-Q_SIGNALS:
- void placeIdChanged();
-
-protected:
- QPlaceReply *sendQuery(QPlaceManager *manager, const QPlaceSearchRequest &request);
-
-private:
- QString m_placeId;
-};
-
-QT_END_NAMESPACE
-
-#endif // QDECLARATIVERECOMMENDATIONMODEL_P_H
diff --git a/src/imports/location/declarativeplaces/qdeclarativeresultmodelbase.cpp b/src/imports/location/declarativeplaces/qdeclarativeresultmodelbase.cpp
deleted file mode 100644
index f1c67785..00000000
--- a/src/imports/location/declarativeplaces/qdeclarativeresultmodelbase.cpp
+++ /dev/null
@@ -1,310 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativeresultmodelbase_p.h"
-
-#include <QtLocation/QPlaceManager>
-#include <QtLocation/QPlaceResult>
-
-QDeclarativeResultModelBase::QDeclarativeResultModelBase(QObject *parent)
-: QDeclarativeSearchModelBase(parent), m_favoritesPlugin(0)
-{
-}
-
-/*!
- \internal
-*/
-QDeclarativeGeoServiceProvider *QDeclarativeResultModelBase::favoritesPlugin() const
-{
- return m_favoritesPlugin;
-}
-
-/*!
- \internal
-*/
-void QDeclarativeResultModelBase::setFavoritesPlugin(QDeclarativeGeoServiceProvider *plugin)
-{
-
- if (m_favoritesPlugin == plugin)
- return;
-
- m_favoritesPlugin = plugin;
-
- if (m_favoritesPlugin) {
- QGeoServiceProvider *serviceProvider = m_favoritesPlugin->sharedGeoServiceProvider();
- if (serviceProvider) {
- QPlaceManager *placeManager = serviceProvider->placeManager();
- if (placeManager) {
- if (placeManager->childCategoryIds().isEmpty()) {
- QPlaceReply *reply = placeManager->initializeCategories();
- connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater()));
- }
- }
- }
- }
-
- emit favoritesPluginChanged();
-}
-
-/*!
- \internal
-*/
-QVariantMap QDeclarativeResultModelBase::favoritesMatchParameters() const
-{
- return m_matchParameters;
-}
-
-/*!
- \internal
-*/
-void QDeclarativeResultModelBase::setFavoritesMatchParameters(const QVariantMap &parameters)
-{
- if (m_matchParameters == parameters)
- return;
-
- m_matchParameters = parameters;
- emit favoritesMatchParametersChanged();
-}
-
-/*!
- \internal
-*/
-void QDeclarativeResultModelBase::clearData()
-{
- QDeclarativeSearchModelBase::clearData();
-
- qDeleteAll(m_places);
- m_places.clear();
- qDeleteAll(m_icons);
- m_icons.clear();
- m_results.clear();
-}
-
-/*!
- \internal
-*/
-int QDeclarativeResultModelBase::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
-
- return m_results.count();
-}
-
-/*!
- \internal
-*/
-QVariant QDeclarativeResultModelBase::data(int index, const QString &role) const
-{
- QModelIndex modelIndex = createIndex(index, 0);
- return data(modelIndex, roleNames().key(role.toLatin1()));
-}
-
-QHash<int, QByteArray> QDeclarativeResultModelBase::roleNames() const
-{
- QHash<int, QByteArray> roles = QDeclarativeSearchModelBase::roleNames();
- roles.insert(TitleRole, "title");
- roles.insert(IconRole, "icon");
- roles.insert(DistanceRole, "distance");
- roles.insert(PlaceRole, "place");
- return roles;
-}
-
-/*!
- \internal
-*/
-QVariant QDeclarativeResultModelBase::data(const QModelIndex &index, int role) const
-{
- if (index.row() > m_results.count())
- return QVariant();
-
- const QPlaceSearchResult &result = m_results.at(index.row());
-
- switch (role) {
- case Qt::DisplayRole:
- case TitleRole:
- return m_results.at(index.row()).title();
- case IconRole:
- return QVariant::fromValue(static_cast<QObject *>(m_icons.at(index.row())));
- case DistanceRole:
- if (result.type() == QPlaceSearchResult::PlaceResult) {
- QPlaceResult placeResult = result;
- return placeResult.distance();
- } else {
- return QVariant();
- }
- case PlaceRole:
- return QVariant::fromValue(static_cast<QObject *>(m_places.at(index.row())));
- default:
- return QVariant();
- }
-}
-
-void QDeclarativeResultModelBase::initializePlugin(QDeclarativeGeoServiceProvider *plugin)
-{
- //disconnect the manager of the old plugin if we have one
- if (m_plugin) {
- QGeoServiceProvider *serviceProvider = m_plugin->sharedGeoServiceProvider();
- if (serviceProvider) {
- QPlaceManager *placeManager = serviceProvider->placeManager();
- if (placeManager)
- disconnect(placeManager, SIGNAL(dataChanged()), this, SIGNAL(dataChanged()));
- }
- }
-
- //connect to the manager of the new plugin.
- if (plugin) {
- QGeoServiceProvider *serviceProvider = plugin->sharedGeoServiceProvider();
- if (serviceProvider) {
- QPlaceManager *placeManager = serviceProvider->placeManager();
- if (placeManager)
- connect(placeManager, SIGNAL(dataChanged()), this, SIGNAL(dataChanged()));
- }
- }
- QDeclarativeSearchModelBase::initializePlugin(plugin);
-}
-
-/*!
- \internal
-*/
-void QDeclarativeResultModelBase::queryFinished()
-{
- if (!m_reply)
- return;
- QPlaceReply *reply = m_reply;
- m_reply = 0;
- if (reply->error() != QPlaceReply::NoError) {
- m_resultsBuffer.clear();
- updateLayout();
- setStatus(Error, reply->errorString());
- reply->deleteLater();
- }
-
- if (reply->type() == QPlaceReply::SearchReply) {
- QPlaceSearchReply *searchReply = qobject_cast<QPlaceSearchReply *>(reply);
- Q_ASSERT(searchReply);
-
- m_resultsBuffer = searchReply->results();
- reply->deleteLater();
-
- if (!m_favoritesPlugin) {
- updateLayout();
- setStatus(Ready);
- } else {
- QGeoServiceProvider *serviceProvider = m_favoritesPlugin->sharedGeoServiceProvider();
- if (!serviceProvider) {
- updateLayout();
- setStatus(Error, QLatin1String("Favorites plugin returns a null QGeoServiceProvider instance"));
- return;
- }
-
- QPlaceManager *favoritesManager = serviceProvider->placeManager();
- if (!favoritesManager) {
- updateLayout();
- setStatus(Error, QLatin1String("Favorites plugin returns a null QPlaceManager"));
- return;
- }
-
- QPlaceMatchRequest request;
- if (m_matchParameters.isEmpty()) {
- if (!m_plugin) {
- reply->deleteLater();
- setStatus(Error, QLatin1String("Plugin not assigned"));
- return;
- }
-
- QVariantMap params;
- params.insert(QPlaceMatchRequest::AlternativeId, QString::fromLatin1("x_id_") + m_plugin->name());
- request.setParameters(params);
- } else {
- request.setParameters(m_matchParameters);
- }
-
- request.setResults(m_resultsBuffer);
- m_reply = favoritesManager->matchingPlaces(request);
- connect(m_reply, SIGNAL(finished()), this, SLOT(queryFinished()));
- }
- } else if (reply->type() == QPlaceReply::MatchReply) {
- QPlaceMatchReply *matchReply = qobject_cast<QPlaceMatchReply *>(reply);
- Q_ASSERT(matchReply);
- updateLayout(matchReply->places());
- setStatus(Ready);
- reply->deleteLater();
- } else {
- setStatus(Error, QLatin1String("Unknown reply type"));
- reply->deleteLater();
- }
-}
-
-/*!
- \internal
- Note: m_results buffer should be correctly populated before
- calling this function
-*/
-void QDeclarativeResultModelBase::updateLayout(const QList<QPlace> &favoritePlaces)
-{
- int oldRowCount = rowCount();
-
- beginResetModel();
- clearData();
- m_results = m_resultsBuffer;
- m_resultsBuffer.clear();
-
- for (int i = 0; i < m_results.count(); ++i) {
- if (m_results.at(i).type() == QPlaceSearchResult::PlaceResult) {
- QPlaceResult placeResult = m_results.at(i);
- QDeclarativePlace *place = new QDeclarativePlace(placeResult.place(),plugin(), this);
- m_places.append(place);
-
- QDeclarativePlaceIcon *icon = 0;
- if (!m_results.at(i).icon().isEmpty())
- icon = new QDeclarativePlaceIcon(m_results.at(i).icon(), plugin(), this);
- m_icons.append(icon);
-
- if ((favoritePlaces.count() == m_results.count()) && favoritePlaces.at(i) != QPlace())
- m_places[i]->setFavorite(new QDeclarativePlace(favoritePlaces.at(i), m_favoritesPlugin, m_places[i]));
- }
- }
-
- endResetModel();
- if (m_results.count() != oldRowCount)
- emit rowCountChanged();
-}
-
diff --git a/src/imports/location/declarativeplaces/qdeclarativeresultmodelbase_p.h b/src/imports/location/declarativeplaces/qdeclarativeresultmodelbase_p.h
deleted file mode 100644
index 5cdc3f08..00000000
--- a/src/imports/location/declarativeplaces/qdeclarativeresultmodelbase_p.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVERESULTMODELBASE_H
-#define QDECLARATIVERESULTMODELBASE_H
-
-#include "qdeclarativesearchmodelbase.h"
-#include "qdeclarativeplace_p.h"
-#include "qdeclarativeplaceicon_p.h"
-
-#include <QtLocation/QGeoServiceProvider>
-#include <QtLocation/QPlaceSearchReply>
-
-class QDeclarativeResultModelBase : public QDeclarativeSearchModelBase
-{
- Q_OBJECT
-
-public:
- Q_PROPERTY(int count READ rowCount NOTIFY rowCountChanged)
- Q_PROPERTY(QDeclarativeGeoServiceProvider *favoritesPlugin READ favoritesPlugin WRITE setFavoritesPlugin NOTIFY favoritesPluginChanged)
- Q_PROPERTY(QVariantMap favoritesMatchParameters READ favoritesMatchParameters WRITE setFavoritesMatchParameters NOTIFY favoritesMatchParametersChanged)
-
- explicit QDeclarativeResultModelBase(QObject *parent = 0);
-
- QDeclarativeGeoServiceProvider *favoritesPlugin() const;
- void setFavoritesPlugin(QDeclarativeGeoServiceProvider *plugin);
-
- QVariantMap favoritesMatchParameters() const;
- void setFavoritesMatchParameters(const QVariantMap &parameters);
-
- virtual void clearData();
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const;
- Q_INVOKABLE QVariant data(int index, const QString &roleName) const;
- QHash<int, QByteArray> roleNames() const;
-
-Q_SIGNALS:
- void rowCountChanged();
- void favoritesPluginChanged();
- void favoritesMatchParametersChanged();
- void dataChanged();
-
-protected:
- virtual void initializePlugin(QDeclarativeGeoServiceProvider *plugin);
-
-protected Q_SLOTS:
- virtual void queryFinished();
-
-private Q_SLOTS:
- void updateLayout(const QList<QPlace> &favoritePlaces = QList<QPlace>());
-
-protected:
- enum Roles {
- DistanceRole = Qt::UserRole,
- TitleRole,
- IconRole,
- PlaceRole,
- UserRole
- };
-
- QList<QPlaceSearchResult> m_results;
- QList<QPlaceSearchResult> m_resultsBuffer;
- QList<QDeclarativePlace *> m_places;
- QList<QDeclarativePlaceIcon*> m_icons;
-
- QDeclarativeGeoServiceProvider *m_favoritesPlugin;
- QVariantMap m_matchParameters;
-};
-
-#endif
diff --git a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp
index 6eaa4f44..207d6b19 100644
--- a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp
+++ b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp
@@ -319,7 +319,7 @@ QT_USE_NAMESPACE
*/
QDeclarativeSearchResultModel::QDeclarativeSearchResultModel(QObject *parent)
-: QDeclarativeResultModelBase(parent)
+ : QDeclarativeSearchModelBase(parent), m_favoritesPlugin(0)
{
}
@@ -407,6 +407,26 @@ void QDeclarativeSearchResultModel::categories_clear(QQmlListProperty<QDeclarati
}
/*!
+ \qmlproperty string PlaceSearchModel::recommendationId
+
+ This property holds the placeId to be used in order to find recommendations
+ for similar places.
+*/
+QString QDeclarativeSearchResultModel::recommendationId() const
+{
+ return m_request.recommendationId();
+}
+
+void QDeclarativeSearchResultModel::setRecommendationId(const QString &placeId)
+{
+ if (m_request.recommendationId() == placeId)
+ return;
+
+ m_request.setRecommendationId(placeId);
+ emit recommendationIdChanged();
+}
+
+/*!
\qmlproperty enumeration PlaceSearchModel::relevanceHint
This property holds a relevance hint used in the search query. The hint is given to the
@@ -481,32 +501,135 @@ void QDeclarativeSearchResultModel::setVisibilityScope(QDeclarativePlace::Visibi
emit visibilityScopeChanged();
}
+/*!
+ \internal
+*/
+QDeclarativeGeoServiceProvider *QDeclarativeSearchResultModel::favoritesPlugin() const
+{
+ return m_favoritesPlugin;
+}
+
+/*!
+ \internal
+*/
+void QDeclarativeSearchResultModel::setFavoritesPlugin(QDeclarativeGeoServiceProvider *plugin)
+{
+
+ if (m_favoritesPlugin == plugin)
+ return;
+
+ m_favoritesPlugin = plugin;
+
+ if (m_favoritesPlugin) {
+ QGeoServiceProvider *serviceProvider = m_favoritesPlugin->sharedGeoServiceProvider();
+ if (serviceProvider) {
+ QPlaceManager *placeManager = serviceProvider->placeManager();
+ if (placeManager) {
+ if (placeManager->childCategoryIds().isEmpty()) {
+ QPlaceReply *reply = placeManager->initializeCategories();
+ connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater()));
+ }
+ }
+ }
+ }
+
+ emit favoritesPluginChanged();
+}
+
+/*!
+ \internal
+*/
+QVariantMap QDeclarativeSearchResultModel::favoritesMatchParameters() const
+{
+ return m_matchParameters;
+}
+
+/*!
+ \internal
+*/
+void QDeclarativeSearchResultModel::setFavoritesMatchParameters(const QVariantMap &parameters)
+{
+ if (m_matchParameters == parameters)
+ return;
+
+ m_matchParameters = parameters;
+ emit favoritesMatchParametersChanged();
+}
+
+/*!
+ \internal
+*/
+int QDeclarativeSearchResultModel::rowCount(const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+
+ return m_results.count();
+}
+
+void QDeclarativeSearchResultModel::clearData()
+{
+ QDeclarativeSearchModelBase::clearData();
+
+ qDeleteAll(m_places);
+ m_places.clear();
+ qDeleteAll(m_icons);
+ m_icons.clear();
+ m_results.clear();
+}
+
QVariant QDeclarativeSearchResultModel::data(const QModelIndex &index, int role) const
{
if (index.row() > m_results.count())
return QVariant();
+ const QPlaceSearchResult &result = m_results.at(index.row());
+
switch (role) {
case SearchResultTypeRole:
- return m_results.at(index.row()).type();
+ return result.type();
+ case Qt::DisplayRole:
+ case TitleRole:
+ return result.title();
+ case IconRole:
+ return QVariant::fromValue(static_cast<QObject *>(m_icons.at(index.row())));
+ case DistanceRole:
+ if (result.type() == QPlaceSearchResult::PlaceResult) {
+ QPlaceResult placeResult = result;
+ return placeResult.distance();
+ }
+ break;
+ case PlaceRole:
+ if (result.type() == QPlaceSearchResult::PlaceResult)
+ return QVariant::fromValue(static_cast<QObject *>(m_places.at(index.row())));
case SponsoredRole:
- if (m_results.at(index.row()).type() == QPlaceSearchResult::PlaceResult) {
- QPlaceResult placeResult = m_results.at(index.row());
+ if (result.type() == QPlaceSearchResult::PlaceResult) {
+ QPlaceResult placeResult = result;
return placeResult.isSponsored();
- } else {
- return false;
}
break;
- default:
- return QDeclarativeResultModelBase::data(index, role);
}
+ return QVariant();
+}
+
+/*!
+ \internal
+*/
+QVariant QDeclarativeSearchResultModel::data(int index, const QString &role) const
+{
+ QModelIndex modelIndex = createIndex(index, 0);
+ return data(modelIndex, roleNames().key(role.toLatin1()));
}
QHash<int, QByteArray> QDeclarativeSearchResultModel::roleNames() const
{
- QHash<int, QByteArray> roles = QDeclarativeResultModelBase::roleNames();
+ QHash<int, QByteArray> roles = QDeclarativeSearchModelBase::roleNames();
roles.insert(SearchResultTypeRole, "type");
+ roles.insert(TitleRole, "title");
+ roles.insert(IconRole, "icon");
+ roles.insert(DistanceRole, "distance");
+ roles.insert(PlaceRole, "place");
roles.insert(SponsoredRole, "sponsored");
+
return roles;
}
@@ -530,6 +653,7 @@ void QDeclarativeSearchResultModel::initializePlugin(QDeclarativeGeoServiceProvi
if (placeManager) {
disconnect(placeManager, SIGNAL(placeUpdated(QString)), this, SLOT(placeUpdated(QString)));
disconnect(placeManager, SIGNAL(placeRemoved(QString)), this, SLOT(placeRemoved(QString)));
+ connect(placeManager, SIGNAL(dataChanged()), this, SIGNAL(dataChanged()));
}
}
}
@@ -542,10 +666,83 @@ void QDeclarativeSearchResultModel::initializePlugin(QDeclarativeGeoServiceProvi
if (placeManager) {
connect(placeManager, SIGNAL(placeUpdated(QString)), this, SLOT(placeUpdated(QString)));
connect(placeManager, SIGNAL(placeRemoved(QString)), this, SLOT(placeRemoved(QString)));
+ disconnect(placeManager, SIGNAL(dataChanged()), this, SIGNAL(dataChanged()));
}
}
}
- QDeclarativeResultModelBase::initializePlugin(plugin);
+ QDeclarativeSearchModelBase::initializePlugin(plugin);
+}
+
+/*!
+ \internal
+*/
+void QDeclarativeSearchResultModel::queryFinished()
+{
+ if (!m_reply)
+ return;
+ QPlaceReply *reply = m_reply;
+ m_reply = 0;
+ if (reply->error() != QPlaceReply::NoError) {
+ m_resultsBuffer.clear();
+ updateLayout();
+ setStatus(Error, reply->errorString());
+ reply->deleteLater();
+ }
+
+ if (reply->type() == QPlaceReply::SearchReply) {
+ QPlaceSearchReply *searchReply = qobject_cast<QPlaceSearchReply *>(reply);
+ Q_ASSERT(searchReply);
+
+ m_resultsBuffer = searchReply->results();
+ reply->deleteLater();
+
+ if (!m_favoritesPlugin) {
+ updateLayout();
+ setStatus(Ready);
+ } else {
+ QGeoServiceProvider *serviceProvider = m_favoritesPlugin->sharedGeoServiceProvider();
+ if (!serviceProvider) {
+ updateLayout();
+ setStatus(Error, QLatin1String("Favorites plugin returns a null QGeoServiceProvider instance"));
+ return;
+ }
+
+ QPlaceManager *favoritesManager = serviceProvider->placeManager();
+ if (!favoritesManager) {
+ updateLayout();
+ setStatus(Error, QLatin1String("Favorites plugin returns a null QPlaceManager"));
+ return;
+ }
+
+ QPlaceMatchRequest request;
+ if (m_matchParameters.isEmpty()) {
+ if (!m_plugin) {
+ reply->deleteLater();
+ setStatus(Error, QLatin1String("Plugin not assigned"));
+ return;
+ }
+
+ QVariantMap params;
+ params.insert(QPlaceMatchRequest::AlternativeId, QString::fromLatin1("x_id_") + m_plugin->name());
+ request.setParameters(params);
+ } else {
+ request.setParameters(m_matchParameters);
+ }
+
+ request.setResults(m_resultsBuffer);
+ m_reply = favoritesManager->matchingPlaces(request);
+ connect(m_reply, SIGNAL(finished()), this, SLOT(queryFinished()));
+ }
+ } else if (reply->type() == QPlaceReply::MatchReply) {
+ QPlaceMatchReply *matchReply = qobject_cast<QPlaceMatchReply *>(reply);
+ Q_ASSERT(matchReply);
+ updateLayout(matchReply->places());
+ setStatus(Ready);
+ reply->deleteLater();
+ } else {
+ setStatus(Error, QLatin1String("Unknown reply type"));
+ reply->deleteLater();
+ }
}
/*!
@@ -566,6 +763,41 @@ void QDeclarativeSearchResultModel::initializePlugin(QDeclarativeGeoServiceProvi
/*!
\internal
+ Note: m_results buffer should be correctly populated before
+ calling this function
+*/
+void QDeclarativeSearchResultModel::updateLayout(const QList<QPlace> &favoritePlaces)
+{
+ int oldRowCount = rowCount();
+
+ beginResetModel();
+ clearData();
+ m_results = m_resultsBuffer;
+ m_resultsBuffer.clear();
+
+ for (int i = 0; i < m_results.count(); ++i) {
+ if (m_results.at(i).type() == QPlaceSearchResult::PlaceResult) {
+ QPlaceResult placeResult = m_results.at(i);
+ QDeclarativePlace *place = new QDeclarativePlace(placeResult.place(),plugin(), this);
+ m_places.append(place);
+
+ QDeclarativePlaceIcon *icon = 0;
+ if (!m_results.at(i).icon().isEmpty())
+ icon = new QDeclarativePlaceIcon(m_results.at(i).icon(), plugin(), this);
+ m_icons.append(icon);
+
+ if ((favoritePlaces.count() == m_results.count()) && favoritePlaces.at(i) != QPlace())
+ m_places[i]->setFavorite(new QDeclarativePlace(favoritePlaces.at(i), m_favoritesPlugin, m_places[i]));
+ }
+ }
+
+ endResetModel();
+ if (m_results.count() != oldRowCount)
+ emit rowCountChanged();
+}
+
+/*!
+ \internal
*/
void QDeclarativeSearchResultModel::placeUpdated(const QString &placeId)
{
diff --git a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h
index d1b036b5..de42c3bc 100644
--- a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h
@@ -42,23 +42,29 @@
#ifndef QDECLARATIVESEARCHRESULTMODEL_P_H
#define QDECLARATIVESEARCHRESULTMODEL_P_H
-#include "qdeclarativeresultmodelbase_p.h"
+#include "qdeclarativesearchmodelbase.h"
#include "qdeclarativecategory_p.h"
#include "qdeclarativeplace_p.h"
+#include "qdeclarativeplaceicon_p.h"
QT_BEGIN_NAMESPACE
class QDeclarativeGeoServiceProvider;
-class QDeclarativeSearchResultModel : public QDeclarativeResultModelBase
+class QDeclarativeSearchResultModel : public QDeclarativeSearchModelBase
{
Q_OBJECT
Q_PROPERTY(QString searchTerm READ searchTerm WRITE setSearchTerm NOTIFY searchTermChanged)
Q_PROPERTY(QQmlListProperty<QDeclarativeCategory> categories READ categories NOTIFY categoriesChanged)
+ Q_PROPERTY(QString recommendationId READ recommendationId WRITE setRecommendationId NOTIFY recommendationIdChanged)
Q_PROPERTY(RelevanceHint relevanceHint READ relevanceHint WRITE setRelevanceHint NOTIFY relevanceHintChanged)
Q_PROPERTY(QDeclarativePlace::Visibility visibilityScope READ visibilityScope WRITE setVisibilityScope NOTIFY visibilityScopeChanged)
+ Q_PROPERTY(int count READ rowCount NOTIFY rowCountChanged)
+ Q_PROPERTY(QDeclarativeGeoServiceProvider *favoritesPlugin READ favoritesPlugin WRITE setFavoritesPlugin NOTIFY favoritesPluginChanged)
+ Q_PROPERTY(QVariantMap favoritesMatchParameters READ favoritesMatchParameters WRITE setFavoritesMatchParameters NOTIFY favoritesMatchParametersChanged)
+
Q_ENUMS(SearchResultType RelevanceHint)
public:
@@ -86,38 +92,74 @@ public:
static QDeclarativeCategory *category_at(QQmlListProperty<QDeclarativeCategory> *list, int index);
static void categories_clear(QQmlListProperty<QDeclarativeCategory> *list);
+ QString recommendationId() const;
+ void setRecommendationId(const QString &recommendationId);
+
QDeclarativeSearchResultModel::RelevanceHint relevanceHint() const;
void setRelevanceHint(QDeclarativeSearchResultModel::RelevanceHint hint);
QDeclarativePlace::Visibility visibilityScope() const;
void setVisibilityScope(QDeclarativePlace::Visibility visibilityScope);
- QVariant data(const QModelIndex &index, int role) const;
+ QDeclarativeGeoServiceProvider *favoritesPlugin() const;
+ void setFavoritesPlugin(QDeclarativeGeoServiceProvider *plugin);
+
+ QVariantMap favoritesMatchParameters() const;
+ void setFavoritesMatchParameters(const QVariantMap &parameters);
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+ virtual void clearData();
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ Q_INVOKABLE QVariant data(int index, const QString &roleName) const;
QHash<int, QByteArray> roleNames() const;
Q_SIGNALS:
void searchTermChanged();
void categoriesChanged();
+ void recommendationIdChanged();
void relevanceHintChanged();
void visibilityScopeChanged();
+ void rowCountChanged();
+ void favoritesPluginChanged();
+ void favoritesMatchParametersChanged();
+ void dataChanged();
+
protected:
QPlaceReply *sendQuery(QPlaceManager *manager, const QPlaceSearchRequest &request);
virtual void initializePlugin(QDeclarativeGeoServiceProvider *plugin);
+protected Q_SLOTS:
+ virtual void queryFinished();
+
private Q_SLOTS:
+ void updateLayout(const QList<QPlace> &favoritePlaces = QList<QPlace>());
+
void placeUpdated(const QString &placeId);
void placeRemoved(const QString &placeId);
private:
enum Roles {
- SearchResultTypeRole = QDeclarativeResultModelBase::UserRole,
+ SearchResultTypeRole = Qt::UserRole,
+ TitleRole,
+ IconRole,
+ DistanceRole,
+ PlaceRole,
SponsoredRole
};
int getRow(const QString &placeId) const;
QList<QDeclarativeCategory *> m_categories;
QtLocation::VisibilityScope m_visibilityScope;
+
+ QList<QPlaceSearchResult> m_results;
+ QList<QPlaceSearchResult> m_resultsBuffer;
+ QList<QDeclarativePlace *> m_places;
+ QList<QDeclarativePlaceIcon *> m_icons;
+
+ QDeclarativeGeoServiceProvider *m_favoritesPlugin;
+ QVariantMap m_matchParameters;
};
QT_END_NAMESPACE
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp
index 24bcb188..a23a8155 100644
--- a/src/imports/location/location.cpp
+++ b/src/imports/location/location.cpp
@@ -80,7 +80,6 @@
#include "qdeclarativeplaceuser_p.h"
#include "qdeclarativecontactdetail_p.h"
-#include "qdeclarativerecommendationmodel_p.h"
#include "qdeclarativesupportedcategoriesmodel_p.h"
#include "qdeclarativesearchresultmodel_p.h"
#include "qdeclarativesearchsuggestionmodel_p.h"
@@ -157,7 +156,6 @@ public:
qmlRegisterType<QDeclarativePolygonMapItem>(uri, 5, 0, "MapPolygon");
qmlRegisterType<QDeclarativeRouteMapItem>(uri, 5, 0, "MapRoute");
- qmlRegisterType<QDeclarativeRecommendationModel>(uri, 5, 0, "PlaceRecommendationModel");
qmlRegisterType<QDeclarativeSupportedCategoriesModel>(uri, 5, 0, "CategoryModel");
qmlRegisterType<QDeclarativeSearchResultModel>(uri, 5, 0, "PlaceSearchModel");
qmlRegisterType<QDeclarativeSearchSuggestionModel>(uri, 5, 0, "PlaceSearchSuggestionModel");
diff --git a/src/imports/location/plugins.qmltypes b/src/imports/location/plugins.qmltypes
index f8c512db..b11aa9f7 100644
--- a/src/imports/location/plugins.qmltypes
+++ b/src/imports/location/plugins.qmltypes
@@ -1502,13 +1502,6 @@ Module {
Signal { name: "countChanged"; type: "void" }
}
Component {
- name: "QDeclarativeRecommendationModel"
- prototype: "QDeclarativeResultModelBase"
- exports: ["PlaceRecommendationModel 5.0"]
- Property { name: "placeId"; type: "string" }
- Signal { name: "placeIdChanged"; type: "void" }
- }
- Component {
name: "QDeclarativeRectangleMapItem"
defaultProperty: "data"
prototype: "QDeclarativeGeoMapItemBase"
@@ -1539,23 +1532,6 @@ Module {
}
}
Component {
- name: "QDeclarativeResultModelBase"
- prototype: "QDeclarativeSearchModelBase"
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "favoritesPlugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true }
- Property { name: "favoritesMatchParameters"; type: "QVariantMap" }
- Signal { name: "rowCountChanged"; type: "void" }
- Signal { name: "favoritesPluginChanged"; type: "void" }
- Signal { name: "favoritesMatchParametersChanged"; type: "void" }
- Signal { name: "dataChanged"; type: "void" }
- Method {
- name: "data"
- type: "QVariant"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "roleName"; type: "string" }
- }
- }
- Component {
name: "QDeclarativeReviewModel"
prototype: "QDeclarativePlaceContentModel"
exports: ["ReviewModel 5.0"]
@@ -1607,7 +1583,7 @@ Module {
}
Component {
name: "QDeclarativeSearchResultModel"
- prototype: "QDeclarativeResultModelBase"
+ prototype: "QDeclarativeSearchModelBase"
exports: ["PlaceSearchModel 5.0"]
Enum {
name: "SearchResultType"
@@ -1626,12 +1602,27 @@ Module {
}
Property { name: "searchTerm"; type: "string" }
Property { name: "categories"; type: "QDeclarativeCategory"; isList: true; isReadonly: true }
+ Property { name: "recommendationId"; type: "string" }
Property { name: "relevanceHint"; type: "RelevanceHint" }
Property { name: "visibilityScope"; type: "QDeclarativePlace::Visibility" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "favoritesPlugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true }
+ Property { name: "favoritesMatchParameters"; type: "QVariantMap" }
Signal { name: "searchTermChanged"; type: "void" }
Signal { name: "categoriesChanged"; type: "void" }
+ Signal { name: "recommendationIdChanged"; type: "void" }
Signal { name: "relevanceHintChanged"; type: "void" }
Signal { name: "visibilityScopeChanged"; type: "void" }
+ Signal { name: "rowCountChanged"; type: "void" }
+ Signal { name: "favoritesPluginChanged"; type: "void" }
+ Signal { name: "favoritesMatchParametersChanged"; type: "void" }
+ Signal { name: "dataChanged"; type: "void" }
+ Method {
+ name: "data"
+ type: "QVariant"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "roleName"; type: "string" }
+ }
}
Component {
name: "QDeclarativeSearchSuggestionModel"
diff --git a/src/location/places/qplacemanager.cpp b/src/location/places/qplacemanager.cpp
index 502237d1..2849a4c7 100644
--- a/src/location/places/qplacemanager.cpp
+++ b/src/location/places/qplacemanager.cpp
@@ -229,17 +229,6 @@ QPlaceSearchReply *QPlaceManager::search(const QPlaceSearchRequest &request) con
}
/*!
- Provides recommendations for places that are similar to the place identified by \a placeId,
- and using the parameters as specified in \a request.
-
- See \l {Recommendations} for an example of usage.
-*/
-QPlaceSearchReply *QPlaceManager::recommendations(const QString &placeId, const QPlaceSearchRequest &request) const
-{
- return d->recommendations(placeId, request);
-}
-
-/*!
Requests a set of search term suggestions according to the parameters specified in \a request.
The \a request can hold the incomplete search term, along with other data such
as a search area to narrow down relevant results.
diff --git a/src/location/places/qplacemanager.h b/src/location/places/qplacemanager.h
index a64bf7f0..aa144829 100644
--- a/src/location/places/qplacemanager.h
+++ b/src/location/places/qplacemanager.h
@@ -82,8 +82,6 @@ public:
QPlaceSearchReply *search(const QPlaceSearchRequest &query) const;
- QPlaceSearchReply *recommendations(const QString &placeId, const QPlaceSearchRequest &request = QPlaceSearchRequest()) const;
-
QPlaceSearchSuggestionReply *searchSuggestions(const QPlaceSearchRequest &request) const;
QPlaceIdReply *savePlace(const QPlace &place);
diff --git a/src/location/places/qplacemanagerengine.cpp b/src/location/places/qplacemanagerengine.cpp
index f2a67d40..e51b0b28 100644
--- a/src/location/places/qplacemanagerengine.cpp
+++ b/src/location/places/qplacemanagerengine.cpp
@@ -175,20 +175,6 @@ QPlaceSearchReply *QPlaceManagerEngine::search(const QPlaceSearchRequest &reques
}
/*!
- Provides recommendations for places that are similar to the place identified by \a placeId,
- and using the parameters as specified in \a request.
-*/
-QPlaceSearchReply *QPlaceManagerEngine::recommendations(const QString &placeId,
- const QPlaceSearchRequest &request)
-{
- Q_UNUSED(placeId)
- Q_UNUSED(request)
-
- return new QPlaceSearchReplyUnsupported(
- QStringLiteral("Place recommendations are not supported."), this);
-}
-
-/*!
Requests a set of search term suggestions according to the parameters specified in \a request.
*/
QPlaceSearchSuggestionReply *QPlaceManagerEngine::searchSuggestions(
diff --git a/src/location/places/qplacemanagerengine.h b/src/location/places/qplacemanagerengine.h
index 93dd0e15..d3c5b1a6 100644
--- a/src/location/places/qplacemanagerengine.h
+++ b/src/location/places/qplacemanagerengine.h
@@ -68,8 +68,6 @@ public:
virtual QPlaceSearchReply *search(const QPlaceSearchRequest &request);
- virtual QPlaceSearchReply *recommendations(const QString &placeId,
- const QPlaceSearchRequest &request);
virtual QPlaceSearchSuggestionReply *searchSuggestions(const QPlaceSearchRequest &request);
virtual QPlaceIdReply *savePlace(const QPlace &place);
diff --git a/src/location/places/qplacesearchrequest.cpp b/src/location/places/qplacesearchrequest.cpp
index fbd56f65..e6cd5e4c 100644
--- a/src/location/places/qplacesearchrequest.cpp
+++ b/src/location/places/qplacesearchrequest.cpp
@@ -64,6 +64,7 @@ public:
QList<QPlaceCategory> categories;
QGeoShape searchArea;
int dymNumber;
+ QString recommendationId;
QtLocation::VisibilityScope visibilityScope;
QPlaceSearchRequest::RelevanceHint relevanceHint;
int limit;
@@ -82,6 +83,7 @@ QPlaceSearchRequestPrivate::QPlaceSearchRequestPrivate(const QPlaceSearchRequest
searchTerm(other.searchTerm),
categories(other.categories),
searchArea(other.searchArea),
+ recommendationId(other.recommendationId),
dymNumber(other.dymNumber),
visibilityScope(other.visibilityScope),
relevanceHint(other.relevanceHint),
@@ -100,6 +102,7 @@ QPlaceSearchRequestPrivate &QPlaceSearchRequestPrivate::operator=(const QPlaceSe
searchTerm = other.searchTerm;
categories = other.categories;
searchArea = other.searchArea;
+ recommendationId = other.recommendationId;
dymNumber = other.dymNumber;
visibilityScope = other.visibilityScope;
relevanceHint = other.relevanceHint;
@@ -115,6 +118,7 @@ bool QPlaceSearchRequestPrivate::operator==(const QPlaceSearchRequestPrivate &ot
return searchTerm == other.searchTerm &&
categories == other.categories &&
searchArea == other.searchArea &&
+ recommendationId == other.recommendationId &&
dymNumber == other.dymNumber &&
visibilityScope == other.visibilityScope &&
relevanceHint == other.relevanceHint &&
@@ -129,6 +133,7 @@ void QPlaceSearchRequestPrivate::clear()
searchTerm.clear();
categories.clear();
searchArea = QGeoShape();
+ recommendationId.clear();
dymNumber = 0;
visibilityScope = QtLocation::UnspecifiedVisibility;
relevanceHint = QPlaceSearchRequest::UnspecifiedHint;
@@ -152,11 +157,10 @@ void QPlaceSearchRequestPrivate::clear()
The QPlaceSearchRequest is primarily used with the QPlaceManager to
\l {QPlaceManager::search()} {search for places}, however it is also
- used to provide parameters for \l {QPlaceManager::searchSuggestions()}{generating search term suggestions}
- and \l {QPlaceManager::recommendations()} {retreiving recommendations}. Note that depending on usage,
- some parameters may not be relevant, for example the relevance hint is not important for search term suggestions. However
- in general, most of the parameters are useful for each of these operations, for example for a recommendation, a search area
- and categories can be useful in narrowing down recommendation candidates.
+ used to provide parameters for \l {QPlaceManager::searchSuggestions()}{generating search term suggestions}.
+ Note that in this context only some of the parameters may be relevant. For example, the search area
+ is useful in narrowing down relevant search suggestions, while other parameters such as relevance hint
+ are not so applicable.
Also be aware that providers may vary by which parameters they support for example some providers may not support
paging while others do, some providers may honor relevance hints while others may completely ignore them,
@@ -310,6 +314,25 @@ void QPlaceSearchRequest::setSearchArea(const QGeoShape &area)
}
/*!
+ Returns the place id which will be used to search for recommendations
+ for similar places.
+*/
+QString QPlaceSearchRequest::recommendationId() const
+{
+ Q_D(const QPlaceSearchRequest);
+ return d->recommendationId;
+}
+
+/*!
+ Sets the \a placeId which will be used to search for recommendations.
+*/
+void QPlaceSearchRequest::setRecommendationId(const QString &placeId)
+{
+ Q_D(QPlaceSearchRequest);
+ d->recommendationId = placeId;
+}
+
+/*!
Returns the visibility scope used when searching for places. The default value is
QtLocation::UnspecifiedVisibility meaning that no explicit scope has been assigned.
Places of any scope may be returned during the search.
diff --git a/src/location/places/qplacesearchrequest.h b/src/location/places/qplacesearchrequest.h
index 0612c771..c22662bc 100644
--- a/src/location/places/qplacesearchrequest.h
+++ b/src/location/places/qplacesearchrequest.h
@@ -86,6 +86,9 @@ public:
QGeoShape searchArea() const;
void setSearchArea(const QGeoShape &area);
+ QString recommendationId() const;
+ void setRecommendationId(const QString &recommendationId);
+
QtLocation::VisibilityScope visibilityScope() const;
void setVisibilityScope(QtLocation::VisibilityScope visibilityScopes);
diff --git a/src/plugins/geoservices/nokia/placesv2/placesv2.pri b/src/plugins/geoservices/nokia/placesv2/placesv2.pri
index 43835f65..73f3fcbd 100644
--- a/src/plugins/geoservices/nokia/placesv2/placesv2.pri
+++ b/src/plugins/geoservices/nokia/placesv2/placesv2.pri
@@ -6,7 +6,6 @@ HEADERS += \
placesv2/qplacecontentreplyimpl.h \
placesv2/qplacedetailsreplyimpl.h \
placesv2/qplaceidreplyimpl.h \
- placesv2/qplacerecommendationreplyimpl.h \
placesv2/qplacesearchreplyimpl.h \
placesv2/qplacesearchsuggestionreplyimpl.h \
placesv2/jsonparserhelpers.h
@@ -17,7 +16,6 @@ SOURCES += \
placesv2/qplacecontentreplyimpl.cpp \
placesv2/qplacedetailsreplyimpl.cpp \
placesv2/qplaceidreplyimpl.cpp \
- placesv2/qplacerecommendationreplyimpl.cpp \
placesv2/qplacesearchreplyimpl.cpp \
placesv2/qplacesearchsuggestionreplyimpl.cpp \
placesv2/jsonparserhelpers.cpp
diff --git a/src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.cpp
deleted file mode 100644
index 76ddba43..00000000
--- a/src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-** This file is part of the Nokia services plugin for the Maps and
-** Navigation API. The use of these services, whether by use of the
-** plugin or by other means, is governed by the terms and conditions
-** described by the file NOKIA_TERMS_AND_CONDITIONS.txt in
-** this package, located in the directory containing the Nokia services
-** plugin source code.
-**
-****************************************************************************/
-
-#include "qplacerecommendationreplyimpl.h"
-#include "jsonparserhelpers.h"
-#include "../qplacemanagerengine_nokiav2.h"
-#include "../qgeoerror_messages.h"
-
-#include <QCoreApplication>
-#include <QtCore/QJsonDocument>
-#include <QtCore/QJsonObject>
-#include <QtCore/QJsonArray>
-#include <QtLocation/QPlaceIcon>
-#include <QtLocation/QPlaceResult>
-
-QT_BEGIN_NAMESPACE
-
-QPlaceRecommendationReplyImpl::QPlaceRecommendationReplyImpl(QNetworkReply *reply,
- QPlaceManagerEngineNokiaV2 *parent)
- : QPlaceSearchReply(parent), m_reply(reply), m_engine(parent)
-{
- Q_ASSERT(parent);
-
- if (!m_reply)
- return;
-
- m_reply->setParent(this);
- connect(m_reply, SIGNAL(finished()), this, SLOT(replyFinished()));
- connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)),
- this, SLOT(replyError(QNetworkReply::NetworkError)));
-}
-
-QPlaceRecommendationReplyImpl::~QPlaceRecommendationReplyImpl()
-{
-}
-
-void QPlaceRecommendationReplyImpl::abort()
-{
- if (m_reply)
- m_reply->abort();
-}
-
-void QPlaceRecommendationReplyImpl::setError(QPlaceReply::Error error_, const QString &errorString)
-{
- QPlaceReply::setError(error_, errorString);
- emit error(error_, errorString);
- setFinished(true);
- emit finished();
-}
-
-void QPlaceRecommendationReplyImpl::replyFinished()
-{
- QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll());
- if (!document.isObject()) {
- setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR));
- emit error(error(), errorString());
- return;
- }
-
- QJsonObject object = document.object();
-
- //const QUrl next = object.value(QLatin1String("next")).toString();
-
- QJsonArray items = object.value(QLatin1String("items")).toArray();
-
- QList<QPlaceSearchResult> results;
- for (int i = 0; i < items.count(); ++i) {
- QJsonObject item = items.at(i).toObject();
-
- QPlaceResult result;
-
- result.setDistance(item.value(QLatin1String("distance")).toDouble());
-
- QPlace place;
-
- QGeoLocation location;
-
- location.setCoordinate(parseCoordinate(item.value(QLatin1String("position")).toArray()));
-
- const QString vicinity = item.value(QLatin1String("vicinity")).toString();
- QGeoAddress address;
- address.setText(vicinity);
- location.setAddress(address);
-
- place.setLocation(location);
-
- QPlaceRatings ratings;
- ratings.setAverage(item.value(QLatin1String("averageRating")).toDouble());
- ratings.setMaximum(5.0);
- place.setRatings(ratings);
-
- const QString title = item.value(QLatin1String("title")).toString();
- place.setName(title);
- result.setTitle(title);
-
-
- place.setCategories(parseCategories(item.value(QLatin1String("categories")).toArray(),
- m_engine));
-
- QPlaceIcon icon = m_engine->icon(item.value(QLatin1String("icon")).toString(),
- place.categories());
- place.setIcon(icon);
- result.setIcon(icon);
-
- //QJsonArray having = item.value(QLatin1String("having")).toArray();
-
- QUrl href = item.value(QLatin1String("href")).toString();
- place.setPlaceId(href.path().mid(18, 41));
-
- result.setPlace(place);
-
- results.append(result);
- }
-
- setResults(results);
-
- m_reply->deleteLater();
- m_reply = 0;
-
- setFinished(true);
- emit finished();
-}
-
-void QPlaceRecommendationReplyImpl::replyError(QNetworkReply::NetworkError error)
-{
- switch (error) {
- case QNetworkReply::OperationCanceledError:
- setError(CancelError, "Request canceled.");
- break;
- default:
- setError(CommunicationError, "Network error.");
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.h b/src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.h
deleted file mode 100644
index a7a407ef..00000000
--- a/src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-** This file is part of the Nokia services plugin for the Maps and
-** Navigation API. The use of these services, whether by use of the
-** plugin or by other means, is governed by the terms and conditions
-** described by the file NOKIA_TERMS_AND_CONDITIONS.txt in
-** this package, located in the directory containing the Nokia services
-** plugin source code.
-**
-****************************************************************************/
-
-#ifndef QPLACERECOMMENDATIONREPLYIMPL_H
-#define QPLACERECOMMENDATIONREPLYIMPL_H
-
-#include <QtNetwork/QNetworkReply>
-#include <QtLocation/QPlaceSearchReply>
-
-QT_BEGIN_NAMESPACE
-
-class QPlaceManager;
-class QPlaceManagerEngineNokiaV2;
-
-class QPlaceRecommendationReplyImpl : public QPlaceSearchReply
-{
- Q_OBJECT
-
-public:
- QPlaceRecommendationReplyImpl(QNetworkReply *reply, QPlaceManagerEngineNokiaV2 *parent);
- ~QPlaceRecommendationReplyImpl();
-
- void abort();
-
-private slots:
- void setError(QPlaceReply::Error error_, const QString &errorString);
- void replyFinished();
- void replyError(QNetworkReply::NetworkError error);
-
-private:
- QNetworkReply *m_reply;
- QPlaceManagerEngineNokiaV2 *m_engine;
-};
-
-QT_END_NAMESPACE
-
-#endif // QPLACERECOMMENDATIONREPLYIMPL_H
diff --git a/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp
index db97dffb..db42257a 100644
--- a/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp
+++ b/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp
@@ -62,12 +62,15 @@
QT_BEGIN_NAMESPACE
-QPlaceSearchReplyImpl::QPlaceSearchReplyImpl(QNetworkReply *reply,
+QPlaceSearchReplyImpl::QPlaceSearchReplyImpl(const QPlaceSearchRequest &request,
+ QNetworkReply *reply,
QPlaceManagerEngineNokiaV2 *parent)
: QPlaceSearchReply(parent), m_reply(reply), m_engine(parent)
{
Q_ASSERT(parent);
+ setRequest(request);
+
if (!m_reply)
return;
@@ -106,9 +109,13 @@ void QPlaceSearchReplyImpl::replyFinished()
QJsonObject object = document.object();
//QJsonObject searchObject = object.value(QLatin1String("search")).toObject();
-
- QJsonObject resultsObject = object.value(QLatin1String("results")).toObject();
- QJsonArray items = resultsObject.value(QLatin1String("items")).toArray();
+ QJsonArray items;
+ if (request().recommendationId().isEmpty()) {
+ QJsonObject resultsObject = object.value(QLatin1String("results")).toObject();
+ items = resultsObject.value(QLatin1String("items")).toArray();
+ } else {
+ items = object.value(QLatin1String("items")).toArray();
+ }
QList<QPlaceSearchResult> results;
for (int i = 0; i < items.count(); ++i) {
diff --git a/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.h b/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.h
index 2bdc1347..9fd076ec 100644
--- a/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.h
+++ b/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.h
@@ -61,7 +61,8 @@ class QPlaceSearchReplyImpl : public QPlaceSearchReply
Q_OBJECT
public:
- explicit QPlaceSearchReplyImpl(QNetworkReply *reply,
+ explicit QPlaceSearchReplyImpl(const QPlaceSearchRequest &request,
+ QNetworkReply *reply,
QPlaceManagerEngineNokiaV2 *parent);
~QPlaceSearchReplyImpl();
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
index 0ecf0cb0..561574d1 100644
--- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
+++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
@@ -52,7 +52,6 @@
#include "placesv2/qplacecontentreplyimpl.h"
#include "placesv2/qplacesearchsuggestionreplyimpl.h"
#include "placesv2/qplacesearchreplyimpl.h"
-#include "placesv2/qplacerecommendationreplyimpl.h"
#include "placesv2/qplacedetailsreplyimpl.h"
#include "placesv2/qplaceidreplyimpl.h"
#include "qgeonetworkaccessmanager.h"
@@ -382,8 +381,12 @@ QPlaceSearchReply *QPlaceManagerEngineNokiaV2::search(const QPlaceSearchRequest
// Both a search term and search categories are not supported.
unsupported |= !query.searchTerm().isEmpty() && !query.categories().isEmpty();
+ unsupported |= !query.searchTerm().isEmpty() && !query.recommendationId().isEmpty();
+
+ unsupported |= !query.categories().isEmpty() && !query.recommendationId().isEmpty();
+
if (unsupported) {
- QPlaceSearchReplyImpl *reply = new QPlaceSearchReplyImpl(0, this);
+ QPlaceSearchReplyImpl *reply = new QPlaceSearchReplyImpl(query, 0, this);
QMetaObject::invokeMethod(reply, "setError", Qt::QueuedConnection,
Q_ARG(QPlaceReply::Error, QPlaceReply::BadArgumentError),
Q_ARG(QString, "Unsupported search request options specified."));
@@ -413,7 +416,25 @@ QPlaceSearchReply *QPlaceManagerEngineNokiaV2::search(const QPlaceSearchRequest
QNetworkReply *networkReply = sendRequest(requestUrl);
- QPlaceSearchReplyImpl *reply = new QPlaceSearchReplyImpl(networkReply, this);
+ QPlaceSearchReplyImpl *reply = new QPlaceSearchReplyImpl(query, networkReply, this);
+ connect(reply, SIGNAL(finished()), this, SLOT(replyFinished()));
+ connect(reply, SIGNAL(error(QPlaceReply::Error,QString)),
+ this, SLOT(replyError(QPlaceReply::Error,QString)));
+
+ return reply;
+ } else if (!query.recommendationId().isEmpty()) {
+ QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
+ QLatin1String("/places/v1/places/") + query.recommendationId() +
+ QLatin1String("/related/recommended"));
+
+ QUrlQuery queryItems;
+ queryItems.addQueryItem(QLatin1String("tf"), QLatin1String("html"));
+
+ requestUrl.setQuery(queryItems);
+
+ QNetworkReply *networkReply = sendRequest(requestUrl);
+
+ QPlaceSearchReplyImpl *reply = new QPlaceSearchReplyImpl(query, networkReply, this);
connect(reply, SIGNAL(finished()), this, SLOT(replyFinished()));
connect(reply, SIGNAL(error(QPlaceReply::Error,QString)),
this, SLOT(replyError(QPlaceReply::Error,QString)));
@@ -455,7 +476,7 @@ QPlaceSearchReply *QPlaceManagerEngineNokiaV2::search(const QPlaceSearchRequest
QNetworkReply *networkReply = sendRequest(requestUrl);
- QPlaceSearchReplyImpl *reply = new QPlaceSearchReplyImpl(networkReply, this);
+ QPlaceSearchReplyImpl *reply = new QPlaceSearchReplyImpl(query, networkReply, this);
connect(reply, SIGNAL(finished()), this, SLOT(replyFinished()));
connect(reply, SIGNAL(error(QPlaceReply::Error,QString)),
this, SLOT(replyError(QPlaceReply::Error,QString)));
@@ -464,37 +485,6 @@ QPlaceSearchReply *QPlaceManagerEngineNokiaV2::search(const QPlaceSearchRequest
}
}
-QPlaceSearchReply *QPlaceManagerEngineNokiaV2::recommendations(const QString &placeId, const QPlaceSearchRequest &query)
-{
- QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
- QLatin1String("/places/v1/places/") + placeId +
- QLatin1String("/related/recommended"));
-
- QUrlQuery queryItems;
-
- queryItems.addQueryItem(QLatin1String("tf"), QLatin1String("html"));
-
- if (query.limit() > 0) {
- queryItems.addQueryItem(QLatin1String("size"),
- QString::number(query.limit()));
- }
- if (query.offset() > -1) {
- queryItems.addQueryItem(QLatin1String("offset"),
- QString::number(query.offset()));
- }
-
- requestUrl.setQuery(queryItems);
-
- QNetworkReply *networkReply = sendRequest(requestUrl);
-
- QPlaceRecommendationReplyImpl *reply = new QPlaceRecommendationReplyImpl(networkReply, this);
- connect(reply, SIGNAL(finished()), this, SLOT(replyFinished()));
- connect(reply, SIGNAL(error(QPlaceReply::Error,QString)),
- this, SLOT(replyError(QPlaceReply::Error,QString)));
-
- return reply;
-}
-
QPlaceSearchSuggestionReply *QPlaceManagerEngineNokiaV2::searchSuggestions(const QPlaceSearchRequest &query)
{
QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.h b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.h
index ca375ebe..70654db6 100644
--- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.h
+++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.h
@@ -89,7 +89,6 @@ public:
QPlaceSearchReply *search(const QPlaceSearchRequest &query);
- QPlaceSearchReply *recommendations(const QString &placeId, const QPlaceSearchRequest &query);
QPlaceSearchSuggestionReply *searchSuggestions(const QPlaceSearchRequest &query);
QPlaceIdReply *savePlace(const QPlace &place);
diff --git a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp
index eb28eca4..113c4d3c 100644
--- a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp
+++ b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp
@@ -143,15 +143,6 @@ QPlaceSearchReply *QPlaceManagerEngineJsonDb::search(const QPlaceSearchRequest &
return searchReply;
}
-QPlaceSearchReply *QPlaceManagerEngineJsonDb::recommendations(const QString &placeId, const QPlaceSearchRequest &request)
-{
- Q_UNUSED(placeId);
- SearchReply *searchReply = new SearchReply(this);
- searchReply->setRequest(request);
- searchReply->triggerDone(QPlaceReply::UnsupportedError, QString::fromLatin1("Recommendations are unsupported"));
- return searchReply;
-}
-
QPlaceSearchSuggestionReply *QPlaceManagerEngineJsonDb::searchSuggestions(const QPlaceSearchRequest &request)
{
Q_UNUSED(request)
diff --git a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h
index bf8ed9be..4fe905b0 100644
--- a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h
+++ b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h
@@ -82,7 +82,6 @@ public:
QPlaceSearchReply *search(const QPlaceSearchRequest &request);
- QPlaceSearchReply *recommendations(const QString &placeId, const QPlaceSearchRequest &request);
QPlaceSearchSuggestionReply *searchSuggestions(const QPlaceSearchRequest &request);
QPlaceIdReply *savePlace(const QPlace &place);
diff --git a/tests/auto/declarative_core/tst_placerecommendationmodel.qml b/tests/auto/declarative_core/tst_placerecommendationmodel.qml
deleted file mode 100644
index 5a7a200a..00000000
--- a/tests/auto/declarative_core/tst_placerecommendationmodel.qml
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtLocation 5.0
-
-TestCase {
- id: testCase
-
- name: "PlaceRecommendationModel"
-
- PlaceRecommendationModel {
- id: testModel
- }
-
- Plugin {
- id: testPlugin
- name: "qmlgeo.test.plugin"
- }
-
- GeoCircle {
- id: testSearchArea
- center: Coordinate {
- latitude: 10
- longitude: 20
- }
- radius: 5000
- }
-
- function test_setAndGet_data() {
- var myNull = null;
- return [
- { tag: "plugin", property: "plugin", signal: "pluginChanged", value: testPlugin },
- { tag: "searchArea", property: "searchArea", signal: "searchAreaChanged", value: testSearchArea },
- { tag: "offset", property: "offset", signal: "offsetChanged", value: 10, reset: 0 },
- { tag: "limit", property: "limit", signal: "limitChanged", value: 10, reset: -1 },
-
- { tag: "placeId", property: "placeId", signal: "placeIdChanged", value: "test-place-id-1", reset: "" },
- ];
- }
-
- function test_setAndGet(data) {
- var signalSpy = Qt.createQmlObject('import QtTest 1.0; SignalSpy {}', testCase, "SignalSpy");
- signalSpy.target = testModel;
- signalSpy.signalName = data.signal;
-
- // set property to something new
- testModel[data.property] = data.value;
- compare(testModel[data.property], data.value);
- compare(signalSpy.count, 1);
-
- // set property to the same value (signal spy should not increase)
- testModel[data.property] = data.value;
- compare(testModel[data.property], data.value);
- compare(signalSpy.count, 1);
-
- // reset property
- if (data.reset === undefined) {
- testModel[data.property] = null;
- compare(testModel[data.property], null);
- } else {
- testModel[data.property] = data.reset;
- compare(testModel[data.property], data.reset);
- }
- compare(signalSpy.count, 2);
-
- signalSpy.destroy();
- }
-}
diff --git a/tests/auto/geotestplugin/qplacemanagerengine_test.h b/tests/auto/geotestplugin/qplacemanagerengine_test.h
index c04035e4..ac5e2509 100644
--- a/tests/auto/geotestplugin/qplacemanagerengine_test.h
+++ b/tests/auto/geotestplugin/qplacemanagerengine_test.h
@@ -188,14 +188,6 @@ public:
return 0;
}
- QPlaceSearchReply *recommendations(const QString &placeId, const QPlaceSearchRequest &query)
- {
- Q_UNUSED(placeId)
- Q_UNUSED(query)
-
- return 0;
- }
-
QPlaceSearchSuggestionReply *searchSuggestions(const QPlaceSearchRequest &query)
{
Q_UNUSED(query)
diff --git a/tests/auto/qplacemanager_unsupported/tst_qplacemanager_unsupported.cpp b/tests/auto/qplacemanager_unsupported/tst_qplacemanager_unsupported.cpp
index 67cc30c0..2672e0b2 100644
--- a/tests/auto/qplacemanager_unsupported/tst_qplacemanager_unsupported.cpp
+++ b/tests/auto/qplacemanager_unsupported/tst_qplacemanager_unsupported.cpp
@@ -65,7 +65,6 @@ private Q_SLOTS:
void testGetPlaceDetails();
void testGetPlaceContent();
void testSearch();
- void testRecommendations();
void testSearchSuggestions();
void testSavePlace();
@@ -156,13 +155,6 @@ void tst_QPlaceManagerUnsupported::testSearch()
return;
}
-void tst_QPlaceManagerUnsupported::testRecommendations()
-{
- QPlaceSearchReply *reply = m_manager->recommendations(QString());
- if (!checkSignals(reply, QPlaceReply::UnsupportedError))
- return;
-}
-
void tst_QPlaceManagerUnsupported::testSearchSuggestions()
{
QPlaceSearchSuggestionReply *reply = m_manager->searchSuggestions(QPlaceSearchRequest());