@@ -60,6 +60,7 @@
const quint32 PreferredInitialFixTime = 0;
const double KnotsToMps = 0.514444;
+const QString LocationSettingsDir = QStringLiteral("/etc/location/");
const QString LocationSettingsFile = QStringLiteral("/etc/location/location.conf");
const QString LocationSettingsEnabledKey = QStringLiteral("location/enabled");
const QString LocationSettingsGpsEnabledKey = QStringLiteral("location/gps/enabled");
@@ -449,6 +450,9 @@
m_locationSettings = new QFileSystemWatcher(this);
connect(m_locationSettings, SIGNAL(fileChanged(QString)),
this, SLOT(locationEnabledChanged()));
+ connect(m_locationSettings, SIGNAL(directoryChanged(QString)),
+ this, SLOT(locationEnabledChanged()));
+ m_locationSettings->addPath(LocationSettingsDir);
m_locationSettings->addPath(LocationSettingsFile);
new GeoclueAdaptor(this);
@@ -1068,7 +1072,8 @@
if (!m_agpsOnlineEnabled)
return;
- foreach (NetworkService *service, m_networkManager->getServices(QStringLiteral("cellular"))) {
+ QVector<NetworkService*> services = m_networkManager->getServices(QStringLiteral("cellular"));
+ Q_FOREACH (NetworkService *service, services) {
if (!service->connected())
continue;
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-0.2.11.tar.gz/main.cpp
^
|
@@ -28,6 +28,14 @@
uid_t effectiveUid;
uid_t savedUid;
+#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
+ QCoreApplication::setSetuidAllowed(true);
+#endif
+ QLoggingCategory::setFilterRules(QStringLiteral("geoclue.provider.hybris.debug=false\n"
+ "geoclue.provider.hybris.nmea.debug=false\n"
+ "geoclue.provider.hybris.position.debug=false"));
+ QCoreApplication a(argc, argv);
+
int result = getresuid(&realUid, &effectiveUid, &savedUid);
if (result == -1)
qFatal("Failed to get process uids, %s", strerror(errno));
@@ -62,6 +70,9 @@
// Register service on DBus system bus prior to dropping privileges.
QDBusConnection system = QDBusConnection::systemBus();
+ DeviceControl control;
+ if (!system.registerObject(QStringLiteral("/com/jollamobile/gps/Device"), &control))
+ qFatal("Failed to register object /com/jollamobile/gps/Device");
if (!system.registerService(QStringLiteral("com.jollamobile.gps")))
qFatal("Failed to register service com.jollamobile.gps");
@@ -72,29 +83,12 @@
qFatal("Failed to set process uid to %d, %s", realUid, strerror(errno));
#endif
- QLoggingCategory::setFilterRules(QStringLiteral("geoclue.provider.hybris.debug=false\n"
- "geoclue.provider.hybris.nmea.debug=false\n"
- "geoclue.provider.hybris.position.debug=false"));
-
- QCoreApplication a(argc, argv);
-
-
- DeviceControl control;
-
- if (!system.registerObject(QStringLiteral("/com/jollamobile/gps/Device"), &control))
- qFatal("Failed to register object /com/jollamobile/gps/Device");
-
-
- QDBusConnection connection = QDBusConnection::sessionBus();
-
- if (!connection.registerService(QStringLiteral("org.freedesktop.Geoclue.Providers.Hybris")))
- qFatal("Failed to register service org.freedesktop.Geoclue.Providers.Hybris");
-
+ QDBusConnection session = QDBusConnection::sessionBus();
HybrisProvider provider;
-
- if (!connection.registerObject(QStringLiteral("/org/freedesktop/Geoclue/Providers/Hybris"), &provider))
+ if (!session.registerObject(QStringLiteral("/org/freedesktop/Geoclue/Providers/Hybris"), &provider))
qFatal("Failed to register object /org/freedesktop/Geoclue/Providers/Hybris");
-
+ if (!session.registerService(QStringLiteral("org.freedesktop.Geoclue.Providers.Hybris")))
+ qFatal("Failed to register service org.freedesktop.Geoclue.Providers.Hybris");
provider.setDeviceController(&control);
return a.exec();
|