X-Git-Url: https://www.flypig.org.uk/git/?a=blobdiff_plain;f=qml%2Fpages%2FConfigurePage.qml;h=1615c97e53977c893ce3e1484af15c81f7ea8352;hb=e24363e314aca32e7bee952f02f517a04a8dc5f2;hp=b6ad3da505cbcc4e896233b3297489109546e20f;hpb=3aba2d3bed67a9d91350393dd4772f566aca7db1;p=openvpnui.git diff --git a/qml/pages/ConfigurePage.qml b/qml/pages/ConfigurePage.qml index b6ad3da..1615c97 100644 --- a/qml/pages/ConfigurePage.qml +++ b/qml/pages/ConfigurePage.qml @@ -1,6 +1,6 @@ /* - Copyright (C) 2013 Jolla Ltd. - Contact: Thomas Perl + Copyright (C) 2014 David Llewellyn-Jones + Contact: David Llewellyn-Jones All rights reserved. You may use this file under the terms of BSD license as follows: @@ -26,16 +26,49 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Built using the standard template from Jolla + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl */ import QtQuick 2.0 import Sailfish.Silica 1.0 - +import "../components" +import "../filebrowse/pages/functions.js" as Functions Dialog { id: configurePage canAccept: true acceptDestinationAction: PageStackAction.Pop + property int _fileDialogue: 0 + + Connections { + target:VpnControl + } + + // connect signals from engine to panels + Connections { + target: engine + onSelectedFilenameChanged: { + switch (_fileDialogue) { + case 1: + caCertFilename.value = engine.selectedFilename + break; + case 2: + clientCertFilename.value = engine.selectedFilename + break; + case 3: + clientKeyFilename.value = engine.selectedFilename + break; + case 4: + tlsKeyFilename.value = engine.selectedFilename + break; + } + _fileDialogue = 0; + } + } + SilicaFlickable { // ComboBox requires a flickable ancestor @@ -60,6 +93,7 @@ Dialog { TextField { id: configureAddress width: parent.width + text: VpnControl.server label: "Server address" placeholderText: "Server address" focus: true @@ -69,6 +103,7 @@ Dialog { TextField { id: configurePort width: parent.width + text: VpnControl.port; inputMethodHints: Qt.ImhFormattedNumbersOnly label: "Port number" placeholderText: "Port number" @@ -78,23 +113,23 @@ Dialog { TextSwitch { id: configureCompression text: "Use Compression" + checked: VpnControl.compressed + automaticCheck: true } TextSwitch { id: configureTLS text: "Use TLS authentication" - onCheckedChanged: { - configureTLSdirection.enabled = checked - configureTLSinfo.visible = checked - } + checked: VpnControl.useTLS + automaticCheck: true } // set currentIndex to change the selected value ComboBox { id: configureTLSdirection width: parent.width label: "TLS direction" - currentIndex: 1 - enabled: false + currentIndex: VpnControl.tlsDirection; + enabled: configureTLS.checked menu: ContextMenu { MenuItem { text: "0" } @@ -102,43 +137,60 @@ Dialog { } } - Label { - text: "Place key files on SD card:" - color: Theme.secondaryColor - font.pixelSize: Theme.fontSizeSmall - x: Theme.paddingLarge - } - Label { - text: "\tca.crt" - color: Theme.secondaryColor - font.pixelSize: Theme.fontSizeSmall - x: Theme.paddingLarge - } - Label { - text: "\tclient.crt" - color: Theme.secondaryColor - font.pixelSize: Theme.fontSizeSmall - x: Theme.paddingLarge + ValueButtonAlignRight { + id: caCertFilename + label: "CA cert" + value: "Select" + width: parent.width + onClicked: { + _fileDialogue = 1 + Functions.goToInitial(Functions.folderFromFile(value), "crt") + } } - Label { - text: "\tclient.key" - color: Theme.secondaryColor - font.pixelSize: Theme.fontSizeSmall - x: Theme.paddingLarge + + ValueButtonAlignRight { + id: clientCertFilename + value: "Select" + label: "Client cert" + width: parent.width + onClicked: { + _fileDialogue = 2; + Functions.goToInitial(Functions.folderFromFile(value), "crt") + } } - Label { - id: configureTLSinfo - visible: false - text: "\tta.key" - color: Theme.secondaryColor - font.pixelSize: Theme.fontSizeSmall - x: Theme.paddingLarge + + ValueButtonAlignRight { + id: clientKeyFilename + value: "Select" + label: "Client key" + width: parent.width + onClicked: { + _fileDialogue = 3; + Functions.goToInitial(Functions.folderFromFile(value), "key") + } } + ValueButtonAlignRight { + id: tlsKeyFilename + value: "Select" + label: "TLS key" + width: parent.width + enabled: configureTLS.checked + onClicked: { + _fileDialogue = 4; + Functions.goToInitial(Functions.folderFromFile(value), "key") + } + } } } onAccepted: { + VpnControl.setServer(configureAddress.text) + VpnControl.setPort(configurePort.text) + VpnControl.setCompressed(configureCompression.checked) + VpnControl.setUseTLS(configureTLS.checked) + VpnControl.setTlsDirection(configureTLSdirection.currentIndex) + VpnControl.updateConfiguration() } }