summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/nokia_places_jsondb
diff options
context:
space:
mode:
authorabcd <amos.choy@nokia.com>2011-12-30 20:52:56 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-05 05:03:12 +0100
commita7b2989a6b7cf401d4772c41a93664046fe1724f (patch)
tree35243db14c155f041af09191b0567cacce5f9141 /src/plugins/geoservices/nokia_places_jsondb
parent8035b14d0d5f7ca0f696c9a994a90e4e5c5efacd (diff)
downloadqtlocation-a7b2989a6b7cf401d4772c41a93664046fe1724f.tar.gz
Don't check the for the db connection anymore.
the connection is no longer used in jsondb Change-Id: I07a8c5466508f9b6d36dede805b03c288bf08a26 Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/plugins/geoservices/nokia_places_jsondb')
-rw-r--r--src/plugins/geoservices/nokia_places_jsondb/detailsreply.cpp5
-rw-r--r--src/plugins/geoservices/nokia_places_jsondb/idreply.cpp20
-rw-r--r--src/plugins/geoservices/nokia_places_jsondb/idreply.h1
-rw-r--r--src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp60
-rw-r--r--src/plugins/geoservices/nokia_places_jsondb/searchreply.cpp5
5 files changed, 28 insertions, 63 deletions
diff --git a/src/plugins/geoservices/nokia_places_jsondb/detailsreply.cpp b/src/plugins/geoservices/nokia_places_jsondb/detailsreply.cpp
index c57e08d8..c737a902 100644
--- a/src/plugins/geoservices/nokia_places_jsondb/detailsreply.cpp
+++ b/src/plugins/geoservices/nokia_places_jsondb/detailsreply.cpp
@@ -60,11 +60,6 @@ void DetailsReply::setPlaceId(const QString &placeId)
void DetailsReply::start()
{
- if (!db()->isConnected()) {
- triggerDone(QPlaceReply::CommunicationError, QLatin1String("No connection to jsondb database"));
- return;
- }
-
connect(db(), SIGNAL(response(int,QVariant)), this, SLOT(processResponse(int,QVariant)));
connect(db(), SIGNAL(error(int,int,QString)), this, SLOT(processError(int,int,QString)));
diff --git a/src/plugins/geoservices/nokia_places_jsondb/idreply.cpp b/src/plugins/geoservices/nokia_places_jsondb/idreply.cpp
index c15385cf..27ba0861 100644
--- a/src/plugins/geoservices/nokia_places_jsondb/idreply.cpp
+++ b/src/plugins/geoservices/nokia_places_jsondb/idreply.cpp
@@ -88,15 +88,6 @@ void IdReply::start()
{
}
-bool IdReply::checkConnection() {
- if (!db()->isConnected()) {
- triggerDone(QPlaceReply::CommunicationError, QLatin1String("No connection to jsondb database"));
- return false;
- }
-
- return true;
-}
-
SavePlaceReply::SavePlaceReply(QPlaceManagerEngineJsonDb *engine)
: IdReply(QPlaceIdReply::SavePlace, engine)
{
@@ -114,8 +105,6 @@ void SavePlaceReply::setPlace(const QPlace &place)
void SavePlaceReply::start()
{
- if (!IdReply::checkConnection())
- return;
connect(db(), SIGNAL(response(int,QVariant)), this, SLOT(processResponse(int,QVariant)));
connect(db(), SIGNAL(error(int,int,QString)), this, SLOT(processError(int,int,QString)));
@@ -246,9 +235,6 @@ void RemovePlaceReply::setId(const QString &placeId)
void RemovePlaceReply::start()
{
- if (!IdReply::checkConnection())
- return;
-
connect(db(), SIGNAL(response(int,QVariant)), this, SLOT(processResponse(int,QVariant)));
connect(db(), SIGNAL(error(int,int,QString)), this, SLOT(processError(int,int,QString)));
@@ -338,9 +324,6 @@ void SaveCategoryReply::setParentId(const QString &parentId)
void SaveCategoryReply::start()
{
- if (!IdReply::checkConnection())
- return;
-
connect(db(), SIGNAL(response(int,QVariant)), this, SLOT(processResponse(int,QVariant)));
connect(db(), SIGNAL(error(int,int,QString)), this, SLOT(processError(int,int,QString)));
@@ -495,9 +478,6 @@ void RemoveCategoryReply::setId(const QString &categoryId)
void RemoveCategoryReply::start()
{
- if (!IdReply::checkConnection())
- return;
-
connect(db(), SIGNAL(response(int,QVariant)), this, SLOT(processResponse(int,QVariant)));
connect(db(), SIGNAL(error(int,int,QString)), this, SLOT(processError(int,int,QString)));
diff --git a/src/plugins/geoservices/nokia_places_jsondb/idreply.h b/src/plugins/geoservices/nokia_places_jsondb/idreply.h
index 91c60c7a..d6ee0aa8 100644
--- a/src/plugins/geoservices/nokia_places_jsondb/idreply.h
+++ b/src/plugins/geoservices/nokia_places_jsondb/idreply.h
@@ -69,7 +69,6 @@ public:
protected:
QPlaceManagerEngineJsonDb *m_engine;
- bool checkConnection();
JsonDbClient *db() { return m_engine->db();}
private:
diff --git a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp
index 07931314..bd012067 100644
--- a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp
+++ b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp
@@ -68,39 +68,35 @@ QPlaceManagerEngineJsonDb::QPlaceManagerEngineJsonDb(const QMap<QString, QVarian
qRegisterMetaType<QPlaceCategory>();
m_db = new JsonDbClient(this);
- if (!m_db->isConnected()) {
- *error = QGeoServiceProvider::ConnectionError;
- *errorString = QLatin1String("JsonDb is not connected");
- } else {
- connect(m_db, SIGNAL(response(int,QVariant)),
- this, SLOT(processJsonDbResponse(int,QVariant)));
- connect(m_db, SIGNAL(error(int,int,QString)),
- this, SLOT(processJsonDbError(int,int,QString)));
- connect(m_db, SIGNAL(notified(QString,QVariant,QString)),
- this, SLOT(processJsonDbNotification(QString,QVariant,QString)));
-
- //Setup notifications
- QVariantMap notificationMap;
- QVariantList actions;
- notificationMap.insert(JsonConverter::Type, JsonConverter::NotificationType);
- notificationMap.insert(QLatin1String("query"),
- QString::fromLatin1("[?%1 = \"%2\" | %1 = \"%3\" ]")
- .arg(JsonConverter::Type).arg(JsonConverter::PlaceType).arg(JsonConverter::CategoryType));
- actions.append(JsonConverter::Create);
- actions.append(JsonConverter::Update);
- actions.append(JsonConverter::Remove);
- notificationMap.insert(JsonConverter::Actions, actions);
-
- connect(m_db, SIGNAL(response(int,QVariant)),
- this, SLOT(setupNotificationsResponse(int,QVariant)));
- connect(m_db, SIGNAL(error(int,int,QString)),
- this, SLOT(setupNotificationsError(int,int,QString)));
- m_notificationReqId = m_db->create(notificationMap);
-
- *error = QGeoServiceProvider::NoError;
- errorString->clear();
- }
+ connect(m_db, SIGNAL(response(int,QVariant)),
+ this, SLOT(processJsonDbResponse(int,QVariant)));
+ connect(m_db, SIGNAL(error(int,int,QString)),
+ this, SLOT(processJsonDbError(int,int,QString)));
+ connect(m_db, SIGNAL(notified(QString,QVariant,QString)),
+ this, SLOT(processJsonDbNotification(QString,QVariant,QString)));
+
+ //Setup notifications
+ QVariantMap notificationMap;
+ QVariantList actions;
+ notificationMap.insert(JsonConverter::Type, JsonConverter::NotificationType);
+ notificationMap.insert(QLatin1String("query"),
+ QString::fromLatin1("[?%1 = \"%2\" | %1 = \"%3\" ]")
+ .arg(JsonConverter::Type).arg(JsonConverter::PlaceType).arg(JsonConverter::CategoryType));
+ actions.append(JsonConverter::Create);
+ actions.append(JsonConverter::Update);
+ actions.append(JsonConverter::Remove);
+ notificationMap.insert(JsonConverter::Actions, actions);
+
+ connect(m_db, SIGNAL(response(int,QVariant)),
+ this, SLOT(setupNotificationsResponse(int,QVariant)));
+ connect(m_db, SIGNAL(error(int,int,QString)),
+ this, SLOT(setupNotificationsError(int,int,QString)));
+
+ m_notificationReqId = m_db->create(notificationMap);
+
+ *error = QGeoServiceProvider::NoError;
+ errorString->clear();
}
QPlaceManagerEngineJsonDb::~QPlaceManagerEngineJsonDb()
diff --git a/src/plugins/geoservices/nokia_places_jsondb/searchreply.cpp b/src/plugins/geoservices/nokia_places_jsondb/searchreply.cpp
index be46ff8b..662c4a49 100644
--- a/src/plugins/geoservices/nokia_places_jsondb/searchreply.cpp
+++ b/src/plugins/geoservices/nokia_places_jsondb/searchreply.cpp
@@ -67,11 +67,6 @@ void SearchReply::setRequest(const QPlaceSearchRequest &request)
void SearchReply::start()
{
- if (!db()->isConnected()) {
- triggerDone(QPlaceReply::CommunicationError, "No connection to jsondb database");
- return;
- }
-
connect(db(), SIGNAL(response(int,QVariant)), this, SLOT(processResponse(int,QVariant)));
connect(db(), SIGNAL(error(int,int,QString)), this, SLOT(processError(int,int,QString)));