From ca5b751610e1928eb1211622035390bd38dd32bf Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 18 Nov 2015 18:56:50 -0800 Subject: Location service: check presence of location source In theory this should only report a location service if this is a satellite based service, but sadly geoclue appears to claim that there is a satellite based service in my Linux VM - so I'm doubtful that this does what the documentation says it does. Signed-off-by: Dirk Hohndel --- subsurface-core/gpslocation.cpp | 5 +++++ subsurface-core/gpslocation.h | 1 + 2 files changed, 6 insertions(+) diff --git a/subsurface-core/gpslocation.cpp b/subsurface-core/gpslocation.cpp index 4c2879f7c..2445c604d 100644 --- a/subsurface-core/gpslocation.cpp +++ b/subsurface-core/gpslocation.cpp @@ -31,6 +31,11 @@ GpsLocation::GpsLocation(void (*showMsgCB)(const char *), QObject *parent) userAgent = getUserAgent(); } +bool GpsLocation::hasLocationsSource() +{ + return gpsSource != 0 && (gpsSource->supportedPositioningMethods() & QGeoPositionInfoSource::SatellitePositioningMethods); +} + void GpsLocation::serviceEnable(bool toggle) { if (!gpsSource) { diff --git a/subsurface-core/gpslocation.h b/subsurface-core/gpslocation.h index 55b47f07e..f60b669f7 100644 --- a/subsurface-core/gpslocation.h +++ b/subsurface-core/gpslocation.h @@ -17,6 +17,7 @@ public: bool applyLocations(); int getGpsNum() const; QString getUserid(QString user, QString passwd); + bool hasLocationsSource(); private: QGeoPositionInfo lastPos; -- cgit v1.2.3-70-g09d2