Commit f025d46f authored by chriadam's avatar chriadam

[nemo-qml-plugin-systemsettings] Move LocationSettings to nqp-ss. Contributes to JB#37470

Since geoclue-hybris now requires LocationSettings, we need to expose
this as public API in nqp-ss.

This commit also exposes the gpsFlightMode setting as the inverse of
the "gps" technology's powered state (from connman).

Contributes to JB#37470
parent 9a930f5f
......@@ -22,6 +22,8 @@ BuildRequires: pkgconfig(libshadowutils)
BuildRequires: pkgconfig(blkid)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(nemomodels-qt5)
BuildRequires: pkgconfig(libsailfishkeyprovider)
BuildRequires: pkgconfig(connman-qt5)
%description
%{summary}.
......@@ -64,6 +66,8 @@ chmod +x %{buildroot}/%{_bindir}/vpn-updown.sh
%{_libdir}/libsystemsettings.so.*
%{_libdir}/systemd/user/vpn-updown.service
%{_bindir}/vpn-updown.sh
%dir %attr(0775, root, privileged) /etc/location
%config %attr(0664, root, privileged) /etc/location/location.conf
%files devel
%defattr(-,root,root,-)
......
[location]
agreement_accepted=false
enabled=false
gps\enabled=true
mls\enabled=true
This diff is collapsed.
/*
* Copyright (C) 2017 Jolla Ltd.
* Contact: Chris Adams <chris.adams@jolla.com>
*
* 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."
*/
#ifndef LOCATIONSETTINGS_H
#define LOCATIONSETTINGS_H
#include <systemsettingsglobal.h>
#include <QObject>
#include <QFileSystemWatcher>
#include <QScopedPointer>
#include <QString>
#include <sailfishkeyprovider_processmutex.h>
class NetworkManager;
class NetworkTechnology;
class SYSTEMSETTINGS_EXPORT LocationSettings : public QObject
{
Q_OBJECT
Q_PROPERTY(bool locationEnabled READ locationEnabled WRITE setLocationEnabled NOTIFY locationEnabledChanged)
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(OnlineAGpsState hereState READ hereState WRITE setHereState NOTIFY hereStateChanged)
Q_PROPERTY(bool hereAvailable READ hereAvailable 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_ENUMS(OnlineAGpsState)
public:
explicit LocationSettings(QObject *parent = 0);
~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;
signals:
void hereStateChanged();
void locationEnabledChanged();
void gpsEnabledChanged();
void gpsFlightModeChanged();
void mlsEnabledChanged();
void mlsOnlineStateChanged();
private slots:
void readSettings();
void findGpsTech();
private:
void writeSettings();
QFileSystemWatcher m_watcher;
bool m_locationEnabled;
bool m_gpsEnabled;
bool m_mlsEnabled;
OnlineAGpsState m_mlsOnlineState;
OnlineAGpsState m_hereState;
NetworkManager *m_connMan;
NetworkTechnology *m_gpsTech;
mutable QScopedPointer<Sailfish::KeyProvider::ProcessMutex> m_processMutex;
};
#endif // LOCATIONSETTINGS_H
......@@ -48,6 +48,7 @@
#include "partitionmodel.h"
#include "certificatemodel.h"
#include "vpnmodel.h"
#include "locationsettings.h"
static QObject *vpnmodel_api_factory(QQmlEngine *, QJSEngine *)
{
......@@ -83,6 +84,7 @@ public:
qRegisterMetaType<DeveloperModeSettings::Status>("DeveloperModeSettings::Status");
qmlRegisterType<BatteryStatus>(uri, 1, 0, "BatteryStatus");
qmlRegisterType<DiskUsage>(uri, 1, 0, "DiskUsage");
qmlRegisterType<LocationSettings>(uri, 1, 0, "LocationSettings");
}
};
......
......@@ -6,7 +6,7 @@ CONFIG += qt plugin c++11 hide_symbols link_pkgconfig
QT += qml dbus network
QT -= gui
PKGCONFIG += profile usb-moded-qt5 nemomodels-qt5
PKGCONFIG += profile usb-moded-qt5 nemomodels-qt5 libsailfishkeyprovider connman-qt5
target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
INSTALLS += target
......
......@@ -6,7 +6,7 @@ QT += qml dbus systeminfo
QT -= gui
CONFIG += c++11 hide_symbols link_pkgconfig
PKGCONFIG += profile mlite5 mce timed-qt5 libshadowutils blkid libcrypto nemomodels-qt5
PKGCONFIG += profile mlite5 mce timed-qt5 libshadowutils blkid libcrypto nemomodels-qt5 libsailfishkeyprovider connman-qt5
system(qdbusxml2cpp -p mceiface.h:mceiface.cpp mce.xml)
system(qdbusxml2cpp -c ConnmanVpnProxy -p connmanvpnproxy ../dbus/net.connman.vpn.xml -i qdbusxml2cpp_dbus_types.h)
......@@ -30,7 +30,8 @@ SOURCES += \
diskusage_impl.cpp \
partition.cpp \
partitionmanager.cpp \
partitionmodel.cpp
partitionmodel.cpp \
locationsettings.cpp
PUBLIC_HEADERS = \
languagemodel.h \
......@@ -50,7 +51,8 @@ PUBLIC_HEADERS = \
partition.h \
partitionmanager.h \
partitionmodel.h \
systemsettingsglobal.h
systemsettingsglobal.h \
locationsettings.h
HEADERS += \
$$PUBLIC_HEADERS \
......@@ -70,6 +72,9 @@ target.path = $$[QT_INSTALL_LIBS]
pkgconfig.files = $$PWD/pkgconfig/systemsettings.pc
pkgconfig.path = $$target.path/pkgconfig
locationconfig.files = $$PWD/location.conf
locationconfig.path = /etc/location
scripts.path = /usr/bin/
scripts.files = vpn-updown.sh
......@@ -81,6 +86,6 @@ QMAKE_PKGCONFIG_DESCRIPTION = System settings application development files
QMAKE_PKGCONFIG_LIBDIR = $$target.path
QMAKE_PKGCONFIG_INCDIR = $$develheaders.path
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
QMAKE_PKGCONFIG_REQUIRES = Qt5Core Qt5DBus profile nemomodels-qt5
QMAKE_PKGCONFIG_REQUIRES = Qt5Core Qt5DBus profile nemomodels-qt5 libsailfishkeyprovider connman-qt5
INSTALLS += target develheaders pkgconfig scripts servicefiles
INSTALLS += target develheaders pkgconfig scripts servicefiles locationconfig
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment