summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/nokia
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2015-03-18 08:10:47 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-04-02 05:13:07 +0000
commit3cbd12a732d775dada857b9995a84c6fdc7b0bf1 (patch)
tree03466aed3be76bf76f47d77dfbea495d5888e264 /src/plugins/geoservices/nokia
parente589217bbf671a738a055652a1b19cfaa6f32099 (diff)
downloadqtlocation-3cbd12a732d775dada857b9995a84c6fdc7b0bf1.tar.gz
Add new Here standard categories
This is based on: http://places.api.here.com/places/static/doc/public/#topics/categories.html Change-Id: I13d5e35d769d80e3c5121bd0c2db5be3414fe099 Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/plugins/geoservices/nokia')
-rw-r--r--src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
index 5a0f3d0d..c94ea390 100644
--- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
+++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
@@ -72,11 +72,20 @@ static const char FIXED_CATEGORIES_string[] =
"leisure-outdoor\0"
"administrative-areas-buildings\0"
"natural-geographical\0"
+ "petrol-station\0"
+ "atm-bank-exchange\0"
+ "toilet-rest-area\0"
+ "hospital-health-care-facility\0"
+ "eat-drink|restaurant\0" // subcategories always start after relative parent category
+ "eat-drink|coffee-tea\0"
+ "eat-drink|snacks-fast-food\0"
+ "transport|airport"
"\0";
static const int FIXED_CATEGORIES_indices[] = {
0, 10, 20, 35, 45, 59, 68, 84,
- 115, -1
+ 115, 136, 151, 169, 186, 216, 237, 258,
+ 285, -1
};
static const char * const NokiaIcon = "nokiaIcon";
@@ -588,11 +597,29 @@ QPlaceReply *QPlaceManagerEngineNokiaV2::initializeCategories()
const QString id = QString::fromLatin1(FIXED_CATEGORIES_string +
FIXED_CATEGORIES_indices[i]);
- PlaceCategoryNode node;
- node.category.setCategoryId(id);
+ int subCatDivider = id.indexOf(QChar('|'));
+ if (subCatDivider >= 0) {
+ // found a sub category
+ const QString subCategoryId = id.mid(subCatDivider+1);
+ const QString parentCategoryId = id.left(subCatDivider);
- m_tempTree.insert(id, node);
- rootNode.childIds.append(id);
+ if (m_tempTree.contains(parentCategoryId)) {
+ PlaceCategoryNode node;
+ node.category.setCategoryId(subCategoryId);
+
+ // find parent
+ PlaceCategoryNode &parent = m_tempTree[parentCategoryId];
+ parent.childIds.append(subCategoryId);
+ m_tempTree.insert(subCategoryId, node);
+ }
+
+ } else {
+ PlaceCategoryNode node;
+ node.category.setCategoryId(id);
+
+ m_tempTree.insert(id, node);
+ rootNode.childIds.append(id);
+ }
}
m_tempTree.insert(QString(), rootNode);