diff --git a/rpm/nemo-qml-plugin-systemsettings.spec b/rpm/nemo-qml-plugin-systemsettings.spec index cfad206..63393ba 100644 --- a/rpm/nemo-qml-plugin-systemsettings.spec +++ b/rpm/nemo-qml-plugin-systemsettings.spec @@ -1,6 +1,6 @@ Name: nemo-qml-plugin-systemsettings Summary: System settings plugin for Nemo Mobile -Version: 0.5.27 +Version: 0.5.37 Release: 1 Group: System/Libraries License: BSD diff --git a/src/locationsettings.cpp b/src/locationsettings.cpp index 8ad5272..7eaca05 100644 --- a/src/locationsettings.cpp +++ b/src/locationsettings.cpp @@ -34,8 +34,6 @@ #include "locationsettings_p.h" #include -#include -#include #include #include @@ -49,26 +47,22 @@ #include namespace { + const QString LocationSettingsDeprecatedCellIdPositioningEnabledKey = QStringLiteral("cell_id_positioning_enabled"); + const QString LocationSettingsDeprecatedHereEnabledKey = QStringLiteral("here_agreement_accepted"); + const QString LocationSettingsDeprecatedHereAgreementAcceptedKey = QStringLiteral("agreement_accepted"); + const QString PoweredPropertyName = QStringLiteral("Powered"); const QString LocationSettingsDir = QStringLiteral("/etc/location/"); const QString LocationSettingsFile = QStringLiteral("/etc/location/location.conf"); const QString LocationSettingsSection = QStringLiteral("location"); - const QString LocationSettingsDeprecatedCellIdPositioningEnabledKey = QStringLiteral("cell_id_positioning_enabled"); - const QString LocationSettingsDeprecatedHereEnabledKey = QStringLiteral("here_agreement_accepted"); - const QString LocationSettingsDeprecatedHereAgreementAcceptedKey = QStringLiteral("agreement_accepted"); const QString LocationSettingsEnabledKey = QStringLiteral("enabled"); const QString LocationSettingsCustomModeKey = QStringLiteral("custom_mode"); - const QString LocationSettingsAgpsProvidersKey = QStringLiteral("agps_providers"); const QString LocationSettingsGpsEnabledKey = QStringLiteral("gps\\enabled"); - const QString LocationSettingsMlsEnabledKey = QStringLiteral("mls\\enabled"); - const QString LocationSettingsMlsAgreementAcceptedKey = QStringLiteral("mls\\agreement_accepted"); - const QString LocationSettingsMlsOnlineEnabledKey = QStringLiteral("mls\\online_enabled"); - const QString LocationSettingsHereEnabledKey = QStringLiteral("here\\enabled"); - const QString LocationSettingsHereAgreementAcceptedKey = QStringLiteral("here\\agreement_accepted"); - const QString LocationSettingsHereOnlineEnabledKey = QStringLiteral("here\\online_enabled"); - const QString LocationSettingsYandexLocatorEnabledKey = QStringLiteral("yandex\\enabled"); - const QString LocationSettingsYandexLocatorAgreementAcceptedKey = QStringLiteral("yandex\\agreement_accepted"); - const QString LocationSettingsYandexLocatorOnlineEnabledKey = QStringLiteral("yandex\\online_enabled"); + + const QString ProviderOfflineEnabledPattern = QStringLiteral("%1\\enabled"); + const QString ProviderAgreementAcceptedPattern = QStringLiteral("%1\\agreement_accepted"); + const QString ProviderOnlineEnabledPattern = QStringLiteral("%1\\online_enabled"); + const QMap AllowedDataSourcesKeys { { LocationSettings::OnlineDataSources, QStringLiteral("allowed_data_sources\\online") }, { LocationSettings::DeviceSensorsData, QStringLiteral("allowed_data_sources\\device_sensors") }, @@ -82,6 +76,10 @@ namespace { { LocationSettings::QzssData, QStringLiteral("allowed_data_sources\\qzss") }, { LocationSettings::SbasData, QStringLiteral("allowed_data_sources\\sbas") } }; + + const QString YandexName = QStringLiteral("yandex"); + const QString HereName = QStringLiteral("here"); + const QString MlsName = QStringLiteral("mls"); } IniFile::IniFile(const QString &fileName) @@ -182,13 +180,7 @@ LocationSettingsPrivate::LocationSettingsPrivate(LocationSettings::Mode mode, Lo , q(settings) , m_locationEnabled(false) , m_gpsEnabled(false) - , m_mlsEnabled(true) - , m_yandexLocatorEnabled(true) - , m_mlsOnlineState(LocationSettings::OnlineAGpsAgreementNotAccepted) - , m_yandexLocatorOnlineState(LocationSettings::OnlineAGpsAgreementNotAccepted) - , m_hereState(LocationSettings::OnlineAGpsAgreementNotAccepted) , m_locationMode(LocationSettings::CustomMode) - , m_settingLocationMode(true) , m_settingMultipleSettings(false) , m_allowedDataSources(static_cast(std::numeric_limits::max())) , m_connMan(Q_NULLPTR) @@ -200,18 +192,7 @@ LocationSettingsPrivate::LocationSettingsPrivate(LocationSettings::Mode mode, Lo "net.connman.Technology", QDBusConnection::systemBus())) { - connect(q, &LocationSettings::gpsEnabledChanged, - this, &LocationSettingsPrivate::recalculateLocationMode); - connect(q, &LocationSettings::mlsEnabledChanged, - this, &LocationSettingsPrivate::recalculateLocationMode); - connect(q, &LocationSettings::mlsOnlineStateChanged, - this, &LocationSettingsPrivate::recalculateLocationMode); - connect(q, &LocationSettings::yandexLocatorEnabledChanged, - this, &LocationSettingsPrivate::recalculateLocationMode); - connect(q, &LocationSettings::yandexLocatorOnlineStateChanged, - this, &LocationSettingsPrivate::recalculateLocationMode); - connect(q, &LocationSettings::hereStateChanged, - this, &LocationSettingsPrivate::recalculateLocationMode); + loadProviders(); connect(&m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(readSettings())); connect(&m_watcher, SIGNAL(directoryChanged(QString)), this, SLOT(readSettings())); @@ -223,8 +204,6 @@ LocationSettingsPrivate::LocationSettingsPrivate(LocationSettings::Mode mode, Lo qWarning() << "Unable to follow location configuration file changes"; } - this->m_settingLocationMode = false; - if (m_gpsTechInterface) { QDBusConnection::systemBus().connect("net.connman", "/net/connman/technology/gps", @@ -247,10 +226,137 @@ LocationSettingsPrivate::~LocationSettingsPrivate() disconnect(m_gpsTech, 0, q, 0); m_gpsTech = 0; } - if (m_gpsTechInterface) { - delete m_gpsTechInterface; - m_gpsTechInterface = 0; + + delete m_gpsTechInterface; + m_gpsTechInterface = 0; +} + +void LocationSettingsPrivate::loadProviders() +{ + // for now just hard-coding the known potential providers. + // can be replaced with config type of thing if there's need to support more and more providers. + if (QFile::exists(QStringLiteral("/usr/libexec/geoclue-here"))) { + LocationProvider provider; + provider.hasAgreement = true; + m_providers[HereName] = provider; + } + + if (QFile::exists(QStringLiteral("/usr/libexec/geoclue-mlsdb"))) { + LocationProvider provider; + provider.hasAgreement = true; + provider.offlineCapable = true; + m_providers[MlsName] = provider; + } + + if (QFile::exists(QStringLiteral("/usr/libexec/geoclue-yandex"))) { + LocationProvider provider; + provider.hasAgreement = true; // supposedly + m_providers[YandexName] = provider; + } +} + +bool LocationSettingsPrivate::updateProvider(const QString &name, const LocationProvider &state) +{ + if (!m_providers.contains(name)) { + return false; + } + + LocationProvider &provider = m_providers[name]; + + bool agreementChanged = false; + if (provider.hasAgreement && provider.agreementAccepted != state.agreementAccepted) { + agreementChanged = true; + provider.agreementAccepted = state.agreementAccepted; + } + + bool onlineEnabledChanged = false; + if (provider.onlineCapable && provider.onlineEnabled != state.onlineEnabled) { + onlineEnabledChanged = true; + provider.onlineEnabled = state.onlineEnabled; + } + + bool offlineEnabledChanged = false; + if (provider.offlineCapable && provider.offlineEnabled != state.offlineEnabled) { + offlineEnabledChanged = true; + provider.offlineEnabled = state.offlineEnabled; + } + + if (m_locationMode != LocationSettings::CustomMode) { + if (m_locationMode == LocationSettings::DeviceOnlyMode) { + // device only doesn't need any agreements + if (m_pendingAgreements.contains(name)) { + m_pendingAgreements.removeOne(name); + emit q->pendingAgreementsChanged(); + } + } else if (provider.hasAgreement) { + if (!provider.agreementAccepted && !m_pendingAgreements.contains(name)) { + m_pendingAgreements.append(name); + emit q->pendingAgreementsChanged(); + } else if (provider.agreementAccepted && m_pendingAgreements.contains(name)) { + m_pendingAgreements.removeOne(name); + emit q->pendingAgreementsChanged(); + } + } } + + if (offlineEnabledChanged && name == MlsName) { + emit q->mlsEnabledChanged(); + } + if (agreementChanged || onlineEnabledChanged) { + if (name == HereName) { + emit q->hereStateChanged(); + } else if (name == MlsName) { + emit q->mlsOnlineStateChanged(); + } else if (name == YandexName) { + emit q->yandexOnlineStateChanged(); + } + } + + return true; +} + +LocationSettings::OnlineAGpsState LocationSettingsPrivate::onlineState(const QString &name, bool *valid) const +{ + LocationSettings::OnlineAGpsState result; + bool resultValid = true; + + if (!m_providers.contains(name)) { + resultValid = false; + result = LocationSettings::OnlineAGpsAgreementNotAccepted; + } else { + LocationProvider provider = m_providers.value(name); + if (!provider.onlineCapable) { + resultValid = false; + result = LocationSettings::OnlineAGpsAgreementNotAccepted; + } else if (!provider.agreementAccepted) { + result = LocationSettings::OnlineAGpsAgreementNotAccepted; + } else { + result = provider.onlineEnabled ? LocationSettings::OnlineAGpsEnabled + : LocationSettings::OnlineAGpsDisabled; + } + } + + if (valid) { + *valid = resultValid; + } + + return result; +} + +void LocationSettingsPrivate::updateOnlineAgpsState(const QString &name, LocationSettings::OnlineAGpsState state) +{ + if (!m_providers.contains(name)) { + return; + } + LocationProvider provider = m_providers.value(name); + if (state == LocationSettings::OnlineAGpsAgreementNotAccepted) { + provider.agreementAccepted = false; + } else { + provider.agreementAccepted = true; + provider.onlineEnabled = (state == LocationSettings::OnlineAGpsEnabled); + } + updateProvider(name, provider); + writeSettings(); } void LocationSettingsPrivate::gpsTechPropertyChanged(const QString &propertyName, const QVariant &) @@ -277,67 +383,49 @@ void LocationSettingsPrivate::findGpsTech() emit q->gpsFlightModeChanged(); } -LocationSettings::LocationMode -LocationSettingsPrivate::calculateLocationMode() const +static void checkOnlineStates(LocationSettings::OnlineAGpsState mode, bool *allOn, bool *allOff) { - bool nls = m_mlsEnabled || m_yandexLocatorEnabled; - bool nls_available = mlsAvailable() || yandexLocatorAvailable(); - - if (m_gpsEnabled - && (!nls_available || - (nls && (m_mlsOnlineState == LocationSettings::OnlineAGpsEnabled || m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsEnabled))) - && (!hereAvailable() || m_hereState == LocationSettings::OnlineAGpsEnabled)) { - return LocationSettings::HighAccuracyMode; - } else if (!m_gpsEnabled - && (!nls_available || - (nls && - ((m_mlsOnlineState == LocationSettings::OnlineAGpsEnabled || m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsEnabled ) - || (m_mlsOnlineState == LocationSettings::OnlineAGpsAgreementNotAccepted || m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsAgreementNotAccepted)))) - && (!hereAvailable() || - (m_hereState == LocationSettings::OnlineAGpsEnabled - || m_hereState == LocationSettings::OnlineAGpsAgreementNotAccepted))) { - return LocationSettings::BatterySavingMode; - } else if (m_gpsEnabled - && (!nls_available || - (nls && - ((m_mlsOnlineState == LocationSettings::OnlineAGpsDisabled || m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsDisabled) - ||(m_mlsOnlineState == LocationSettings::OnlineAGpsAgreementNotAccepted || m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsAgreementNotAccepted)))) - && (!hereAvailable() || - (m_hereState == LocationSettings::OnlineAGpsDisabled - || m_hereState == LocationSettings::OnlineAGpsAgreementNotAccepted))) { - return LocationSettings::DeviceOnlyMode; + if (mode == LocationSettings::OnlineAGpsEnabled) { + *allOff = false; } else { - return LocationSettings::CustomMode; + *allOn = false; } } -void LocationSettingsPrivate::recalculateLocationMode() +LocationSettings::LocationMode +LocationSettingsPrivate::calculateLocationMode() const { - if (!m_settingLocationMode && m_locationMode != LocationSettings::CustomMode) { - LocationSettings::LocationMode currentMode = calculateLocationMode(); - if (currentMode != m_locationMode) { - m_locationMode = currentMode; - emit q->locationModeChanged(); + bool allNetworkOn = true; + bool allNetworkOff = true; + + bool networkLocationExists = false; + bool allOfflineEnabled = true; + + for (const QString &name : m_providers.keys()) { + bool valid = true; + LocationSettings::OnlineAGpsState state = onlineState(name, &valid); + if (valid) { + networkLocationExists = true; + checkOnlineStates(state, &allNetworkOn, &allNetworkOff); } - } -} -bool LocationSettingsPrivate::mlsAvailable() const -{ - return QFile::exists(QStringLiteral("/usr/libexec/geoclue-mlsdb")); -} + LocationProvider provider = m_providers.value(name); + if (provider.offlineCapable && !provider.offlineEnabled) { + allOfflineEnabled = false; + } + } -bool LocationSettingsPrivate::yandexLocatorAvailable() const -{ - return QFile::exists(QStringLiteral("/usr/libexec/geoclue-yandex")); -} + if (m_gpsEnabled && allNetworkOn && networkLocationExists && allOfflineEnabled) { + return LocationSettings::HighAccuracyMode; + } else if (!m_gpsEnabled && allNetworkOn && allOfflineEnabled) { + return LocationSettings::BatterySavingMode; + } else if (m_gpsEnabled && allNetworkOff && allOfflineEnabled) { + return LocationSettings::DeviceOnlyMode; + } -bool LocationSettingsPrivate::hereAvailable() const -{ - return QFile::exists(QStringLiteral("/usr/libexec/geoclue-here")); + return LocationSettings::CustomMode; } - LocationSettings::LocationSettings(QObject *parent) : QObject(parent) , d_ptr(new LocationSettingsPrivate(LocationSettings::AsynchronousMode, this)) @@ -426,110 +514,99 @@ bool LocationSettings::gpsAvailable() const return QFile::exists(QStringLiteral("/usr/libexec/geoclue-hybris")); } -/*Mozilla Location services*/ - -bool LocationSettings::mlsEnabled() const +QStringList LocationSettings::locationProviders() const { Q_D(const LocationSettings); - return d->m_mlsEnabled; + return d->m_providers.keys(); } -void LocationSettings::setMlsEnabled(bool enabled) -{ - Q_D(LocationSettings); - if (enabled != d->m_mlsEnabled) { - d->m_mlsEnabled = enabled; - d->writeSettings(); - emit mlsEnabledChanged(); - } -} - -LocationSettings::OnlineAGpsState LocationSettings::mlsOnlineState() const +LocationProvider LocationSettings::providerInfo(const QString &name) const { Q_D(const LocationSettings); - return d->m_mlsOnlineState; + return d->m_providers.value(name.toLower()); } -void LocationSettings::setMlsOnlineState(LocationSettings::OnlineAGpsState state) +bool LocationSettings::updateLocationProvider(const QString &name, const LocationProvider &providerState) { Q_D(LocationSettings); - if (state == d->m_mlsOnlineState) - return; + if (!d->updateProvider(name.toLower(), providerState)) { + return false; + } - d->m_mlsOnlineState = state; d->writeSettings(); - emit mlsOnlineStateChanged(); + return true; } -bool LocationSettings::mlsAvailable() const +/*Mozilla Location services*/ +bool LocationSettings::mlsEnabled() const { Q_D(const LocationSettings); - return d->mlsAvailable(); + return d->m_providers.value(MlsName).offlineEnabled; } -/*Yandex locator services*/ +void LocationSettings::setMlsEnabled(bool enabled) +{ + if (mlsAvailable() && enabled != mlsEnabled()) { + LocationProvider provider = providerInfo(MlsName); + provider.offlineEnabled = enabled; + updateLocationProvider(MlsName, provider); + } +} -bool LocationSettings::yandexLocatorEnabled() const +LocationSettings::OnlineAGpsState LocationSettings::mlsOnlineState() const { Q_D(const LocationSettings); - return d->m_yandexLocatorEnabled; + return d->onlineState(MlsName); } -void LocationSettings::setYandexLocatorEnabled(bool enabled) +void LocationSettings::setMlsOnlineState(LocationSettings::OnlineAGpsState state) { Q_D(LocationSettings); - if (enabled != d->m_yandexLocatorEnabled) { - d->m_yandexLocatorEnabled = enabled; - d->writeSettings(); - emit yandexLocatorEnabledChanged(); - } + d->updateOnlineAgpsState(MlsName, state); } -LocationSettings::OnlineAGpsState LocationSettings::yandexLocatorOnlineState() const +bool LocationSettings::mlsAvailable() const { Q_D(const LocationSettings); - return d->m_yandexLocatorOnlineState; + return d->m_providers.contains(MlsName); } -void LocationSettings::setYandexLocatorOnlineState(LocationSettings::OnlineAGpsState state) +/*Yandex services*/ +LocationSettings::OnlineAGpsState LocationSettings::yandexOnlineState() const { - Q_D(LocationSettings); - if (state == d->m_yandexLocatorOnlineState) - return; + Q_D(const LocationSettings); + return d->onlineState(YandexName); +} - d->m_yandexLocatorOnlineState = state; - d->writeSettings(); - emit yandexLocatorOnlineStateChanged(); +void LocationSettings::setYandexOnlineState(LocationSettings::OnlineAGpsState state) +{ + Q_D(LocationSettings); + d->updateOnlineAgpsState(YandexName, state); } -bool LocationSettings::yandexLocatorAvailable() const +bool LocationSettings::yandexAvailable() const { Q_D(const LocationSettings); - return d->yandexLocatorAvailable(); + return d->m_providers.contains(YandexName); } /*HERE*/ LocationSettings::OnlineAGpsState LocationSettings::hereState() const { Q_D(const LocationSettings); - return d->m_hereState; + return d->onlineState(HereName); } void LocationSettings::setHereState(LocationSettings::OnlineAGpsState state) { Q_D(LocationSettings); - if (state == d->m_hereState) - return; - - d->m_hereState = state; - d->writeSettings(); - emit hereStateChanged(); + d->updateOnlineAgpsState(HereName, state); } bool LocationSettings::hereAvailable() const { Q_D(const LocationSettings); - return d->hereAvailable(); + return d->m_providers.contains(HereName); } LocationSettings::LocationMode LocationSettings::locationMode() const @@ -547,74 +624,33 @@ void LocationSettings::setLocationMode(LocationMode locationMode) return; } - d->m_settingLocationMode = true; d->m_settingMultipleSettings = true; d->m_locationMode = locationMode; - if (locationMode == HighAccuracyMode) { - setGpsEnabled(true); - if (mlsAvailable()) { - setMlsEnabled(true); - if (mlsOnlineState() != LocationSettings::OnlineAGpsAgreementNotAccepted) { - setMlsOnlineState(LocationSettings::OnlineAGpsEnabled); - } - } - if (yandexLocatorAvailable()) { - setYandexLocatorEnabled(true); - if (yandexLocatorOnlineState() != LocationSettings::OnlineAGpsAgreementNotAccepted) { - setYandexLocatorOnlineState(LocationSettings::OnlineAGpsEnabled); - } - } - if (hereAvailable()) { - if (hereState() != LocationSettings::OnlineAGpsAgreementNotAccepted) { - setHereState(LocationSettings::OnlineAGpsEnabled); - } - } - } else if (locationMode == BatterySavingMode) { - setGpsEnabled(false); - if (mlsAvailable()) { - setMlsEnabled(true); - if (mlsOnlineState() != LocationSettings::OnlineAGpsAgreementNotAccepted) { - setMlsOnlineState(LocationSettings::OnlineAGpsEnabled); - } - } - if (yandexLocatorAvailable()) { - setYandexLocatorEnabled(true); - if (yandexLocatorOnlineState() != LocationSettings::OnlineAGpsAgreementNotAccepted) { - setYandexLocatorOnlineState(LocationSettings::OnlineAGpsEnabled); - } - } - if (hereAvailable()) { - if (hereState() != LocationSettings::OnlineAGpsAgreementNotAccepted) { - setHereState(LocationSettings::OnlineAGpsEnabled); - } - } - } else if (locationMode == DeviceOnlyMode) { - setGpsEnabled(true); - if (mlsAvailable()) { - setMlsEnabled(true); - if (mlsOnlineState() != LocationSettings::OnlineAGpsAgreementNotAccepted) { - setMlsOnlineState(LocationSettings::OnlineAGpsDisabled); - } - } - if (yandexLocatorAvailable()) { - setYandexLocatorEnabled(true); - if (yandexLocatorOnlineState() != LocationSettings::OnlineAGpsAgreementNotAccepted) { - setYandexLocatorOnlineState(LocationSettings::OnlineAGpsDisabled); - } - } - if (hereAvailable()) { - if (hereState() != LocationSettings::OnlineAGpsAgreementNotAccepted) { - setHereState(LocationSettings::OnlineAGpsDisabled); - } + if (locationMode != CustomMode) { + setGpsEnabled(locationMode == HighAccuracyMode || locationMode == DeviceOnlyMode); + bool enableOnline = (locationMode != DeviceOnlyMode); + + for (const QString &name : d->m_providers.keys()) { + LocationProvider provider = d->m_providers.value(name); + provider.offlineEnabled = true; + provider.onlineEnabled = enableOnline; + d->updateProvider(name, provider); } + } else if (d->m_pendingAgreements.isEmpty()) { + d->m_pendingAgreements.clear(); + emit pendingAgreementsChanged(); } d->m_settingMultipleSettings = false; d->writeSettings(); emit locationModeChanged(); +} - d->m_settingLocationMode = false; +QStringList LocationSettings::pendingAgreements() const +{ + Q_D(const LocationSettings); + return d->m_pendingAgreements; } LocationSettings::DataSources LocationSettings::allowedDataSources() const @@ -636,25 +672,9 @@ void LocationSettings::setAllowedDataSources(LocationSettings::DataSources dataS void LocationSettingsPrivate::readSettings() { - // deprecated key values - bool oldMlsEnabled = false; - bool oldHereEnabled = false; - bool oldHereAgreementAccepted = false; - bool oldYandexLocatorEnabled = false; - - // current key values bool locationEnabled = false; bool customMode = false; bool gpsEnabled = false; - bool mlsEnabled = false; - bool mlsAgreementAccepted = false; - bool mlsOnlineEnabled = false; - bool yandexLocatorEnabled = false; - bool yandexLocatorAgreementAccepted = false; - bool yandexLocatorOnlineEnabled = false; - - bool hereEnabled = false; - bool hereAgreementAccepted = false; // MDM allowed data source key values LocationSettings::DataSources allowedDataSources = static_cast(std::numeric_limits::max()); @@ -668,6 +688,9 @@ void LocationSettingsPrivate::readSettings() } // read the deprecated keys first for backward compatibility + bool oldMlsEnabled = false; + bool oldHereEnabled = false; + bool oldHereAgreementAccepted = false; ini.readBool(LocationSettingsSection, LocationSettingsDeprecatedCellIdPositioningEnabledKey, &oldMlsEnabled); ini.readBool(LocationSettingsSection, LocationSettingsDeprecatedHereEnabledKey, &oldHereEnabled); ini.readBool(LocationSettingsSection, LocationSettingsDeprecatedHereAgreementAcceptedKey, &oldHereAgreementAccepted); @@ -676,14 +699,20 @@ void LocationSettingsPrivate::readSettings() ini.readBool(LocationSettingsSection, LocationSettingsEnabledKey, &locationEnabled); ini.readBool(LocationSettingsSection, LocationSettingsCustomModeKey, &customMode); ini.readBool(LocationSettingsSection, LocationSettingsGpsEnabledKey, &gpsEnabled); - ini.readBool(LocationSettingsSection, LocationSettingsMlsEnabledKey, &mlsEnabled, oldMlsEnabled); - ini.readBool(LocationSettingsSection, LocationSettingsMlsAgreementAcceptedKey, &mlsAgreementAccepted); - ini.readBool(LocationSettingsSection, LocationSettingsMlsOnlineEnabledKey, &mlsOnlineEnabled); - ini.readBool(LocationSettingsSection, LocationSettingsYandexLocatorEnabledKey, &yandexLocatorEnabled, oldYandexLocatorEnabled); - ini.readBool(LocationSettingsSection, LocationSettingsYandexLocatorAgreementAcceptedKey, &yandexLocatorAgreementAccepted); - ini.readBool(LocationSettingsSection, LocationSettingsYandexLocatorOnlineEnabledKey, &yandexLocatorOnlineEnabled); - ini.readBool(LocationSettingsSection, LocationSettingsHereEnabledKey, &hereEnabled, oldHereEnabled); - ini.readBool(LocationSettingsSection, LocationSettingsHereAgreementAcceptedKey, &hereAgreementAccepted, oldHereAgreementAccepted); + + for (const QString &name : m_providers.keys()) { + LocationProvider provider; + if (name == MlsName) { + provider.offlineEnabled = oldMlsEnabled; + } else if (name == HereName) { + provider.onlineEnabled = oldHereEnabled; + provider.agreementAccepted = oldHereAgreementAccepted; + } + ini.readBool(LocationSettingsSection, ProviderOfflineEnabledPattern.arg(name), &provider.offlineEnabled); + ini.readBool(LocationSettingsSection, ProviderOnlineEnabledPattern.arg(name), &provider.onlineEnabled); + ini.readBool(LocationSettingsSection, ProviderAgreementAcceptedPattern.arg(name), &provider.agreementAccepted); + updateProvider(name, provider); + } // read the MDM allowed allowed data source keys bool dataSourceAllowed = true; @@ -713,44 +742,14 @@ void LocationSettingsPrivate::readSettings() emit q->gpsEnabledChanged(); } - LocationSettings::OnlineAGpsState hereState = hereAgreementAccepted - ? (hereEnabled ? LocationSettings::OnlineAGpsEnabled : LocationSettings::OnlineAGpsDisabled) - : LocationSettings::OnlineAGpsAgreementNotAccepted; - if (m_hereState != hereState) { - m_hereState = hereState; - emit q->hereStateChanged(); - } - - if (m_mlsEnabled != mlsEnabled) { - m_mlsEnabled = mlsEnabled; - emit q->mlsEnabledChanged(); - } - - if (m_yandexLocatorEnabled != yandexLocatorEnabled) { - m_yandexLocatorEnabled = yandexLocatorEnabled; - emit q->yandexLocatorEnabledChanged(); - } - - LocationSettings::OnlineAGpsState mlsOnlineState = mlsAgreementAccepted - ? ((mlsOnlineEnabled && m_mlsEnabled) ? LocationSettings::OnlineAGpsEnabled : LocationSettings::OnlineAGpsDisabled) - : LocationSettings::OnlineAGpsAgreementNotAccepted; - if (m_mlsOnlineState != mlsOnlineState) { - m_mlsOnlineState = mlsOnlineState; - emit q->mlsOnlineStateChanged(); - } - - LocationSettings::OnlineAGpsState yandexLocatorOnlineState = yandexLocatorAgreementAccepted - ? ((yandexLocatorOnlineEnabled && m_yandexLocatorEnabled) ? LocationSettings::OnlineAGpsEnabled : LocationSettings::OnlineAGpsDisabled) - : LocationSettings::OnlineAGpsAgreementNotAccepted; - if (m_yandexLocatorOnlineState != yandexLocatorOnlineState) { - m_yandexLocatorOnlineState = yandexLocatorOnlineState; - emit q->yandexLocatorOnlineStateChanged(); - } - if ((m_locationMode == LocationSettings::CustomMode) != customMode) { if (customMode) { m_locationMode = LocationSettings::CustomMode; emit q->locationModeChanged(); + if (!m_pendingAgreements.isEmpty()) { + m_pendingAgreements.clear(); + emit q->pendingAgreementsChanged(); + } } else { m_locationMode = calculateLocationMode(); emit q->locationModeChanged(); @@ -770,44 +769,26 @@ void LocationSettingsPrivate::writeSettings() return; } - // set the available location providers value based upon the enabled providers - QStringList agps_providers; - - if (m_mlsEnabled) { - agps_providers.append("mls"); - } - if (m_hereState == LocationSettings::OnlineAGpsEnabled) { - agps_providers.append("here"); - } - if (m_yandexLocatorEnabled) { - agps_providers.append("yandex"); - } - // write the values to the conf file { IniFile ini(LocationSettingsFile); - // write deprecated keys for backward compatibility - ini.writeBool(LocationSettingsSection, LocationSettingsDeprecatedCellIdPositioningEnabledKey, m_mlsEnabled); - ini.writeBool(LocationSettingsSection, LocationSettingsDeprecatedHereEnabledKey, m_hereState == LocationSettings::OnlineAGpsEnabled); - ini.writeBool(LocationSettingsSection, LocationSettingsDeprecatedHereAgreementAcceptedKey, m_hereState != LocationSettings::OnlineAGpsAgreementNotAccepted); - - // then write the current keys ini.writeBool(LocationSettingsSection, LocationSettingsEnabledKey, m_locationEnabled); ini.writeBool(LocationSettingsSection, LocationSettingsCustomModeKey, m_locationMode == LocationSettings::CustomMode); ini.writeBool(LocationSettingsSection, LocationSettingsGpsEnabledKey, m_gpsEnabled); - ini.writeBool(LocationSettingsSection, LocationSettingsMlsEnabledKey, m_mlsEnabled); - ini.writeBool(LocationSettingsSection, LocationSettingsMlsAgreementAcceptedKey, m_mlsOnlineState != LocationSettings::OnlineAGpsAgreementNotAccepted); - ini.writeBool(LocationSettingsSection, LocationSettingsMlsOnlineEnabledKey, m_mlsOnlineState == LocationSettings::OnlineAGpsEnabled); - ini.writeBool(LocationSettingsSection, LocationSettingsYandexLocatorEnabledKey, m_yandexLocatorEnabled); - ini.writeBool(LocationSettingsSection, LocationSettingsYandexLocatorAgreementAcceptedKey, m_yandexLocatorOnlineState != LocationSettings::OnlineAGpsAgreementNotAccepted); - ini.writeBool(LocationSettingsSection, LocationSettingsYandexLocatorOnlineEnabledKey, m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsEnabled); - ini.writeBool(LocationSettingsSection, LocationSettingsHereEnabledKey, m_hereState == LocationSettings::OnlineAGpsEnabled); - ini.writeBool(LocationSettingsSection, LocationSettingsHereAgreementAcceptedKey, m_hereState != LocationSettings::OnlineAGpsAgreementNotAccepted); - ini.writeBool(LocationSettingsSection, LocationSettingsHereOnlineEnabledKey, m_hereState == LocationSettings::OnlineAGpsEnabled); - - // write the available location providers based on the enabled plugins - ini.writeString(LocationSettingsSection, LocationSettingsAgpsProvidersKey, "\""+agps_providers.join(",")+"\""); + + for (const QString &name : m_providers.keys()) { + LocationProvider provider = m_providers.value(name); + if (provider.offlineCapable) { + ini.writeBool(LocationSettingsSection, ProviderOfflineEnabledPattern.arg(name), provider.offlineEnabled); + } + if (provider.onlineCapable) { + ini.writeBool(LocationSettingsSection, ProviderOnlineEnabledPattern.arg(name), provider.onlineEnabled); + } + if (provider.hasAgreement) { + ini.writeBool(LocationSettingsSection, ProviderAgreementAcceptedPattern.arg(name), provider.agreementAccepted); + } + } // write the MDM allowed allowed data source keys for (QMap::const_iterator diff --git a/src/locationsettings.h b/src/locationsettings.h index 5798f61..8e3804d 100644 --- a/src/locationsettings.h +++ b/src/locationsettings.h @@ -37,34 +37,46 @@ #include #include +#include #define LOCATION_SETTINGS_LAST_DATA_SOURCE_BIT 31 +struct LocationProvider { + bool hasAgreement = false; + bool agreementAccepted = false; + bool onlineCapable = true; + bool onlineEnabled = false; + bool offlineCapable = false; + bool offlineEnabled = false; +}; + +// The settings component here expects two types of usage for modifications. +// Either locationMode to high level location types, after which pendingAgreements tells +// which location services need to be explicitly turned on to ensure the usage agreement is acknowledged. +// Or setting location mode to custom, and modifying specific details. + class LocationSettingsPrivate; class SYSTEMSETTINGS_EXPORT LocationSettings : public QObject { Q_OBJECT Q_PROPERTY(bool locationEnabled READ locationEnabled WRITE setLocationEnabled NOTIFY locationEnabledChanged) - + Q_PROPERTY(LocationMode locationMode READ locationMode WRITE setLocationMode NOTIFY locationModeChanged) + Q_PROPERTY(QStringList pendingAgreements READ pendingAgreements NOTIFY pendingAgreementsChanged) + Q_PROPERTY(DataSources allowedDataSources READ allowedDataSources WRITE setAllowedDataSources NOTIFY allowedDataSourcesChanged) + Q_PROPERTY(bool gpsAvailable READ gpsAvailable CONSTANT) Q_PROPERTY(bool gpsEnabled READ gpsEnabled WRITE setGpsEnabled NOTIFY gpsEnabledChanged) Q_PROPERTY(bool gpsFlightMode READ gpsFlightMode WRITE setGpsFlightMode NOTIFY gpsFlightModeChanged) - Q_PROPERTY(bool gpsAvailable READ gpsAvailable CONSTANT) + Q_PROPERTY(QStringList locationProviders READ locationProviders CONSTANT) - Q_PROPERTY(OnlineAGpsState hereState READ hereState WRITE setHereState NOTIFY hereStateChanged) + // Some specific locators provided as convenience for qml Q_PROPERTY(bool hereAvailable READ hereAvailable CONSTANT) - + Q_PROPERTY(OnlineAGpsState hereState READ hereState WRITE setHereState NOTIFY hereStateChanged) + Q_PROPERTY(bool mlsAvailable READ mlsAvailable CONSTANT) Q_PROPERTY(bool mlsEnabled READ mlsEnabled WRITE setMlsEnabled NOTIFY mlsEnabledChanged) Q_PROPERTY(OnlineAGpsState mlsOnlineState READ mlsOnlineState WRITE setMlsOnlineState NOTIFY mlsOnlineStateChanged) - Q_PROPERTY(bool mlsAvailable READ mlsAvailable CONSTANT) - - Q_PROPERTY(bool yandexLocatorEnabled READ yandexLocatorEnabled WRITE setYandexLocatorEnabled NOTIFY yandexLocatorEnabledChanged) - Q_PROPERTY(OnlineAGpsState yandexLocatorOnlineState READ yandexLocatorOnlineState WRITE setYandexLocatorOnlineState NOTIFY yandexLocatorOnlineStateChanged) - Q_PROPERTY(bool yandexLocatorAvailable READ yandexLocatorAvailable CONSTANT) - - Q_PROPERTY(LocationMode locationMode READ locationMode WRITE setLocationMode NOTIFY locationModeChanged) - - Q_PROPERTY(DataSources allowedDataSources READ allowedDataSources WRITE setAllowedDataSources NOTIFY allowedDataSourcesChanged) + Q_PROPERTY(bool yandexAvailable READ yandexAvailable CONSTANT) + Q_PROPERTY(OnlineAGpsState yandexOnlineState READ yandexOnlineState WRITE setYandexOnlineState NOTIFY yandexOnlineStateChanged) Q_ENUMS(OnlineAGpsState) Q_ENUMS(LocationMode) @@ -75,41 +87,12 @@ class SYSTEMSETTINGS_EXPORT LocationSettings : public QObject SynchronousMode }; - explicit LocationSettings(QObject *parent = 0); - explicit LocationSettings(Mode mode, QObject *parent = 0); - virtual ~LocationSettings(); - - bool locationEnabled() const; - void setLocationEnabled(bool enabled); - - bool gpsEnabled() const; - void setGpsEnabled(bool enabled); - bool gpsFlightMode() const; - void setGpsFlightMode(bool flightMode); - bool gpsAvailable() const; - enum OnlineAGpsState { OnlineAGpsAgreementNotAccepted, OnlineAGpsDisabled, OnlineAGpsEnabled }; - OnlineAGpsState hereState() const; - void setHereState(OnlineAGpsState state); - bool hereAvailable() const; - - bool mlsEnabled() const; - void setMlsEnabled(bool enabled); - OnlineAGpsState mlsOnlineState() const; - void setMlsOnlineState(OnlineAGpsState state); - bool mlsAvailable() const; - - bool yandexLocatorEnabled() const; - void setYandexLocatorEnabled(bool enabled); - OnlineAGpsState yandexLocatorOnlineState() const; - void setYandexLocatorOnlineState(OnlineAGpsState state); - bool yandexLocatorAvailable() const; - enum LocationMode { HighAccuracyMode, BatterySavingMode, @@ -117,9 +100,6 @@ class SYSTEMSETTINGS_EXPORT LocationSettings : public QObject CustomMode }; - LocationMode locationMode() const; - void setLocationMode(LocationMode locationMode); - // Data sources are grouped roughly by type, // with gaps left for future expansion. enum DataSource { @@ -144,20 +124,56 @@ class SYSTEMSETTINGS_EXPORT LocationSettings : public QObject Q_DECLARE_FLAGS(DataSources, DataSource) Q_FLAG(DataSources) + explicit LocationSettings(QObject *parent = 0); + explicit LocationSettings(Mode mode, QObject *parent = 0); + virtual ~LocationSettings(); + + bool locationEnabled() const; + void setLocationEnabled(bool enabled); + + bool gpsEnabled() const; + void setGpsEnabled(bool enabled); + bool gpsFlightMode() const; + void setGpsFlightMode(bool flightMode); + bool gpsAvailable() const; + + QStringList locationProviders() const; + LocationProvider providerInfo(const QString &name) const; + bool updateLocationProvider(const QString &name, const LocationProvider &providerState); + + // qml helpers for specific location providers + OnlineAGpsState hereState() const; + void setHereState(OnlineAGpsState state); + bool hereAvailable() const; + + bool mlsEnabled() const; + void setMlsEnabled(bool enabled); + OnlineAGpsState mlsOnlineState() const; + void setMlsOnlineState(OnlineAGpsState state); + bool mlsAvailable() const; + + OnlineAGpsState yandexOnlineState() const; + void setYandexOnlineState(OnlineAGpsState state); + bool yandexAvailable() const; + + LocationMode locationMode() const; + void setLocationMode(LocationMode locationMode); + QStringList pendingAgreements() const; + DataSources allowedDataSources() const; void setAllowedDataSources(DataSources dataSources); signals: - void hereStateChanged(); void locationEnabledChanged(); void gpsEnabledChanged(); void gpsFlightModeChanged(); - void mlsEnabledChanged(); - void mlsOnlineStateChanged(); - void yandexLocatorEnabledChanged(); - void yandexLocatorOnlineStateChanged(); void locationModeChanged(); + void pendingAgreementsChanged(); void allowedDataSourcesChanged(); + void hereStateChanged(); + void mlsEnabledChanged(); + void mlsOnlineStateChanged(); + void yandexOnlineStateChanged(); private: LocationSettingsPrivate *d_ptr; diff --git a/src/locationsettings_p.h b/src/locationsettings_p.h index 46f7f3e..eb5aa5f 100644 --- a/src/locationsettings_p.h +++ b/src/locationsettings_p.h @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include @@ -58,24 +60,20 @@ class LocationSettingsPrivate : public QObject LocationSettingsPrivate(LocationSettings::Mode mode, LocationSettings *settings); ~LocationSettingsPrivate(); + void loadProviders(); + bool updateProvider(const QString &name, const LocationProvider &state); + LocationSettings::OnlineAGpsState onlineState(const QString &name, bool *valid = nullptr) const; + void updateOnlineAgpsState(const QString &name, LocationSettings::OnlineAGpsState state); LocationSettings::LocationMode calculateLocationMode() const; void writeSettings(); - bool mlsAvailable() const; - bool yandexLocatorAvailable() const; - bool hereAvailable() const; - QFileSystemWatcher m_watcher; bool m_locationEnabled; bool m_gpsEnabled; - bool m_mlsEnabled; - bool m_yandexLocatorEnabled; - LocationSettings::OnlineAGpsState m_mlsOnlineState; - LocationSettings::OnlineAGpsState m_yandexLocatorOnlineState; - LocationSettings::OnlineAGpsState m_hereState; + QHash m_providers; LocationSettings::LocationMode m_locationMode; - bool m_settingLocationMode; bool m_settingMultipleSettings; + QStringList m_pendingAgreements; LocationSettings::DataSources m_allowedDataSources; NetworkManager *m_connMan; NetworkTechnology *m_gpsTech; @@ -85,7 +83,6 @@ private slots: void readSettings(); void findGpsTech(); void gpsTechPropertyChanged(const QString &propertyName, const QVariant &value); - void recalculateLocationMode(); }; // TODO: replace this with DBus calls to a central settings service... diff --git a/src/nfcsettings.cpp b/src/nfcsettings.cpp new file mode 100644 index 0000000..10bb465 --- /dev/null +++ b/src/nfcsettings.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2019 Open Mobile Platform LLŠ”. + * + * You may use this file under the terms of the BSD license as follows: + * + * "Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Nemo Mobile nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + */ + + +#include "nfcsettings.h" + +#include +#include +#include + +NfcSettings::NfcSettings(QObject *parent) + : QObject(parent) + , m_valid(false) + , m_enabled(false) + , m_available(false) +{ + m_interface = new QDBusInterface("org.sailfishos.nfc.settings", + "/", + "org.sailfishos.nfc.Settings", + QDBusConnection::systemBus(), + this); + if (QDBusConnection::systemBus().interface()->isServiceRegistered("org.sailfishos.nfc.settings")) { + m_available = true; + emit availableChanged(); + + QDBusPendingCall pcall = m_interface->asyncCall(QLatin1String("GetEnabled")); + QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this); + + connect(watcher, &QDBusPendingCallWatcher::finished, this, &NfcSettings::getEnableStateFinished); + QDBusConnection::systemBus().connect("org.sailfishos.nfc.settings", "/", "org.sailfishos.nfc.Settings", "EnabledChanged", this, SLOT(updateEnabledState(bool))); + + } else { + qWarning() << "NFC interface not available"; + qWarning() << m_interface->lastError(); + } + +} + +NfcSettings::~NfcSettings() +{ +} + +bool NfcSettings::valid() const +{ + return m_valid; +} + +bool NfcSettings::available() const +{ + return m_available; +} + +bool NfcSettings::enabled() const +{ + return m_enabled; +} + +void NfcSettings::setEnabled(bool enabled) +{ + m_interface->asyncCall("SetEnabled", enabled); +} + +void NfcSettings::getEnableStateFinished(QDBusPendingCallWatcher *call) +{ + QDBusPendingReply reply = *call; + if (reply.isError()) { + qWarning() << "Get dbus error:" << reply.error(); + } else { + updateEnabledState(reply.value()); + m_valid = true; + emit validChanged(); + } + call->deleteLater(); +} + +void NfcSettings::updateEnabledState(bool enabled) +{ + if (enabled != m_enabled) { + m_enabled = enabled; + emit enabledChanged(); + } +} diff --git a/src/nfcsettings.h b/src/nfcsettings.h new file mode 100644 index 0000000..642a296 --- /dev/null +++ b/src/nfcsettings.h @@ -0,0 +1,44 @@ +#ifndef NFCSETTINGS_H +#define NFCSETTINGS_H + +#include + +#include +#include +#include +#include + +class SYSTEMSETTINGS_EXPORT NfcSettings : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool valid READ valid NOTIFY validChanged) + Q_PROPERTY(bool available READ available NOTIFY availableChanged) + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) + +public: + explicit NfcSettings(QObject *parent = nullptr); + ~NfcSettings(); + + bool valid() const; + bool available() const; + bool enabled() const; + void setEnabled(bool enabled); + +signals: + void validChanged(); + void availableChanged(); + void enabledChanged(); + +private: + bool m_valid; + bool m_enabled; + bool m_available; + QDBusInterface *m_interface; + QTimer *m_timer; + +private slots: + void getEnableStateFinished(QDBusPendingCallWatcher* call); + void updateEnabledState(bool enabled); +}; + +#endif // NFCSETTINGS_H diff --git a/src/plugin/plugin.cpp b/src/plugin/plugin.cpp index 1a897aa..3db1b4a 100644 --- a/src/plugin/plugin.cpp +++ b/src/plugin/plugin.cpp @@ -50,6 +50,7 @@ #include "settingsvpnmodel.h" #include "locationsettings.h" #include "deviceinfo.h" +#include "nfcsettings.h" template static QObject *api_factory(QQmlEngine *, QJSEngine *) @@ -89,6 +90,7 @@ class SystemSettingsPlugin : public QQmlExtensionPlugin qmlRegisterType(uri, 1, 0, "DiskUsage"); qmlRegisterType(uri, 1, 0, "LocationSettings"); qmlRegisterType(uri, 1, 0, "DeviceInfo"); + qmlRegisterType(uri, 1, 0, "NfcSettings"); } }; diff --git a/src/plugin/plugins.qmltypes b/src/plugin/plugins.qmltypes index 878ba2a..866c079 100644 --- a/src/plugin/plugins.qmltypes +++ b/src/plugin/plugins.qmltypes @@ -154,6 +154,7 @@ Module { Property { name: "developerModeEnabled"; type: "bool"; isReadonly: true } Property { name: "workStatus"; type: "DeveloperModeSettings::Status"; isReadonly: true } Property { name: "workProgress"; type: "int"; isReadonly: true } + Property { name: "repositoryAccessRequired"; type: "bool"; isReadonly: true } Method { name: "setDeveloperMode" Parameter { name: "enabled"; type: "bool" } @@ -364,19 +365,29 @@ Module { } } Property { name: "locationEnabled"; type: "bool" } + Property { name: "locationMode"; type: "LocationMode" } + Property { name: "pendingAgreements"; type: "QStringList"; isReadonly: true } + Property { name: "allowedDataSources"; type: "DataSources" } + Property { name: "gpsAvailable"; type: "bool"; isReadonly: true } Property { name: "gpsEnabled"; type: "bool" } Property { name: "gpsFlightMode"; type: "bool" } - Property { name: "gpsAvailable"; type: "bool"; isReadonly: true } - Property { name: "hereState"; type: "OnlineAGpsState" } + Property { name: "locationProviders"; type: "QStringList"; isReadonly: true } Property { name: "hereAvailable"; type: "bool"; isReadonly: true } + Property { name: "hereState"; type: "OnlineAGpsState" } + Property { name: "mlsAvailable"; type: "bool"; isReadonly: true } Property { name: "mlsEnabled"; type: "bool" } Property { name: "mlsOnlineState"; type: "OnlineAGpsState" } - Property { name: "mlsAvailable"; type: "bool"; isReadonly: true } - Property { name: "yandexLocatorEnabled"; type: "bool" } - Property { name: "yandexLocatorOnlineState"; type: "OnlineAGpsState" } - Property { name: "yandexLocatorAvailable"; type: "bool"; isReadonly: true } - Property { name: "locationMode"; type: "LocationMode" } - Property { name: "allowedDataSources"; type: "DataSources" } + Property { name: "yandexAvailable"; type: "bool"; isReadonly: true } + Property { name: "yandexOnlineState"; type: "OnlineAGpsState" } + } + Component { + name: "NfcSettings" + prototype: "QObject" + exports: ["org.nemomobile.systemsettings/NfcSettings 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "valid"; type: "bool"; isReadonly: true } + Property { name: "available"; type: "bool"; isReadonly: true } + Property { name: "enabled"; type: "bool" } } Component { name: "PartitionModel" diff --git a/src/src.pro b/src/src.pro index 386f2a2..d5e865b 100644 --- a/src/src.pro +++ b/src/src.pro @@ -16,6 +16,7 @@ SOURCES += \ localeconfig.cpp \ logging.cpp \ datetimesettings.cpp \ + nfcsettings.cpp \ profilecontrol.cpp \ alarmtonemodel.cpp \ mceiface.cpp \ @@ -70,6 +71,7 @@ HEADERS += \ diskusage_p.h \ locationsettings_p.h \ logging_p.h \ + nfcsettings.h \ partition_p.h \ partitionmanager_p.h \ udisks2blockdevices_p.h \