2 Copyright (C) 2014 David Llewellyn-Jones
3 Contact: David Llewellyn-Jones <david@flypig.co.uk>
6 You may use this file under the terms of BSD license as follows:
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10 * Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 * Neither the name of the Jolla Ltd nor the
16 names of its contributors may be used to endorse or promote products
17 derived from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
23 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 Built using the standard template from Jolla
31 Copyright (C) 2013 Jolla Ltd.
32 Contact: Thomas Perl <thomas.perl@jollamobile.com>
36 import Sailfish.Silica 1.0
37 import "../components"
38 import "../filebrowse/pages/functions.js" as Functions
43 acceptDestinationAction: PageStackAction.Pop
44 property int _fileDialogue: 0
50 // connect signals from engine to panels
53 onSelectedFilenameChanged: {
54 switch (_fileDialogue) {
56 caCertFilename.value = engine.selectedFilename
59 clientCertFilename.value = engine.selectedFilename
62 clientKeyFilename.value = engine.selectedFilename
65 tlsKeyFilename.value = engine.selectedFilename
74 // ComboBox requires a flickable ancestor
80 contentHeight: configureColumn.height + Theme.paddingLarge
82 VerticalScrollDecorator {}
87 spacing: Theme.paddingLarge
96 text: VpnControl.server
97 label: "Server address"
98 placeholderText: "Server address"
100 EnterKey.onClicked: configurePort.focus = true
106 text: VpnControl.port;
107 inputMethodHints: Qt.ImhFormattedNumbersOnly
109 placeholderText: "Port number"
110 EnterKey.onClicked: parent.focus = true
114 id: configureCompression
115 text: "Use Compression"
116 checked: VpnControl.compressed
122 text: "Use TLS authentication"
123 checked: VpnControl.useTLS
126 // set currentIndex to change the selected value
128 id: configureTLSdirection
130 label: "TLS direction"
131 currentIndex: VpnControl.tlsDirection;
132 enabled: configureTLS.checked
135 MenuItem { text: "0" }
136 MenuItem { text: "1" }
140 ValueButtonAlignRight {
143 value: VpnControl.caCertFile
144 placeholderText: "Select"
148 Functions.goToInitial(Functions.folderFromFile(value), "crt")
152 ValueButtonAlignRight {
153 id: clientCertFilename
154 value: ((VpnControl.clientCertFile === "") ? "Select" : VpnControl.clientCertFile)
159 Functions.goToInitial(Functions.folderFromFile(value), "crt")
163 ValueButtonAlignRight {
164 id: clientKeyFilename
165 value: ((VpnControl.clientKeyFile === "") ? "Select" : VpnControl.clientKeyFile)
170 Functions.goToInitial(Functions.folderFromFile(value), "key")
174 ValueButtonAlignRight {
176 value: ((VpnControl.tlsKeyFile === "") ? "Select" : VpnControl.tlsKeyFile)
179 enabled: configureTLS.checked
182 Functions.goToInitial(Functions.folderFromFile(value), "key")
189 VpnControl.setServer(configureAddress.text)
190 VpnControl.setPort(configurePort.text)
191 VpnControl.setCompressed(configureCompression.checked)
192 VpnControl.setUseTLS(configureTLS.checked)
193 VpnControl.setTlsDirection(configureTLSdirection.currentIndex)
194 VpnControl.updateConfiguration()
195 VpnControl.setCaCertFile(caCertFilename.value)
196 VpnControl.setClientCertFile(clientCertFilename.value)
197 VpnControl.setClientKeyFile(clientKeyFilename.value)
198 VpnControl.setTlsKeyFile(tlsKeyFilename.value)