diff options
author | abcd <amos.choy@nokia.com> | 2012-06-18 17:45:59 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-21 07:42:36 +0200 |
commit | 9e6adfbec01e164793cbd08684524547f31972e1 (patch) | |
tree | 966dc3903b4b548e3f7c1245e3aea36056a136aa /examples/declarative/places | |
parent | 7343a401cd740a65d430fba4fa01abd7c601f4ef (diff) | |
download | qtlocation-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>
Diffstat (limited to 'examples/declarative/places')
-rw-r--r-- | examples/declarative/places/content/places/SearchResultView.qml | 24 | ||||
-rw-r--r-- | examples/declarative/places/places.qml | 28 |
2 files changed, 15 insertions, 37 deletions
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 } } ] |