diff options
author | Raquel Medina <raquel.medina@konsulko.com> | 2019-09-02 22:29:47 +0200 |
---|---|---|
committer | raquel medina <raquel.medina@konsulko.com> | 2019-09-12 12:52:39 +0000 |
commit | 7bba7c7f9fdffe977fef6714fd9c4ea9caae0a4e (patch) | |
tree | 26630c6ced3c1e8d6a68213e2bbfcc76b377f699 /app | |
parent | b591cf219f6c485eb054b628d62475a752f0ffa3 (diff) |
wired: implement configuration data flowsicefish_8.99.1icefish/8.99.18.99.1
- feed stack configuration data provided
by libqtappfw to the ui form;
- forward custom configuration data to
libqtappfw;
- rename staticXXXX properties to customXXXX
- introduce activeXXXX properties to keep the
stack current configuration values.
- fix always invisible placeholder text (qt) bug
by replacing TextField control with TextArea
control.
Bug-AGL: SPEC-2676
Signed-off-by: Raquel Medina <raquel.medina@konsulko.com>
Change-Id: Ib137f8e561ed54179b116acb323485b5b3382ab9
Diffstat (limited to 'app')
-rw-r--r-- | app/wired/ConfigDialog.qml | 81 | ||||
-rw-r--r-- | app/wired/Wired.qml | 28 |
2 files changed, 83 insertions, 26 deletions
diff --git a/app/wired/ConfigDialog.qml b/app/wired/ConfigDialog.qml index 3244799..4d8632f 100644 --- a/app/wired/ConfigDialog.qml +++ b/app/wired/ConfigDialog.qml @@ -28,16 +28,24 @@ Dialog { property alias ypos: root.y property alias maxpwidth: root.width property alias maxpheight: root.height - property alias staticAddress: m_staticAddress.text - property alias staticNetmask: m_staticNetmask.text - property alias staticGateway: m_staticGateway.text - property alias dnslist: m_dnslist.text + property alias customAddress: m_customAddress.text + property alias customNetmask: m_customNetmask.text + property alias customGateway: m_customGateway.text + property alias customNSlist: m_customNSlist.text + + property string activeAddress: undefined + property string activeNetmask: undefined + property string activeGateway: undefined + property string activeNSList: undefined + + property bool activeStatic: undefined + property bool activeManualNS: undefined property bool isIPv4: true - property bool isStatic: false - property bool isManualDNS: false + property bool isStatic: activeStatic + property bool isManualDNS: activeManualNS - signal finished(string svc, string ipv, string ipa, string nm, string gw, string dns) + signal finished(string svc, var newaa, var newna) visible: false z: 1 @@ -68,10 +76,10 @@ Dialog { isIPv4 = true isStatic = false isManualDNS = false - staticAddress = "" - staticNetmask = "" - staticGateway = "" - dnslist = "" + m_customAddress.clear() + m_customNetmask.clear() + m_customGateway.clear() + m_customNSlist.clear() } onIsIPv4Changed: { @@ -86,12 +94,21 @@ Dialog { dnsSwitch.checked = isManualDNS } - onAccepted: { + onAccepted: readInputValues() + function readInputValues() { if (isIPv4 === false) { console.log("IPv6 not supported by settings application") setDefaultValues() } else { - finished(serviceName,"IPv4", staticAddress, staticNetmask, staticGateway, dnslist) + var aa = []; + isStatic? aa.push("manual") : aa.push("dhcp"); + aa.push(customAddress); + aa.push(customNetmask); + aa.push(customGateway); + var na = []; + isManualDNS? na.push("manual"): na.push("auto"); + isManualDNS? na.push(customNSlist) : na.push(""); + root.finished(serviceName, aa, na); } } @@ -99,6 +116,16 @@ Dialog { setDefaultValues() } + onRejected: { + isIPv4 = true + isStatic = activeStatic + isManualDNS = activeManualNS + customAddress.clear() + customNetmask.clear() + customGateway.clear() + customNSlist.clear() + } + Item { id: container anchors.centerIn: parent @@ -217,11 +244,12 @@ Dialog { color: '#080C0F' text: "address:" } - TextField { - id: m_staticAddress + TextArea { + id: m_customAddress font.pixelSize: 28 Layout.fillWidth: true - placeholderText: "address" + Layout.alignment: Qt.AlignLeft + placeholderText: activeAddress } } ColumnLayout { @@ -232,11 +260,12 @@ Dialog { color: '#080C0F' text: "netmask:" } - TextField { - id: m_staticNetmask + TextArea { + id: m_customNetmask font.pixelSize: 28 Layout.fillWidth: true - placeholderText: "netmask" + Layout.alignment: Qt.AlignLeft + placeholderText: activeNetmask } } ColumnLayout { @@ -247,11 +276,12 @@ Dialog { color: '#080C0F' text: "gateway:" } - TextField { - id: m_staticGateway + TextArea { + id: m_customGateway font.pixelSize: 28 Layout.fillWidth: true - placeholderText: "gateway" + Layout.alignment: Qt.AlignLeft + placeholderText: activeGateway } } } @@ -302,11 +332,12 @@ Dialog { color: '#080C0F' text: "DNS list:" } - TextField { - id: m_dnslist + TextArea { + id: m_customNSlist font.pixelSize: 28 Layout.fillWidth: true - placeholderText: "List DNS semicolon separated" + Layout.alignment: Qt.AlignLeft + placeholderText: activeNSList } } } diff --git a/app/wired/Wired.qml b/app/wired/Wired.qml index 6e3e28b..52d24cd 100644 --- a/app/wired/Wired.qml +++ b/app/wired/Wired.qml @@ -61,6 +61,12 @@ SettingPage { font.pixelSize: 18 text: "CONFIGURE" onClicked: { + customconf.activeStatic = Qt.binding(function() { return (sroute[0] === "dhcp")? false : true }) + customconf.activeAddress = Qt.binding(function() { return sroute[1]? sroute[1] : "0.0.0.0" }) + customconf.activeNetmask = Qt.binding(function() { return sroute[2]? sroute[2] : "255.255.255.255" }) + customconf.activeGateway = Qt.binding(function() { return sroute[3]? sroute[3] : "0.0.0.0" }) + customconf.activeManualNS = Qt.binding(function() { return (nservers[0] === "auto")? false : true }) + customconf.activeNSList = Qt.binding(function() { return nservers[1]? nservers[1] : "0.0.0.0" }) customconf.open() } @@ -72,11 +78,31 @@ SettingPage { xpos: (parent.width - maxpwidth)/2 ypos: (parent.height - maxpheight) serviceName: service + activeAddress: address + activeNetmask: sroute[2] + activeGateway: sroute[3] + activeStatic: false + activeManualNS: false + activeNSList: nservers[1] + + onFinished: { + if (!((sroute[0] === newaa[0]) && + (sroute[1] === newaa[1]) && + (sroute[2] === newaa[2]) && + (sroute[3] === newaa[3]))) { + network.configureAddress(svc, newaa); + } + + if (!((nservers[0] === newna[0]) && + (nservers[1] === newna[1]))) { + network.configureNameServer(svc, newna); + } + } } } } onClicked: { - if ((sstate === "ready") || sstate === "online") { + if ((sstate === "ready") || (sstate === "online")) { console.log("Disconnecting from ->", service) networkNameText.font.italic = 1 network.disconnect(service) |