Configuration values are passed between the interface and main code.
[openvpnui.git] / qml / pages / ConfigurePage.qml
index f02f335..0db890a 100644 (file)
@@ -41,6 +41,10 @@ Dialog {
     canAccept: true
     acceptDestinationAction: PageStackAction.Pop
 
+    Connections {
+        target:VpnControl
+    }
+
     SilicaFlickable {
         // ComboBox requires a flickable ancestor
         width: parent.width
@@ -64,6 +68,7 @@ Dialog {
             TextField {
                 id: configureAddress
                 width: parent.width
+                text: VpnControl.server
                 label: "Server address"
                 placeholderText: "Server address"
                 focus: true
@@ -73,6 +78,7 @@ Dialog {
             TextField {
                 id: configurePort
                 width: parent.width
+                text: VpnControl.port;
                 inputMethodHints: Qt.ImhFormattedNumbersOnly
                 label: "Port number"
                 placeholderText: "Port number"
@@ -82,22 +88,26 @@ Dialog {
             TextSwitch {
                 id: configureCompression
                 text: "Use Compression"
+                checked: VpnControl.compressed
+                automaticCheck: true
             }
 
             TextSwitch {
                 id: configureTLS
                 text: "Use TLS authentication"
+                checked: VpnControl.useTLS
                 onCheckedChanged: {
                     configureTLSdirection.enabled = checked
                     configureTLSinfo.visible = checked
                 }
+                automaticCheck: true
             }
             // set currentIndex to change the selected value
             ComboBox {
                 id: configureTLSdirection
                 width: parent.width
                 label: "TLS direction"
-                currentIndex: 1
+                currentIndex: VpnControl.tlsDirection;
                 enabled: false
 
                 menu: ContextMenu {
@@ -143,6 +153,12 @@ Dialog {
     }
 
     onAccepted: {
+        VpnControl.setServer(configureAddress.text)
+        VpnControl.setPort(configurePort.text)
+        VpnControl.setCompressed(configureCompression.checked)
+        VpnControl.setUseTLS(configureTLS.checked)
+        VpnControl.setTlsDirection(configureTLSdirection.currentIndex)
+        VpnControl.updateConfiguration()
     }
 
 }