summaryrefslogtreecommitdiffstats
path: root/src/qtdevicesettings
diff options
context:
space:
mode:
authorTeemu Holappa <teemu.holappa@theqtcompany.com>2016-01-28 10:22:43 +0200
committerTeemu Holappa <teemu.holappa@theqtcompany.com>2016-02-08 08:04:36 +0000
commit3e8998a7d712275891905f9e75a8cd150de86877 (patch)
tree8f781d0c2926e35c345f63e3c096a02f07f30603 /src/qtdevicesettings
parent272cdee776d315a4a265a82b7e539cdd9f41ac79 (diff)
Wifi support to the Network Settings Plugin.
All the network management is done now through the Connman backend. Removed separate wifi settings plugin. Change-Id: I7b6b7231f1c44727ce0591e11182d25bc43718ed Reviewed-by: Risto Avila <risto.avila@theqtcompany.com>
Diffstat (limited to 'src/qtdevicesettings')
-rw-r--r--src/qtdevicesettings/bluetoothsettingsplugin/bluetoothsettingsplugin.pro1
-rw-r--r--src/qtdevicesettings/devicesettings.pro1
-rw-r--r--src/qtdevicesettings/networksettingsplugin/icons.qrc2
-rw-r--r--src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/EditWiredSettings.qml35
-rw-r--r--src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkDetails.qml2
-rw-r--r--src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkSettings.qml12
-rw-r--r--src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSelectorDelegate.qml (renamed from src/qtdevicesettings/wifisettingsplugin/WifiSelectorDelegate.qml)7
-rw-r--r--src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSettings.qml158
-rw-r--r--src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSignalMonitor.qml (renamed from src/qtdevicesettings/wifisettingsplugin/WifiSignalMonitor.qml)4
-rw-r--r--src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WiredSettings.qml26
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp97
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h77
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/networksettingsmanager_linux.cpp583
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/networksettingsmanager_linux_p.h148
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp105
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h92
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp163
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h70
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp405
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h84
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp99
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h75
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/networksettings.pri42
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettings.h (renamed from src/qtdevicesettings/networksettingsplugin/networksettings/networkconfig.h)161
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.cpp (renamed from src/qtdevicesettings/networksettingsplugin/networksettings/networkaddressmodel.cpp)16
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.h (renamed from src/qtdevicesettings/networksettingsplugin/networksettings/networkaddressmodel.h)12
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.cpp81
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.h75
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.cpp (renamed from src/qtdevicesettings/networksettingsplugin/networksettings/networksmodel.cpp)21
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.h71
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.cpp71
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.h72
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.cpp (renamed from src/qtdevicesettings/networksettingsplugin/networksettings/networksettingsmanager.cpp)120
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.h (renamed from src/qtdevicesettings/networksettingsplugin/networksettings/networksettingsmanager.h)88
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.cpp164
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.h (renamed from src/qtdevicesettings/networksettingsplugin/networksettings/networksmodel.h)111
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.cpp55
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.h (renamed from src/qtdevicesettings/wifisettingsplugin/plugin.cpp)33
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettingsplugin.pro7
-rw-r--r--src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.cpp23
-rw-r--r--src/qtdevicesettings/settingscomponents/imports/Settings/CustomCombobox.qml5
-rw-r--r--src/qtdevicesettings/settingscomponents/imports/Settings/FlatStyledDropdownDelegate.qml2
-rw-r--r--src/qtdevicesettings/settingscomponents/imports/Settings/TextLabel.qml1
-rw-r--r--src/qtdevicesettings/timedateplugin/plugin.cpp1
-rw-r--r--src/qtdevicesettings/wifisettingsplugin/WifiManagerView.qml180
-rw-r--r--src/qtdevicesettings/wifisettingsplugin/icons.qrc7
-rw-r--r--src/qtdevicesettings/wifisettingsplugin/qml.qrc7
-rw-r--r--src/qtdevicesettings/wifisettingsplugin/qmldir2
-rw-r--r--src/qtdevicesettings/wifisettingsplugin/wifisettingsplugin.pro26
49 files changed, 2322 insertions, 1378 deletions
diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothsettingsplugin.pro b/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothsettingsplugin.pro
index 5ca0add..1ffc6c5 100644
--- a/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothsettingsplugin.pro
+++ b/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothsettingsplugin.pro
@@ -19,6 +19,7 @@ SOURCES += plugin.cpp \
pluginfiles.files += \
qmldir \
+
installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
target.path = $$installPath
diff --git a/src/qtdevicesettings/devicesettings.pro b/src/qtdevicesettings/devicesettings.pro
index 54758aa..c49e6fb 100644
--- a/src/qtdevicesettings/devicesettings.pro
+++ b/src/qtdevicesettings/devicesettings.pro
@@ -5,7 +5,6 @@ SUBDIRS += \
generalsettingsplugin \
timedateplugin \
settingsui \
- wifisettingsplugin \
localesettingsplugin \
bluetoothsettingsplugin \
diff --git a/src/qtdevicesettings/networksettingsplugin/icons.qrc b/src/qtdevicesettings/networksettingsplugin/icons.qrc
index af8a564..4b07cca 100644
--- a/src/qtdevicesettings/networksettingsplugin/icons.qrc
+++ b/src/qtdevicesettings/networksettingsplugin/icons.qrc
@@ -1,4 +1,6 @@
<RCC>
<qresource prefix="/">
+ <file>../icons/Wifi_lightgray_2x.png</file>
+ <file>../icons/WifiAnim_black_2x.png</file>
</qresource>
</RCC>
diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/EditWiredSettings.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/EditWiredSettings.qml
index a09bdf8..c678c67 100644
--- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/EditWiredSettings.qml
+++ b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/EditWiredSettings.qml
@@ -90,15 +90,15 @@ Item {
ListElement {
text: "DHCP"
- method: IPv4Config.Dhcp
+ method: NetworkSettingsIPv4.Dhcp
}
ListElement {
text: "Manual"
- method: IPv4Config.Manual
+ method: NetworkSettingsIPv4.Manual
}
ListElement {
text: "Off"
- method: IPv4Config.Off
+ method: NetworkSettingsIPv4.Off
}
}
@@ -125,7 +125,7 @@ Item {
Column {
spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- visible: service.ipv4.method === IPv4Config.Dhcp
+ visible: service.ipv4.method === NetworkSettingsIPv4.Dhcp
Row {
spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
@@ -166,7 +166,7 @@ Item {
Column {
spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- visible: service.ipv4.method === IPv4Config.Manual
+ visible: service.ipv4.method === NetworkSettingsIPv4.Manual
Row {
spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
@@ -234,15 +234,15 @@ Item {
ListElement {
text: qsTr("Auto")
- method: IPv6Config.Auto
+ method: NetworkSettingsIPv6.Auto
}
ListElement {
text: qsTr("Manual")
- method: IPv6Config.Manual
+ method: NetworkSettingsIPv6.Manual
}
ListElement {
text: qsTr("Off")
- method: IPv6Config.Off
+ method: NetworkSettingsIPv6.Off
}
}
@@ -268,7 +268,7 @@ Item {
Column {
spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- visible: service.ipv6.method === IPv6Config.Auto
+ visible: service.ipv6.method === NetworkSettingsIPv6.Auto
Row {
spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
TextLabel {
@@ -308,7 +308,7 @@ Item {
Column {
spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- visible: service.ipv6.method === IPv6Config.Manual
+ visible: service.ipv6.method === NetworkSettingsIPv6.Manual
Row {
spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
TextLabel {
@@ -497,15 +497,15 @@ Item {
ListElement {
text: qsTr("Direct")
- method: ProxyConfig.Direct
+ method: NetworkSettingsProxy.Direct
}
ListElement {
text: qsTr("Auto")
- method: ProxyConfig.Auto
+ method: NetworkSettingsProxy.Auto
}
ListElement {
text: qsTr("Manual")
- method: ProxyConfig.Manual
+ method: NetworkSettingsProxy.Manual
}
}
@@ -531,9 +531,10 @@ Item {
Row {
spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- visible: service.proxy.method !== ProxyConfig.Direct
+ visible: service.proxy.method !== NetworkSettingsProxy.Direct
TextLabel {
- text: service.proxy.method === ProxyConfig.Manual ? qsTr("Proxy address") : qsTr("Automatic configuration URL")
+ text: service.proxy.method === NetworkSettingsProxy.Manual ? qsTr("Proxy address") : qsTr("Automatic configuration URL")
+
width: content.titleWidth
horizontalAlignment: Text.AlignRight
}
@@ -546,7 +547,7 @@ Item {
}
Row {
spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- visible: service.proxy.method === ProxyConfig.Manual
+ visible: service.proxy.method === NetworkSettingsProxy.Manual
TextLabel {
text: qsTr("No proxy for")
@@ -632,7 +633,7 @@ Item {
}
if (proxyChanged) {
proxyUrl.accepted();
- service.setupProxyConfig();
+ service.setupNetworkSettingsProxy();
}
stackView.pop();
}
diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkDetails.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkDetails.qml
index 1540e03..3e71be0 100644
--- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkDetails.qml
+++ b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkDetails.qml
@@ -37,6 +37,6 @@ import QtQuick 2.5
Loader {
id: root
- property var service: undefined
+ property var selectedInterface:undefined
anchors.fill: parent
}
diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkSettings.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkSettings.qml
index daf3d1d..dcda5e0 100644
--- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkSettings.qml
+++ b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkSettings.qml
@@ -78,7 +78,7 @@ Item {
}
Repeater {
- model: NetworkSettingsManager.networks
+ model: NetworkSettingsManager.interfaces
Button {
implicitWidth: networkSelect.width - Math.round(20 * Flat.FlatStyle.scaleFactor)
@@ -105,19 +105,21 @@ Item {
}
TextLabel {
- text: networkSelect.stateToStr(status)
+ text: networkSelect.stateToStr(modelData.state)
font.pixelSize: Math.round(12 * Flat.FlatStyle.scaleFactor)
}
+
}
}
onCheckedChanged: {
if (checked) {
- networkDetails.service = NetworkSettingsManager.getService(name, type);
- if (type === NetworkType.Wired) {
+ networkDetails.selectedInterface = modelData
+ networkDetails.selectedInterface.scanServices()
+ if (type === NetworkSettingsType.Wired) {
networkDetails.source = "WiredSettings.qml";
}
- else if (type === NetworkType.Wifi) {
+ else if (type === NetworkSettingsType.Wifi) {
networkDetails.source = "WifiSettings.qml";
}
}
diff --git a/src/qtdevicesettings/wifisettingsplugin/WifiSelectorDelegate.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSelectorDelegate.qml
index cea3750..bc39ebd 100644
--- a/src/qtdevicesettings/wifisettingsplugin/WifiSelectorDelegate.qml
+++ b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSelectorDelegate.qml
@@ -37,13 +37,15 @@ import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4
import com.theqtcompany.settings.common 1.0
-import com.theqtcompany.settings.wifi 1.0
+import com.theqtcompany.settings.network 1.0
+import QtQuick.Controls.Styles.Flat 1.0 as Flat
Item {
id: root
property bool checkable: true
property bool checked: false
property bool pressed: false
+ property bool connect: modelData["connected"]
signal clicked()
MouseArea {
@@ -73,7 +75,7 @@ Item {
anchors.bottom: parent.bottom
anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor)
horizontalAlignment: Text.AlignLeft
- text: modelData["ssid"]
+ text: modelData["name"]
}
WifiSignalMonitor {
anchors.verticalCenter: parent.verticalCenter
@@ -82,6 +84,7 @@ Item {
height: Math.round(parent.height * .8)
width: height
signalStrength: modelData["signalStrength"]
+ connected: modelData["connected"]
}
}
}
diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSettings.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSettings.qml
index 3221e88..e7c2bda 100644
--- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSettings.qml
+++ b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSettings.qml
@@ -39,56 +39,152 @@ import QtQuick.Controls 1.4
import QtQuick.Controls.Styles.Flat 1.0 as Flat
import com.theqtcompany.settings.common 1.0
import com.theqtcompany.settings.network 1.0
-import com.theqtcompany.settings.wifi 1.0
Item {
id: root
anchors.fill: parent
anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor)
+
+ Component.onCompleted: {
+ NetworkSettingsManager.services.type = NetworkSettingsType.Wifi;
+ }
GroupBox {
id: content
title: qsTr("Wireless Settings")
anchors.fill: parent
Layout.fillWidth: true
flat: true
- width: parent.width
- Row {
- id: enableSwitch
+ ColumnLayout {
+ spacing: Math.round(20 * Flat.FlatStyle.scaleFactor)
width: parent.width
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- TextLabel {
- width: root.width*0.382
- horizontalAlignment: Text.AlignRight
- text: NetworkSettingsManager.wifiPowered ? qsTr("Disable Wifi") : qsTr("Enable Wifi")
+ Row {
+ id: enableSwitch
+ width: parent.width
+ spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ TextLabel {
+ width: root.width*0.382
+ horizontalAlignment: Text.AlignRight
+ text: selectedInterface.powered ? qsTr("Disable Wifi") : qsTr("Enable Wifi")
+ }
+ Switch {
+ checked: selectedInterface.powered
+ onCheckedChanged: selectedInterface.powered = checked
+ }
}
- Switch {
- checked: NetworkSettingsManager.wifiPowered
- onCheckedChanged: NetworkSettingsManager.wifiPowered = checked
+
+ Row {
+ spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ width: parent.width
+
+ TextLabel {
+ id: labelText
+ text: qsTr("Selected network ")
+ width: content.width*0.382
+ horizontalAlignment: Text.AlignRight
+ }
+
+ CustomCombobox {
+ id: networkSelection
+ model: NetworkSettingsManager.services
+ visible: selectedInterface.powered
+ width: Math.round(200 * Flat.FlatStyle.scaleFactor)
+ textRole: "name"
+ onSelectedIndexChanged : if (selectedIndex >= 0) model.itemFromRow(selectedIndex).connectService();
+
+ delegate: WifiSelectorDelegate {
+ id: delegate
+ onConnectChanged: if (connect) networkSelection.setSelectIndexToVal(modelData.name, "name");
+ }
+ }
}
- }
- Item {
- id: wifiManagerContainer
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: enableSwitch.bottom
- anchors.topMargin: Math.round(10 * Flat.FlatStyle.scaleFactor)
- anchors.bottom: parent.bottom
- Loader {
- id: wifiManagerLoader
- asynchronous: true
- sourceComponent: NetworkSettingsManager.wifiPowered ? wifiManager : undefined
+ GroupBox {
+ id: connectView
+ title: qsTr("Enter a password")
+ flat: false
+ visible: false
+ ColumnLayout {
+ Row {
+ id: errorView
+ property alias text: text.text
+ visible: text.text !== ""
+
+ spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ Image {
+ source: "../icons/Alert_yellow_1x.png"
+ }
+ Text {
+ id: text
+ color: "#face20"
+ text: ""
+ }
+ }
+ Row {
+ spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ visible: false
+ TextLabel {
+ text: qsTr("User name")
+ width: root.width*0.382
+ horizontalAlignment: Text.AlignRight
+ }
+ TextField {
+ text: ""
+ inputMethodHints: Qt.ImhNoPredictiveText
+ }
+ }
+ Row {
+ spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ TextLabel {
+ text: qsTr("Password")
+ horizontalAlignment: Text.AlignRight
+ }
+ TextField {
+ id: password
+ text: ""
+ echoMode: TextInput.Password
+ inputMethodHints: Qt.ImhNoPredictiveText
+ }
+ }
+ Row {
+ spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ Button {
+ text: qsTr("Connect")
+ onClicked: {
+ connectView.visible = false
+ NetworkSettingsUserAgent.setUserCredentials("", password.text)
+ }
+ }
+ Button {
+ text: qsTr("Cancel")
+ onClicked:connectView.visible = false
+ }
+ }
+ }
+ }
+
+ Button {
+ id: disconnect
+ text: qsTr("Disconnect")
+ visible: selectedInterface.state === NetworkSettingsState.Online ||
+ selectedInterface.state === NetworkSettingsState.Ready
+ onClicked: {
+ console.log("disconnect");
+ NetworkSettingsManager.services.itemFromRow(networkSelection.selectedIndex).disconnectService();
+ networkSelection.selectedIndex = -1;
+ }
}
}
- }
- Component {
- id: wifiManager
- WifiManagerView {
- id: wifiSettings
- width: root.width
- visible: true
+ Connections {
+ target: NetworkSettingsUserAgent
+ onShowUserCredentialsInput : {
+ connectView.visible = true
+ }
+ onError: {
+ errorView.visible = true
+ connectView.visible = true
+ }
}
}
}
diff --git a/src/qtdevicesettings/wifisettingsplugin/WifiSignalMonitor.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSignalMonitor.qml
index e3ab0c8..35d9e53 100644
--- a/src/qtdevicesettings/wifisettingsplugin/WifiSignalMonitor.qml
+++ b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSignalMonitor.qml
@@ -64,13 +64,13 @@ Item {
Image {
anchors.fill: parent
- source: "../icons/Wifi_lightgray_2x.png"
+ source: "Wifi_lightgray_2x.png"
}
AnimatedSprite {
id: sprite
anchors.fill: parent
- source: connected ? "../icons/WifiAnim_qt_2x.png" : "../icons/WifiAnim_black_2x.png"
+ source: connected ? "WifiAnim_qt_2x.png" : "WifiAnim_black_2x.png"
frameDuration: 500
frameCount: 4
currentFrame: 3
diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WiredSettings.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WiredSettings.qml
index 5a7e860..4c07baa 100644
--- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WiredSettings.qml
+++ b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WiredSettings.qml
@@ -45,10 +45,12 @@ Item {
anchors.fill: parent
anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor)
property bool editMode: false
+ property var service: null
+ property string title: qsTr("Network");
- onVisibleChanged: {
- if (visible)
- titlebar.title = qsTr("Network");
+ Component.onCompleted: {
+ NetworkSettingsManager.services.type = NetworkSettingsType.Wired;
+ root.service = NetworkSettingsManager.services.itemFromRow(0);
}
ListModel {
@@ -56,15 +58,15 @@ Item {
ListElement {
text: "DHCP"
- method: IPv4Config.Dhcp
+ method: NetworkSettingsIPv4.Dhcp
}
ListElement {
text: "Manual"
- method: IPv4Config.Manual
+ method: NetworkSettingsIPv4.Manual
}
ListElement {
text: "Off"
- method: IPv4Config.Off
+ method: NetworkSettingsIPv4.Off
}
}
@@ -85,7 +87,7 @@ Item {
model: methodsModel
Component.onCompleted: selectedIndex = service.ipv4.method
onSelectedIndexChanged : {
- if (model.get(selectedIndex).method !== IPv4Config.Dhcp) {
+ if (model.get(selectedIndex).method !== NetworkSettingsIPv4.Dhcp) {
service.ipv4.method = model.get(selectedIndex).method;
editMode = true;
}
@@ -104,7 +106,7 @@ Item {
}
Row {
- visible: service.ipv4.method !== IPv4Config.Off
+ visible: service.ipv4.method !== NetworkSettingsIPv4.Off
TextLabel {
text: qsTr("IP Address: ")
}
@@ -121,7 +123,7 @@ Item {
}
Row {
- visible: service.ipv4.method !== IPv4Config.Off
+ visible: service.ipv4.method !== NetworkSettingsIPv4.Off
TextLabel {
text: qsTr("Mask: ")
}
@@ -138,7 +140,7 @@ Item {
}
Row {
- visible: service.ipv4.method !== IPv4Config.Off
+ visible: service.ipv4.method !== NetworkSettingsIPv4.Off
TextLabel {
text: qsTr("Router: ")
}
@@ -155,7 +157,7 @@ Item {
}
Row {
- visible: service.ipv4.method !== IPv4Config.Off
+ visible: service.ipv4.method !== NetworkSettingsIPv4.Off
TextLabel {
text: qsTr("DNS server: ")
}
@@ -197,7 +199,7 @@ Item {
text: qsTr("Edit")
visible: !editMode
- onClicked: stackView.push( { item : Qt.resolvedUrl("EditWiredSettings.qml"), properties : { service: service } } )
+ onClicked: stackView.push({item: Qt.resolvedUrl("EditWiredSettings.qml"), properties: {service: root.service}});
}
}
}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp
new file mode 100644
index 0000000..94a1fa1
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "connmancommon.h"
+
+//Conversion operations for datatypes
+const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj)
+{
+ argument.beginStructure();
+ argument >> obj.objectPath >> obj.propertyMap;
+ argument.endStructure();
+ return argument;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj)
+{
+ argument.beginStructure();
+ argument << obj.objectPath << obj.propertyMap;
+ argument.endStructure();
+ return argument;
+}
+
+const QString &operator>>(const QString &argument, QNetworkSettingsType &obj)
+{
+ if (argument == AttributeEthernet) {
+ obj.setType(QNetworkSettingsType::Wired);
+ }
+ else if (argument == AttributeWifi) {
+ obj.setType(QNetworkSettingsType::Wifi);
+ }
+ else {
+ obj.setType(QNetworkSettingsType::Unknown);
+ }
+
+ return argument;
+}
+
+const QString &operator>>(const QString &argument, QNetworkSettingsState &obj)
+{
+ if (argument == AttributeIdle) {
+ obj.setState(QNetworkSettingsState::Idle);
+ }
+ else if (argument == AttributeFailure) {
+ obj.setState(QNetworkSettingsState::Failure);
+ }
+ else if (argument == AttributeAssociation) {
+ obj.setState(QNetworkSettingsState::Association);
+ }
+ else if (argument == AttributeConfiguration) {
+ obj.setState(QNetworkSettingsState::Configuration);
+ }
+ else if (argument == AttributeReady) {
+ obj.setState(QNetworkSettingsState::Ready);
+ }
+ else if (argument == AttributeDisconnect) {
+ obj.setState(QNetworkSettingsState::Disconnect);
+ }
+ else if (argument == AttributeOneline) {
+ obj.setState(QNetworkSettingsState::Online);
+ }
+ else {
+ obj.setState(QNetworkSettingsState::Undefined);
+ }
+ return argument;
+}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h
new file mode 100644
index 0000000..dd3e7af
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef CONNMANCOMMON_H
+#define CONNMANCOMMON_H
+
+#include <QtCore/QMetaType>
+#include <QtDBus>
+#include <qnetworksettings.h>
+
+#define AgentPath "/ConnmanAgent"
+#define PropertyState "State"
+#define PropertyName "Name"
+#define PropertyType "Type"
+#define PropertyConnected "Connected"
+#define PropertyPowered "Powered"
+
+#define AttributeWifi "wifi"
+#define AttributeEthernet "ethernet"
+#define AttributeIdle "idle"
+#define AttributeFailure "failure"
+#define AttributeAssociation "association"
+#define AttributeConfiguration "configuration"
+#define AttributeReady "ready"
+#define AttributeDisconnect "disconnect"
+#define AttributeOneline "online"
+
+struct ConnmanMap {
+ QDBusObjectPath objectPath;
+ QVariantMap propertyMap;
+};
+
+QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj);
+const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj);
+
+const QString &operator>>(const QString &argument, QNetworkSettingsType &obj);
+const QString &operator>>(const QString &argument, QNetworkSettingsState &obj);
+
+typedef QList<ConnmanMap> ConnmanMapList;
+
+Q_DECLARE_METATYPE( ConnmanMap )
+Q_DECLARE_METATYPE( ConnmanMapList )
+
+
+#endif // CONNMANCOMMON_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/networksettingsmanager_linux.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/networksettingsmanager_linux.cpp
deleted file mode 100644
index c4973ea..0000000
--- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/networksettingsmanager_linux.cpp
+++ /dev/null
@@ -1,583 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QQmlPropertyMap>
-
-#include "networkconfig.h"
-#include "networksettingsmanager_linux_p.h"
-#include "connman_manager_interface.cpp"
-#include "moc_connman_manager_interface.cpp"
-#include "connman_service_interface.h"
-#include "connman_technology_interface.h"
-
-const QString PropertyIPv4("IPv4");
-const QString PropertyIPv4Config("IPv4.Configuration");
-const QString PropertyIPv6("IPv6");
-const QString PropertyIPv6Config("IPv6.Configuration");
-const QString PropertyNameservers("Nameservers");
-const QString PropertyNameserversConfig("Nameservers.Configuration");
-const QString PropertyDomains("Domains");
-const QString PropertyDomainsConfig("Domains.Configuration");
-const QString PropertyProxy("Proxy");
-const QString PropertyProxyConfig("Proxy.Configuration");
-const QString PropertyState("State");
-const QString PropertyName("Name");
-const QString PropertyType("Type");
-const QString PropertyConnected("Connected");
-const QString PropertyPowered("Powered");
-const QString PropertyAddress("Address");
-const QString PropertyNetMask("Netmask");
-const QString PropertyGateway("Gateway");
-const QString PropertyPrefixLength("PrefixLength");
-const QString PropertyMethod("Method");
-const QString PropertyPrivacy("Privacy");
-const QString PropertyUrl("Url");
-const QString PropertyServers("Servers");
-const QString PropertyExcludes("Excludes");
-const QString AttributeAuto("auto");
-const QString AttributeDhcp("dhcp");
-const QString AttributeManual("manual");
-const QString AttributeOff("off");
-const QString AttributeDisabled("disabled");
-const QString AttributeEnabled("enabled");
-const QString AttributePreferred("preferred");
-const QString AttributeDirect("direct");
-const QString AttributeWifi("wifi");
-const QString AttributeEthernet("ethernet");
-const QString AttributeIdle("idle");
-const QString AttributeFailure("failure");
-const QString AttributeAssociation("association");
-const QString AttributeConfiguration("configuration");
-const QString AttributeReady("ready");
-const QString AttributeDisconnect("disconnect");
-const QString AttributeOneline("online");
-
-//Conversion operations for datatypes
-const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj)
-{
- argument.beginStructure();
- argument >> obj.objectPath >> obj.propertyMap;
- argument.endStructure();
- return argument;
-}
-
-QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj)
-{
- argument.beginStructure();
- argument << obj.objectPath << obj.propertyMap;
- argument.endStructure();
- return argument;
-}
-
-const QVariantMap &operator>>(const QVariantMap &argument, IPv4Config &obj)
-{
- obj.setAddress(argument[PropertyAddress].toString());
- obj.setMask(argument[PropertyNetMask].toString());
- obj.setGateway(argument[PropertyGateway].toString());
-
- QString method = argument[PropertyMethod].toString();
-
- if (method == AttributeDhcp) {
- obj.setMethod(IPv4Config::Dhcp);
- }
- else if (method == AttributeManual) {
- obj.setMethod(IPv4Config::Manual);
- }
- else if (method == AttributeOff) {
- obj.setMethod(IPv4Config::Off);
- }
- else {
- obj.setMethod(IPv4Config::Off);
- }
- return argument;
-}
-
-const QVariantMap &operator<<(QVariantMap &argument, const IPv4Config &obj)
-{
- argument.insert(PropertyAddress, QVariant::fromValue(obj.address()));
-
- argument.insert(PropertyNetMask, QVariant::fromValue(obj.mask()));
-
- argument.insert(PropertyGateway, QVariant::fromValue(obj.gateway()));
-
- QString method;
- switch (obj.method()) {
- case IPv4Config::Dhcp:
- method = AttributeDhcp;
- break;
- case IPv4Config::Manual:
- method = AttributeManual;
- break;
- case IPv4Config::Off:
- method = AttributeOff;
- break;
- default:
- break;
- }
- argument.insert(PropertyMethod, QVariant::fromValue(method));
- return argument;
-}
-
-const QVariantMap &operator>>(const QVariantMap &argument, IPv6Config &obj)
-{
- obj.setAddress(argument[PropertyAddress].toString());
- obj.setGateway(argument[PropertyGateway].toString());
- obj.setPrefixLength(argument[PropertyPrefixLength].toInt());
- QString method = argument[PropertyMethod].toString();
- if (method == AttributeAuto) {
- obj.setMethod(IPv6Config::Auto);
- }
- else if (method == AttributeManual) {
- obj.setMethod(IPv6Config::Manual);
- }
- else if (method == AttributeOff) {
- obj.setMethod(IPv6Config::Off);
- }
- QString privacy = argument[PropertyPrivacy].toString();
-
- if (privacy == AttributeDisabled) {
- obj.setPrivacy(IPv6Config::Disabled);
- }
- else if (privacy == AttributeEnabled) {
- obj.setPrivacy(IPv6Config::Enabled);
- }
- else if (privacy == AttributePreferred) {
- obj.setPrivacy(IPv6Config::Preferred);
- }
- return argument;
-}
-
-const QVariantMap &operator<<(QVariantMap &argument, const IPv6Config &obj)
-{
- argument.insert(PropertyAddress, QVariant::fromValue(obj.address()));
- argument.insert(PropertyGateway, QVariant::fromValue(obj.address()));
- argument.insert(PropertyPrefixLength, QVariant::fromValue(obj.prefixLength()));
-
- QString method;
- switch (obj.method()) {
- case IPv6Config::Auto:
- method = AttributeAuto;
- break;
- case IPv6Config::Manual:
- method = AttributeManual;
- break;
- case IPv6Config::Off:
- method = AttributeOff;
- break;
- default:
- break;
- }
- argument.insert(PropertyMethod, QVariant::fromValue(method));
-
- QString privacy;
- switch (obj.privacy()) {
- case IPv6Config::Disabled:
- method = AttributeDisabled;
- break;
- case IPv6Config::Enabled:
- method = AttributeEnabled;
- break;
- case IPv6Config::Preferred:
- method = AttributePreferred;
- break;
- default:
- break;
- }
- argument.insert(PropertyPrivacy, QVariant::fromValue(privacy));
-
- return argument;
-}
-
-
-const QVariantMap &operator>>(const QVariantMap &argument, ProxyConfig &obj)
-{
- QString method = argument[PropertyMethod].toString();
- if (method == AttributeDirect) {
- obj.setMethod(ProxyConfig::Direct);
- }
- else if (method == AttributeAuto) {
- obj.setMethod(ProxyConfig::Auto);
- }
- else if (method == AttributeManual) {
- obj.setMethod(ProxyConfig::Manual);
- }
-
- QString urlStr = argument[PropertyUrl].toString();
- obj.setUrl(QUrl(urlStr));
-
- obj.setServers(argument[PropertyServers].toStringList());
- obj.setExcludes(argument[PropertyExcludes].toStringList());
-
- return argument;
-}
-
-const QVariantMap &operator<<(QVariantMap &argument, const ProxyConfig &obj)
-{
- QString method;
- switch (obj.method()) {
- case ProxyConfig::Direct:
- method = AttributeDirect;
- break;
- case ProxyConfig::Auto:
- method = AttributeAuto;
- break;
- case ProxyConfig::Manual:
- method = AttributeManual;
- break;
- default:
- break;
- }
- argument.insert(PropertyMethod, QVariant::fromValue(method));
- argument.insert(PropertyUrl, QVariant::fromValue(obj.url().toString()));
- argument.insert(PropertyServers, QVariant::fromValue(obj.servers()));
- argument.insert(PropertyServers, QVariant::fromValue(obj.excludes()));
-
- return argument;
-}
-
-const QString &operator>>(const QString &argument, NetworkType &obj)
-{
- if (argument == AttributeEthernet) {
- obj.setType(NetworkType::Wired);
- }
- else if (argument == AttributeWifi) {
- obj.setType(NetworkType::Wifi);
- }
- else {
- obj.setType(NetworkType::Unknown);
- }
-
- return argument;
-}
-
-const QString &operator>>(const QString &argument, NetworkState &obj)
-{
- if (argument == AttributeIdle) {
- obj.setState(NetworkState::Idle);
- }
- else if (argument == AttributeFailure) {
- obj.setState(NetworkState::Failure);
- }
- else if (argument == AttributeAssociation) {
- obj.setState(NetworkState::Association);
- }
- else if (argument == AttributeConfiguration) {
- obj.setState(NetworkState::Configuration);
- }
- else if (argument == AttributeReady) {
- obj.setState(NetworkState::Ready);
- }
- else if (argument == AttributeDisconnect) {
- obj.setState(NetworkState::Disconnect);
- }
- else if (argument == AttributeOneline) {
- obj.setState(NetworkState::Online);
- }
- else {
- obj.setState(NetworkState::Undefined);
- }
- return argument;
-}
-
-NetworkServicePrivate::NetworkServicePrivate(const QString& aPath, NetworkService *parent) :
- QObject(parent)
- ,q_ptr(parent)
- ,m_path(aPath)
-{
- qDBusRegisterMetaType<ConnmanMap>();
- qDBusRegisterMetaType<ConnmanMapList>();
-
- m_service = new NetConnmanServiceInterface("net.connman", m_path,
- QDBusConnection::systemBus(), this);
-
- connect(m_service, SIGNAL(PropertyChanged(QString,QDBusVariant)),
- this, SLOT(updateProperty(QString,QDBusVariant)));
-
- QDBusPendingReply<QVariantMap> reply = m_service->GetProperties();
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
-
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(propertiesUpdated(QDBusPendingCallWatcher*)));
-}
-
-void NetworkServicePrivate::setupIpv6Config()
-{
- QVariantMap param;
- param << m_ipv6config;
- if (m_service)
- m_service->SetProperty(PropertyIPv6Config, QDBusVariant(QVariant(param)));
-}
-
-void NetworkServicePrivate::setupNameserversConfig()
-{
- QVariant param = QVariant::fromValue(m_nameserverConfig.stringList());
- if (m_service)
- m_service->SetProperty(PropertyNameserversConfig, QDBusVariant(QVariant(param)));
-}
-
-void NetworkServicePrivate::setupDomainsConfig()
-{
- QVariant param = QVariant::fromValue(m_domainsConfig.stringList());
- if (m_service)
- m_service->SetProperty(PropertyDomainsConfig, QDBusVariant(QVariant(param)));
-}
-
-void NetworkServicePrivate::setupProxyConfig()
-{
- QVariantMap param;
- param << m_proxyConfig;
- if (m_service)
- m_service->SetProperty(PropertyProxyConfig, QDBusVariant(QVariant(param)));
-}
-
-void NetworkServicePrivate::setupIpv4Config()
-{
- QVariantMap param;
- param << m_ipv4config;
- if (m_service)
- m_service->SetProperty(PropertyIPv4Config, QDBusVariant(QVariant(param)));
-}
-
-
-void NetworkServicePrivate::propertiesUpdated(QDBusPendingCallWatcher *call)
-{
- QDBusPendingReply<QVariantMap> reply = *call;
- call->deleteLater();
-
- if (!reply.isError())
- setupConfiguration(reply.value());
-}
-
-void NetworkServicePrivate::updateProperty(const QString &name, const QDBusVariant &value)
-{
- updateProperty(name, value.variant());
-}
-
-void NetworkServicePrivate::updateProperty(const QString& key, const QVariant& val)
-{
- Q_Q(NetworkService);
-
- if (key == PropertyIPv4) {
- QVariantMap value = qdbus_cast<QVariantMap>(val);
- value >> m_ipv4config;
- emit q->ipv4Changed();
- }
- else if (key == PropertyIPv6) {
- QVariantMap value = qdbus_cast<QVariantMap>(val);
- value >> m_ipv6config;
- emit q->ipv6Changed();
- }
- else if (key == PropertyNameservers) {
- QStringList value = qdbus_cast<QStringList>(val);
- m_nameserverConfig.setStringList(value);
- emit q->nameserversChanged();
- }
- else if (key == PropertyDomains) {
- QStringList value = qdbus_cast<QStringList>(val);
- m_domainsConfig.setStringList(value);
- emit q->domainsChanged();
- }
- else if (key == PropertyProxy) {
- QVariantMap value = qdbus_cast<QVariantMap>(val);
- value >> m_proxyConfig;
- emit q->proxyChanged();
- }
- else if (key == PropertyState) {
- QString value = qdbus_cast<QString>(val);
- value >> m_state;
- emit q->stateChanged();
- }
- else if (key == PropertyName) {
- m_name = qdbus_cast<QString>(val);
- emit q->nameChanged();
- }
- else if (key == PropertyType) {
- QString value = qdbus_cast<QString>(val);
- value >> m_type;
- }
-}
-
-void NetworkServicePrivate::setupConfiguration(const QVariantMap &properties)
-{
- QVariantMap::const_iterator it = properties.constBegin(), end = properties.constEnd();
- for ( ; it != end; ++it) {
- updateProperty(it.key(), it.value());
- }
-}
-
-NetworkTechnology::NetworkTechnology(const QString& path, const QVariantMap& properties, QObject* parent)
- : NetworkItem(parent)
- {
- m_technology = new NetConnmanTechnologyInterface("net.connman", path,
- QDBusConnection::systemBus(), this);
- connect(m_technology, SIGNAL(PropertyChanged(QString,QDBusVariant)),
- this, SLOT(updateProperty(QString,QDBusVariant)));
-
- updateProperty(PropertyName, properties[PropertyName]);
- updateProperty(PropertyType, properties[PropertyType]);
- updateProperty(PropertyConnected, properties[PropertyConnected]);
- updateProperty(PropertyPowered, properties[PropertyPowered]);
- }
-
-void NetworkTechnology::updateProperty(const QString &name, const QDBusVariant &value)
-{
- updateProperty(name, value.variant());
-}
-
-void NetworkTechnology::updateProperty(const QString &name, const QVariant &value)
-{
- if (name == PropertyName) {
- m_name = qdbus_cast<QString>(value);
- }
- else if (name == PropertyType) {
- qdbus_cast<QString>(value) >> m_type;
- emit typeChanged();
- }
- else if (name == PropertyConnected) {
- bool connected = qdbus_cast<bool>(value);
- if (connected)
- m_state.setState(NetworkState::Online);
- else
- m_state.setState(NetworkState::Disconnect);
- emit stateChanged();
- }
- else if (name == PropertyPowered) {
- m_powered = qdbus_cast<bool>(value);
- emit poweredChanged();
- }
-}
-
-
-NetworkSettingsManagerPrivate::NetworkSettingsManagerPrivate(NetworkSettingsManager *parent)
- :QObject(parent)
- ,q_ptr(parent)
-{
- m_manager = new NetConnmanManagerInterface("net.connman", "/",
- QDBusConnection::systemBus(), this);
-
- if (m_manager->isValid()) {
- //List technologies
- QDBusPendingReply<ConnmanMapList> reply = m_manager->GetTechnologies();
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(getTechnologiesFinished(QDBusPendingCallWatcher*)));
-
- reply = m_manager->GetServices();
- watcher = new QDBusPendingCallWatcher(reply, this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(getServicesFinished(QDBusPendingCallWatcher*)));
- }
- else {
- delete m_manager;
- m_manager = NULL;
- }
-}
-
-void NetworkSettingsManagerPrivate::getServicesFinished(QDBusPendingCallWatcher *watcher)
-{
- Q_Q(NetworkSettingsManager);
- QDBusPendingReply<ConnmanMapList> reply = *watcher;
- watcher->deleteLater();
- if (reply.isError())
- return;
-
- foreach (const ConnmanMap &object, reply.value()) {
- const QString servicePath = object.objectPath.path();
- NetworkService *service = new NetworkService(servicePath, this);
- m_services.append(service);
-
- //Update status property
- QString n = qdbus_cast<QString>(object.propertyMap[PropertyName]);
- QString t = qdbus_cast<QString>(object.propertyMap[PropertyType]);
- QString s = qdbus_cast<QString>(object.propertyMap[PropertyState]);
-
- NetworkType type;
- t >> type;
- NetworkState state;
- s >> state;
-
- foreach (NetworkItem* item, m_networksModel.getModel()) {
- if (item->name() == n && item->type() == type.type()) {
- item->setState(state.state());
- }
- }
- }
- emit q->servicesChanged();
-}
-
-void NetworkSettingsManagerPrivate::getTechnologiesFinished(QDBusPendingCallWatcher *watcher)
-{
- Q_Q(NetworkSettingsManager);
- QDBusPendingReply<ConnmanMapList> reply = *watcher;
- watcher->deleteLater();
- if (reply.isError())
- return;
-
- foreach (const ConnmanMap &object, reply.value()) {
- NetworkTechnology *item = new NetworkTechnology(object.objectPath.path(), object.propertyMap, this);
-
- //Wired to the top
- if (item->type() == NetworkType::Wired)
- m_networksModel.insert(0, item);
- else if (item->type() == NetworkType::Wifi) {
- connect(item, &NetworkItem::poweredChanged, q, &NetworkSettingsManager::wifiPoweredChanged);
- m_networksModel.append(item);
- }
- emit q->networksChanged();
- }
-}
-
-bool NetworkSettingsManagerPrivate::wifiPowered()
-{
- foreach (NetworkItem* item, m_networksModel.getModel()) {
- if (item->type() == NetworkType::Wifi) {
- return item->powered();
- }
- }
- return false;
-}
-
-void NetworkSettingsManagerPrivate::setWifiPowered(const bool powered)
-{
- foreach (NetworkItem* item, m_networksModel.getModel()) {
- if (item->type() == NetworkType::Wifi) {
- NetworkTechnology* technology = qobject_cast<NetworkTechnology*>(item);
- if (technology) {
- NetConnmanTechnologyInterface *connmantech = technology->getTechnology();
- connmantech->SetProperty(PropertyPowered, QDBusVariant(QVariant(powered)));
- }
- }
- }
-}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/networksettingsmanager_linux_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/networksettingsmanager_linux_p.h
deleted file mode 100644
index bccbed8..0000000
--- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/networksettingsmanager_linux_p.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef NETWORKSETTINGSMANAGERPRIVATE_H
-#define NETWORKSETTINGSMANAGERPRIVATE_H
-
-#include <QObject>
-#include <QtDBus>
-#include <QList>
-#include <QtDBus/QDBusObjectPath>
-#include <QtCore/QMetaType>
-#include "networkaddressmodel.h"
-#include "networksettingsmanager.h"
-#include "networksmodel.h"
-
-class NetConnmanManagerInterface;
-class NetConnmanServiceInterface;
-class NetworkService;
-class NetConnmanTechnologyInterface;
-
-struct ConnmanMap {
- QDBusObjectPath objectPath;
- QVariantMap propertyMap;
-};
-
-QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj);
-
-const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj);
-
-typedef QList<ConnmanMap> ConnmanMapList;
-
-Q_DECLARE_METATYPE( ConnmanMap )
-Q_DECLARE_METATYPE( ConnmanMapList )
-
-class NetworkServicePrivate : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PUBLIC(NetworkService)
-public:
- NetworkServicePrivate(const QString& aPath, NetworkService *parent=0);
-
- NetworkService *q_ptr;
-private slots:
- void propertiesUpdated(QDBusPendingCallWatcher *call);
- void updateProperty(const QString &name, const QDBusVariant &value);
-
-private:
- void setupConfiguration(const QVariantMap &properties);
- void updateProperty(const QString& key, const QVariant& value);
-
-protected:
- void setAutoConnect(const bool autoconnect);
- void setupIpv4Config();
- void setupIpv6Config();
- void setupNameserversConfig();
- void setupDomainsConfig();
- void setupProxyConfig();
-
- QString m_path;
- QString m_name;
- NetworkState m_state;
- IPv4Config m_ipv4config;
- IPv6Config m_ipv6config;
- NetworkAddressModel m_domainsConfig;
- NetworkAddressModel m_nameserverConfig;
- ProxyConfig m_proxyConfig;
- WifiConfig m_wifiConfig;
- NetworkType m_type;
- NetConnmanServiceInterface *m_service;
-};
-
-class NetworkTechnology : public NetworkItem
-{
- Q_OBJECT
-public:
- explicit NetworkTechnology(const QString& path, const QVariantMap& properties, QObject* parent=0);
- virtual ~NetworkTechnology() {
-
- }
-
- NetConnmanTechnologyInterface *getTechnology() {
- return m_technology;
- }
-
-public slots:
- void updateProperty(const QString &name, const QDBusVariant &value);
-protected:
- void updateProperty(const QString &name, const QVariant &value);
-
-private:
- NetConnmanTechnologyInterface *m_technology;
-};
-
-
-class NetworkSettingsManagerPrivate : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PUBLIC(NetworkSettingsManager)
-public:
- explicit NetworkSettingsManagerPrivate(NetworkSettingsManager *parent);
- NetworkSettingsManager *q_ptr;
- void setWifiPowered(const bool powered);
- bool wifiPowered();
-
-public slots:
- void getServicesFinished(QDBusPendingCallWatcher *watcher);
- void getTechnologiesFinished(QDBusPendingCallWatcher *watcher);
-
-protected:
- QList<NetworkService*> m_services;
- NetworksModel m_networksModel;
-private:
- NetConnmanManagerInterface *m_manager;
-};
-
-#endif // NETWORKSETTINGSMANAGERPRIVATE_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp
new file mode 100644
index 0000000..9a034d0
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qnetworksettingsinterface_p.h"
+#include "qnetworksettingsinterface.h"
+#include "connman_technology_interface.h"
+#include "connmancommon.h"
+
+QNetworkSettingsInterfacePrivate::QNetworkSettingsInterfacePrivate(QNetworkSettingsInterface* parent)
+ : QObject(parent)
+ ,q_ptr(parent)
+{
+
+}
+
+void QNetworkSettingsInterfacePrivate::initialize(const QString& path, const QVariantMap& properties)
+{
+ m_technology = new NetConnmanTechnologyInterface("net.connman", path,
+ QDBusConnection::systemBus(), this);
+ connect(m_technology, SIGNAL(PropertyChanged(QString,QDBusVariant)),
+ this, SLOT(updateProperty(QString,QDBusVariant)));
+
+ updateProperty(PropertyName, properties[PropertyName]);
+ updateProperty(PropertyType, properties[PropertyType]);
+ updateProperty(PropertyConnected, properties[PropertyConnected]);
+ updateProperty(PropertyPowered, properties[PropertyPowered]);
+}
+
+void QNetworkSettingsInterfacePrivate::updateProperty(const QString &name, const QDBusVariant &value)
+{
+ updateProperty(name, value.variant());
+}
+
+void QNetworkSettingsInterfacePrivate::updateProperty(const QString &name, const QVariant &value)
+{
+ Q_Q(QNetworkSettingsInterface);
+ if (name == PropertyName) {
+ m_name = qdbus_cast<QString>(value);
+ }
+ else if (name == PropertyType) {
+ qdbus_cast<QString>(value) >> m_type;
+ emit q->typeChanged();
+ }
+ else if (name == PropertyConnected) {
+ bool connected = qdbus_cast<bool>(value);
+ if (connected)
+ m_state.setState(QNetworkSettingsState::Online);
+ else
+ m_state.setState(QNetworkSettingsState::Disconnect);
+ emit q->stateChanged();
+ }
+ else if (name == PropertyPowered) {
+ m_powered = qdbus_cast<bool>(value);
+ emit q->poweredChanged();
+ }
+}
+
+void QNetworkSettingsInterfacePrivate::setState(QNetworkSettingsState::States aState)
+{
+ Q_Q(QNetworkSettingsInterface);
+ m_state.setState(aState);
+ emit q->stateChanged();
+}
+
+void QNetworkSettingsInterfacePrivate::setPowered(const bool aPowered)
+{
+ m_technology->SetProperty(PropertyPowered, QDBusVariant(QVariant(aPowered)));
+}
+
+void QNetworkSettingsInterfacePrivate::scan()
+{
+ m_technology->Scan();
+}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h
new file mode 100644
index 0000000..6e1d5ca
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QNETWORKSETTINGSINTERFACEPRIVATE_H
+#define QNETWORKSETTINGSINTERFACEPRIVATE_H
+
+#include <QObject>
+#include <QtDBus>
+#include "qnetworksettings.h"
+#include "qnetworksettingsinterface.h"
+
+class NetConnmanTechnologyInterface;
+
+class QNetworkSettingsInterfacePrivate : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PUBLIC(QNetworkSettingsInterface)
+public:
+ explicit QNetworkSettingsInterfacePrivate(QNetworkSettingsInterface* parent);
+ void initialize(const QString& path, const QVariantMap& properties);
+ void setPowered(const bool power);
+ void setState(QNetworkSettingsState::States aState);
+ void scan();
+
+public slots:
+ void updateProperty(const QString &name, const QDBusVariant &value);
+protected:
+ void updateProperty(const QString &name, const QVariant &value);
+
+protected:
+ NetConnmanTechnologyInterface *m_technology;
+ QString m_name;
+ QNetworkSettingsType m_type;
+ QNetworkSettingsState m_state;
+ bool m_powered;
+ QNetworkSettingsInterface *q_ptr;
+};
+
+
+class ConnmanSettingsInterface : public QNetworkSettingsInterface
+{
+ Q_OBJECT
+public:
+ ConnmanSettingsInterface(const QString& path, const QVariantMap& properties, QObject *parent=0)
+ :QNetworkSettingsInterface(parent)
+ {
+ if (d_ptr)
+ d_ptr->initialize(path, properties);
+ }
+
+ void setState(QNetworkSettingsState::States aState) {
+ Q_D(QNetworkSettingsInterface);
+ d->setState(aState);
+ }
+
+ virtual ~ConnmanSettingsInterface() {
+
+ }
+};
+#endif // QNETWORKSETTINGSINTERFACEPRIVATE_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp
new file mode 100644
index 0000000..2d4a0d3
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qnetworksettingsmanager_p.h"
+#include "connman_manager_interface.cpp"
+#include "moc_connman_manager_interface.cpp"
+#include "qnetworksettingsinterface.h"
+#include "qnetworksettingsinterface_p.h"
+
+QNetworkSettingsManagerPrivate::QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent)
+ :QObject(parent)
+ ,q_ptr(parent)
+{
+ m_serviceFilter.setSourceModel(&m_serviceModel);
+ m_manager = new NetConnmanManagerInterface("net.connman", "/",
+ QDBusConnection::systemBus(), this);
+
+ if (m_manager->isValid()) {
+ //List technologies
+ QDBusPendingReply<ConnmanMapList> reply = m_manager->GetTechnologies();
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(getTechnologiesFinished(QDBusPendingCallWatcher*)));
+
+ reply = m_manager->GetServices();
+ watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(getServicesFinished(QDBusPendingCallWatcher*)));
+
+ connect(m_manager, &NetConnmanManagerInterface::ServicesChanged, this, &QNetworkSettingsManagerPrivate::servicesChanged);
+
+ m_manager->RegisterAgent(QDBusObjectPath(AgentPath));
+ }
+ else {
+ delete m_manager;
+ m_manager = NULL;
+ }
+}
+
+void QNetworkSettingsManagerPrivate::requestInput(const QString& service, const QString& type)
+{
+ Q_UNUSED(type);
+ foreach (QNetworkSettingsService* servicePtr, m_serviceModel.getModel()) {
+ if (servicePtr->id() == service)
+ emit servicePtr->showCrendentialInput();
+ }
+}
+
+void QNetworkSettingsManagerPrivate::getServicesFinished(QDBusPendingCallWatcher *watcher)
+{
+ Q_Q(QNetworkSettingsManager);
+ QDBusPendingReply<ConnmanMapList> reply = *watcher;
+ watcher->deleteLater();
+ if (reply.isError())
+ return;
+
+ foreach (const ConnmanMap &object, reply.value()) {
+ const QString servicePath = object.objectPath.path();
+ QNetworkSettingsService *service = new QNetworkSettingsService(servicePath, this);
+ m_serviceModel.append(service);
+
+ //Update status property
+ QString n = qdbus_cast<QString>(object.propertyMap[PropertyName]);
+ QString t = qdbus_cast<QString>(object.propertyMap[PropertyType]);
+ QString s = qdbus_cast<QString>(object.propertyMap[PropertyState]);
+
+ QNetworkSettingsType type;
+ t >> type;
+ QNetworkSettingsState state;
+ s >> state;
+
+ foreach (QNetworkSettingsInterface* item, m_interfaceModel.getModel()) {
+ ConnmanSettingsInterface* technology = qobject_cast<ConnmanSettingsInterface*>(item);
+ if (technology->name() == n && technology->type() == type.type()) {
+ technology->setState(state.state());
+ }
+ }
+ }
+ emit q->servicesChanged();
+}
+
+void QNetworkSettingsManagerPrivate::getTechnologiesFinished(QDBusPendingCallWatcher *watcher)
+{
+ Q_Q(QNetworkSettingsManager);
+
+ QDBusPendingReply<ConnmanMapList> reply = *watcher;
+ watcher->deleteLater();
+ if (reply.isError())
+ return;
+
+ foreach (const ConnmanMap &object, reply.value()) {
+ ConnmanSettingsInterface *item = new ConnmanSettingsInterface(object.objectPath.path(), object.propertyMap, this);
+
+ if (item->type() == QNetworkSettingsType::Wired) {
+ m_interfaceModel.insert(0, item);
+ }
+ else if (item->type() == QNetworkSettingsType::Wifi) {
+ m_interfaceModel.append(item);
+ }
+ emit q->interfacesChanged();
+ }
+}
+
+void QNetworkSettingsManagerPrivate::servicesChanged(ConnmanMapList changed, const QList<QDBusObjectPath> &removed)
+{
+ foreach (QDBusObjectPath path, removed) {
+ QList<QNetworkSettingsService*> serviceList = m_serviceModel.getModel();
+ QMutableListIterator<QNetworkSettingsService*> i(serviceList);
+ while (i.hasNext()) {
+ if (i.next()->id() == path.path())
+ i.remove();
+ }
+ }
+
+ QStringList newServices;
+ foreach (ConnmanMap map, changed) {
+ bool found = false;
+ foreach (QNetworkSettingsService* service, m_serviceModel.getModel()) {
+ if (service->id() == map.objectPath.path()) {
+ found =true;
+ break;
+ }
+ }
+ if (!found)
+ newServices.append(map.objectPath.path());
+ }
+ foreach (QString newService, newServices) {
+ QNetworkSettingsService *service = new QNetworkSettingsService(newService, this);
+ m_serviceModel.append(service);
+ }
+}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h
new file mode 100644
index 0000000..6883d74
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QNETWORKSETTINGSMANAGERPRIVATE_H
+#define QNETWORKSETTINGSMANAGERPRIVATE_H
+
+#include <QObject>
+#include <QtDBus>
+#include "connmancommon.h"
+#include "qnetworksettingsmanager.h"
+#include "qnetworksettingsinterfacemodel.h"
+#include "qnetworksettingsservicemodel.h"
+
+class NetConnmanManagerInterface;
+
+class QNetworkSettingsManagerPrivate : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PUBLIC(QNetworkSettingsManager)
+public:
+ explicit QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent);
+ QNetworkSettingsManager *q_ptr;
+
+public slots:
+ void getServicesFinished(QDBusPendingCallWatcher *watcher);
+ void getTechnologiesFinished(QDBusPendingCallWatcher *watcher);
+ void requestInput(const QString& service, const QString& type);
+ void servicesChanged(ConnmanMapList changed, const QList<QDBusObjectPath> &removed);
+
+protected:
+ QNetworkSettingsInterfaceModel m_interfaceModel;
+ QNetworkSettingsServiceModel m_serviceModel;
+ QNetworkSettingsServiceFilter m_serviceFilter;
+private:
+ NetConnmanManagerInterface *m_manager;
+};
+
+#endif // QNETWORKSETTINGSMANAGERPRIVATE_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp
new file mode 100644
index 0000000..95181ed
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp
@@ -0,0 +1,405 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qnetworksettingsservice_p.h"
+#include "connman_service_interface.h"
+#include "connmancommon.h"
+
+const QString PropertyIPv4("IPv4");
+const QString PropertyQNetworkSettingsIPv4("IPv4.Configuration");
+const QString PropertyIPv6("IPv6");
+const QString PropertyQNetworkSettingsIPv6("IPv6.Configuration");
+const QString PropertyNameservers("Nameservers");
+const QString PropertyNameserversConfig("Nameservers.Configuration");
+const QString PropertyDomains("Domains");
+const QString PropertyDomainsConfig("Domains.Configuration");
+const QString PropertyProxy("Proxy");
+const QString PropertyQNetworkSettingsProxy("Proxy.Configuration");
+const QString PropertyAddress("Address");
+const QString PropertyNetMask("Netmask");
+const QString PropertyGateway("Gateway");
+const QString PropertyPrefixLength("PrefixLength");
+const QString PropertyMethod("Method");
+const QString PropertyPrivacy("Privacy");
+const QString PropertyUrl("Url");
+const QString PropertyServers("Servers");
+const QString PropertyExcludes("Excludes");
+const QString PropertyStrength("Strength");
+const QString PropertySecurity("Security");
+
+const QString AttributeAuto("auto");
+const QString AttributeDhcp("dhcp");
+const QString AttributeManual("manual");
+const QString AttributeOff("off");
+const QString AttributeDisabled("disabled");
+const QString AttributeEnabled("enabled");
+const QString AttributePreferred("preferred");
+const QString AttributeDirect("direct");
+const QString AttributeNone("none");
+const QString AttributeWep("wep");
+const QString AttributePsk("psk");
+const QString AttributeIeee("ieee8021x");
+const QString AttributeWps("wps");
+const QString AttributeInvalidKey("invalid-key");
+
+const QVariantMap &operator>>(const QVariantMap &argument, QNetworkSettingsIPv4 &obj)
+{
+ obj.setAddress(argument[PropertyAddress].toString());
+ obj.setMask(argument[PropertyNetMask].toString());
+ obj.setGateway(argument[PropertyGateway].toString());
+
+ QString method = argument[PropertyMethod].toString();
+
+ if (method == AttributeDhcp) {
+ obj.setMethod(QNetworkSettingsIPv4::Dhcp);
+ }
+ else if (method == AttributeManual) {
+ obj.setMethod(QNetworkSettingsIPv4::Manual);
+ }
+ else if (method == AttributeOff) {
+ obj.setMethod(QNetworkSettingsIPv4::Off);
+ }
+ else {
+ obj.setMethod(QNetworkSettingsIPv4::Off);
+ }
+ return argument;
+}
+
+const QVariantMap &operator<<(QVariantMap &argument, const QNetworkSettingsIPv4 &obj)
+{
+ argument.insert(PropertyAddress, QVariant::fromValue(obj.address()));
+
+ argument.insert(PropertyNetMask, QVariant::fromValue(obj.mask()));
+
+ argument.insert(PropertyGateway, QVariant::fromValue(obj.gateway()));
+
+ QString method;
+ switch (obj.method()) {
+ case QNetworkSettingsIPv4::Dhcp:
+ method = AttributeDhcp;
+ break;
+ case QNetworkSettingsIPv4::Manual:
+ method = AttributeManual;
+ break;
+ case QNetworkSettingsIPv4::Off:
+ method = AttributeOff;
+ break;
+ default:
+ break;
+ }
+ argument.insert(PropertyMethod, QVariant::fromValue(method));
+ return argument;
+}
+
+const QVariantMap &operator>>(const QVariantMap &argument, QNetworkSettingsIPv6 &obj)
+{
+ obj.setAddress(argument[PropertyAddress].toString());
+ obj.setGateway(argument[PropertyGateway].toString());
+ obj.setPrefixLength(argument[PropertyPrefixLength].toInt());
+ QString method = argument[PropertyMethod].toString();
+ if (method == AttributeAuto) {
+ obj.setMethod(QNetworkSettingsIPv6::Auto);
+ }
+ else if (method == AttributeManual) {
+ obj.setMethod(QNetworkSettingsIPv6::Manual);
+ }
+ else if (method == AttributeOff) {
+ obj.setMethod(QNetworkSettingsIPv6::Off);
+ }
+ QString privacy = argument[PropertyPrivacy].toString();
+
+ if (privacy == AttributeDisabled) {
+ obj.setPrivacy(QNetworkSettingsIPv6::Disabled);
+ }
+ else if (privacy == AttributeEnabled) {
+ obj.setPrivacy(QNetworkSettingsIPv6::Enabled);
+ }
+ else if (privacy == AttributePreferred) {
+ obj.setPrivacy(QNetworkSettingsIPv6::Preferred);
+ }
+ return argument;
+}
+
+
+const QVariantMap &operator<<(QVariantMap &argument, const QNetworkSettingsIPv6 &obj)
+{
+ argument.insert(PropertyAddress, QVariant::fromValue(obj.address()));
+ argument.insert(PropertyGateway, QVariant::fromValue(obj.address()));
+ argument.insert(PropertyPrefixLength, QVariant::fromValue(obj.prefixLength()));
+
+ QString method;
+ switch (obj.method()) {
+ case QNetworkSettingsIPv6::Auto:
+ method = AttributeAuto;
+ break;
+ case QNetworkSettingsIPv6::Manual:
+ method = AttributeManual;
+ break;
+ case QNetworkSettingsIPv6::Off:
+ method = AttributeOff;
+ break;
+ default:
+ break;
+ }
+ argument.insert(PropertyMethod, QVariant::fromValue(method));
+
+ QString privacy;
+ switch (obj.privacy()) {
+ case QNetworkSettingsIPv6::Disabled:
+ method = AttributeDisabled;
+ break;
+ case QNetworkSettingsIPv6::Enabled:
+ method = AttributeEnabled;
+ break;
+ case QNetworkSettingsIPv6::Preferred:
+ method = AttributePreferred;
+ break;
+ default:
+ break;
+ }
+ argument.insert(PropertyPrivacy, QVariant::fromValue(privacy));
+
+ return argument;
+}
+
+
+const QVariantMap &operator>>(const QVariantMap &argument, QNetworkSettingsProxy &obj)
+{
+ QString method = argument[PropertyMethod].toString();
+ if (method == AttributeDirect) {
+ obj.setMethod(QNetworkSettingsProxy::Direct);
+ }
+ else if (method == AttributeAuto) {
+ obj.setMethod(QNetworkSettingsProxy::Auto);
+ }
+ else if (method == AttributeManual) {
+ obj.setMethod(QNetworkSettingsProxy::Manual);
+ }
+
+ QString urlStr = argument[PropertyUrl].toString();
+ obj.setUrl(QUrl(urlStr));
+
+ obj.setServers(argument[PropertyServers].toStringList());
+ obj.setExcludes(argument[PropertyExcludes].toStringList());
+
+ return argument;
+}
+
+const QVariantMap &operator<<(QVariantMap &argument, const QNetworkSettingsProxy &obj)
+{
+ QString method;
+ switch (obj.method()) {
+ case QNetworkSettingsProxy::Direct:
+ method = AttributeDirect;
+ break;
+ case QNetworkSettingsProxy::Auto:
+ method = AttributeAuto;
+ break;
+ case QNetworkSettingsProxy::Manual:
+ method = AttributeManual;
+ break;
+ default:
+ break;
+ }
+ argument.insert(PropertyMethod, QVariant::fromValue(method));
+ argument.insert(PropertyUrl, QVariant::fromValue(obj.url().toString()));
+ argument.insert(PropertyServers, QVariant::fromValue(obj.servers()));
+ argument.insert(PropertyServers, QVariant::fromValue(obj.excludes()));
+
+ return argument;
+}
+
+QNetworkSettingsServicePrivate::QNetworkSettingsServicePrivate(const QString& id, QNetworkSettingsService *parent) :
+ QObject(parent)
+ ,q_ptr(parent)
+ ,m_id(id)
+{
+ qDBusRegisterMetaType<ConnmanMap>();
+ qDBusRegisterMetaType<ConnmanMapList>();
+
+ m_service = new NetConnmanServiceInterface("net.connman", m_id,
+ QDBusConnection::systemBus(), this);
+
+ connect(m_service, SIGNAL(PropertyChanged(QString,QDBusVariant)),
+ this, SLOT(updateProperty(QString,QDBusVariant)));
+
+ QDBusPendingReply<QVariantMap> reply = m_service->GetProperties();
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
+
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(propertiesUpdated(QDBusPendingCallWatcher*)));
+}
+
+void QNetworkSettingsServicePrivate::setupIpv6Config()
+{
+ QVariantMap param;
+ param << m_ipv6config;
+ if (m_service)
+ m_service->SetProperty(PropertyQNetworkSettingsIPv6, QDBusVariant(QVariant(param)));
+}
+
+void QNetworkSettingsServicePrivate::setupNameserversConfig()
+{
+ QVariant param = QVariant::fromValue(m_nameserverConfig.stringList());
+ if (m_service)
+ m_service->SetProperty(PropertyNameserversConfig, QDBusVariant(QVariant(param)));
+}
+
+void QNetworkSettingsServicePrivate::setupDomainsConfig()
+{
+ QVariant param = QVariant::fromValue(m_domainsConfig.stringList());
+ if (m_service)
+ m_service->SetProperty(PropertyDomainsConfig, QDBusVariant(QVariant(param)));
+}
+
+void QNetworkSettingsServicePrivate::setupQNetworkSettingsProxy()
+{
+ QVariantMap param;
+ param << m_proxyConfig;
+ if (m_service)
+ m_service->SetProperty(PropertyQNetworkSettingsProxy, QDBusVariant(QVariant(param)));
+}
+
+void QNetworkSettingsServicePrivate::setupIpv4Config()
+{
+ QVariantMap param;
+ param << m_ipv4config;
+ if (m_service)
+ m_service->SetProperty(PropertyQNetworkSettingsIPv4, QDBusVariant(QVariant(param)));
+}
+
+void QNetworkSettingsServicePrivate::connectService()
+{
+ if (m_service) {
+ m_service->Connect();
+ }
+}
+
+void QNetworkSettingsServicePrivate::disconnectService()
+{
+ if (m_service)
+ m_service->Disconnect();
+
+}
+
+void QNetworkSettingsServicePrivate::propertiesUpdated(QDBusPendingCallWatcher *call)
+{
+ QDBusPendingReply<QVariantMap> reply = *call;
+ call->deleteLater();
+
+ if (!reply.isError())
+ setupConfiguration(reply.value());
+}
+
+void QNetworkSettingsServicePrivate::updateProperty(const QString &name, const QDBusVariant &value)
+{
+ updateProperty(name, value.variant());
+}
+
+void QNetworkSettingsServicePrivate::updateProperty(const QString& key, const QVariant& val)
+{
+ Q_Q(QNetworkSettingsService);
+
+ if (key == PropertyIPv4) {
+ QVariantMap value = qdbus_cast<QVariantMap>(val);
+ value >> m_ipv4config;
+ emit q->ipv4Changed();
+ }
+ else if (key == PropertyIPv6) {
+ QVariantMap value = qdbus_cast<QVariantMap>(val);
+ value >> m_ipv6config;
+ emit q->ipv6Changed();
+ }
+ else if (key == PropertyNameservers) {
+ QStringList value = qdbus_cast<QStringList>(val);
+ m_nameserverConfig.setStringList(value);
+ emit q->nameserversChanged();
+ }
+ else if (key == PropertyDomains) {
+ QStringList value = qdbus_cast<QStringList>(val);
+ m_domainsConfig.setStringList(value);
+ emit q->domainsChanged();
+ }
+ else if (key == PropertyProxy) {
+ QVariantMap value = qdbus_cast<QVariantMap>(val);
+ value >> m_proxyConfig;
+ emit q->proxyChanged();
+ }
+ else if (key == PropertyState) {
+ QString value = qdbus_cast<QString>(val);
+ value >> m_state;
+ emit q->stateChanged();
+ }
+ else if (key == PropertyName) {
+ m_name = qdbus_cast<QString>(val);
+ emit q->nameChanged();
+ }
+ else if (key == PropertyType) {
+ QString value = qdbus_cast<QString>(val);
+ value >> m_type;
+ }
+ else if (key == PropertyStrength) {
+ m_wifiConfig.setSignalStrength(val.toInt());
+ }
+ else if (key == PropertySecurity) {
+ QStringList value = qdbus_cast<QStringList>(val);
+ foreach (const QString str, value) {
+ if (str == AttributeNone) {
+ m_wifiConfig.setSecurity(QNetworkSettingsWireless::None);
+ }
+ else if (str == AttributeWep) {
+ m_wifiConfig.setSecurity(QNetworkSettingsWireless::WEP);
+ }
+ else if (str == AttributePsk) {
+ m_wifiConfig.setSecurity(QNetworkSettingsWireless::WPA);
+ }
+ else if (str == AttributeIeee) {
+ m_wifiConfig.setSecurity(QNetworkSettingsWireless::WPA2);
+ }
+ else if (str == AttributeWps) {
+ m_wifiConfig.setSecurity(QNetworkSettingsWireless::WPS);
+ }
+ }
+ }
+}
+
+void QNetworkSettingsServicePrivate::setupConfiguration(const QVariantMap &properties)
+{
+ QVariantMap::const_iterator it = properties.constBegin(), end = properties.constEnd();
+ for ( ; it != end; ++it) {
+ updateProperty(it.key(), it.value());
+ }
+}
+
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h
new file mode 100644
index 0000000..39a04bd
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QNETWORKSETTINGSSERVICEPRIVATE_H
+#define QNETWORKSETTINGSSERVICEPRIVATE_H
+
+#include <QtDBus>
+#include "qnetworksettingsservice.h"
+#include "qnetworksettings.h"
+
+class NetConnmanServiceInterface;
+
+class QNetworkSettingsServicePrivate : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PUBLIC(QNetworkSettingsService)
+public:
+ QNetworkSettingsServicePrivate(const QString& aPath, QNetworkSettingsService *parent=0);
+
+ QNetworkSettingsService *q_ptr;
+private slots:
+ void propertiesUpdated(QDBusPendingCallWatcher *call);
+ void updateProperty(const QString &name, const QDBusVariant &value);
+
+private:
+ void setupConfiguration(const QVariantMap &properties);
+ void updateProperty(const QString& key, const QVariant& value);
+
+protected:
+ void setAutoConnect(const bool autoconnect);
+ void setupIpv4Config();
+ void setupIpv6Config();
+ void setupNameserversConfig();
+ void setupDomainsConfig();
+ void setupQNetworkSettingsProxy();
+ void connectService();
+ void disconnectService();
+
+ QString m_id;
+ QString m_name;
+ QNetworkSettingsState m_state;
+ QNetworkSettingsIPv4 m_ipv4config;
+ QNetworkSettingsIPv6 m_ipv6config;
+ QNetworkSettingsAddressModel m_domainsConfig;
+ QNetworkSettingsAddressModel m_nameserverConfig;
+ QNetworkSettingsProxy m_proxyConfig;
+ QNetworkSettingsWireless m_wifiConfig;
+ QNetworkSettingsType m_type;
+ NetConnmanServiceInterface *m_service;
+};
+
+#endif // QNETWORKSETTINGSSERVICEPRIVATE_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp
new file mode 100644
index 0000000..918c8b8
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qnetworksettingsuseragent_p.h"
+#include "connmancommon.h"
+
+const QString PropertyPassphrase("Passphrase");
+
+QNetworkSettingsUserAgentPrivate::QNetworkSettingsUserAgentPrivate(QNetworkSettingsUserAgent *parent)
+ :QDBusAbstractAdaptor(parent)
+ ,q_ptr(parent)
+ ,m_pendingReply(false)
+{
+
+ setAutoRelaySignals(true);
+ QMetaObject::invokeMethod(this, "registerAgent", Qt::QueuedConnection);
+}
+
+void QNetworkSettingsUserAgentPrivate::cancel()
+{
+ // handle method call net.connman.Agent.Cancel
+ m_pendingReply = false;
+ QMetaObject::invokeMethod(parent(), "Cancel");
+}
+
+void QNetworkSettingsUserAgentPrivate::release()
+{
+ // handle method call net.connman.Agent.Release
+ QMetaObject::invokeMethod(parent(), "Release");
+}
+
+void QNetworkSettingsUserAgentPrivate::ReportError(const QDBusObjectPath &path, const QString &param)
+{
+ Q_Q(QNetworkSettingsUserAgent);
+ Q_UNUSED(path);
+ Q_UNUSED(param);
+ emit q->error();
+}
+
+void QNetworkSettingsUserAgentPrivate::registerAgent()
+{
+ Q_Q(QNetworkSettingsUserAgent);
+ QDBusConnection::systemBus().registerObject(AgentPath, q_ptr);
+}
+
+QVariantMap QNetworkSettingsUserAgentPrivate::RequestInput(const QDBusObjectPath &path, const QVariantMap &params, const QDBusMessage &msg)
+{
+ Q_Q(QNetworkSettingsUserAgent);
+ Q_UNUSED(path);
+ Q_UNUSED(params);
+ msg.setDelayedReply(true);
+ m_reply = msg.createReply();
+ m_pendingReply = true;
+ emit q->showUserCredentialsInput();
+ return QVariantMap();
+}
+
+void QNetworkSettingsUserAgentPrivate::setUserCredentials(const QString& username,
+ const QString& password)
+{
+ QVariantMap response;
+ response[PropertyName] = username;
+ response[PropertyPassphrase] = password;
+ m_reply << response;
+ m_pendingReply = false;
+ QDBusConnection::systemBus().send(m_reply);
+}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h
new file mode 100644
index 0000000..8c480a5
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QNETWORKSETTINGSUSERAGENTPRIVATE_H
+#define QNETWORKSETTINGSUSERAGENTPRIVATE_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "qnetworksettingsuseragent.h"
+
+QT_BEGIN_NAMESPACE
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+QT_END_NAMESPACE
+
+const QString AgentPath("/ConnmanAgent");
+
+class QNetworkSettingsUserAgentPrivate : public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "net.connman.Agent")
+ Q_DECLARE_PUBLIC(QNetworkSettingsUserAgent)
+public:
+ QNetworkSettingsUserAgentPrivate(QNetworkSettingsUserAgent *parent=0);
+ void setUserCredentials(const QString& aUsername, const QString& aPassword);
+ void cancel();
+ void release();
+public Q_SLOTS: // Dbus methods
+ void ReportError(const QDBusObjectPath &path, const QString &param);
+ QVariantMap RequestInput(const QDBusObjectPath &path, const QVariantMap &params,
+ const QDBusMessage &message);
+ void registerAgent();
+private:
+ QNetworkSettingsUserAgent *q_ptr;
+ QDBusMessage m_reply;
+ bool m_pendingReply;
+};
+
+#endif // QNETWORKSETTINGSUSERAGENTPRIVATE_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/networksettings.pri b/src/qtdevicesettings/networksettingsplugin/networksettings/networksettings.pri
index 7a81571..d067eb7 100644
--- a/src/qtdevicesettings/networksettingsplugin/networksettings/networksettings.pri
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/networksettings.pri
@@ -1,9 +1,3 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2015-11-03T13:52:45
-#
-#-------------------------------------------------
-
QT += core network dbus
INCLUDEPATH += $${PWD}/connman
@@ -14,15 +8,31 @@ DBUS_INTERFACES = \
networksettings/connman/connman_service.xml \
networksettings/connman/connman_technology.xml
-
-SOURCES += networksettings/networksettingsmanager.cpp \
- networksettings/connman/networksettingsmanager_linux.cpp \
- networksettings/networkaddressmodel.cpp \
- networksettings/networksmodel.cpp
+SOURCES += \
+ $$PWD/qnetworksettingsinterfacemodel.cpp \
+ $$PWD/qnetworksettingsmanager.cpp \
+ $$PWD/qnetworksettingsaddressmodel.cpp \
+ $$PWD/qnetworksettingsservicemodel.cpp \
+ $$PWD/qnetworksettingsservice.cpp \
+ $$PWD/qnetworksettingsuseragent.cpp \
+ $$PWD/qnetworksettingsinterface.cpp \
+ $$PWD/connman/qnetworksettingsinterface_p.cpp \
+ $$PWD/connman/qnetworksettingsservice_p.cpp \
+ $$PWD/connman/qnetworksettingsuseragent_p.cpp \
+ $$PWD/connman/qnetworksettingsmanager_p.cpp \
+ $$PWD/connman/connmancommon.cpp
HEADERS += \
- networksettings/networkconfig.h \
- networksettings/connman/networksettingsmanager_linux_p.h \
- networksettings/networkaddressmodel.h \
- networksettings/networksettingsmanager.h \
- networksettings/networksmodel.h
+ $$PWD/qnetworksettingsinterfacemodel.h \
+ $$PWD/qnetworksettings.h \
+ $$PWD/qnetworksettingsmanager.h \
+ $$PWD/qnetworksettingsaddressmodel.h \
+ $$PWD/qnetworksettingsservicemodel.h \
+ $$PWD/qnetworksettingsservice.h \
+ $$PWD/qnetworksettingsuseragent.h \
+ $$PWD/qnetworksettingsinterface.h \
+ $$PWD/connman/qnetworksettingsinterface_p.h \
+ $$PWD/connman/qnetworksettingsservice_p.h \
+ $$PWD/connman/qnetworksettingsuseragent_p.h \
+ $$PWD/connman/qnetworksettingsmanager_p.h \
+ $$PWD/connman/connmancommon.h
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/networkconfig.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettings.h
index cdff473..6a0604b 100644
--- a/src/qtdevicesettings/networksettingsplugin/networksettings/networkconfig.h
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettings.h
@@ -33,15 +33,15 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef NETWORKCONFIG_H
-#define NETWORKCONFIG_H
+#ifndef QNETWORKSETTINGS_H
+#define QNETWORKSETTINGS_H
#include <QObject>
#include <QUrl>
#include <QVariantMap>
-#include "networkaddressmodel.h"
+#include "qnetworksettingsaddressmodel.h"
-class NetworkState : public QObject
+class QNetworkSettingsState : public QObject
{
Q_OBJECT
Q_ENUMS(States)
@@ -50,13 +50,13 @@ class NetworkState : public QObject
public:
enum States {Idle, Failure, Association, Configuration, Ready, Disconnect, Online, Undefined};
- explicit NetworkState(States aState, QObject *parent = 0)
+ explicit QNetworkSettingsState(States state, QObject *parent = 0)
: QObject(parent)
{
- m_state = aState;
+ m_state = state;
}
- explicit NetworkState(QObject *parent = 0)
+ explicit QNetworkSettingsState(QObject *parent = 0)
: QObject(parent)
{
m_state = Undefined;
@@ -66,8 +66,8 @@ public:
return m_state;
}
- void setState(const States aState) {
- m_state = aState;
+ void setState(const States state) {
+ m_state = state;
emit stateChanged();
}
@@ -78,7 +78,7 @@ private:
States m_state;
};
-class NetworkType : public QObject
+class QNetworkSettingsType : public QObject
{
Q_OBJECT
Q_ENUMS(Types)
@@ -92,13 +92,13 @@ public:
Unknown
};
- explicit NetworkType(Types aType, QObject *parent = 0)
+ explicit QNetworkSettingsType(Types type, QObject *parent = 0)
: QObject(parent)
{
- m_type = aType;
+ m_type = type;
}
- explicit NetworkType(QObject *parent = 0)
+ explicit QNetworkSettingsType(QObject *parent = 0)
: QObject(parent)
{
m_type = Unknown;
@@ -109,8 +109,8 @@ public:
return m_type;
}
- void setType(const Types aType) {
- m_type = aType;
+ void setType(const Types type) {
+ m_type = type;
emit typeChanged();
}
@@ -121,7 +121,7 @@ private:
Types m_type;
};
-class IPv4Config : public QObject
+class QNetworkSettingsIPv4 : public QObject
{
Q_OBJECT
Q_ENUMS(MethodType)
@@ -131,7 +131,7 @@ class IPv4Config : public QObject
Q_PROPERTY(QString mask READ mask WRITE setMask NOTIFY maskChanged)
public:
- explicit IPv4Config(QObject *parent = 0)
+ explicit QNetworkSettingsIPv4(QObject *parent = 0)
: QObject(parent)
{
@@ -142,8 +142,8 @@ public:
QString address() const {
return m_address;
}
- void setAddress(const QString& aAdderess) {
- m_address = aAdderess;
+ void setAddress(const QString& adderess) {
+ m_address = adderess;
emit addressChanged();
}
@@ -151,8 +151,8 @@ public:
return m_gateway;
}
- void setGateway(const QString& aGateway) {
- m_gateway = aGateway;
+ void setGateway(const QString& gateway) {
+ m_gateway = gateway;
emit gatewayChanged();
}
@@ -160,8 +160,8 @@ public:
return m_method;
}
- void setMethod(const MethodType aMethod) {
- m_method = aMethod;
+ void setMethod(const MethodType method) {
+ m_method = method;
emit methodChanged();
}
@@ -169,8 +169,8 @@ public:
return m_mask;
}
- void setMask(const QString& aMask) {
- m_mask = aMask;
+ void setMask(const QString& mask) {
+ m_mask = mask;
emit maskChanged();
}
@@ -188,7 +188,7 @@ private:
};
-class IPv6Config : public QObject
+class QNetworkSettingsIPv6 : public QObject
{
Q_OBJECT
Q_ENUMS(MethodType PrivacyType)
@@ -199,7 +199,7 @@ class IPv6Config : public QObject
Q_PROPERTY(int prefixLength READ prefixLength WRITE setPrefixLength NOTIFY prefixLengthChanged)
public:
- explicit IPv6Config(QObject *parent = 0)
+ explicit QNetworkSettingsIPv6(QObject *parent = 0)
: QObject(parent)
{
@@ -211,8 +211,8 @@ public:
QString address() const {
return m_address;
}
- void setAddress(const QString& aAdderess) {
- m_address = aAdderess;
+ void setAddress(const QString& adderess) {
+ m_address = adderess;
emit addressChanged();
}
@@ -220,8 +220,8 @@ public:
return m_gateway;
}
- void setGateway(const QString& aGateway) {
- m_gateway = aGateway;
+ void setGateway(const QString& gateway) {
+ m_gateway = gateway;
emit gatewayChanged();
}
@@ -229,8 +229,8 @@ public:
return m_method;
}
- void setMethod(const MethodType aMethod) {
- m_method = aMethod;
+ void setMethod(const MethodType method) {
+ m_method = method;
emit methodChanged();
}
@@ -238,8 +238,8 @@ public:
return m_privacy;
}
- void setPrivacy(const PrivacyType aPrivacy) {
- m_privacy = aPrivacy;
+ void setPrivacy(const PrivacyType privacy) {
+ m_privacy = privacy;
emit privacyChanged();
}
@@ -247,8 +247,8 @@ public:
return m_prefixLength;
}
- void setPrefixLength(const int& aPrefixLength) {
- m_prefixLength = aPrefixLength;
+ void setPrefixLength(const int& prefixLength) {
+ m_prefixLength = prefixLength;
emit prefixLengthChanged();
}
@@ -267,7 +267,7 @@ private:
int m_prefixLength;
};
-class ProxyConfig : public QObject
+class QNetworkSettingsProxy : public QObject
{
Q_OBJECT
Q_ENUMS(MethodType)
@@ -277,7 +277,7 @@ public:
Q_PROPERTY(QAbstractItemModel* excludes READ excludes NOTIFY excludesChanged)
Q_PROPERTY(MethodType method READ method WRITE setMethod NOTIFY methodChanged)
- explicit ProxyConfig(QObject *parent=NULL)
+ explicit QNetworkSettingsProxy(QObject *parent=NULL)
: QObject(parent)
{
@@ -289,8 +289,8 @@ public:
return m_url;
}
- void setUrl(const QUrl& aUrl) {
- m_url = aUrl;
+ void setUrl(const QUrl& url) {
+ m_url = url;
emit urlChanged();
}
@@ -298,8 +298,8 @@ public:
return &m_servers;
}
- void setServers(const QStringList& aServers) {
- m_servers.setStringList(aServers);
+ void setServers(const QStringList& servers) {
+ m_servers.setStringList(servers);
emit serversChanged();
}
@@ -315,8 +315,8 @@ public:
return m_excludes.stringList();
}
- void setExcludes(const QStringList& aExcludes) {
- m_excludes.setStringList(aExcludes);
+ void setExcludes(const QStringList& excludes) {
+ m_excludes.setStringList(excludes);
emit excludesChanged();
}
@@ -324,8 +324,8 @@ public:
return m_method;
}
- void setMethod(const MethodType& aMethod) {
- m_method = aMethod;
+ void setMethod(const MethodType& method) {
+ m_method = method;
emit methodChanged();
}
@@ -336,59 +336,64 @@ signals:
void methodChanged();
private:
QUrl m_url;
- NetworkAddressModel m_servers;
- NetworkAddressModel m_excludes;
+ QNetworkSettingsAddressModel m_servers;
+ QNetworkSettingsAddressModel m_excludes;
MethodType m_method;
};
-class WifiConfig : public QObject
+class QNetworkSettingsWireless : public QObject
{
Q_OBJECT
- Q_PROPERTY(QString bssid READ bssid NOTIFY bssidChanged)
- Q_PROPERTY(int maxRate READ maxRate NOTIFY maxRateChanged)
- Q_PROPERTY(int frequency READ frequency NOTIFY frequencyChanged)
- Q_PROPERTY(QString encryptionMode READ encryptionMode NOTIFY encryptionModeChanged)
+ Q_PROPERTY(int signalStrength READ signalStrength WRITE setSignalStrength NOTIFY signalStrengthChanged)
Q_PROPERTY(bool hidden READ hidden NOTIFY hiddenChanged)
public:
- explicit WifiConfig(QObject* parent = 0) :
+ explicit QNetworkSettingsWireless(QObject* parent = 0) :
QObject(parent) {
+ }
+
+ enum SecurityFlags {None=1, WEP=2, WPA=4, WPA2=8, WPS=16};
+ Q_INVOKABLE bool supportsSecurity(SecurityFlags security) {
+ if (m_securityFlags & security) {
+ return true;
+ }
+ return false;
}
- const QString bssid() {
- return m_bssid;
+ bool hidden() const {
+ return m_hidden;
}
- int maxRate() {
- return m_maxRate;
+ void setHidden(const bool hidden) {
+ m_hidden = hidden;
+ emit hiddenChanged();
}
- int frequency() {
- return m_frequency;
+ int signalStrength() const {
+ return m_signalStrength;
}
- const QString encryptionMode() {
- return m_encryptionMode;
+ void setSignalStrength(const int signalStrength) {
+ m_signalStrength = signalStrength;
+ emit signalStrengthChanged();
}
- bool hidden() const {
- return m_hidden;
+ void setSecurity(const SecurityFlags security) {
+ if (security == None) {
+ m_securityFlags = None;
+ }
+ else {
+ m_securityFlags |= security;
+ }
}
signals:
- void bssidChanged(const QString &bssid);
- void maxRateChanged(quint32 rate);
- void frequencyChanged(quint16 frequency);
- void encryptionModeChanged(const QString &mode);
- void hiddenChanged(bool);
-
+ void hiddenChanged();
+ void signalStrengthChanged();
+ void passwordChanged();
private:
- QString m_bssid;
- quint32 m_maxRate;
- quint16 m_frequency;
- QString m_encryptionMode;
+ quint16 m_securityFlags;
bool m_hidden;
+ int m_signalStrength;
};
-
-
-#endif
+#endif //QNETWORKSETTINGS_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/networkaddressmodel.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.cpp
index 3df67ab..b70278b 100644
--- a/src/qtdevicesettings/networksettingsplugin/networksettings/networkaddressmodel.cpp
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.cpp
@@ -33,27 +33,27 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "networkaddressmodel.h"
+#include "qnetworksettingsaddressmodel.h"
-NetworkAddressModel::NetworkAddressModel(QObject *parent)
+QNetworkSettingsAddressModel::QNetworkSettingsAddressModel(QObject *parent)
:QStringListModel(parent)
{
}
-NetworkAddressModel::NetworkAddressModel(const QStringList &strings, QObject *parent)
+QNetworkSettingsAddressModel::QNetworkSettingsAddressModel(const QStringList &strings, QObject *parent)
:QStringListModel(parent)
{
setStringList(strings);
}
-void NetworkAddressModel::setStringList(const QStringList &addresses)
+void QNetworkSettingsAddressModel::setStringList(const QStringList &addresses)
{
m_addresses = addresses;
QStringListModel::setStringList(m_addresses);
emit countChanged();
}
-void NetworkAddressModel::append(const QString& address)
+void QNetworkSettingsAddressModel::append(const QString& address)
{
int row = rowCount();
@@ -66,18 +66,18 @@ void NetworkAddressModel::append(const QString& address)
emit countChanged();
}
-void NetworkAddressModel::remove(int index)
+void QNetworkSettingsAddressModel::remove(int index)
{
removeRows(index, 1);
emit countChanged();
}
-int NetworkAddressModel::count() const
+int QNetworkSettingsAddressModel::count() const
{
return rowCount();
}
-void NetworkAddressModel::resetChanges()
+void QNetworkSettingsAddressModel::resetChanges()
{
QStringListModel::setStringList(m_addresses);
}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/networkaddressmodel.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.h
index b90958f..b7a1c2e 100644
--- a/src/qtdevicesettings/networksettingsplugin/networksettings/networkaddressmodel.h
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.h
@@ -33,18 +33,18 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef NETWORKADDRESSMODEL_H
-#define NETWORKADDRESSMODEL_H
+#ifndef QNETWORKSETTINGSADDRESSMODEL_H
+#define QNETWORKSETTINGSADDRESSMODEL_H
#include <QStringListModel>
-class NetworkAddressModel : public QStringListModel
+class QNetworkSettingsAddressModel : public QStringListModel
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
- explicit NetworkAddressModel(QObject *parent = 0);
- explicit NetworkAddressModel(const QStringList &strings, QObject *parent = 0);
+ explicit QNetworkSettingsAddressModel(QObject *parent = 0);
+ explicit QNetworkSettingsAddressModel(const QStringList &strings, QObject *parent = 0);
Q_INVOKABLE void append(const QString& address);
Q_INVOKABLE void remove(int index);
Q_INVOKABLE void resetChanges();
@@ -57,4 +57,4 @@ private:
QStringList m_addresses;
};
-#endif // NETWORKADDRESSMODEL_H
+#endif // QNETWORKSETTINGSADDRESSMODEL_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.cpp
new file mode 100644
index 0000000..893311a
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qnetworksettingsinterface.h"
+#include "qnetworksettingsinterface_p.h"
+#include "qnetworksettings.h"
+
+QNetworkSettingsInterface::QNetworkSettingsInterface(QObject *parent) :
+ QObject(parent)
+ ,d_ptr(new QNetworkSettingsInterfacePrivate(this))
+{
+
+}
+
+QString QNetworkSettingsInterface::name() const
+{
+ Q_D(const QNetworkSettingsInterface);
+ return d->m_name;
+}
+
+QNetworkSettingsState::States QNetworkSettingsInterface::state()
+{
+ Q_D(QNetworkSettingsInterface);
+ return d->m_state.state();
+}
+
+QNetworkSettingsType::Types QNetworkSettingsInterface::type()
+{
+ Q_D(QNetworkSettingsInterface);
+ return d->m_type.type();
+}
+
+bool QNetworkSettingsInterface::powered() const
+{
+ Q_D(const QNetworkSettingsInterface);
+ return d->m_powered;
+}
+
+void QNetworkSettingsInterface::setPowered(const bool powered)
+{
+ Q_D(QNetworkSettingsInterface);
+ d->setPowered(powered);
+}
+
+void QNetworkSettingsInterface::scanServices()
+{
+ Q_D(QNetworkSettingsInterface);
+ d->scan();
+}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.h
new file mode 100644
index 0000000..bce4848
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNETWORKSETTINGSINTERFACE_H
+#define QNETWORKSETTINGSINTERFACE_H
+
+#include <QObject>
+#include "qnetworksettings.h"
+
+QT_FORWARD_DECLARE_CLASS(QNetworkSettingsInterfacePrivate)
+
+class QNetworkSettingsInterface : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name NOTIFY nameChanged)
+ Q_PROPERTY(QNetworkSettingsState::States state READ state NOTIFY stateChanged)
+ Q_PROPERTY(QNetworkSettingsType::Types type READ type NOTIFY typeChanged)
+ Q_PROPERTY(bool powered READ powered WRITE setPowered NOTIFY poweredChanged)
+
+public:
+ explicit QNetworkSettingsInterface(QObject* parent=0);
+ QString name() const;
+ QNetworkSettingsState::States state();
+ QNetworkSettingsType::Types type();
+ bool powered() const;
+ void setPowered(const bool powered);
+ Q_INVOKABLE void scanServices();
+
+signals:
+ void nameChanged();
+ void stateChanged();
+ void typeChanged();
+ void poweredChanged();
+
+protected:
+ friend class NetworksInterfaceModel;
+ QNetworkSettingsInterfacePrivate *d_ptr;
+
+ Q_DISABLE_COPY(QNetworkSettingsInterface)
+ Q_DECLARE_PRIVATE(QNetworkSettingsInterface)
+};
+
+#endif // QNETWORKSETTINGSINTERFACE_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/networksmodel.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.cpp
index 8524417..a4ea477 100644
--- a/src/qtdevicesettings/networksettingsplugin/networksettings/networksmodel.cpp
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.cpp
@@ -34,9 +34,10 @@
**
****************************************************************************/
#include <QQmlPropertyMap>
-#include "networksmodel.h"
+#include "qnetworksettingsinterfacemodel.h"
+#include "qnetworksettingsinterface.h"
-NetworksModel::NetworksModel(QObject *parent)
+QNetworkSettingsInterfaceModel::QNetworkSettingsInterfaceModel(QObject *parent)
: QAbstractListModel(parent)
{
m_roleNames.insert(Qt::UserRole, "modelData");
@@ -45,28 +46,28 @@ NetworksModel::NetworksModel(QObject *parent)
m_roleNames.insert(Name, "name");
}
-NetworksModel::~NetworksModel()
+QNetworkSettingsInterfaceModel::~QNetworkSettingsInterfaceModel()
{
}
-QHash<int, QByteArray> NetworksModel::roleNames() const
+QHash<int, QByteArray> QNetworkSettingsInterfaceModel::roleNames() const
{
return m_roleNames;
}
-int NetworksModel::rowCount(const QModelIndex & parent) const
+int QNetworkSettingsInterfaceModel::rowCount(const QModelIndex & parent) const
{
Q_UNUSED(parent);
return m_items.count();
}
-QVariant NetworksModel::data(const QModelIndex & index, int role) const
+QVariant QNetworkSettingsInterfaceModel::data(const QModelIndex & index, int role) const
{
if (!index.isValid()) return QVariant();
- NetworkItem *item = m_items[index.row()];
+ QNetworkSettingsInterface *item = m_items[index.row()];
if (role == Qt::UserRole) {
return QVariant::fromValue(static_cast<QObject*>(item));
}
@@ -87,7 +88,7 @@ QVariant NetworksModel::data(const QModelIndex & index, int role) const
}
-void NetworksModel::append(NetworkItem* item)
+void QNetworkSettingsInterfaceModel::append(QNetworkSettingsInterface* item)
{
item->setParent(this);
@@ -96,7 +97,7 @@ void NetworksModel::append(NetworkItem* item)
endInsertRows();
}
-void NetworksModel::insert(int row, NetworkItem* item)
+void QNetworkSettingsInterfaceModel::insert(int row, QNetworkSettingsInterface* item)
{
item->setParent(this);
@@ -105,7 +106,7 @@ void NetworksModel::insert(int row, NetworkItem* item)
endInsertRows();
}
-QList<NetworkItem*> NetworksModel::getModel()
+QList<QNetworkSettingsInterface*> QNetworkSettingsInterfaceModel::getModel()
{
return m_items;
}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.h
new file mode 100644
index 0000000..c44733a
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QNETWORKSETTINGSINTERFACEMODEL_H
+#define QNETWORKSETTINGSINTERFACEMODEL_H
+
+#include <QAbstractListModel>
+#include "qnetworksettings.h"
+
+class QNetworkSettingsInterface;
+
+class QNetworkSettingsInterfaceModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+public:
+ explicit QNetworkSettingsInterfaceModel(QObject *parent=0);
+ virtual ~QNetworkSettingsInterfaceModel();
+ // from QAbstractItemModel
+ int rowCount(const QModelIndex & parent = QModelIndex()) const;
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+ QHash<int, QByteArray> roleNames() const;
+
+ void append(QNetworkSettingsInterface* networkInterface);
+ void insert(int row, QNetworkSettingsInterface* networkInterface);
+ QList<QNetworkSettingsInterface*> getModel();
+
+ enum Roles {
+ Type = Qt::UserRole + 1,
+ Status,
+ Name
+ };
+
+private:
+ QList<QNetworkSettingsInterface*> m_items;
+ QHash<int, QByteArray> m_roleNames;
+};
+
+#endif // QNETWORKSETTINGSINTERFACEMODEL_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.cpp
new file mode 100644
index 0000000..f4a8918
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qnetworksettingsmanager.h"
+#include "qnetworksettingsservice.h"
+#include "qnetworksettingsservicemodel.h"
+#include "qnetworksettingsinterfacemodel.h"
+#include "qnetworksettingsmanager_p.h"
+#include <QStringListModel>
+
+QNetworkSettingsManager::QNetworkSettingsManager(QObject *parent) :
+ QObject(parent)
+ ,d_ptr(new QNetworkSettingsManagerPrivate(this))
+{
+}
+
+QAbstractItemModel* QNetworkSettingsManager::services()
+{
+ Q_D(QNetworkSettingsManager);
+ return &d->m_serviceFilter;
+}
+
+QAbstractItemModel* QNetworkSettingsManager::interfaces()
+{
+ Q_D(QNetworkSettingsManager);
+ return &d->m_interfaceModel;
+}
+
+QNetworkSettingsService* QNetworkSettingsManager::getService(const QString& name, const int type)
+{
+ Q_D(QNetworkSettingsManager);
+
+ foreach (QNetworkSettingsService* service, d->m_serviceModel.getModel()) {
+ if (service->name() == name && service->type() == type) {
+ return service;
+ }
+ }
+ return NULL;
+}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.h
new file mode 100644
index 0000000..03921b2
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QNETWORKSETTINGSMANAGER_H
+#define QNETWORKSETTINGSMANAGER_H
+
+#include "qnetworksettings.h"
+#include <QObject>
+#include <QQmlListProperty>
+#include <QStringListModel>
+
+QT_FORWARD_DECLARE_CLASS(QNetworkSettingsManagerPrivate)
+QT_FORWARD_DECLARE_CLASS(QNetworkSettingsService)
+
+class QNetworkSettingsManager : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(StateTypes NetworkTypeTypes)
+ Q_PROPERTY(QAbstractItemModel* services READ services NOTIFY servicesChanged)
+ Q_PROPERTY(QAbstractItemModel* interfaces READ interfaces NOTIFY interfacesChanged)
+public:
+ explicit QNetworkSettingsManager(QObject* parent = 0);
+ QAbstractItemModel* services();
+ QAbstractItemModel* interfaces();
+
+ Q_INVOKABLE QNetworkSettingsService* getService(const QString& name, const int type);
+
+Q_SIGNALS:
+ void servicesChanged();
+ void interfacesChanged();
+
+protected:
+ QNetworkSettingsManagerPrivate *d_ptr;
+
+private:
+ Q_DISABLE_COPY(QNetworkSettingsManager)
+ Q_DECLARE_PRIVATE(QNetworkSettingsManager)
+};
+
+#endif // QNETWORKSETTINGSMANAGER_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/networksettingsmanager.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.cpp
index 6df0f22..8ade875 100644
--- a/src/qtdevicesettings/networksettingsplugin/networksettings/networksettingsmanager.cpp
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.cpp
@@ -33,135 +33,115 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "networksettingsmanager.h"
-#include "connman/networksettingsmanager_linux_p.h"
-#include <QStringListModel>
-NetworkService::NetworkService(const QString& aServiceId, QObject* parent) :
+#include "qnetworksettingsservice.h"
+#include "qnetworksettingsservice_p.h"
+
+QNetworkSettingsService::QNetworkSettingsService(const QString& aServiceId, QObject* parent) :
QObject(parent)
- ,d_ptr(new NetworkServicePrivate(aServiceId, this))
+ ,d_ptr(new QNetworkSettingsServicePrivate(aServiceId, this))
{
}
-QString NetworkService::name() const
+QString QNetworkSettingsService::id() const
+{
+ Q_D(const QNetworkSettingsService);
+ return d->m_id;
+}
+
+QString QNetworkSettingsService::name() const
{
- Q_D(const NetworkService);
+ Q_D(const QNetworkSettingsService);
return d->m_name;
}
-NetworkState::States NetworkService::state()
+QNetworkSettingsState::States QNetworkSettingsService::state()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
return d->m_state.state();
}
-NetworkType::Types NetworkService::type()
+QNetworkSettingsType::Types QNetworkSettingsService::type()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
return d->m_type.type();
}
-IPv4Config* NetworkService::ipv4()
+QNetworkSettingsIPv4* QNetworkSettingsService::ipv4()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
return &d->m_ipv4config;
}
-IPv6Config* NetworkService::ipv6()
+QNetworkSettingsIPv6* QNetworkSettingsService::ipv6()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
return &d->m_ipv6config;
}
-ProxyConfig* NetworkService::proxy()
+QNetworkSettingsProxy* QNetworkSettingsService::proxy()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
return &d->m_proxyConfig;
}
-QAbstractItemModel* NetworkService::domains()
+QNetworkSettingsWireless* QNetworkSettingsService::wirelessConfig()
+{
+ Q_D(QNetworkSettingsService);
+ return &d->m_wifiConfig;
+}
+
+QAbstractItemModel* QNetworkSettingsService::domains()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
return &d->m_domainsConfig;
}
-QAbstractItemModel* NetworkService::nameservers()
+QAbstractItemModel* QNetworkSettingsService::nameservers()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
return &d->m_nameserverConfig;
}
-void NetworkService::setupIpv4Config()
+void QNetworkSettingsService::setupIpv4Config()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
d->setupIpv4Config();
}
-void NetworkService::setupIpv6Config()
+void QNetworkSettingsService::setupIpv6Config()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
d->setupIpv6Config();
}
-void NetworkService::setupNameserversConfig()
+void QNetworkSettingsService::setupNameserversConfig()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
d->setupNameserversConfig();
}
-void NetworkService::setupDomainsConfig()
+void QNetworkSettingsService::setupDomainsConfig()
{
- Q_D(NetworkService);
+ Q_D(QNetworkSettingsService);
d->setupDomainsConfig();
}
-void NetworkService::setupProxyConfig()
-{
- Q_D(NetworkService);
- d->setupProxyConfig();
-}
-
-NetworkSettingsManager::NetworkSettingsManager(QObject *parent) :
- QObject(parent)
- ,d_ptr(new NetworkSettingsManagerPrivate(this))
+void QNetworkSettingsService::setupNetworkSettingsProxy()
{
-
+ Q_D(QNetworkSettingsService);
+ d->setupQNetworkSettingsProxy();
}
-QQmlListProperty<NetworkService> NetworkSettingsManager::services()
-{
- Q_D(NetworkSettingsManager);
- return QQmlListProperty<NetworkService>(this, d->m_services);
-}
-
-QAbstractItemModel* NetworkSettingsManager::networks()
-{
- Q_D(NetworkSettingsManager);
- return &d->m_networksModel;
-}
-
-NetworkService* NetworkSettingsManager::getService(const QString& aName, const int aType)
-{
- Q_D(NetworkSettingsManager);
-
- foreach (NetworkService* service, d->m_services) {
- if (service->name() == aName && service->type() == aType) {
- return service;
- }
- }
- return NULL;
-}
-
-
-bool NetworkSettingsManager::wifiPowered()
+void QNetworkSettingsService::connectService()
{
- Q_D(NetworkSettingsManager);
- return d->wifiPowered();
+ Q_D(QNetworkSettingsService);
+ d->connectService();
}
-void NetworkSettingsManager::setWifiPowered(const bool power)
+void QNetworkSettingsService::disconnectService()
{
- Q_D(NetworkSettingsManager);
- d->setWifiPowered(power);
+ Q_D(QNetworkSettingsService);
+ d->disconnectService();
}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/networksettingsmanager.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.h
index 8e51258..96d4244 100644
--- a/src/qtdevicesettings/networksettingsplugin/networksettings/networksettingsmanager.h
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.h
@@ -33,49 +33,51 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef NETWORKSETTINGSMANAGER_H
-#define NETWORKSETTINGSMANAGER_H
+#ifndef QNETWORKSETTINGSSERVICE_H
+#define QNETWORKSETTINGSSERVICE_H
-#include "networkconfig.h"
#include <QObject>
-#include <QQmlListProperty>
-#include <QStringListModel>
+#include "qnetworksettings.h"
-QT_FORWARD_DECLARE_CLASS(NetworkSettingsManagerPrivate)
-QT_FORWARD_DECLARE_CLASS(NetworkServicePrivate)
-QT_FORWARD_DECLARE_CLASS(NetworkNetworkTypePrivate)
+QT_FORWARD_DECLARE_CLASS(QNetworkSettingsServicePrivate)
-class NetworkService : public QObject
+class QNetworkSettingsService : public QObject
{
Q_OBJECT
Q_ENUMS(StateTypes)
+ Q_PROPERTY(QString id READ id CONSTANT)
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
- Q_PROPERTY(NetworkState::States state READ state NOTIFY stateChanged)
- Q_PROPERTY(NetworkType::Types type READ type NOTIFY typeChanged)
- Q_PROPERTY(IPv4Config* ipv4 READ ipv4 NOTIFY ipv4Changed)
- Q_PROPERTY(IPv6Config* ipv6 READ ipv6 NOTIFY ipv6Changed)
- Q_PROPERTY(ProxyConfig* proxy READ proxy NOTIFY proxyChanged)
+ Q_PROPERTY(QNetworkSettingsState::States state READ state NOTIFY stateChanged)
+ Q_PROPERTY(QNetworkSettingsType::Types type READ type NOTIFY typeChanged)
+ Q_PROPERTY(QNetworkSettingsIPv4* ipv4 READ ipv4 NOTIFY ipv4Changed)
+ Q_PROPERTY(QNetworkSettingsIPv6* ipv6 READ ipv6 NOTIFY ipv6Changed)
+ Q_PROPERTY(QNetworkSettingsProxy* proxy READ proxy NOTIFY proxyChanged)
+ Q_PROPERTY(QNetworkSettingsWireless* wirelessConfig READ wirelessConfig NOTIFY wirelessChanged)
Q_PROPERTY(QAbstractItemModel* domains READ domains NOTIFY domainsChanged)
Q_PROPERTY(QAbstractItemModel* nameservers READ nameservers NOTIFY nameserversChanged)
public:
- explicit NetworkService(const QString& aServiceId, QObject* parent = 0);
+ explicit QNetworkSettingsService(const QString& aServiceId, QObject* parent = 0);
+ QString id() const;
QString name() const;
- NetworkState::States state();
- NetworkType::Types type();
- IPv4Config* ipv4();
- IPv6Config* ipv6();
- ProxyConfig* proxy();
+ QNetworkSettingsState::States state();
+ QNetworkSettingsType::Types type();
+ QNetworkSettingsIPv4* ipv4();
+ QNetworkSettingsIPv6* ipv6();
+ QNetworkSettingsProxy* proxy();
QAbstractItemModel* domains();
QAbstractItemModel* nameservers();
+ QNetworkSettingsWireless* wirelessConfig();
Q_INVOKABLE void setAutoConnect(const bool autoconnect);
Q_INVOKABLE void setupIpv4Config();
Q_INVOKABLE void setupIpv6Config();
Q_INVOKABLE void setupNameserversConfig();
Q_INVOKABLE void setupDomainsConfig();
- Q_INVOKABLE void setupProxyConfig();
-
+ Q_INVOKABLE void setupNetworkSettingsProxy();
+ //Wireless config
+ Q_INVOKABLE void connectService();
+ Q_INVOKABLE void disconnectService();
Q_SIGNALS:
void nameChanged();
void stateChanged();
@@ -85,43 +87,13 @@ Q_SIGNALS:
void ipv6Changed();
void domainsChanged();
void nameserversChanged();
-
-protected:
- NetworkServicePrivate *d_ptr;
-
- Q_DISABLE_COPY(NetworkService)
- Q_DECLARE_PRIVATE(NetworkService)
-};
-
-class NetworkSettingsManager : public QObject
-{
- Q_OBJECT
- Q_ENUMS(StateTypes NetworkTypeTypes)
- Q_PROPERTY(QQmlListProperty<NetworkService> services READ services NOTIFY servicesChanged)
- Q_PROPERTY(QAbstractItemModel* networks READ networks NOTIFY networksChanged)
- Q_PROPERTY(bool wifiPowered READ wifiPowered WRITE setWifiPowered NOTIFY wifiPoweredChanged)
-public:
- explicit NetworkSettingsManager(QObject* parent = 0);
- QQmlListProperty<NetworkService> services();
-
- QAbstractItemModel* networks();
-
- Q_INVOKABLE NetworkService* getService(const QString& aName, const int aType);
-
- bool wifiPowered();
- void setWifiPowered(const bool power);
-
-Q_SIGNALS:
- void servicesChanged();
- void wifiPoweredChanged();
- void networksChanged();
-
+ void wirelessChanged();
+ void showCrendentialInput();
protected:
- NetworkSettingsManagerPrivate *d_ptr;
+ QNetworkSettingsServicePrivate *d_ptr;
-private:
- Q_DISABLE_COPY(NetworkSettingsManager)
- Q_DECLARE_PRIVATE(NetworkSettingsManager)
+ Q_DISABLE_COPY(QNetworkSettingsService)
+ Q_DECLARE_PRIVATE(QNetworkSettingsService)
};
-#endif // NETWORKSETTINGSMANAGER_H
+#endif // QNETWORKSETTINGSSERVICE_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.cpp
new file mode 100644
index 0000000..ff5406d
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.cpp
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qnetworksettingsservicemodel.h"
+#include "qnetworksettings.h"
+
+QNetworkSettingsServiceModel::QNetworkSettingsServiceModel(QObject *parent)
+ : QAbstractListModel(parent)
+{
+ m_roleNames.insert(Qt::UserRole, "modelData");
+ m_roleNames.insert(Name, "name");
+ m_roleNames.insert(SignalStrength, "signalStrength");
+ m_roleNames.insert(Connected, "connected");
+}
+
+QNetworkSettingsServiceModel::~QNetworkSettingsServiceModel()
+{
+
+}
+
+QHash<int, QByteArray> QNetworkSettingsServiceModel::roleNames() const
+{
+ return m_roleNames;
+}
+
+
+int QNetworkSettingsServiceModel::rowCount(const QModelIndex & parent) const
+{
+ Q_UNUSED(parent);
+ return m_items.count();
+}
+
+QVariant QNetworkSettingsServiceModel::data(const QModelIndex & index, int role) const
+{
+ if (!index.isValid()) return QVariant();
+
+ QNetworkSettingsService *item = m_items[index.row()];
+ if (role == Qt::UserRole) {
+ return QVariant::fromValue(static_cast<QObject*>(item));
+ }
+ else if (role == Name) {
+ return item->name();
+ }
+ else if (role == SignalStrength) {
+ return item->wirelessConfig()->signalStrength();
+ }
+ else if (role == Connected) {
+ return item->state() == QNetworkSettingsState::Online || item->state() == QNetworkSettingsState::Ready;
+ }
+ return QVariant();
+}
+
+void QNetworkSettingsServiceModel::append(QNetworkSettingsService* item)
+{
+ item->setParent(this);
+
+ beginInsertRows(QModelIndex(), rowCount(), rowCount());
+ m_items.append(item);
+ endInsertRows();
+}
+
+void QNetworkSettingsServiceModel::insert(int row, QNetworkSettingsService* item)
+{
+ item->setParent(this);
+
+ beginInsertRows(QModelIndex(), row, row);
+ m_items.insert(row, item);
+ endInsertRows();
+}
+
+QList<QNetworkSettingsService*> QNetworkSettingsServiceModel::getModel()
+{
+ return m_items;
+}
+
+//Filter model
+
+QNetworkSettingsServiceFilter::QNetworkSettingsServiceFilter(QObject* parent)
+ :QSortFilterProxyModel(parent)
+{
+ connect(this, &QNetworkSettingsServiceFilter::typeChanged, this, &QNetworkSettingsServiceFilter::invalidate);
+}
+
+QNetworkSettingsServiceFilter::~QNetworkSettingsServiceFilter()
+{
+
+}
+
+QNetworkSettingsType::Types QNetworkSettingsServiceFilter::type() const
+{
+ return m_type;
+}
+
+void QNetworkSettingsServiceFilter::setType(const QNetworkSettingsType::Types type)
+{
+ m_type = type;
+ emit typeChanged();
+}
+
+bool QNetworkSettingsServiceFilter::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const
+{
+ if (this->sourceModel())
+ {
+ QModelIndex index = this->sourceModel()->index( source_row, 0, source_parent );
+ if (index.isValid())
+ {
+ if (index.isValid())
+ {
+ QObject * obj = qvariant_cast<QObject *>(index.data(Qt::UserRole));
+ QNetworkSettingsService * service = qobject_cast<QNetworkSettingsService *>(obj);
+ if (service->type() == m_type)
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+QVariant QNetworkSettingsServiceFilter::itemFromRow(const int row) const
+{
+ QModelIndex idx = index(row, 0);
+ QModelIndex mapped = mapToSource(idx);
+ if (mapped.isValid())
+ {
+ QVariant serviceItem = mapped.data(Qt::UserRole);
+ if (serviceItem.isValid())
+ {
+ return serviceItem;
+ }
+ }
+ return QVariant::fromValue(QString(""));
+}
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/networksmodel.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.h
index d4c389c..0b520ef 100644
--- a/src/qtdevicesettings/networksettingsplugin/networksettings/networksmodel.h
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.h
@@ -33,99 +33,56 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef NETWORKSMODEL_H
-#define NETWORKSMODEL_H
+#ifndef QNETWORKSETTINGSSERVICEMODEL_H
+#define QNETWORKSETTINGSSERVICEMODEL_H
-#include <QAbstractListModel>
-#include "networkconfig.h"
+#include <QSortFilterProxyModel>
+#include "qnetworksettings.h"
+#include "qnetworksettingsservice.h"
-QT_FORWARD_DECLARE_CLASS(NetworksModelPrivate)
-QT_FORWARD_DECLARE_CLASS(QQmlPropertyMap)
-
-class NetworkItem : public QObject {
- Q_OBJECT
- Q_PROPERTY(QString name READ name NOTIFY nameChanged)
- Q_PROPERTY(NetworkState::States state READ state NOTIFY stateChanged)
- Q_PROPERTY(NetworkType::Types type READ type NOTIFY typeChanged)
- Q_PROPERTY(bool powered READ powered NOTIFY poweredChanged)
-
-public:
- explicit NetworkItem(QObject* parent=0) :
- QObject(parent) {
-
- }
-
- QString name() const {
- return m_name;
- }
-
- void setName(const QString& aName) {
- m_name = aName;
- }
-
- NetworkState::States state() const {
- return m_state.state();
- }
-
- NetworkType::Types type() const {
- return m_type.type();
- }
-
- void setState(const NetworkState::States aState) {
- m_state.setState(aState);
- }
-
- void setType(const NetworkType::Types aType) {
- m_type.setType(aType);
- }
-
- bool powered() const {
- return m_powered;
- }
-
- void setPowered(const bool aPowered) {
- m_powered = aPowered;
- }
-
-signals:
- void nameChanged();
- void stateChanged();
- void typeChanged();
- void poweredChanged();
-
-protected:
- QString m_name;
- NetworkState m_state;
- NetworkType m_type;
- bool m_powered;
- friend class NetworksModel;
-};
-
-class NetworksModel : public QAbstractListModel
+class QNetworkSettingsServiceModel : public QAbstractListModel
{
Q_OBJECT
-
public:
- explicit NetworksModel(QObject *parent=0);
- virtual ~NetworksModel();
+ explicit QNetworkSettingsServiceModel(QObject *parent=0);
+ virtual ~QNetworkSettingsServiceModel();
// from QAbstractItemModel
int rowCount(const QModelIndex & parent = QModelIndex()) const;
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
QHash<int, QByteArray> roleNames() const;
- void append(NetworkItem* networkItem);
- void insert(int row, NetworkItem* networkItem);
- QList<NetworkItem*> getModel();
+ void append(QNetworkSettingsService* networkService);
+ void insert(int row, QNetworkSettingsService* networkInterface);
+ QList<QNetworkSettingsService*> getModel();
enum Roles {
Type = Qt::UserRole + 1,
- Status,
- Name
+ Name,
+ SignalStrength,
+ Connected
};
private:
- QList<NetworkItem*> m_items;
+ QList<QNetworkSettingsService*> m_items;
QHash<int, QByteArray> m_roleNames;
};
-#endif // NETWORKSMODEL_H
+class QNetworkSettingsServiceFilter : public QSortFilterProxyModel
+{
+ Q_OBJECT
+ Q_PROPERTY(QNetworkSettingsType::Types type READ type WRITE setType NOTIFY typeChanged)
+public:
+ explicit QNetworkSettingsServiceFilter(QObject* parent=0);
+ virtual ~QNetworkSettingsServiceFilter();
+ bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const override;
+ QNetworkSettingsType::Types type() const;
+ void setType(QNetworkSettingsType::Types type);
+ Q_INVOKABLE QVariant itemFromRow(const int row) const;
+signals:
+ void typeChanged();
+private:
+ QNetworkSettingsType::Types m_type;
+
+};
+
+#endif // QNETWORKSETTINGSSERVICEMODEL_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.cpp
new file mode 100644
index 0000000..0e7b637
--- /dev/null
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qnetworksettingsuseragent.h"
+#include "qnetworksettingsuseragent_p.h"
+
+QNetworkSettingsUserAgent::QNetworkSettingsUserAgent(QObject *parent)
+ :QObject(parent)
+ ,d_ptr(new QNetworkSettingsUserAgentPrivate(this))
+{
+}
+
+void QNetworkSettingsUserAgent::setUserCredentials(const QString& username, const QString& passphrase)
+{
+ Q_D(QNetworkSettingsUserAgent);
+ d->setUserCredentials(username, passphrase);
+}
+
+void QNetworkSettingsUserAgent::cancelInput()
+{
+ Q_D(QNetworkSettingsUserAgent);
+ d->cancel();
+}
diff --git a/src/qtdevicesettings/wifisettingsplugin/plugin.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.h
index c87f68a..6f4dc22 100644
--- a/src/qtdevicesettings/wifisettingsplugin/plugin.cpp
+++ b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.h
@@ -33,26 +33,27 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#ifndef QNETWORKSETTINGSUSERAGENT_H
+#define QNETWORKSETTINGSUSERAGENT_H
-#include <QtQml/QQmlExtensionPlugin>
-#include <QtQml/qqml.h>
-#include <qcoreapplication.h>
+#include <QObject>
-class WifiSettingsQmlPlugin : public QQmlExtensionPlugin
+QT_FORWARD_DECLARE_CLASS(QNetworkSettingsUserAgentPrivate)
+
+class QNetworkSettingsUserAgent : public QObject
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
-
public:
- void registerTypes(const char *uri)
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.wifi"));
- const QString prefix = "qrc:";
- qmlRegisterType(QUrl(prefix + "WifiManagerView.qml"), uri, 1, 0, "WifiManagerView");
- qmlRegisterType(QUrl(prefix + "WifiSignalMonitor.qml"), uri, 1, 0, "WifiSignalMonitor");
- qmlRegisterType(QUrl(prefix + "WifiSelectorDelegate.qml"), uri, 1, 0, "WifiSelectorDelegate");
+ explicit QNetworkSettingsUserAgent(QObject *parent = 0);
+ Q_INVOKABLE void setUserCredentials(const QString& username, const QString& passphrase);
+ Q_INVOKABLE void cancelInput();
+signals:
+ void showUserCredentialsInput();
+ void error();
+private:
+ QNetworkSettingsUserAgentPrivate *d_ptr;
- }
+ Q_DISABLE_COPY(QNetworkSettingsUserAgent)
+ Q_DECLARE_PRIVATE(QNetworkSettingsUserAgent)
};
-
-#include "plugin.moc"
+#endif // QNETWORKSETTINGSUSERAGENT_H
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettingsplugin.pro b/src/qtdevicesettings/networksettingsplugin/networksettingsplugin.pro
index c514393..1024f91 100644
--- a/src/qtdevicesettings/networksettingsplugin/networksettingsplugin.pro
+++ b/src/qtdevicesettings/networksettingsplugin/networksettingsplugin.pro
@@ -31,7 +31,12 @@ pluginfiles.files += \
imports/NetworkSettings/WifiSettings.qml \
imports/NetworkSettings/IpAddressTextField.qml \
imports/NetworkSettings/NetworkSettings.qml \
- imports/NetworkSettings/WiredSettings.qml
+ imports/NetworkSettings/WiredSettings.qml \
+ imports/NetworkSettings/WifiSelectorDelegate.qml \
+ imports/NetworkSettings/WifiSignalMonitor.qml \
+ ../icons/WifiAnim_black_2x.png \
+ ../icons/WifiAnim_qt_2x.png \
+ ../icons/Wifi_lightgray_2x.png \
installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.cpp b/src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.cpp
index 684cef0..3480b56 100644
--- a/src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.cpp
+++ b/src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.cpp
@@ -34,11 +34,14 @@
**
****************************************************************************/
#include "networksettingsplugin_plugin.h"
-#include "networkconfig.h"
-#include "networksettingsmanager.h"
+#include "qnetworksettings.h"
+#include "qnetworksettingsmanager.h"
+#include "qnetworksettingsservice.h"
+#include "qnetworksettingsuseragent.h"
#include <qqml.h>
#include <QQmlEngine>
+#include <QQmlContext>
template <typename T>
QObject *instance(QQmlEngine *engine, QJSEngine *) {
@@ -50,12 +53,12 @@ QObject *instance(QQmlEngine *engine, QJSEngine *) {
void NetworksettingspluginPlugin::registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.network"));
- qmlRegisterUncreatableType<NetworkService>(uri, 1, 0, "NetworkService", "Cannot be instantiated directly.");
- qmlRegisterUncreatableType<IPv4Config>(uri, 1, 0, "IPv4Config", "Cannot be instantiated directly.");
- qmlRegisterUncreatableType<IPv6Config>(uri, 1, 0, "IPv6Config", "Cannot be instantiated directly.");
- qmlRegisterUncreatableType<ProxyConfig>(uri, 1, 0, "ProxyConfig", "Cannot be instantiated directly.");
- qmlRegisterUncreatableType<NetworkType>(uri, 1, 0, "NetworkType", "Cannot be instantiated directly.");
- qmlRegisterSingletonType<NetworkSettingsManager>(uri, 1, 0, "NetworkSettingsManager", &instance<NetworkSettingsManager>);
+ qmlRegisterUncreatableType<QNetworkSettingsService>(uri, 1, 0, "NetworkService", "Cannot be instantiated directly.");
+ qmlRegisterUncreatableType<QNetworkSettingsIPv4>(uri, 1, 0, "NetworkSettingsIPv4", "Cannot be instantiated directly.");
+ qmlRegisterUncreatableType<QNetworkSettingsIPv6>(uri, 1, 0, "NetworkSettingsIPv6", "Cannot be instantiated directly.");
+ qmlRegisterUncreatableType<QNetworkSettingsProxy>(uri, 1, 0, "NetworkSettingsProxy", "Cannot be instantiated directly.");
+ qmlRegisterUncreatableType<QNetworkSettingsType>(uri, 1, 0, "NetworkSettingsType", "Cannot be instantiated directly.");
+ qmlRegisterUncreatableType<QNetworkSettingsState>(uri, 1, 0, "NetworkSettingsState", "Cannot be instantiated directly.");
+ qmlRegisterSingletonType<QNetworkSettingsManager>(uri, 1, 0, "NetworkSettingsManager", &instance<QNetworkSettingsManager>);
+ qmlRegisterSingletonType<QNetworkSettingsUserAgent>(uri, 1, 0, "NetworkSettingsUserAgent", &instance<QNetworkSettingsUserAgent>);
}
-
-
diff --git a/src/qtdevicesettings/settingscomponents/imports/Settings/CustomCombobox.qml b/src/qtdevicesettings/settingscomponents/imports/Settings/CustomCombobox.qml
index 72342e1..37c7871 100644
--- a/src/qtdevicesettings/settingscomponents/imports/Settings/CustomCombobox.qml
+++ b/src/qtdevicesettings/settingscomponents/imports/Settings/CustomCombobox.qml
@@ -144,7 +144,7 @@ Item {
DelegateModel {
id: comboboxModel
- delegate: comboboxDelete
+ delegate: comboboxDelegate
}
Repeater {
@@ -156,7 +156,7 @@ Item {
}
Component {
- id: comboboxDelete
+ id: comboboxDelegate
Item {
id: comboboxViewDelegate
property bool checked
@@ -168,6 +168,7 @@ Item {
sourceComponent: delegate
anchors.fill: parent
property var modelData: model
+ property string textRole: textRole
onLoaded : exgroup.bindCheckable(item)
}
diff --git a/src/qtdevicesettings/settingscomponents/imports/Settings/FlatStyledDropdownDelegate.qml b/src/qtdevicesettings/settingscomponents/imports/Settings/FlatStyledDropdownDelegate.qml
index ca68e16..c1bd24c 100644
--- a/src/qtdevicesettings/settingscomponents/imports/Settings/FlatStyledDropdownDelegate.qml
+++ b/src/qtdevicesettings/settingscomponents/imports/Settings/FlatStyledDropdownDelegate.qml
@@ -72,7 +72,7 @@ Item {
anchors.bottom: parent.bottom
anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor)
horizontalAlignment: Text.AlignLeft
- text: modelData.text
+ text: modelData.name
}
}
}
diff --git a/src/qtdevicesettings/settingscomponents/imports/Settings/TextLabel.qml b/src/qtdevicesettings/settingscomponents/imports/Settings/TextLabel.qml
index 176f848..e9f5d12 100644
--- a/src/qtdevicesettings/settingscomponents/imports/Settings/TextLabel.qml
+++ b/src/qtdevicesettings/settingscomponents/imports/Settings/TextLabel.qml
@@ -36,6 +36,7 @@
import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4
+import QtQuick.Controls.Styles.Flat 1.0 as Flat
Text {
color: systemPalette.text
diff --git a/src/qtdevicesettings/timedateplugin/plugin.cpp b/src/qtdevicesettings/timedateplugin/plugin.cpp
index 3fa4939..b092c2c 100644
--- a/src/qtdevicesettings/timedateplugin/plugin.cpp
+++ b/src/qtdevicesettings/timedateplugin/plugin.cpp
@@ -59,7 +59,6 @@ class TimeDateSettingsQmlPlugin : public QQmlExtensionPlugin
public:
void registerTypes(const char *uri)
{
- const QString prefix = "qrc:";
qmlRegisterSingletonType<SystemTime>(uri, 1, 0, "TimeManager", &instance<SystemTime>);
}
diff --git a/src/qtdevicesettings/wifisettingsplugin/WifiManagerView.qml b/src/qtdevicesettings/wifisettingsplugin/WifiManagerView.qml
deleted file mode 100644
index 71115d5..0000000
--- a/src/qtdevicesettings/wifisettingsplugin/WifiManagerView.qml
+++ /dev/null
@@ -1,180 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick 2.5
-import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.4
-import QtQuick.Controls.Styles.Flat 1.0 as Flat
-import com.theqtcompany.settings.common 1.0
-import com.theqtcompany.settings.wifi 1.0
-import B2Qt.Wifi 1.0
-
-Item {
- id: root
- Component.onCompleted: {
- if (WifiManager.backendState === WifiManager.NotRunning) {
- WifiManager.start();
- }
- else if (WifiManager.backendState == WifiManager.Running) {
- WifiManager.scanning = true;
- }
- }
-
- WifiConfiguration {
- id: config
- property bool connected: WifiManager.networkState === WifiManager.Connected
- }
-
- ColumnLayout {
- id: content
- anchors.fill: parent
-
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
-
- TextLabel {
- text: qsTr("Selected network ")
- width: root.width*0.382
- horizontalAlignment: Text.AlignRight
- }
-
- CustomCombobox {
- id: networkSelection
- model: WifiManager.networks
- width: Math.round(200 * Flat.FlatStyle.scaleFactor)
- textRole: "ssid"
- Component.onCompleted: {
- setSelectIndexToVal(WifiManager.currentSSID, "ssid");
- }
- onSelectedIndexChanged : {
- var ssid = networkSelection.textValue;
- config.ssid = ssid;
- if (WifiManager.currentSSID !== ssid || !config.connected) {
- connectView.visible = true;
- }
- }
- delegate: WifiSelectorDelegate { }
- }
-
- Image {
- id: warning
- anchors.verticalCenter: parent.verticalCenter
- source: "../icons/Alert_yellow_1x.png"
- visible: WifiManager.state === WifiManager.HandshakeFailed ||
- WifiManager.state === WifiManager.DhcpRequestFailed
- }
- }
-
- Button {
- id: disconnect
- text: qsTr("Disconnect")
- visible: config.connected
- onClicked: {
- WifiManager.disconnect();
- networkSelection.currentIndex = -1;
- }
- }
-
- GroupBox {
- id: connectView
- title: qsTr("Enter a password")
- flat: false
- visible: false
- ColumnLayout {
- Row {
- id: errorView
- property alias text: text.text
- visible: text.text !== ""
-
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- Image {
- source: "../icons/Alert_yellow_1x.png"
- }
- Text {
- id: text
- color: "#face20"
- text: ""
- }
- }
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- visible: false
- TextLabel {
- text: qsTr("User name")
- width: root.width*0.382
- horizontalAlignment: Text.AlignRight
- }
- TextField {
- text: ""
- inputMethodHints: Qt.ImhNoPredictiveText
- }
- }
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- TextLabel {
- text: qsTr("Password")
- horizontalAlignment: Text.AlignRight
- }
- TextField {
- id: password
- text: ""
- echoMode: TextInput.Password
- inputMethodHints: Qt.ImhNoPredictiveText
- }
- }
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- Button {
- text: qsTr("Connect")
- onClicked: {
- config.passphrase = password.text
- if (!WifiManager.connect(config)) {
- print("failed to connect: " + WifiManager.lastError)
- errorView.text = qsTr("Invalid password");
- }
- else {
- connectView.visible = false
- }
- }
- }
- Button {
- text: qsTr("Cancel")
- onClicked:connectView.visible = false
- }
- }
- }
- }
- }
-}
diff --git a/src/qtdevicesettings/wifisettingsplugin/icons.qrc b/src/qtdevicesettings/wifisettingsplugin/icons.qrc
deleted file mode 100644
index ac67804..0000000
--- a/src/qtdevicesettings/wifisettingsplugin/icons.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>../icons/Wifi_lightgray_2x.png</file>
- <file>../icons/WifiAnim_black_2x.png</file>
- <file>../icons/Alert_yellow_1x.png</file>
- </qresource>
-</RCC>
diff --git a/src/qtdevicesettings/wifisettingsplugin/qml.qrc b/src/qtdevicesettings/wifisettingsplugin/qml.qrc
deleted file mode 100644
index b43e801..0000000
--- a/src/qtdevicesettings/wifisettingsplugin/qml.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>WifiManagerView.qml</file>
- <file>WifiSignalMonitor.qml</file>
- <file>WifiSelectorDelegate.qml</file>
- </qresource>
-</RCC>
diff --git a/src/qtdevicesettings/wifisettingsplugin/qmldir b/src/qtdevicesettings/wifisettingsplugin/qmldir
deleted file mode 100644
index d5c237e..0000000
--- a/src/qtdevicesettings/wifisettingsplugin/qmldir
+++ /dev/null
@@ -1,2 +0,0 @@
-module com.theqtcompany.settings.wifi
-plugin qmlwifiplugin
diff --git a/src/qtdevicesettings/wifisettingsplugin/wifisettingsplugin.pro b/src/qtdevicesettings/wifisettingsplugin/wifisettingsplugin.pro
deleted file mode 100644
index aa50429..0000000
--- a/src/qtdevicesettings/wifisettingsplugin/wifisettingsplugin.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-TEMPLATE = lib
-CONFIG += plugin
-QT += qml
-
-uri = com.theqtcompany.settings.wifi
-
-DESTDIR = imports/Wifi
-TARGET = qmlwifiplugin
-
-SOURCES += plugin.cpp
-
-pluginfiles.files += \
- qmldir \
-
-installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
-
-target.path = $$installPath
-pluginfiles.path += $$installPath
-INSTALLS += target pluginfiles
-
-
-RESOURCES += \
- icons.qrc \
- qml.qrc
-
-HEADERS +=