summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabcd <qt-info@nokia.com>2011-08-08 13:47:01 +1000
committerabcd <qt_abcd1@ovi.com>2011-08-10 05:11:05 +0200
commit256f631e4e3848b4548706522edaebfc96adc546 (patch)
tree4718537fe9f3bfa45eeaf760f510854dabcafe0b
parent4e570cc94fd10dd92ec1dbb117964d3a9748f48b (diff)
downloadqtlocation-256f631e4e3848b4548706522edaebfc96adc546.tar.gz
Add PlaceSaveReply class
Change-Id: I3baab99ef01992555f97b6d7274c8adc6b773683 Reviewed-on: http://codereview.qt.nokia.com/2722 Reviewed-by: abcd <qt_abcd1@ovi.com>
-rw-r--r--src/location/places/places.pri2
-rw-r--r--src/location/places/qplacemanager.cpp2
-rw-r--r--src/location/places/qplacemanager.h3
-rw-r--r--src/location/places/qplacemanagerengine.h2
-rw-r--r--src/location/places/qplacereply.h3
-rw-r--r--src/location/places/qplacesavereply.cpp110
-rw-r--r--src/location/places/qplacesavereply.h71
-rw-r--r--src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp2
-rw-r--r--src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h2
-rw-r--r--tests/auto/geotestplugin/qplacemanagerengine_test.h2
10 files changed, 192 insertions, 7 deletions
diff --git a/src/location/places/places.pri b/src/location/places/places.pri
index 784ed7a1..b29247d6 100644
--- a/src/location/places/places.pri
+++ b/src/location/places/places.pri
@@ -24,6 +24,7 @@ PUBLIC_HEADERS += \
places/qplacedetailsreply.h \
places/qplacemediareply.h \
places/qplacereviewreply.h \
+ places/qplacesavereply.h \
places/qplacesearchreply.h \
places/qplacetextpredictionreply.h \
#manager and engine
@@ -57,6 +58,7 @@ SOURCES += \
places/qplaceperiod.cpp \
places/qplacerating.cpp \
places/qplacereview.cpp \
+ places/qplacesavereply.cpp \
places/qplacesupplier.cpp \
places/qplaceweekdayhours.cpp \
#result
diff --git a/src/location/places/qplacemanager.cpp b/src/location/places/qplacemanager.cpp
index 752d423f..047edc3b 100644
--- a/src/location/places/qplacemanager.cpp
+++ b/src/location/places/qplacemanager.cpp
@@ -209,7 +209,7 @@ QPlaceManager::ConnectivityModes QPlaceManager::supportedConnectivityModes() con
/*!
Saves a \a place at the given \a scope.
*/
-QPlaceReply *QPlaceManager::savePlace(QGeoPlace *place, VisibilityScope scope)
+QPlaceSaveReply *QPlaceManager::savePlace(const QGeoPlace &place, VisibilityScope scope)
{
return d->engine->savePlace(place, scope);
}
diff --git a/src/location/places/qplacemanager.h b/src/location/places/qplacemanager.h
index 6023e3fb..569c76fa 100644
--- a/src/location/places/qplacemanager.h
+++ b/src/location/places/qplacemanager.h
@@ -46,6 +46,7 @@
#include "qplacemediaobject.h"
#include "qplacemediareply.h"
#include "qplacequery.h"
+#include "qplacesavereply.h"
#include "qplacereply.h"
#include "qplacesearchreply.h"
#include "qplacedetailsreply.h"
@@ -124,7 +125,7 @@ public:
void setConnectivityMode(ConnectivityModes connectivityMode);
ConnectivityModes supportedConnectivityModes() const;
- QPlaceReply *savePlace(QGeoPlace *place, VisibilityScope scope);
+ QPlaceSaveReply *savePlace(const QGeoPlace &place, VisibilityScope scope = QPlaceManager::NoScope);
VisibilityScopes supportedSaveVisibilityScopes();
QPlaceReply *removePlace(const QGeoPlace &place);
diff --git a/src/location/places/qplacemanagerengine.h b/src/location/places/qplacemanagerengine.h
index e83a77fa..324ea953 100644
--- a/src/location/places/qplacemanagerengine.h
+++ b/src/location/places/qplacemanagerengine.h
@@ -76,7 +76,7 @@ public:
virtual void setConnectivityMode(QPlaceManager::ConnectivityModes mode) = 0;
virtual QPlaceManager::ConnectivityModes supportedConnectivityModes() const = 0;
- virtual QPlaceReply *savePlace(QGeoPlace *place, QPlaceManager::VisibilityScope scope) = 0;
+ virtual QPlaceSaveReply *savePlace(const QGeoPlace &place, QPlaceManager::VisibilityScope scope) = 0;
virtual QPlaceManager::VisibilityScopes supportedSaveVisibilityScopes() const = 0;
virtual QPlaceReply *removePlace(const QGeoPlace &place) = 0;
diff --git a/src/location/places/qplacereply.h b/src/location/places/qplacereply.h
index 0cf59025..5a73cffb 100644
--- a/src/location/places/qplacereply.h
+++ b/src/location/places/qplacereply.h
@@ -71,7 +71,8 @@ public:
PlaceSearchReply,
TextPredictionReply,
ReviewReply,
- MediaReply
+ MediaReply,
+ SaveReply
};
QPlaceReply(QObject *parent);
diff --git a/src/location/places/qplacesavereply.cpp b/src/location/places/qplacesavereply.cpp
new file mode 100644
index 00000000..d9d5f24b
--- /dev/null
+++ b/src/location/places/qplacesavereply.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplacesavereply.h"
+#include "qplacereply_p.h"
+
+QT_BEGIN_NAMESPACE
+class QPlaceSaveReplyPrivate : public QPlaceReplyPrivate
+{
+public:
+ QPlaceSaveReplyPrivate() {}
+ ~QPlaceSaveReplyPrivate() {}
+ QGeoPlace place;
+};
+
+QT_END_NAMESPACE
+
+QT_USE_NAMESPACE
+
+/*!
+ \class QPlaceSaveReply
+
+ \brief The QPlaceSaveReply class manages a place save operation started by an
+ instance of QPlaceManager.
+
+ \inmodule QtPlaces
+
+ \ingroup places-main
+*/
+
+/*!
+ Constructs a save reply with a given \a parent.
+*/
+QPlaceSaveReply::QPlaceSaveReply(QObject *parent)
+ : QPlaceReply(new QPlaceSaveReplyPrivate, parent)
+{
+}
+
+/*!
+ Destroys the save reply.
+*/
+QPlaceSaveReply::~QPlaceSaveReply()
+{
+}
+
+/*!
+ Returns the type of reply.
+*/
+QPlaceReply::Type QPlaceSaveReply::type() const
+{
+ return QPlaceReply::SaveReply;
+}
+
+ /*!
+ Returns the saved place. One should ensure that the reply
+ is finished before calling this function, otherwise
+ a default place is returned.
+*/
+QGeoPlace QPlaceSaveReply::place() const
+{
+ Q_D(const QPlaceSaveReply);
+ return d->place;
+}
+
+/*!
+ Sets the saved \a place.
+*/
+void QPlaceSaveReply::setPlace(const QGeoPlace &place)
+{
+ Q_D(QPlaceSaveReply);
+ d->place = place;
+}
diff --git a/src/location/places/qplacesavereply.h b/src/location/places/qplacesavereply.h
new file mode 100644
index 00000000..bc794963
--- /dev/null
+++ b/src/location/places/qplacesavereply.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLACESAVEREPLY_H
+#define QPLACESAVEREPLY_H
+
+#include "qplacereply.h"
+#include "qgeoplace.h"
+
+QT_BEGIN_NAMESPACE
+
+class QPlaceSaveReplyPrivate;
+class Q_LOCATION_EXPORT QPlaceSaveReply : public QPlaceReply
+{
+ Q_OBJECT
+public:
+ QPlaceSaveReply(QObject *parent =0);
+ virtual ~QPlaceSaveReply();
+
+ QPlaceReply::Type type() const;
+
+ QGeoPlace place() const;
+
+protected:
+ void setPlace(const QGeoPlace &place);
+private:
+ Q_DISABLE_COPY(QPlaceSaveReply)
+ Q_DECLARE_PRIVATE(QPlaceSaveReply)
+};
+
+QT_END_NAMESPACE
+
+#endif // QPLACEDETAILSREPLY_H
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp
index 6350d21f..5edb91df 100644
--- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp
@@ -223,7 +223,7 @@ QPlaceManager::ConnectivityModes QPlaceManagerEngineNokia::supportedConnectivity
return QPlaceManager::OnlineMode;
}
-QPlaceReply *QPlaceManagerEngineNokia::savePlace(QGeoPlace *place, QPlaceManager::VisibilityScope scope) {
+QPlaceSaveReply *QPlaceManagerEngineNokia::savePlace(const QGeoPlace &place, QPlaceManager::VisibilityScope scope) {
//TODO: implementation
return NULL;
}
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h
index fa366bb7..0a42a648 100644
--- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h
+++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h
@@ -81,7 +81,7 @@ public:
void setConnectivityMode(QPlaceManager::ConnectivityModes connectivityMode);
QPlaceManager::ConnectivityModes supportedConnectivityModes() const;
- QPlaceReply *savePlace(QGeoPlace *place, QPlaceManager::VisibilityScope scope);
+ QPlaceSaveReply *savePlace(const QGeoPlace &place, QPlaceManager::VisibilityScope scope);
QPlaceManager::VisibilityScopes supportedSaveVisibilityScopes() const;
QPlaceReply *removePlace(const QGeoPlace &place);
diff --git a/tests/auto/geotestplugin/qplacemanagerengine_test.h b/tests/auto/geotestplugin/qplacemanagerengine_test.h
index cf126516..c3d0f4d2 100644
--- a/tests/auto/geotestplugin/qplacemanagerengine_test.h
+++ b/tests/auto/geotestplugin/qplacemanagerengine_test.h
@@ -119,7 +119,7 @@ public:
return QPlaceManager::OnlineMode;
}
- QPlaceReply *savePlace(QGeoPlace *place, QPlaceManager::VisibilityScope scope)
+ QPlaceSaveReply *savePlace(const QGeoPlace &place, QPlaceManager::VisibilityScope scope)
{
return 0;
}