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
68 configFilename.value = engine.selectedFilename
77 // ComboBox requires a flickable ancestor
83 contentHeight: configureColumn.height + Theme.paddingLarge
85 VerticalScrollDecorator {}
90 spacing: Theme.paddingLarge
99 text: VpnControl.server
100 label: "Server address"
101 placeholderText: "Server address"
103 EnterKey.onClicked: configurePort.focus = true
109 text: VpnControl.port;
110 inputMethodHints: Qt.ImhFormattedNumbersOnly
112 placeholderText: "Port number"
113 EnterKey.onClicked: parent.focus = true
117 id: configureCompression
118 text: "Use Compression"
119 checked: VpnControl.compressed
125 text: "Use TLS authentication"
126 checked: VpnControl.useTLS
129 // set currentIndex to change the selected value
131 id: configureTLSdirection
133 label: "TLS direction"
134 currentIndex: VpnControl.tlsDirection;
135 enabled: configureTLS.checked
138 MenuItem { text: "0" }
139 MenuItem { text: "1" }
143 ValueButtonAlignRight {
146 value: VpnControl.caCertFile
147 placeholderText: "Select"
151 Functions.goToInitial(Functions.folderFromFile(value), "crt")
155 ValueButtonAlignRight {
156 id: clientCertFilename
158 value: VpnControl.clientCertFile
159 placeholderText: "Select"
163 Functions.goToInitial(Functions.folderFromFile(value), "crt")
167 ValueButtonAlignRight {
168 id: clientKeyFilename
170 value: VpnControl.clientKeyFile
171 placeholderText: "Select"
175 Functions.goToInitial(Functions.folderFromFile(value), "key")
179 ValueButtonAlignRight {
182 value: VpnControl.tlsKeyFile
183 placeholderText: "Select"
185 enabled: configureTLS.checked
188 Functions.goToInitial(Functions.folderFromFile(value), "key")
192 ValueButtonAlignRight {
194 label: "Extra options"
195 value: VpnControl.configFile
196 placeholderText: "Select"
200 Functions.goToInitial(Functions.folderFromFile(value), "ovpn")
207 VpnControl.setServer(configureAddress.text)
208 VpnControl.setPort(configurePort.text)
209 VpnControl.setCompressed(configureCompression.checked)
210 VpnControl.setUseTLS(configureTLS.checked)
211 VpnControl.setTlsDirection(configureTLSdirection.currentIndex)
212 VpnControl.updateConfiguration()
213 VpnControl.setCaCertFile(caCertFilename.value)
214 VpnControl.setClientCertFile(clientCertFilename.value)
215 VpnControl.setClientKeyFile(clientKeyFilename.value)
216 VpnControl.setTlsKeyFile(tlsKeyFilename.value)
217 VpnControl.setConfigFile(configFilename.value)