summaryrefslogtreecommitdiff
path: root/src/location/places
diff options
context:
space:
mode:
authorabcd <qt-info@nokia.com>2011-09-02 10:57:00 +1000
committerabcd <qt_abcd1@ovi.com>2011-09-06 09:46:34 +0200
commit1cc33bb7ef8ab997a9ffe841857a39533ba09f31 (patch)
tree22aadaceae210d1dd64ad42ffde102b0c773f419 /src/location/places
parenta385d5889925c3effe468fed5835f59707da92da (diff)
downloadqtlocation-1cc33bb7ef8ab997a9ffe841857a39533ba09f31.tar.gz
Add place add/updated/removed signals + refactor Remove
These signals indicate changes to the database. These 3 signals are provided rather than a single placesChanged() signal because it gives greater granularity. E.g. if a place is removed, we may want to know precisely which one it is so we can remove it from a model. For the SearchResultmodel whenever a place is added, updated, or deleted we reload the model by executing the query again. For now in the jsondb plugin implement signal emission manually whenever a request is finished. In a future change we will use proper jsondb notifications. For the online plugins, we do not expect these signals to be emitted. Also place removal now uses the QPlaceIdReply. Change-Id: I29f5aaaa6b8152abe1f5305a4d52abc721e6915e Reviewed-on: http://codereview.qt.nokia.com/4109 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: abcd <qt_abcd1@ovi.com>
Diffstat (limited to 'src/location/places')
-rw-r--r--src/location/places/qplacemanager.cpp34
-rw-r--r--src/location/places/qplacemanager.h6
-rw-r--r--src/location/places/qplacemanagerengine.cpp25
-rw-r--r--src/location/places/qplacemanagerengine.h6
4 files changed, 68 insertions, 3 deletions
diff --git a/src/location/places/qplacemanager.cpp b/src/location/places/qplacemanager.cpp
index b66cd111..d2f55e20 100644
--- a/src/location/places/qplacemanager.cpp
+++ b/src/location/places/qplacemanager.cpp
@@ -106,6 +106,13 @@ QPlaceManager::QPlaceManager(QPlaceManagerEngine *engine, QObject *parent)
this, SIGNAL(error(QPlaceReply*,QPlaceReply::Error)));
connect(d->engine,SIGNAL(authenticationRequired(QAuthenticator*)),
this, SIGNAL(authenticationRequired(QAuthenticator*)));
+
+ connect(d->engine, SIGNAL(placeAdded(QString)),
+ this, SIGNAL(placeAdded(QString)), Qt::QueuedConnection);
+ connect(d->engine, SIGNAL(placeUpdated(QString)),
+ this, SIGNAL(placeUpdated(QString)), Qt::QueuedConnection);
+ connect(d->engine, SIGNAL(placeRemoved(QString)),
+ this, SIGNAL(placeRemoved(QString)), Qt::QueuedConnection);
} else {
qFatal("The place manager engine that was set for this place manager was NULL.");
}
@@ -211,7 +218,7 @@ QPlaceIdReply *QPlaceManager::savePlace(const QGeoPlace &place, VisibilityScope
/*!
Removes a \a place from the manager
*/
-QPlaceReply *QPlaceManager::removePlace(const QGeoPlace &place)
+QPlaceIdReply *QPlaceManager::removePlace(const QGeoPlace &place)
{
return d->engine->removePlace(place);
}
@@ -307,3 +314,28 @@ Use deleteLater() instead.
If authentication is unsuccessful, the manager will emit the signal again.
*/
+
+/*!
+ \fn void QPlaceManager::placeAdded(const QString&placeId)
+
+ This signal is emitted if a place has been added to the manager's datastore.
+
+ It is generally only emitted by managers that store places locally.
+
+*/
+
+/*!
+ \fn void QPlaceManager::placeUpdated(const QString&placeId)
+
+ This signal is emitted if a place has been modified in the manager's datastore.
+
+ It is generally only emitted by managers that store places locally.
+*/
+
+/*!
+ \fn void QPlaceManager::placeRemoved(const QString&placeId)
+
+ This signal is emitted if a place has been removed from the manager's datastore.
+
+ It is generally only emitted by managers that store places locally.
+*/
diff --git a/src/location/places/qplacemanager.h b/src/location/places/qplacemanager.h
index e3881d70..984ecd42 100644
--- a/src/location/places/qplacemanager.h
+++ b/src/location/places/qplacemanager.h
@@ -125,7 +125,7 @@ public:
QPlaceIdReply *savePlace(const QGeoPlace &place, VisibilityScope scope = QPlaceManager::NoScope);
VisibilityScopes supportedSaveVisibilityScopes();
- QPlaceReply *removePlace(const QGeoPlace &place);
+ QPlaceIdReply *removePlace(const QGeoPlace &place);
QPlaceReply *initializeCategories();
QList<QPlaceCategory> categories(const QPlaceCategory &parent = QPlaceCategory()) const;
@@ -140,6 +140,10 @@ Q_SIGNALS:
void error(QPlaceReply *, QPlaceReply::Error error, const QString &errorString = QString());
void authenticationRequired(QAuthenticator *authenticator);
+ void placeAdded(const QString &placeId);
+ void placeUpdated(const QString &placeId);
+ void placeRemoved(const QString &placeId);
+
private:
QPlaceManager(QPlaceManagerEngine *engine, QObject *parent = 0);
diff --git a/src/location/places/qplacemanagerengine.cpp b/src/location/places/qplacemanagerengine.cpp
index 6b5155fc..77c87f4f 100644
--- a/src/location/places/qplacemanagerengine.cpp
+++ b/src/location/places/qplacemanagerengine.cpp
@@ -153,6 +153,31 @@ QPlaceManagerEnginePrivate::~QPlaceManagerEnginePrivate()
{
}
+/*!
+ \fn void QPlaceManagerEngine::placeAdded(const QString&placeId)
+
+ This signal is emitted if a place has been added to the manager engine's datastore.
+
+ It is generally only emitted by managers that store places locally.
+
+*/
+
+/*!
+ \fn void QPlaceManagerEngine::placeUpdated(const QString&placeId)
+
+ This signal is emitted if a place has been modified in the manager engine's datastore.
+
+ It is generally only emitted by managers that store places locally.
+*/
+
+/*!
+ \fn void QPlaceManagerEngine::placeRemoved(const QString&placeId)
+
+ This signal is emitted if a place has been removed from the manager engine's datastore.
+
+ It is generally only emitted by managers that store places locally.
+*/
+
#include "moc_qplacemanagerengine.cpp"
QT_END_NAMESPACE
diff --git a/src/location/places/qplacemanagerengine.h b/src/location/places/qplacemanagerengine.h
index 82312368..6902a151 100644
--- a/src/location/places/qplacemanagerengine.h
+++ b/src/location/places/qplacemanagerengine.h
@@ -77,7 +77,7 @@ public:
virtual QPlaceIdReply *savePlace(const QGeoPlace &place, QPlaceManager::VisibilityScope scope) = 0;
virtual QPlaceManager::VisibilityScopes supportedSaveVisibilityScopes() const = 0;
- virtual QPlaceReply *removePlace(const QGeoPlace &place) = 0;
+ virtual QPlaceIdReply *removePlace(const QGeoPlace &place) = 0;
virtual QPlaceReply *initializeCategories() = 0;
virtual QList<QPlaceCategory> categories(const QPlaceCategory &parent) const = 0;
@@ -90,6 +90,10 @@ Q_SIGNALS:
void error(QPlaceReply *, QPlaceReply::Error error, QString errorString = QString());
void authenticationRequired(QAuthenticator *authenticator);
+ void placeAdded(const QString &placeId);
+ void placeUpdated(const QString &placeId);
+ void placeRemoved(const QString &placeId);
+
private:
void setManagerName(const QString &managerName);
void setManagerVersion(int managerVersion);