diff options
15 files changed, 65 insertions, 32 deletions
diff --git a/src/plugins/geoservices/nokia/nokia.pro b/src/plugins/geoservices/nokia/nokia.pro index 647a0a4e..f9c6a5cc 100644 --- a/src/plugins/geoservices/nokia/nokia.pro +++ b/src/plugins/geoservices/nokia/nokia.pro @@ -8,6 +8,7 @@ contains(QT_CONFIG, location-china-support) { } PLUGIN_TYPE = geoservices +PLUGIN_CLASS_NAME = NokiaGeoServicePlugin load(qt_plugin) HEADERS += \ diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp index 5543d001..30ad5808 100644 --- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp +++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp @@ -600,39 +600,43 @@ QPlaceReply *QPlaceManagerEngineNokiaV2::initializeCategories() if (m_categoryReply) return m_categoryReply.data(); - m_tempTree.clear(); - CategoryParser parser; + m_tempTree.clear(); + CategoryParser parser; - if (!parser.parse(m_localDataPath + QLatin1String("/offline/offline-mapping.json"))) { - PlaceCategoryNode rootNode; + if (parser.parse(m_localDataPath + QLatin1String("/offline/offline-mapping.json"))) { + m_tempTree = parser.tree(); + } else { + PlaceCategoryNode rootNode; - for (int i = 0; FIXED_CATEGORIES_indices[i] != -1; ++i) { - const QString id = QString::fromLatin1(FIXED_CATEGORIES_string + - FIXED_CATEGORIES_indices[i]); - m_tempTree.insert(id, PlaceCategoryNode()); - rootNode.childIds.append(id); - } + for (int i = 0; FIXED_CATEGORIES_indices[i] != -1; ++i) { + const QString id = QString::fromLatin1(FIXED_CATEGORIES_string + + FIXED_CATEGORIES_indices[i]); - m_tempTree.insert(QString(), rootNode); - } else { - m_tempTree = parser.tree(); - } + PlaceCategoryNode node; + node.category.setCategoryId(id); - //request all categories in the tree from the server - //because we don't want the root node, we remove it from the list - QStringList ids = m_tempTree.keys(); - ids.removeAll(QString()); - foreach (const QString &id, ids) { - QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() + - QLatin1String("/places/v1/categories/places/") + id); - QNetworkReply *networkReply = sendRequest(requestUrl); - connect(networkReply, SIGNAL(finished()), this, SLOT(categoryReplyFinished())); - connect(networkReply, SIGNAL(error(QNetworkReply::NetworkError)), - this, SLOT(categoryReplyError())); - - m_categoryRequests.insert(id, networkReply); + m_tempTree.insert(id, node); + rootNode.childIds.append(id); } + m_tempTree.insert(QString(), rootNode); + } + + //request all categories in the tree from the server + //because we don't want the root node, we remove it from the list + QStringList ids = m_tempTree.keys(); + ids.removeAll(QString()); + foreach (const QString &id, ids) { + QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() + + QLatin1String("/places/v1/categories/places/") + id); + QNetworkReply *networkReply = sendRequest(requestUrl); + connect(networkReply, SIGNAL(finished()), this, SLOT(categoryReplyFinished())); + connect(networkReply, SIGNAL(error(QNetworkReply::NetworkError)), + this, SLOT(categoryReplyError())); + + m_categoryRequests.insert(id, networkReply); + } + QPlaceCategoriesReplyImpl *reply = new QPlaceCategoriesReplyImpl(this); connect(reply, SIGNAL(finished()), this, SLOT(replyFinished())); connect(reply, SIGNAL(error(QPlaceReply::Error,QString)), @@ -764,6 +768,8 @@ void QPlaceManagerEngineNokiaV2::categoryReplyFinished() if (!reply) return; + QString categoryId; + if (reply->error() == QNetworkReply::NoError) { QJsonDocument document = QJsonDocument::fromJson(reply->readAll()); if (!document.isObject()) { @@ -777,7 +783,7 @@ void QPlaceManagerEngineNokiaV2::categoryReplyFinished() QJsonObject category = document.object(); - QString categoryId = category.value(QLatin1String("categoryId")).toString(); + categoryId = category.value(QLatin1String("categoryId")).toString(); if (m_tempTree.contains(categoryId)) { PlaceCategoryNode node = m_tempTree.value(categoryId); node.category.setName(category.value(QLatin1String("name")).toString()); @@ -786,14 +792,23 @@ void QPlaceManagerEngineNokiaV2::categoryReplyFinished() m_tempTree.insert(categoryId, node); } + } else { + categoryId = m_categoryRequests.key(reply); + PlaceCategoryNode rootNode = m_tempTree.value(QString()); + rootNode.childIds.removeAll(categoryId); + m_tempTree.insert(QString(), rootNode); + m_tempTree.remove(categoryId); } - m_categoryRequests.remove(m_categoryRequests.key(reply)); + m_categoryRequests.remove(categoryId); reply->deleteLater(); - if (m_categoryRequests.isEmpty() && m_categoryReply) { + if (m_categoryRequests.isEmpty()) { m_categoryTree = m_tempTree; - m_categoryReply.data()->emitFinished(); + m_tempTree.clear(); + + if (m_categoryReply) + m_categoryReply.data()->emitFinished(); } } diff --git a/src/plugins/geoservices/osm/osm.pro b/src/plugins/geoservices/osm/osm.pro index 897ebbfc..cb82aeaa 100644 --- a/src/plugins/geoservices/osm/osm.pro +++ b/src/plugins/geoservices/osm/osm.pro @@ -2,6 +2,7 @@ TARGET = qtgeoservices_osm QT += location-private positioning-private network PLUGIN_TYPE = geoservices +PLUGIN_CLASS_NAME = OSMGeoServicePlugin load(qt_plugin) HEADERS += \ diff --git a/src/plugins/position/android/src/src.pro b/src/plugins/position/android/src/src.pro index a61b77b5..4f1e4412 100644 --- a/src/plugins/position/android/src/src.pro +++ b/src/plugins/position/android/src/src.pro @@ -2,6 +2,7 @@ TARGET = qtposition_android QT = core positioning PLUGIN_TYPE = position +PLUGIN_CLASS_NAME = AndroidPositionPlugin load(qt_plugin) diff --git a/src/plugins/position/blackberry/blackberry.pro b/src/plugins/position/blackberry/blackberry.pro index e3543107..852f6dc7 100644 --- a/src/plugins/position/blackberry/blackberry.pro +++ b/src/plugins/position/blackberry/blackberry.pro @@ -2,6 +2,7 @@ TARGET = qtposition_blackberry QT = core positioning PLUGIN_TYPE = position +PLUGIN_CLASS_NAME = BBPositionPlugin load(qt_plugin) INCLUDEPATH += $$QT.location.includes diff --git a/src/plugins/position/corelocation/corelocation.pro b/src/plugins/position/corelocation/corelocation.pro index 1a1a2a39..544d825a 100644 --- a/src/plugins/position/corelocation/corelocation.pro +++ b/src/plugins/position/corelocation/corelocation.pro @@ -2,7 +2,7 @@ TARGET = qtposition_cl QT = core positioning PLUGIN_TYPE = position -PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryCL +PLUGIN_CLASS_NAME = IOSPositionPlugin load(qt_plugin) INCLUDEPATH += $$QT.location.includes diff --git a/src/plugins/position/geoclue/geoclue.pro b/src/plugins/position/geoclue/geoclue.pro index 5c318645..9db7839f 100644 --- a/src/plugins/position/geoclue/geoclue.pro +++ b/src/plugins/position/geoclue/geoclue.pro @@ -2,6 +2,7 @@ TARGET = qtposition_geoclue QT = core positioning PLUGIN_TYPE = position +PLUGIN_CLASS_NAME = GeoCluePositionPlugin load(qt_plugin) HEADERS += \ diff --git a/src/plugins/position/gypsy/gypsy.pro b/src/plugins/position/gypsy/gypsy.pro index f67d41e7..3bd9b144 100644 --- a/src/plugins/position/gypsy/gypsy.pro +++ b/src/plugins/position/gypsy/gypsy.pro @@ -2,6 +2,7 @@ TARGET = qtposition_gypsy QT = core positioning PLUGIN_TYPE = position +PLUGIN_CLASS_NAME = GypsyPositionPlugin load(qt_plugin) HEADERS += \ diff --git a/src/plugins/position/positionpoll/positionpoll.pro b/src/plugins/position/positionpoll/positionpoll.pro index 1b7e38f5..4af58327 100644 --- a/src/plugins/position/positionpoll/positionpoll.pro +++ b/src/plugins/position/positionpoll/positionpoll.pro @@ -2,6 +2,7 @@ TARGET = qtposition_positionpoll QT = core positioning PLUGIN_TYPE = position +PLUGIN_CLASS_NAME = PollPositionPlugin load(qt_plugin) SOURCES += \ diff --git a/src/plugins/position/simulator/simulator.pro b/src/plugins/position/simulator/simulator.pro index 17948ca5..18d12dfb 100644 --- a/src/plugins/position/simulator/simulator.pro +++ b/src/plugins/position/simulator/simulator.pro @@ -2,6 +2,7 @@ TARGET = qtposition_simulator QT = core network positioning PLUGIN_TYPE = position +PLUGIN_CLASS_NAME = SimulatorPositionPlugin load(qt_plugin) INCLUDEPATH += $$QT.location.includes diff --git a/tests/auto/geotestplugin/geotestplugin.pro b/tests/auto/geotestplugin/geotestplugin.pro index 2519b7d0..4b50989f 100644 --- a/tests/auto/geotestplugin/geotestplugin.pro +++ b/tests/auto/geotestplugin/geotestplugin.pro @@ -2,6 +2,8 @@ TARGET = qtgeoservices_qmltestplugin QT += location-private positioning-private testlib PLUGIN_TYPE = geoservices +PLUGIN_CLASS_NAME = TestGeoServicePlugin +PLUGIN_EXTENDS = - load(qt_plugin) HEADERS += qgeocodingmanagerengine_test.h \ diff --git a/tests/auto/placesplugin_unsupported/placesplugin_unsupported.pro b/tests/auto/placesplugin_unsupported/placesplugin_unsupported.pro index 6e10c8c9..e5d04cb3 100644 --- a/tests/auto/placesplugin_unsupported/placesplugin_unsupported.pro +++ b/tests/auto/placesplugin_unsupported/placesplugin_unsupported.pro @@ -2,6 +2,8 @@ TARGET = qtgeoservices_placesplugin_unsupported QT += location PLUGIN_TYPE = geoservices +PLUGIN_CLASS_NAME = UnsupportedPlacesGeoServicePlugin +PLUGIN_EXTENDS = - load(qt_plugin) HEADERS += qgeoserviceproviderplugin_test.h diff --git a/tests/auto/positionplugin/positionplugin.pro b/tests/auto/positionplugin/positionplugin.pro index 768e6864..0575acbf 100644 --- a/tests/auto/positionplugin/positionplugin.pro +++ b/tests/auto/positionplugin/positionplugin.pro @@ -2,6 +2,8 @@ TARGET = qtposition_testplugin QT += positioning PLUGIN_TYPE = position +PLUGIN_CLASS_NAME = TestPositionPlugin +PLUGIN_EXTENDS = - load(qt_plugin) SOURCES += plugin.cpp diff --git a/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerplugins.pro b/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerplugins.pro index d0e0854a..8f34477e 100644 --- a/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerplugins.pro +++ b/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerplugins.pro @@ -2,6 +2,8 @@ TARGET = qtgeoservices_geocodingplugin QT += location PLUGIN_TYPE = geoservices +PLUGIN_CLASS_NAME = GeocodingTestGeoServicePlugin +PLUGIN_EXTENDS = - load(qt_plugin) HEADERS += qgeocodingmanagerengine_test.h \ diff --git a/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro b/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro index cb17bcc6..08913d88 100644 --- a/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro +++ b/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro @@ -2,6 +2,8 @@ TARGET = qtgeoservices_routingplugin QT += location PLUGIN_TYPE = geoservices +PLUGIN_CLASS_NAME = RoutingTestGeoServicePlugin +PLUGIN_EXTENDS = - load(qt_plugin) HEADERS += qgeoroutingmanagerengine_test.h \ |