summaryrefslogtreecommitdiffstats
path: root/plugins/geoservices
diff options
context:
space:
mode:
authorVladimir Bezkorovainyi <vladimir.bezkorovainyi@nokia.com>2011-07-20 15:52:27 +0200
committerVladimir Bezkorovainyi <vladimir.bezkorovainyi@nokia.com>2011-07-20 15:52:27 +0200
commit59da29664a8c1b7f96fb6f5c316247dbcde3c2af (patch)
tree063b41cdd451b394ab4f1e344fe3279c17f04a62 /plugins/geoservices
parent2d65ba8590d4c189832e25bed6f4b719284bf1e9 (diff)
parentd41735afd1c1e17faf3a00c220c823defee70868 (diff)
Merge branch 'maps-api' of scm.dev.nokia.troll.no:qtmobility/qtm-location into maps-api
Diffstat (limited to 'plugins/geoservices')
-rw-r--r--plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp23
-rw-r--r--plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.h9
-rw-r--r--plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.cpp15
-rw-r--r--plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.h8
4 files changed, 51 insertions, 4 deletions
diff --git a/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp b/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp
index 74ace4edd1..53b4629f3d 100644
--- a/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp
+++ b/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp
@@ -58,7 +58,8 @@ QGeoRoutingManagerEngineNokia::QGeoRoutingManagerEngineNokia(const QMap<QString,
: QGeoRoutingManagerEngine(parameters),
m_host("prd.lbsp.navteq.com"),
m_token(QGeoServiceProviderFactoryNokia::defaultToken),
- m_referer(QGeoServiceProviderFactoryNokia::defaultReferer)
+ m_referer(QGeoServiceProviderFactoryNokia::defaultReferer),
+ m_serviceDisabled(false)
{
m_networkManager = new QNetworkAccessManager(this);
@@ -128,12 +129,16 @@ QGeoRoutingManagerEngineNokia::QGeoRoutingManagerEngineNokia(const QMap<QString,
QGeoRouteRequest::SegmentDetails segmentDetails;
segmentDetails |= QGeoRouteRequest::BasicSegmentData;
setSupportedSegmentDetails(segmentDetails);
-
if (error)
*error = QGeoServiceProvider::NoError;
if (errorString)
*errorString = "";
+#ifdef USE_CHINA_NETWORK_REGISTRATION
+ connect(&m_networkInfo, SIGNAL(currentMobileCountryCodeChanged(const QString&)), SLOT(currentMobileCountryCodeChanged(const QString&)));
+ currentMobileCountryCodeChanged(m_networkInfo.currentMobileCountryCode());
+#endif
+
}
QGeoRoutingManagerEngineNokia::~QGeoRoutingManagerEngineNokia() {}
@@ -142,7 +147,7 @@ QGeoRouteReply* QGeoRoutingManagerEngineNokia::calculateRoute(const QGeoRouteReq
{
QString reqString = calculateRouteRequestString(request);
- if (reqString.isEmpty()) {
+ if (reqString.isEmpty() || m_serviceDisabled) {
QGeoRouteReply *reply = new QGeoRouteReply(QGeoRouteReply::UnsupportedOptionError, "The given route request options are not supported by this service provider.", this);
emit error(reply, reply->error(), reply->errorString());
return reply;
@@ -168,7 +173,7 @@ QGeoRouteReply* QGeoRoutingManagerEngineNokia::updateRoute(const QGeoRoute &rout
{
QString reqString = updateRouteRequestString(route, position);
- if (reqString.isEmpty()) {
+ if (reqString.isEmpty() || m_serviceDisabled) {
QGeoRouteReply *reply = new QGeoRouteReply(QGeoRouteReply::UnsupportedOptionError, "The given route request options are not supported by this service provider.", this);
emit error(reply, reply->error(), reply->errorString());
return reply;
@@ -476,3 +481,13 @@ void QGeoRoutingManagerEngineNokia::routeError(QGeoRouteReply::Error error, cons
emit this->error(reply, error, errorString);
}
+
+void QGeoRoutingManagerEngineNokia::currentMobileCountryCodeChanged(const QString & mcc)
+{
+ if(mcc == "460" || mcc == "461"){
+ m_serviceDisabled=true;
+ }
+ else{
+ m_serviceDisabled=false;
+ }
+}
diff --git a/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.h b/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.h
index 5382104bf6..438078dfb6 100644
--- a/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.h
+++ b/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.h
@@ -54,6 +54,9 @@
#include <qgeoserviceprovider.h>
#include <qgeoroutingmanagerengine.h>
#include <QNetworkAccessManager>
+#ifdef USE_CHINA_NETWORK_REGISTRATION
+#include "../../../src/systeminfo/qsystemnetworkinfo.h"
+#endif
QTM_USE_NAMESPACE
@@ -72,6 +75,7 @@ public:
private slots:
void routeFinished();
void routeError(QGeoRouteReply::Error error, const QString &errorString);
+ void currentMobileCountryCodeChanged(const QString& mcc);
private:
QString calculateRouteRequestString(const QGeoRouteRequest &request);
@@ -87,6 +91,11 @@ private:
QString m_host;
QString m_token;
QString m_referer;
+ bool m_serviceDisabled;
+#ifdef USE_CHINA_NETWORK_REGISTRATION
+ QSystemNetworkInfo m_networkInfo;
+#endif
+
};
#endif
diff --git a/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.cpp b/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.cpp
index 04db58be18..5ca882deac 100644
--- a/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.cpp
+++ b/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.cpp
@@ -108,6 +108,11 @@ QGeoSearchManagerEngineNokia::QGeoSearchManagerEngineNokia(const QMap<QString, Q
if (errorString)
*errorString = "";
+#ifdef USE_CHINA_NETWORK_REGISTRATION
+ connect(&m_networkInfo, SIGNAL(currentMobileCountryCodeChanged(const QString&)), SLOT(currentMobileCountryCodeChanged(const QString&)));
+ currentMobileCountryCodeChanged(m_networkInfo.currentMobileCountryCode());
+#endif
+
}
QGeoSearchManagerEngineNokia::~QGeoSearchManagerEngineNokia() {}
@@ -297,3 +302,13 @@ void QGeoSearchManagerEngineNokia::placesError(QGeoSearchReply::Error error, con
emit this->error(reply, error, errorString);
}
+
+void QGeoSearchManagerEngineNokia::currentMobileCountryCodeChanged(const QString & mcc)
+{
+ if(mcc == "460" || mcc == "461"){
+ m_host="pr.geo.maps.svc.ovi.com.cn";
+ }
+ else{
+ m_host ="loc.desktop.maps.svc.ovi.com";
+ }
+}
diff --git a/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.h b/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.h
index 5fad069c91..19a252513f 100644
--- a/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.h
+++ b/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.h
@@ -57,6 +57,10 @@
#include <QNetworkAccessManager>
#include <QLocale>
+#ifdef USE_CHINA_NETWORK_REGISTRATION
+#include "../../../src/systeminfo/qsystemnetworkinfo.h"
+#endif
+
QTM_USE_NAMESPACE
@@ -83,6 +87,7 @@ public:
private slots:
void placesFinished();
void placesError(QGeoSearchReply::Error error, const QString &errorString);
+ void currentMobileCountryCodeChanged(const QString& mcc);
private:
static QString trimDouble(double degree, int decimalDigits = 10);
@@ -92,6 +97,9 @@ private:
QString m_host;
QString m_token;
QString m_referer;
+#ifdef USE_CHINA_NETWORK_REGISTRATION
+ QSystemNetworkInfo m_networkInfo;
+#endif
};
#endif