summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2012-05-01 15:40:52 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-09 00:44:19 +0200
commit6e63524d0c175fd1ef7c8ccfd047041622198fda (patch)
tree45294cc5f2b610e3c99a52b7e526c22dd723c8fa /src
parent405ac7c7c4de6d26c2fd8a8f18e306d2526f3e55 (diff)
downloadqtlocation-6e63524d0c175fd1ef7c8ccfd047041622198fda.tar.gz
Add cancel() method to GeocodeModel and RouteModel.
Change-Id: If575f519425da01ad2052bd2d98e36453149d05c Reviewed-by: Alex Wilson <alex.wilson@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/imports/location/qdeclarativegeocodemodel.cpp14
-rw-r--r--src/imports/location/qdeclarativegeocodemodel_p.h1
-rw-r--r--src/imports/location/qdeclarativegeoroutemodel.cpp14
-rw-r--r--src/imports/location/qdeclarativegeoroutemodel_p.h1
4 files changed, 30 insertions, 0 deletions
diff --git a/src/imports/location/qdeclarativegeocodemodel.cpp b/src/imports/location/qdeclarativegeocodemodel.cpp
index 96771ac6..5e908ca5 100644
--- a/src/imports/location/qdeclarativegeocodemodel.cpp
+++ b/src/imports/location/qdeclarativegeocodemodel.cpp
@@ -604,6 +604,20 @@ void QDeclarativeGeocodeModel::reset()
}
/*!
+ \qmlmethod QtLocation5::GeocodeModel::cancel()
+
+ Cancels any outstanding requests and clears errors. Model status will be set to either
+ GeocodeModel.Null or GeocodeModel.Ready.
+*/
+void QDeclarativeGeocodeModel::cancel()
+{
+ abortRequest();
+ setErrorString(QString());
+ setError(NoError);
+ setStatus(declarativeLocations_.isEmpty() ? Null : Ready);
+}
+
+/*!
\qmlproperty QVariant QtLocation5::GeocodeModel::query
This property holds the data of the geocoding request.
diff --git a/src/imports/location/qdeclarativegeocodemodel_p.h b/src/imports/location/qdeclarativegeocodemodel_p.h
index 7ed33cfa..acbde061 100644
--- a/src/imports/location/qdeclarativegeocodemodel_p.h
+++ b/src/imports/location/qdeclarativegeocodemodel_p.h
@@ -134,6 +134,7 @@ public:
QVariant query() const;
void setQuery(const QVariant& query);
Q_INVOKABLE void reset();
+ Q_INVOKABLE void cancel();
Q_SIGNALS:
void countChanged();
diff --git a/src/imports/location/qdeclarativegeoroutemodel.cpp b/src/imports/location/qdeclarativegeoroutemodel.cpp
index fb081aac..50aa4df0 100644
--- a/src/imports/location/qdeclarativegeoroutemodel.cpp
+++ b/src/imports/location/qdeclarativegeoroutemodel.cpp
@@ -179,6 +179,20 @@ void QDeclarativeGeoRouteModel::reset()
}
/*!
+ \qmlmethod QtLocation5::RouteModel::cancel()
+
+ Cancels any outstanding requests and clears errors. Model status will be set to either
+ RouteModel.Null or RouteModel.Ready.
+*/
+void QDeclarativeGeoRouteModel::cancel()
+{
+ abortRequest();
+ setErrorString(QString());
+ setError(NoError);
+ setStatus(routes_.isEmpty() ? Null : Ready);
+}
+
+/*!
\internal
*/
void QDeclarativeGeoRouteModel::abortRequest()
diff --git a/src/imports/location/qdeclarativegeoroutemodel_p.h b/src/imports/location/qdeclarativegeoroutemodel_p.h
index 346f9768..45daa391 100644
--- a/src/imports/location/qdeclarativegeoroutemodel_p.h
+++ b/src/imports/location/qdeclarativegeoroutemodel_p.h
@@ -126,6 +126,7 @@ public:
int count() const;
Q_INVOKABLE QDeclarativeGeoRoute* get(int index);
Q_INVOKABLE void reset();
+ Q_INVOKABLE void cancel();
Q_SIGNALS:
void countChanged();