diff options
Diffstat (limited to 'src/core/location_provider_qt.cpp')
-rw-r--r-- | src/core/location_provider_qt.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp index d17fc3d21..e3be01b36 100644 --- a/src/core/location_provider_qt.cpp +++ b/src/core/location_provider_qt.cpp @@ -60,7 +60,7 @@ public: QtPositioningHelper(LocationProviderQt *provider); ~QtPositioningHelper(); - bool start(bool highAccuracy); + void start(bool highAccuracy); void stop(); void refresh(); @@ -88,15 +88,20 @@ QtPositioningHelper::~QtPositioningHelper() m_locationProvider->m_positioningHelper = 0; } -bool QtPositioningHelper::start(bool highAccuracy) +void QtPositioningHelper::start(bool highAccuracy) { DCHECK_CURRENTLY_ON(BrowserThread::UI); Q_UNUSED(highAccuracy); // FIXME: go through availableSources until one supports QGeoPositionInfoSource::SatellitePositioningMethods // for the highAccuracy case. m_positionInfoSource = QGeoPositionInfoSource::createDefaultSource(this); - if (!m_positionInfoSource) - return false; + if (!m_positionInfoSource) { + qWarning("Failed to initialize location provider: The system either has no default " + "position source, no valid plugins could be found or the user does not have " + "the right permissions."); + error(QGeoPositionInfoSource::UnknownSourceError); + return; + } connect(m_positionInfoSource, &QGeoPositionInfoSource::positionUpdated, this, &QtPositioningHelper::updatePosition); // disambiguate the error getter and the signal in QGeoPositionInfoSource. @@ -105,7 +110,7 @@ bool QtPositioningHelper::start(bool highAccuracy) connect(m_positionInfoSource, &QGeoPositionInfoSource::updateTimeout, this, &QtPositioningHelper::timeout); m_positionInfoSource->startUpdates(); - return true; + return; } void QtPositioningHelper::stop() @@ -208,7 +213,7 @@ bool LocationProviderQt::StartProvider(bool highAccuracy) m_positioningHelper = new QtPositioningHelper(this); m_positioningHelper->moveToThread(guiThread); } - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(base::IgnoreResult(&QtPositioningHelper::start) + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&QtPositioningHelper::start , base::Unretained(m_positioningHelper), highAccuracy)); return true; } |