diff options
35 files changed, 385 insertions, 159 deletions
diff --git a/src/imports/location/declarativeplaces/qdeclarativecategory.cpp b/src/imports/location/declarativeplaces/qdeclarativecategory.cpp index 28ff1b7c..488f016c 100644 --- a/src/imports/location/declarativeplaces/qdeclarativecategory.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativecategory.cpp @@ -120,3 +120,17 @@ QString QDeclarativeCategory::name() const { return m_category.name(); } + +QDeclarativeCategory::Visibility QDeclarativeCategory::visibility() const +{ + return static_cast<QDeclarativeCategory::Visibility>(m_category.visibility()); +} + +void QDeclarativeCategory::setVisibility(Visibility visibility) +{ + if (static_cast<QDeclarativeCategory::Visibility>(m_category.visibility()) == visibility) + return; + + m_category.setVisibility(static_cast<QtLocation::Visibility>(visibility)); + emit visibilityChanged(); +} diff --git a/src/imports/location/declarativeplaces/qdeclarativecategory_p.h b/src/imports/location/declarativeplaces/qdeclarativecategory_p.h index 764a89fa..dc544be7 100644 --- a/src/imports/location/declarativeplaces/qdeclarativecategory_p.h +++ b/src/imports/location/declarativeplaces/qdeclarativecategory_p.h @@ -53,14 +53,24 @@ class QDeclarativeCategory : public QObject { Q_OBJECT + Q_ENUMS(Visibility) + Q_PROPERTY(QString categoryId READ categoryId WRITE setCategoryId NOTIFY categoryIdChanged) Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged) public: explicit QDeclarativeCategory(QObject* parent = 0); explicit QDeclarativeCategory(const QPlaceCategory &category, QObject* parent = 0); ~QDeclarativeCategory(); + enum Visibility { + UnspecifiedVisibility = QtLocation::UnspecifiedVisibility, + DeviceVisibility = QtLocation::DeviceVisibility, + PrivateVisibility = QtLocation::PrivateVisibility, + PublicVisibility = QtLocation::PublicVisibility + }; + QPlaceCategory category(); void setCategory(const QPlaceCategory &category); @@ -69,9 +79,13 @@ public: QString name() const; void setName(const QString &name); + Visibility visibility() const; + void setVisibility(Visibility visibility); + signals: void categoryIdChanged(); void nameChanged(); + void visibilityChanged(); private: QPlaceCategory m_category; diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp index 71235c09..f752e511 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp @@ -746,6 +746,20 @@ void QDeclarativePlace::suppliers_clear(QDeclarativeListProperty<QDeclarativeSup emit object->suppliersChanged(); } +QDeclarativePlace::Visibility QDeclarativePlace::visibility() const +{ + return static_cast<QDeclarativePlace::Visibility>(m_src.visibility()); +} + +void QDeclarativePlace::setVisibility(Visibility visibility) +{ + if (static_cast<QDeclarativePlace::Visibility>(m_src.visibility()) == visibility) + return; + + m_src.setVisibility(static_cast<QtLocation::Visibility>(visibility)); + emit visibilityChanged(); +} + void QDeclarativePlace::synchronizeSuppliers() { qDeleteAll(m_suppliers); diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace_p.h b/src/imports/location/declarativeplaces/qdeclarativeplace_p.h index 526fe9ac..bd09d36c 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplace_p.h +++ b/src/imports/location/declarativeplaces/qdeclarativeplace_p.h @@ -64,7 +64,7 @@ class QDeclarativePlace : public QObject, public QDeclarativeParserStatus { Q_OBJECT - Q_ENUMS(Status) + Q_ENUMS(Status Visibility) Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged) Q_PROPERTY(QDeclarativeListProperty<QDeclarativeCategory> categories READ categories NOTIFY categoriesChanged) @@ -83,19 +83,27 @@ class QDeclarativePlace : public QObject, public QDeclarativeParserStatus Q_PROPERTY(bool detailsFetched READ detailsFetched WRITE setDetailsFetched NOTIFY detailsFetchedChanged); Q_PROPERTY(Status status READ status NOTIFY statusChanged); - Q_INTERFACES(QDeclarativeParserStatus) - Q_PROPERTY(QString primaryPhone READ primaryPhone WRITE setPrimaryPhone NOTIFY primaryPhoneChanged); Q_PROPERTY(QString primaryFax READ primaryFax WRITE setPrimaryFax NOTIFY primaryFaxChanged); Q_PROPERTY(QString primaryEmail READ primaryEmail WRITE setPrimaryEmail NOTIFY primaryEmailChanged); Q_PROPERTY(QUrl primaryUrl READ primaryUrl WRITE setPrimaryUrl NOTIFY primaryUrlChanged); + Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged) + + Q_INTERFACES(QDeclarativeParserStatus) + public: explicit QDeclarativePlace(QObject* parent = 0); explicit QDeclarativePlace(const QPlace &src, QObject* parent = 0); ~QDeclarativePlace(); enum Status {Ready, Saving, Fetching, Removing, Error}; + enum Visibility { + UnspecifiedVisibility = QtLocation::UnspecifiedVisibility, + DeviceVisibility = QtLocation::DeviceVisibility, + PrivateVisibility = QtLocation::PrivateVisibility, + PublicVisibility = QtLocation::PublicVisibility + }; //From QDeclarativeParserStatus virtual void classBegin() {} @@ -161,6 +169,9 @@ public: QDeclarativePropertyMap *extendedAttributes() const; void setExtendedAttributes(QDeclarativePropertyMap *attrib); + Visibility visibility() const; + void setVisibility(Visibility visibility); + signals: void pluginChanged(); void categoriesChanged(); @@ -184,6 +195,7 @@ signals: void extendedAttributesChanged(); void statusChanged(); + void visibilityChanged(); private slots: void finished(); diff --git a/src/imports/location/declarativeplaces/qdeclarativerecommendationmodel.cpp b/src/imports/location/declarativeplaces/qdeclarativerecommendationmodel.cpp index 0e5ae3bd..84b0b789 100644 --- a/src/imports/location/declarativeplaces/qdeclarativerecommendationmodel.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativerecommendationmodel.cpp @@ -44,6 +44,7 @@ #include <QtDeclarative/QDeclarativeInfo> #include <QtLocation/QGeoServiceProvider> +#include <QtLocation/QPlaceManager> #include <qplacesearchreply.h> diff --git a/src/imports/location/declarativeplaces/qdeclarativesearchmodelbase.h b/src/imports/location/declarativeplaces/qdeclarativesearchmodelbase.h index ec822547..6a8fe139 100644 --- a/src/imports/location/declarativeplaces/qdeclarativesearchmodelbase.h +++ b/src/imports/location/declarativeplaces/qdeclarativesearchmodelbase.h @@ -46,11 +46,13 @@ #include <QtDeclarative/QDeclarativeParserStatus> #include <QtLocation/QPlaceSearchRequest> #include <QtLocation/QPlaceSearchResult> +#include <QtLocation/QPlaceReply> #include "qdeclarativegeoserviceprovider_p.h" QT_BEGIN_NAMESPACE +class QPlaceManager; class QPlaceSearchRequest; class QPlaceSearchReply; class QDeclarativePlace; diff --git a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp index 748f4555..6e89abd3 100644 --- a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp @@ -45,6 +45,7 @@ #include <QtDeclarative/QDeclarativeInfo> #include <QtLocation/QGeoServiceProvider> #include <QtLocation/QPlaceSearchReply> +#include <QtLocation/QPlaceManager> QT_USE_NAMESPACE @@ -316,6 +317,27 @@ void QDeclarativeSearchResultModel::setDidYouMean(int didYouMeanSuggestionNumber emit didYouMeanChanged(); } +/*! + \qmlproperty QDeclarativePlace::Visibility SearchResultModel::visibilityScope + + This property holds the visibility scope of the places to search. +*/ +QDeclarativePlace::Visibility QDeclarativeSearchResultModel::visibilityScope() const +{ + return QDeclarativePlace::Visibility(int(m_visibilityScope)); +} + +void QDeclarativeSearchResultModel::setVisibilityScope(QDeclarativePlace::Visibility visibilityScope) +{ + QtLocation::VisibilityScope scope = QtLocation::VisibilityScope(visibilityScope); + + if (m_visibilityScope == scope) + return; + + m_visibilityScope = scope; + emit visibilityScopeChanged(); +} + void QDeclarativeSearchResultModel::clearData() { qDeleteAll(m_places); diff --git a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h index 3cabc26f..d294e5bb 100644 --- a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h +++ b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h @@ -44,6 +44,7 @@ #include "qdeclarativesearchmodelbase.h" #include "qdeclarativecategory_p.h" +#include "qdeclarativeplace_p.h" QT_BEGIN_NAMESPACE @@ -57,6 +58,7 @@ class QDeclarativeSearchResultModel : public QDeclarativeSearchModelBase Q_PROPERTY(QDeclarativeCategory *searchCategory READ searchCategory WRITE setSearchCategory NOTIFY searchCategoryChanged) Q_PROPERTY(int didYouMean READ didYouMean WRITE setDidYouMean NOTIFY didYouMeanChanged) Q_PROPERTY(RelevanceHint relevanceHint READ relevanceHint WRITE setRelevanceHint NOTIFY relevanceHintChanged) + Q_PROPERTY(QDeclarativePlace::Visibility visibilityScope READ visibilityScope WRITE setVisibilityScope NOTIFY visibilityScopeChanged) Q_ENUMS(SearchResultType RelevanceHint) @@ -90,6 +92,9 @@ public: int didYouMean() const; void setDidYouMean(int dym); + QDeclarativePlace::Visibility visibilityScope() const; + void setVisibilityScope(QDeclarativePlace::Visibility visibilityScope); + void clearData(); void updateSearchRequest(); void processReply(QPlaceReply *reply); @@ -112,6 +117,7 @@ signals: void searchCategoryChanged(); void didYouMeanChanged(); void relevanceHintChanged(); + void visibilityScopeChanged(); protected: QPlaceReply *sendQuery(QPlaceManager *manager, const QPlaceSearchRequest &request); @@ -122,6 +128,7 @@ private: QList<QPlaceSearchResult> m_results; QMap<QString, QDeclarativePlace *> m_places; QDeclarativeCategory m_category; + QtLocation::VisibilityScope m_visibilityScope; QPlaceManager *m_placeManager; }; diff --git a/src/location/location.pro b/src/location/location.pro index df4b9937..f4f5b43a 100644 --- a/src/location/location.pro +++ b/src/location/location.pro @@ -36,7 +36,8 @@ PUBLIC_HEADERS += \ qnmeapositioninfosource.h \ qgeopositioninfosourcefactory.h \ qlatin1constant.h \ - qmobilitypluginsearch.h + qmobilitypluginsearch.h \ + qtlocation.h PRIVATE_HEADERS += \ qgeoaddress_p.h \ @@ -151,7 +152,8 @@ SOURCES += \ qlocationutils.cpp \ qnmeapositioninfosource.cpp \ qgeoareamonitor_polling.cpp \ - qgeopositioninfosourcefactory.cpp + qgeopositioninfosourcefactory.cpp \ + qtlocation.cpp symbian { INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE diff --git a/src/location/places/qplacecategory.cpp b/src/location/places/qplacecategory.cpp index 7dce7f4e..9996207c 100644 --- a/src/location/places/qplacecategory.cpp +++ b/src/location/places/qplacecategory.cpp @@ -42,32 +42,22 @@ #include "qplacecategory.h" #include "qplacecategory_p.h" -#include "qplacemanagerengine.h" - -QT_USE_NAMESPACE +QT_BEGIN_NAMESPACE QPlaceCategoryPrivate::QPlaceCategoryPrivate() - : QSharedData() +: visibility(QtLocation::UnspecifiedVisibility) { } QPlaceCategoryPrivate::QPlaceCategoryPrivate(const QPlaceCategoryPrivate &other) - : QSharedData() +: categoryId(other.categoryId), name(other.name), visibility(other.visibility) { - this->categoryId = other.categoryId; - this->name = other.name; } QPlaceCategoryPrivate::~QPlaceCategoryPrivate() { } -bool QPlaceCategoryPrivate::operator==(const QPlaceCategoryPrivate &other) const -{ - return (this->categoryId == other.categoryId) - && (this->name == other.name); -} - /*! \class QPlaceCategory @@ -116,7 +106,9 @@ QPlaceCategory &QPlaceCategory::operator =(const QPlaceCategory &other) { bool QPlaceCategory::operator==(const QPlaceCategory &other) const { - return (*(d.constData()) == *(other.d.constData())); + return d->categoryId == other.d->categoryId && + d->name == other.d->name && + d->visibility == other.d->visibility; } /*! @@ -150,3 +142,21 @@ void QPlaceCategory::setName(const QString &name) { d->name = name; } + +/*! + Sets the visibility of the category to \a visibility. +*/ +void QPlaceCategory::setVisibility(QtLocation::Visibility visibility) +{ + d->visibility = visibility; +} + +/*! + Returns the visibility of the category. +*/ +QtLocation::Visibility QPlaceCategory::visibility() const +{ + return d->visibility; +} + +QT_END_NAMESPACE diff --git a/src/location/places/qplacecategory.h b/src/location/places/qplacecategory.h index 8bb60049..4a2e88d2 100644 --- a/src/location/places/qplacecategory.h +++ b/src/location/places/qplacecategory.h @@ -42,10 +42,10 @@ #ifndef QPLACECATEGORY_H #define QPLACECATEGORY_H -#include <QSharedDataPointer> -#include <QString> -#include <QVariant> -#include <QList> +#include <QtCore/QSharedDataPointer> +#include <QtCore/QString> +#include <QtCore/QMetaType> +#include <QtLocation/qtlocation.h> QT_BEGIN_HEADER @@ -53,8 +53,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(Location) -class QPlaceManagerEngine; - class QPlaceCategoryPrivate; class Q_LOCATION_EXPORT QPlaceCategory { @@ -76,6 +74,9 @@ public: QString name() const; void setName(const QString &name); + QtLocation::Visibility visibility() const; + void setVisibility(QtLocation::Visibility visibility); + private: QSharedDataPointer<QPlaceCategoryPrivate> d; }; diff --git a/src/location/places/qplacecategory_p.h b/src/location/places/qplacecategory_p.h index 4f37c566..b856435d 100644 --- a/src/location/places/qplacecategory_p.h +++ b/src/location/places/qplacecategory_p.h @@ -42,9 +42,9 @@ #ifndef QPLACECATEGORY_P_H #define QPLACECATEGORY_P_H -#include <QSharedData> - -#include "qplacecategory.h" +#include <QtCore/QSharedData> +#include <QtCore/QString> +#include <QtLocation/qtlocation.h> QT_BEGIN_NAMESPACE @@ -56,10 +56,9 @@ public: ~QPlaceCategoryPrivate(); - bool operator==(const QPlaceCategoryPrivate &other) const; - QString categoryId; QString name; + QtLocation::Visibility visibility; }; QT_END_NAMESPACE diff --git a/src/location/places/qplacemanager.cpp b/src/location/places/qplacemanager.cpp index 76463bc0..d21973ef 100644 --- a/src/location/places/qplacemanager.cpp +++ b/src/location/places/qplacemanager.cpp @@ -58,14 +58,6 @@ QT_BEGIN_NAMESPACE */ /*! - \enum QPlaceManager::SearchVisibilityScope - Defines the scope for searching places according to visibility. - \value PublicSearch Searches will only be conducted on public places. - \value PrivateSearch Searches will only be conducted on private places. - \value PublicAndPrivateSearch Searches will be conducted on both public and private places -*/ - -/*! \enum QPlaceManager::ManagerFeature Defines the possible features that the place manager can possible. \value ImportFeature The manager supports import operations @@ -192,20 +184,12 @@ QPlaceTextPredictionReply *QPlaceManager::textPredictions(const QPlaceSearchRequ return d->textPredictions(request); } -/* - Returns the available scopes in which places can be saved. -*/ -QPlaceManager::VisibilityScopes QPlaceManager::supportedSaveVisibilityScopes() -{ - return d->supportedSaveVisibilityScopes(); -} - /*! Saves a \a place at the given \a scope. */ -QPlaceIdReply *QPlaceManager::savePlace(const QPlace &place, VisibilityScope scope) +QPlaceIdReply *QPlaceManager::savePlace(const QPlace &place) { - return d->savePlace(place, scope); + return d->savePlace(place); } /*! diff --git a/src/location/places/qplacemanager.h b/src/location/places/qplacemanager.h index f4ed60f5..9006c0a0 100644 --- a/src/location/places/qplacemanager.h +++ b/src/location/places/qplacemanager.h @@ -70,15 +70,6 @@ class Q_LOCATION_EXPORT QPlaceManager : public QObject { Q_OBJECT public: - enum VisibilityScope { - NoScope = 0x0000, - PublicScope = 0x0001, - PrivateScope = 0x0002, - PublicAndPrivateScope = 0x0007 - }; - - Q_DECLARE_FLAGS(VisibilityScopes, VisibilityScope) - enum ManagerFeature { ImportFeature, ExportFeature, @@ -112,9 +103,8 @@ public: QPlaceTextPredictionReply *textPredictions(const QPlaceSearchRequest &request) const; - QPlaceIdReply *savePlace(const QPlace &place, VisibilityScope scope = QPlaceManager::NoScope); + QPlaceIdReply *savePlace(const QPlace &place); QPlaceIdReply *removePlace(const QPlace &place); - VisibilityScopes supportedSaveVisibilityScopes(); QPlaceIdReply *saveCategory(const QPlaceCategory &category, const QString &parentId = QString()); QPlaceIdReply *removeCategory(const QString &categoryId); @@ -152,8 +142,6 @@ private: friend class QGeoServiceProvider; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QPlaceManager::VisibilityScopes); - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/location/places/qplacemanagerengine.cpp b/src/location/places/qplacemanagerengine.cpp index 245a9ea7..78f5d4d3 100644 --- a/src/location/places/qplacemanagerengine.cpp +++ b/src/location/places/qplacemanagerengine.cpp @@ -42,8 +42,6 @@ #include "qplacemanagerengine.h" #include "qplacemanagerengine_p.h" -#include "qplacecategory_p.h" - QT_USE_NAMESPACE /*! @@ -131,7 +129,6 @@ int QPlaceManagerEngine::managerVersion() const return d_ptr->managerVersion; } - /*! \fn void QPlaceManagerEngine::authenticationRequired(QAuthenticator *authenticator) diff --git a/src/location/places/qplacemanagerengine.h b/src/location/places/qplacemanagerengine.h index 7335b452..ec6c6a8a 100644 --- a/src/location/places/qplacemanagerengine.h +++ b/src/location/places/qplacemanagerengine.h @@ -74,9 +74,8 @@ public: virtual QPlaceSearchReply *recommendations(const QPlace &place, const QPlaceSearchRequest &request) = 0; virtual QPlaceTextPredictionReply *textPredictions(const QPlaceSearchRequest &request) = 0; - virtual QPlaceIdReply *savePlace(const QPlace &place, QPlaceManager::VisibilityScope scope) = 0; + virtual QPlaceIdReply *savePlace(const QPlace &place) = 0; virtual QPlaceIdReply *removePlace(const QPlace &place) = 0; - virtual QPlaceManager::VisibilityScopes supportedSaveVisibilityScopes() const = 0; virtual QPlaceIdReply *saveCategory(const QPlaceCategory &category, const QString &parentId) = 0; virtual QPlaceIdReply *removeCategory(const QString &categoryId) = 0; diff --git a/src/location/places/qplacemanagerengine_p.h b/src/location/places/qplacemanagerengine_p.h index 4cc9759c..719df151 100644 --- a/src/location/places/qplacemanagerengine_p.h +++ b/src/location/places/qplacemanagerengine_p.h @@ -54,6 +54,7 @@ // #include <QtCore/QString> +#include <QtLocation/qtlocation.h> QT_BEGIN_NAMESPACE diff --git a/src/location/places/qplacesearchrequest.cpp b/src/location/places/qplacesearchrequest.cpp index 741f70cd..69f451a5 100644 --- a/src/location/places/qplacesearchrequest.cpp +++ b/src/location/places/qplacesearchrequest.cpp @@ -42,6 +42,7 @@ #include "qplacerequest_p.h" #include "qplacesearchrequest.h" #include "qgeocoordinate.h" +#include "qgeoboundingarea.h" QT_BEGIN_NAMESPACE @@ -60,13 +61,13 @@ public: QList<QPlaceCategory> categories; QGeoBoundingArea *searchArea; int dymNumber; - QPlaceManager::VisibilityScopes scope; + QtLocation::VisibilityScope visibilityScope; QPlaceSearchRequest::RelevanceHint relevanceHint; }; QPlaceSearchRequestPrivate::QPlaceSearchRequestPrivate() -: QPlaceRequestPrivate(), searchArea(0), dymNumber(0), scope(QPlaceManager::NoScope), - relevanceHint(QPlaceSearchRequest::NoHint) +: QPlaceRequestPrivate(), searchArea(0), dymNumber(0), + visibilityScope(QtLocation::UnspecifiedVisibility), relevanceHint(QPlaceSearchRequest::NoHint) { } @@ -80,7 +81,7 @@ QPlaceSearchRequestPrivate::QPlaceSearchRequestPrivate(const QPlaceSearchRequest else this->searchArea = 0; this->dymNumber = other.dymNumber; - this->scope = other.scope; + visibilityScope = other.visibilityScope; this->relevanceHint = other.relevanceHint; } @@ -109,7 +110,7 @@ bool QPlaceSearchRequestPrivate::compare(const QPlaceRequestPrivate *other) cons && this->categories == od->categories && this->dymNumber == od->dymNumber && searchAreaMatch - && this->scope == od->scope + && visibilityScope == od->visibilityScope && this->relevanceHint == od->relevanceHint ); } @@ -122,7 +123,7 @@ void QPlaceSearchRequestPrivate::clear() delete searchArea; searchArea = 0; dymNumber = 0; - scope = QPlaceManager::NoScope; + visibilityScope = QtLocation::UnspecifiedVisibility; relevanceHint = QPlaceSearchRequest::NoHint; } @@ -255,24 +256,23 @@ void QPlaceSearchRequest::setDidYouMeanSuggestionNumber(const int &number) } /*! - Returns the visibility scope used when searching for places. The default value - is QPlaceManager::NoScope meaning no explicit scope has been assigned. - It is up to the manager implementation to decide what scope it searches - by default. + Returns the visibility scope used when searching for places. The default value is + QtLocation::UnspecifiedVisibility meaning that no explicit scope has been assigned. It is up + to the manager implementation to decide what scope it searches by default. */ -QPlaceManager::VisibilityScopes QPlaceSearchRequest::visibilityScope() const +QtLocation::VisibilityScope QPlaceSearchRequest::visibilityScope() const { Q_D(const QPlaceSearchRequest); - return d->scope; + return d->visibilityScope; } /*! Sets the \a scope used when searching for places. */ -void QPlaceSearchRequest::setVisibilityScope(QPlaceManager::VisibilityScopes scope) +void QPlaceSearchRequest::setVisibilityScope(QtLocation::VisibilityScope visibilityScope) { Q_D(QPlaceSearchRequest); - d->scope = scope; + d->visibilityScope = visibilityScope; } /*! @@ -296,21 +296,4 @@ void QPlaceSearchRequest::setRelevanceHint(QPlaceSearchRequest::RelevanceHint hi d->relevanceHint = hint; } -/*! - Clears the parameters of the search request. -*/ -void QPlaceSearchRequest::clear() -{ - Q_D(QPlaceSearchRequest); - - QPlaceRequest::clear(); - d->searchTerm.clear(); - d->categories.clear(); - if (d->searchArea) - delete d->searchArea; - d->searchArea = 0; - d->dymNumber = 0; - d->scope = QPlaceManager::NoScope; -} - QT_END_NAMESPACE diff --git a/src/location/places/qplacesearchrequest.h b/src/location/places/qplacesearchrequest.h index d2f54657..fef4a936 100644 --- a/src/location/places/qplacesearchrequest.h +++ b/src/location/places/qplacesearchrequest.h @@ -42,13 +42,11 @@ #ifndef QPLACESEARCHREQUEST_H #define QPLACESEARCHREQUEST_H -#include <QSharedDataPointer> -#include "qgeoboundingarea.h" -#include "qplacecategory.h" -#include "qplacerequest.h" -#include "qplacemanager.h" - -#include <QString> +#include <QtCore/QSharedDataPointer> +#include <QtLocation/QPlaceRequest> +#include <QtLocation/placemacro.h> +#include <QtLocation/QPlaceCategory> +#include <QtLocation/qtlocation.h> QT_BEGIN_HEADER @@ -56,6 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Location) +class QGeoBoundingArea; class QPlaceSearchRequestPrivate; class Q_LOCATION_EXPORT QPlaceSearchRequest : public QPlaceRequest @@ -83,14 +82,12 @@ public: int didYouMeanSuggestionNumber() const; void setDidYouMeanSuggestionNumber(const int &number); - QPlaceManager::VisibilityScopes visibilityScope() const; - void setVisibilityScope(QPlaceManager::VisibilityScopes scope); + QtLocation::VisibilityScope visibilityScope() const; + void setVisibilityScope(QtLocation::VisibilityScope visibilityScopes); RelevanceHint relevanceHint() const; void setRelevanceHint(RelevanceHint hint); - void clear(); - private: Q_DECLARE_D_FUNC(QPlaceSearchRequest) }; diff --git a/src/location/qplace.cpp b/src/location/qplace.cpp index 74a42dc9..7912357a 100644 --- a/src/location/qplace.cpp +++ b/src/location/qplace.cpp @@ -432,12 +432,29 @@ void QPlace::insertExtendedAttribute(const QString &key, const QPlaceAttribute & d->extendedAttributes.insert(key, value); } +/*! + Sets the visibility of the place to \a visibility. +*/ +void QPlace::setVisibility(QtLocation::Visibility visibility) +{ + Q_D(QPlace); + d->visibility = visibility; +} + +/*! + Returns the visibility of the place. +*/ +QtLocation::Visibility QPlace::visibility() const +{ + Q_D(const QPlace); + return d->visibility; +} + /******************************************************************************* *******************************************************************************/ QPlacePrivate::QPlacePrivate() - : QSharedData(), - detailsFetched(false) +: QSharedData(), visibility(QtLocation::UnspecifiedVisibility), detailsFetched(false) { } @@ -457,6 +474,7 @@ QPlacePrivate::QPlacePrivate(const QPlacePrivate &other) primaryEmail(other.primaryEmail), primaryUrl(other.primaryUrl), extendedAttributes(other.extendedAttributes), + visibility(other.visibility), detailsFetched(other.detailsFetched) { } @@ -472,10 +490,15 @@ QPlacePrivate& QPlacePrivate::operator= (const QPlacePrivate & other) name = other.name; placeId = other.placeId; attribution = other.attribution; + contentCollections = other.contentCollections; + contentCounts = other.contentCounts; primaryPhone = other.primaryPhone; primaryFax = other.primaryFax; primaryEmail = other.primaryEmail; primaryUrl = other.primaryUrl; + extendedAttributes = other.extendedAttributes; + visibility = other.visibility; + detailsFetched = other.detailsFetched; return *this; } @@ -497,6 +520,7 @@ bool QPlacePrivate::operator== (const QPlacePrivate &other) const qDebug() << "email" << (primaryEmail == other.primaryEmail); qDebug() << "url" << (primaryUrl == other.primaryUrl); qDebug() << "extendedAttributes" << (extendedAttributes == other.extendedAttributes); + qDebug() << "visibility" << (visibility == other.visibility); #endif return (categories == other.categories @@ -513,6 +537,7 @@ bool QPlacePrivate::operator== (const QPlacePrivate &other) const && primaryEmail == other.primaryEmail && primaryUrl == other.primaryUrl && extendedAttributes == other.extendedAttributes + && visibility == other.visibility ); } diff --git a/src/location/qplace.h b/src/location/qplace.h index 7aae1790..ec916ca9 100644 --- a/src/location/qplace.h +++ b/src/location/qplace.h @@ -42,8 +42,8 @@ #ifndef QPLACE_H #define QPLACE_H -#include <QSharedDataPointer> -#include <QVariant> +#include <QtCore/QSharedDataPointer> +#include <QtLocation/qtlocation.h> #include "qgeoaddress.h" #include "qgeoboundingbox.h" @@ -120,6 +120,9 @@ public: void setExtendedAttributes(const QPlace::ExtendedAttributes &attributes); void insertExtendedAttribute(const QString &key, const QPlaceAttribute &); + QtLocation::Visibility visibility() const; + void setVisibility(QtLocation::Visibility visibility); + protected: QSharedDataPointer<QPlacePrivate> d_ptr; diff --git a/src/location/qplace_p.h b/src/location/qplace_p.h index 7a1ea144..b27fe54a 100644 --- a/src/location/qplace_p.h +++ b/src/location/qplace_p.h @@ -95,6 +95,8 @@ public: QPlace::ExtendedAttributes extendedAttributes; + QtLocation::Visibility visibility; + bool detailsFetched; }; diff --git a/src/location/qtlocation.cpp b/src/location/qtlocation.cpp new file mode 100644 index 00000000..0d510039 --- /dev/null +++ b/src/location/qtlocation.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtLocation module of the Qt Toolkit. +** +** $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 <QtLocation/qtlocation.h> + +QT_BEGIN_NAMESPACE + +namespace QtLocation { +/*! + \enum QtLocation::Visibility + + Defines the visibility of a QPlace or QPlaceCategory. + + \value UnspecifiedVisibility Only used when search for places and categories. Indicates + that results with any visibility should be returned. + \value DeviceVisibility Places and categories with DeviceVisibility are only stored on + the local device. + \value PrivateVisibility Places and categories with PrivateVisibility are only visible + to the current user. The data may be stored either locally or + on a remote service or both. + \value PublicVisibility Places and categories with PublicVisibility are visible to + everyone. +*/ +} + +QT_END_NAMESPACE diff --git a/src/location/qtlocation.h b/src/location/qtlocation.h new file mode 100644 index 00000000..363eb503 --- /dev/null +++ b/src/location/qtlocation.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtLocation module of the Qt Toolkit. +** +** $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 QTLOCATION_H +#define QTLOCATION_H + +#include <QtCore/QtGlobal> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QtLocation { + +enum Visibility { + UnspecifiedVisibility = 0x00, + DeviceVisibility = 0x01, + PrivateVisibility = 0x02, + PublicVisibility = 0x04 +}; + +Q_DECLARE_FLAGS(VisibilityScope, Visibility) + +} + +QT_END_NAMESPACE + +Q_DECLARE_OPERATORS_FOR_FLAGS(QT_PREPEND_NAMESPACE(QtLocation::VisibilityScope)) + +QT_END_HEADER + +#endif // QTLOCATION_H diff --git a/src/plugins/geoservices/nokia/places/qplacecategorytree.h b/src/plugins/geoservices/nokia/places/qplacecategorytree.h index 30a61253..0d876747 100644 --- a/src/plugins/geoservices/nokia/places/qplacecategorytree.h +++ b/src/plugins/geoservices/nokia/places/qplacecategorytree.h @@ -42,6 +42,7 @@ #ifndef QPLACECATEGORYTREE_H #define QPLACECATEGORYTREE_H +#include <QtCore/QHash> #include <QtLocation/QPlaceCategory> class QPlaceCategoryTree diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp index cd653bc1..9ba45df7 100644 --- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp +++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp @@ -48,6 +48,8 @@ #include "qplacemanagerengine_nokia.h" +#include <QtLocation/QPlaceContentRequest> + #include "places/qplacecategoriesrepository.h" #include "places/qplacecontentreplyimpl.h" #include "places/qplacetextpredictionreplyimpl.h" @@ -190,8 +192,8 @@ QPlaceSearchReply *QPlaceManagerEngineNokia::searchForPlaces(const QPlaceSearchR newQuery.setSearchTerm(query.categories().at(0).name()); } - if ((query.visibilityScope() == QPlaceManager::NoScope - || query.visibilityScope() & QPlaceManager::PublicScope)) { + if (query.visibilityScope() == QtLocation::UnspecifiedVisibility || + query.visibilityScope() == QtLocation::PublicVisibility) { QPlaceRestReply *restReply = QPlaceRestManager::instance()->sendSearchRequest(newQuery); @@ -244,11 +246,9 @@ QPlaceTextPredictionReply *QPlaceManagerEngineNokia::textPredictions(const QPlac return reply; } -QPlaceIdReply *QPlaceManagerEngineNokia::savePlace(const QPlace &place, - QPlaceManager::VisibilityScope scope) +QPlaceIdReply *QPlaceManagerEngineNokia::savePlace(const QPlace &place) { Q_UNUSED(place) - Q_UNUSED(scope) //TODO: implementation return 0; @@ -262,10 +262,6 @@ QPlaceIdReply *QPlaceManagerEngineNokia::removePlace(const QPlace &place) return 0; } -QPlaceManager::VisibilityScopes QPlaceManagerEngineNokia::supportedSaveVisibilityScopes() const { - return QPlaceManager::NoScope; -} - QPlaceIdReply *QPlaceManagerEngineNokia::saveCategory(const QPlaceCategory &category, const QString &parentId) { Q_UNUSED(category) diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h index a6c67a52..99e4d4aa 100644 --- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h +++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h @@ -77,9 +77,7 @@ public: QPlaceSearchReply *recommendations(const QPlace &place, const QPlaceSearchRequest &query); QPlaceTextPredictionReply *textPredictions(const QPlaceSearchRequest &query); - QPlaceIdReply *savePlace(const QPlace &place, QPlaceManager::VisibilityScope scope); - QPlaceManager::VisibilityScopes supportedSaveVisibilityScopes() const; - + QPlaceIdReply *savePlace(const QPlace &place); QPlaceIdReply *removePlace(const QPlace &place); QPlaceIdReply *saveCategory(const QPlaceCategory &category, const QString &parentId); diff --git a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp index 47d3a8e4..9a51e404 100644 --- a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp +++ b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp @@ -162,7 +162,7 @@ QPlaceTextPredictionReply *QPlaceManagerEngineJsonDb::textPredictions(const QPla return textPredictionReply; } -QPlaceIdReply *QPlaceManagerEngineJsonDb::savePlace(const QPlace &place, QPlaceManager::VisibilityScope scope) +QPlaceIdReply *QPlaceManagerEngineJsonDb::savePlace(const QPlace &place) { IdReply *saveReply = new IdReply(QPlaceIdReply::SavePlace, this); if (!m_jsonDbHandler.isConnected()) { @@ -170,7 +170,7 @@ QPlaceIdReply *QPlaceManagerEngineJsonDb::savePlace(const QPlace &place, QPlaceM return saveReply; } - if (scope == QPlaceManager::PublicScope) { + if (place.visibility() & QtLocation::PublicVisibility) { saveReply->triggerDone(QPlaceReply::UnsupportedError, tr("Saving to public scope in unsupported")); } else { QVariant jsonPlace = JsonDbHandler::convertToJsonVariant(place); @@ -278,11 +278,6 @@ QPlaceIdReply *QPlaceManagerEngineJsonDb::saveCategory(const QPlaceCategory &cat return saveReply; } -QPlaceManager::VisibilityScopes QPlaceManagerEngineJsonDb::supportedSaveVisibilityScopes() const -{ - return QPlaceManager::NoScope | QPlaceManager::PrivateScope; -} - QPlaceIdReply *QPlaceManagerEngineJsonDb::removePlace(const QPlace &place) { IdReply *removeReply = new IdReply(QPlaceIdReply::RemovePlace, this); diff --git a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h index 1f5829bd..615251b6 100644 --- a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h +++ b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h @@ -69,9 +69,7 @@ public: QPlaceSearchReply *recommendations(const QPlace &place, const QPlaceSearchRequest &request); QPlaceTextPredictionReply *textPredictions(const QPlaceSearchRequest &request); - QPlaceIdReply *savePlace(const QPlace &place, QPlaceManager::VisibilityScope scope); - QPlaceManager::VisibilityScopes supportedSaveVisibilityScopes() const; - + QPlaceIdReply *savePlace(const QPlace &place); QPlaceIdReply *removePlace(const QPlace &place); QPlaceIdReply *saveCategory(const QPlaceCategory &category, const QString &parentId); diff --git a/tests/auto/declarative/tst_place.qml b/tests/auto/declarative/tst_place.qml index 0282ea17..ef771a44 100644 --- a/tests/auto/declarative/tst_place.qml +++ b/tests/auto/declarative/tst_place.qml @@ -69,6 +69,8 @@ TestCase { primaryEmail: "test-place@example.com" primaryUrl: "http://www.example.com/test-place" + visibility: Place.DeviceVisibility + location: Location { locationId: "test-place-location-id" @@ -155,7 +157,7 @@ TestCase { function compare_place(place1, place2) { // check simple properties var simpleProperties = ["name", "placeId", "primaryPhone", "primaryFax", "primaryEmail", - "primaryUrl"]; + "primaryUrl", "visibility"]; for (x in simpleProperties) { if (place1[simpleProperties[x]] !== place2[simpleProperties[x]]) return false; @@ -270,6 +272,7 @@ TestCase { compare(emptyPlace.primaryFax, ""); compare(emptyPlace.primaryEmail, ""); compare(emptyPlace.primaryUrl, ""); + compare(emptyPlace.visibility, Place.UnspecifiedVisibility); // complex properties compare(emptyPlace.rating, null); @@ -292,6 +295,7 @@ TestCase { { tag: "primaryFax", property: "primaryFax", signal: "primaryFaxChanged", value: "22222222", reset: "" }, { tag: "primaryEmail", property: "primaryEmail", signal: "primaryEmailChanged", value: "test@example.com", reset: "" }, { tag: "primaryUrl", property: "primaryUrl", signal: "primaryUrlChanged", value: "http://www.example.com/test-place-id-1", reset: "" }, + { tag: "visibility", property: "visibility", signal: "visibilityChanged", value: Place.PublicVisibility, reset: Place.UnspecifiedVisibility }, ]; } diff --git a/tests/auto/geotestplugin/qplacemanagerengine_test.h b/tests/auto/geotestplugin/qplacemanagerengine_test.h index fbadc721..9cc68e0a 100644 --- a/tests/auto/geotestplugin/qplacemanagerengine_test.h +++ b/tests/auto/geotestplugin/qplacemanagerengine_test.h @@ -47,6 +47,8 @@ #include <qplacemanager.h> #include <qplacemanagerengine.h> #include <qplacereply.h> +#include <QtLocation/QPlaceDetailsReply> +#include <QtLocation/QPlaceIdReply> #include <QtCore/QDebug> @@ -172,10 +174,8 @@ public: return 0; } - QPlaceIdReply *savePlace(const QPlace &place, QPlaceManager::VisibilityScope scope) + QPlaceIdReply *savePlace(const QPlace &place) { - Q_UNUSED(scope) - IdReply *reply = new IdReply(QPlaceIdReply::SavePlace, this); if (!place.placeId().isEmpty() && !m_places.contains(place.placeId())) { @@ -197,11 +197,6 @@ public: return reply; } - QPlaceManager::VisibilityScopes supportedSaveVisibilityScopes() const - { - return QPlaceManager::PublicScope; - } - QPlaceIdReply *removePlace(const QPlace &place) { IdReply *reply = new IdReply(QPlaceIdReply::RemovePlace, this); diff --git a/tests/auto/qplace/tst_qplace.cpp b/tests/auto/qplace/tst_qplace.cpp index e4c9dacb..d244eb35 100644 --- a/tests/auto/qplace/tst_qplace.cpp +++ b/tests/auto/qplace/tst_qplace.cpp @@ -76,6 +76,7 @@ private Q_SLOTS: void primaryUrlTest(); void operatorsTest(); void extendedAttributeTest(); + void visibilityTest(); }; tst_Place::tst_Place() @@ -480,6 +481,17 @@ void tst_Place::extendedAttributeTest() QCOMPARE(place.extendedAttributes().count(), 0); } -QTEST_APPLESS_MAIN(tst_Place); +void tst_Place::visibilityTest() +{ + QPlace place; + + QCOMPARE(place.visibility(), QtLocation::UnspecifiedVisibility); + + place.setVisibility(QtLocation::DeviceVisibility); + + QCOMPARE(place.visibility(), QtLocation::DeviceVisibility); +} + +QTEST_APPLESS_MAIN(tst_Place) #include "tst_qplace.moc" diff --git a/tests/auto/qplacecategory/tst_qplacecategory.cpp b/tests/auto/qplacecategory/tst_qplacecategory.cpp index 204e8bb2..5f8f8ce1 100644 --- a/tests/auto/qplacecategory/tst_qplacecategory.cpp +++ b/tests/auto/qplacecategory/tst_qplacecategory.cpp @@ -57,6 +57,7 @@ private Q_SLOTS: void constructorTest(); void categoryIdTest(); void nameTest(); + void visibilityTest(); void operatorsTest(); }; @@ -92,6 +93,17 @@ void tst_QPlaceCategory::nameTest() QVERIFY2(testObj.name() == "testText", "Wrong value returned"); } +void tst_QPlaceCategory::visibilityTest() +{ + QPlaceCategory category; + + QCOMPARE(category.visibility(), QtLocation::UnspecifiedVisibility); + + category.setVisibility(QtLocation::DeviceVisibility); + + QCOMPARE(category.visibility(), QtLocation::DeviceVisibility); +} + void tst_QPlaceCategory::operatorsTest() { QPlaceCategory testObj; diff --git a/tests/auto/qplacemanager_jsondb/tst_qplacemanager_jsondb.cpp b/tests/auto/qplacemanager_jsondb/tst_qplacemanager_jsondb.cpp index d7b76c2b..c0cb5764 100644 --- a/tests/auto/qplacemanager_jsondb/tst_qplacemanager_jsondb.cpp +++ b/tests/auto/qplacemanager_jsondb/tst_qplacemanager_jsondb.cpp @@ -115,8 +115,7 @@ private Q_SLOTS: private: bool doSavePlace(const QPlace &place, QPlaceReply::Error expectedError = QPlaceReply::NoError, - QString *placeId = 0, - QPlaceManager::VisibilityScope = QPlaceManager::NoScope); + QString *placeId = 0); void doSavePlaces(QList<QPlace> &places); void doSavePlaces(const QList<QPlace *> &places); @@ -221,7 +220,10 @@ void tst_QPlaceManagerJsonDb::saveAndRemovePlace() //try removing a place that does not exist; QVERIFY(doRemovePlace(place, QPlaceReply::PlaceDoesNotExistError)); - QVERIFY(doSavePlace(place, QPlaceReply::UnsupportedError,0, QPlaceManager::PublicScope)); + + place.setVisibility(QtLocation::PublicVisibility); + + QVERIFY(doSavePlace(place, QPlaceReply::UnsupportedError, 0)); } void tst_QPlaceManagerJsonDb::updatePlace() @@ -991,10 +993,9 @@ void tst_QPlaceManagerJsonDb::cleanup() bool tst_QPlaceManagerJsonDb::doSavePlace(const QPlace &place, QPlaceReply::Error expectedError, - QString *placeId, - QPlaceManager::VisibilityScope scope) + QString *placeId) { - QPlaceIdReply *saveReply = placeManager->savePlace(place,scope); + QPlaceIdReply *saveReply = placeManager->savePlace(place); bool isSuccessful = checkSignals(saveReply, expectedError); if (placeId != 0) { *placeId = saveReply->id(); diff --git a/tests/auto/qplacesearchrequest/tst_qplacesearchrequest.cpp b/tests/auto/qplacesearchrequest/tst_qplacesearchrequest.cpp index 4071d99b..1260ecad 100644 --- a/tests/auto/qplacesearchrequest/tst_qplacesearchrequest.cpp +++ b/tests/auto/qplacesearchrequest/tst_qplacesearchrequest.cpp @@ -178,12 +178,15 @@ void tst_QPlaceSearchRequest::didYouMeanSuggestionNumberTest() void tst_QPlaceSearchRequest::visibilityScopeTest() { QPlaceSearchRequest query; - QVERIFY2(query.visibilityScope() == QPlaceManager::NoScope, "Wrong default value"); - query.setVisibilityScope(QPlaceManager::PublicScope); - QCOMPARE(query.visibilityScope(), QPlaceManager::PublicScope); - query.setVisibilityScope(QPlaceManager::PublicAndPrivateScope); - QVERIFY(query.visibilityScope() & QPlaceManager::PublicScope); - QVERIFY(query.visibilityScope() & QPlaceManager::PrivateScope); + QVERIFY2(query.visibilityScope() == QtLocation::UnspecifiedVisibility, "Wrong default value"); + + query.setVisibilityScope(QtLocation::DeviceVisibility); + QCOMPARE(query.visibilityScope(), QtLocation::DeviceVisibility); + + query.setVisibilityScope(QtLocation::DeviceVisibility | QtLocation::PublicVisibility); + QVERIFY(query.visibilityScope() & QtLocation::DeviceVisibility); + QVERIFY(!(query.visibilityScope() & QtLocation::PrivateVisibility)); + QVERIFY(query.visibilityScope() & QtLocation::PublicVisibility); } void tst_QPlaceSearchRequest::relevanceHintTest() @@ -244,12 +247,12 @@ void tst_QPlaceSearchRequest::operatorsTest() //test that identical visibility scopes match testObj.clear(); testObj2.clear(); - testObj.setVisibilityScope(QPlaceManager::PublicScope); - testObj2.setVisibilityScope(QPlaceManager::PublicScope); + testObj.setVisibilityScope(QtLocation::PublicVisibility); + testObj2.setVisibilityScope(QtLocation::PublicVisibility); QVERIFY2(testObj == testObj2, "Identical scopes not identified as matching"); //test that different scopes do not match - testObj2.setVisibilityScope(QPlaceManager::PublicScope | QPlaceManager::PrivateScope); + testObj2.setVisibilityScope(QtLocation::PrivateVisibility); QVERIFY2(testObj != testObj2, "Different scopes identified as matching"); } |