Merge lp:~pete-woods/indicator-network/pptp into lp:indicator-network/15.10
- pptp
- Merge into trunk.15.10
Proposed by
Pete Woods
Status: | Merged |
---|---|
Approved by: | Pete Woods |
Approved revision: | 554 |
Merged at revision: | 557 |
Proposed branch: | lp:~pete-woods/indicator-network/pptp |
Merge into: | lp:indicator-network/15.10 |
Diff against target: |
2417 lines (+1764/-212) 30 files modified
data/com.ubuntu.connectivity1.vpn.VpnConnection.OpenVpn.xml (+0/-162) data/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml (+34/-0) debian/changelog (+6/-0) src/connectivity-api/connectivity-qt/CMakeLists.txt (+10/-1) src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.cpp (+189/-0) src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.h (+179/-0) src/connectivity-api/connectivity-qt/connectivityqt/vpn-connections-list-model.cpp (+3/-1) src/indicator/CMakeLists.txt (+10/-0) src/indicator/connectivity-service/connectivity-service.cpp (+2/-1) src/indicator/connectivity-service/dbus-pptp-connection.cpp (+198/-0) src/indicator/connectivity-service/dbus-pptp-connection.h (+177/-0) src/indicator/nmofono/vpn/pptp-connection.cpp (+417/-0) src/indicator/nmofono/vpn/pptp-connection.h (+192/-0) src/indicator/nmofono/vpn/vpn-connection.cpp (+15/-1) src/indicator/nmofono/vpn/vpn-connection.h (+3/-0) src/indicator/nmofono/vpn/vpn-manager.cpp (+12/-3) src/vpn-editor/Main.qml (+1/-0) src/vpn-editor/Openvpn/AdvancedGeneral.qml (+14/-8) src/vpn-editor/Openvpn/AdvancedProxies.qml (+2/-1) src/vpn-editor/Openvpn/AdvancedSecurity.qml (+2/-1) src/vpn-editor/Openvpn/AdvancedTls.qml (+5/-2) src/vpn-editor/Openvpn/Password.qml (+4/-4) src/vpn-editor/Openvpn/PasswordTls.qml (+1/-0) src/vpn-editor/Openvpn/SettingTitle.qml (+0/-23) src/vpn-editor/Openvpn/StaticKey.qml (+2/-1) src/vpn-editor/Openvpn/Tls.qml (+1/-0) src/vpn-editor/Pptp/Advanced.qml (+160/-0) src/vpn-editor/Pptp/Editor.qml (+97/-0) src/vpn-editor/VpnList.qml (+27/-2) src/vpn-editor/manifest.json (+1/-1) |
To merge this branch: | bzr merge lp:~pete-woods/indicator-network/pptp |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Indicator Applet Developers | Pending | ||
Review via email: mp+282572@code.launchpad.net |
Commit message
Add PPTP support to VPN editor
Description of the change
Add PPTP support to VPN editor
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'data/com.ubuntu.connectivity1.vpn.VpnConnection.OpenVpn.xml' | |||
2 | --- data/com.ubuntu.connectivity1.vpn.VpnConnection.OpenVpn.xml 2015-12-04 13:18:04 +0000 | |||
3 | +++ data/com.ubuntu.connectivity1.vpn.VpnConnection.OpenVpn.xml 2016-02-15 09:40:45 +0000 | |||
4 | @@ -85,165 +85,3 @@ | |||
5 | 85 | 85 | ||
6 | 86 | </interface> | 86 | </interface> |
7 | 87 | </node> | 87 | </node> |
8 | 88 | |||
9 | 89 | <!-- | ||
10 | 90 | |||
11 | 91 | tls: | ||
12 | 92 | { | ||
13 | 93 | 'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'tls', 'uuid': '799623fc-e37a-4b39-9841-87588f2e8b8d'}, | ||
14 | 94 | 'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn', | ||
15 | 95 | 'data': { | ||
16 | 96 | 'connection-type': 'tls', | ||
17 | 97 | 'remote': 'gatewoo', | ||
18 | 98 | |||
19 | 99 | 'ca': '/home/pete/.sesame/canonical_ca.crt', | ||
20 | 100 | |||
21 | 101 | 'cert': '/home/pete/.sesame/canonical-pete.crt', | ||
22 | 102 | 'cert-pass-flags': '1', | ||
23 | 103 | |||
24 | 104 | 'key': '/home/pete/.sesame/canonical-pete.key' | ||
25 | 105 | } | ||
26 | 106 | }, | ||
27 | 107 | 'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'}, | ||
28 | 108 | 'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'} | ||
29 | 109 | } | ||
30 | 110 | |||
31 | 111 | tls (all options): | ||
32 | 112 | { | ||
33 | 113 | 'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'tls', 'uuid': '799623fc-e37a-4b39-9841-87588f2e8b8d'}, | ||
34 | 114 | 'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn', | ||
35 | 115 | 'data': { | ||
36 | 116 | 'connection-type': 'tls', | ||
37 | 117 | |||
38 | 118 | Basic: | ||
39 | 119 | 'key': '/home/pete/.sesame/canonical-pete.key', | ||
40 | 120 | 'ca': '/home/pete/.sesame/canonical_ca.crt', | ||
41 | 121 | 'remote': 'gatewoo', | ||
42 | 122 | 'cert': '/home/pete/.sesame/canonical-pete.crt', | ||
43 | 123 | 'cert-pass-flags': '1', | ||
44 | 124 | |||
45 | 125 | General: | ||
46 | 126 | 'port': '1234', | ||
47 | 127 | 'reneg-seconds': '123', | ||
48 | 128 | 'comp-lzo': 'yes', | ||
49 | 129 | 'proto-tcp': 'yes', | ||
50 | 130 | 'dev-type': 'tun', | ||
51 | 131 | 'dev': 'banana', | ||
52 | 132 | 'tunnel-mtu': '1495', | ||
53 | 133 | 'fragment-size': '1301', | ||
54 | 134 | 'mssfix': 'yes', | ||
55 | 135 | 'remote-random': 'yes', | ||
56 | 136 | |||
57 | 137 | Security: | ||
58 | 138 | 'cipher': 'DES-CBC', | ||
59 | 139 | 'keysize': '128', | ||
60 | 140 | 'auth': 'RSA-MD4', | ||
61 | 141 | |||
62 | 142 | TLS Auth: | ||
63 | 143 | 'tls-remote': '/banana', | ||
64 | 144 | 'remote-cert-tls': 'server', | ||
65 | 145 | 'ta': '/home/pete/.sesame/canonical_ta.key' | ||
66 | 146 | 'ta-dir': '1', | ||
67 | 147 | |||
68 | 148 | Proxies: | ||
69 | 149 | 'proxy-type': 'http', | ||
70 | 150 | 'proxy-server': '1234', | ||
71 | 151 | 'proxy-port': '4567', | ||
72 | 152 | 'proxy-retry': 'yes', | ||
73 | 153 | 'http-proxy-username': 'proxyuser', | ||
74 | 154 | } | ||
75 | 155 | }, | ||
76 | 156 | 'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'}, | ||
77 | 157 | 'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'}} | ||
78 | 158 | |||
79 | 159 | {'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'tls', 'uuid': '799623fc-e37a-4b39-9841-87588f2e8b8d'}, | ||
80 | 160 | 'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn', | ||
81 | 161 | 'data': { | ||
82 | 162 | 'key': '/home/pete/.sesame/canonical-pete.key', | ||
83 | 163 | 'mssfix': 'yes', | ||
84 | 164 | 'proxy-port': '4567', | ||
85 | 165 | 'http-proxy-username': 'proxyuser', | ||
86 | 166 | 'connection-type': 'tls', | ||
87 | 167 | 'reneg-seconds': '123', | ||
88 | 168 | 'port': '1234', | ||
89 | 169 | 'dev-type': 'tun', | ||
90 | 170 | 'remote-random': 'yes', | ||
91 | 171 | 'ta-dir': '1', | ||
92 | 172 | 'proxy-server': '1234', | ||
93 | 173 | 'ca': '/home/pete/.sesame/canonical_ca.crt', | ||
94 | 174 | 'keysize': '128', | ||
95 | 175 | 'fragment-size': '1301', | ||
96 | 176 | 'tunnel-mtu': '1495', | ||
97 | 177 | 'proxy-retry': 'yes', | ||
98 | 178 | 'remote-cert-tls': 'server', | ||
99 | 179 | 'comp-lzo': 'yes', | ||
100 | 180 | 'remote': 'gatewoo', | ||
101 | 181 | 'proto-tcp': 'yes', | ||
102 | 182 | 'dev': 'banana', | ||
103 | 183 | 'proxy-type': 'http', | ||
104 | 184 | 'cert': '/home/pete/.sesame/canonical-pete.crt', | ||
105 | 185 | 'tls-remote': '/banana', | ||
106 | 186 | 'cert-pass-flags': '1', | ||
107 | 187 | 'ta': '/home/pete/.sesame/canonical_ta.key' | ||
108 | 188 | }}, 'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'}, 'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'}} | ||
109 | 189 | |||
110 | 190 | password: | ||
111 | 191 | { | ||
112 | 192 | 'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'username-password', 'uuid': '330cc533-102e-4a1f-b854-79eb6016a68b'}, | ||
113 | 193 | 'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn', | ||
114 | 194 | 'data': { | ||
115 | 195 | 'connection-type': 'password', | ||
116 | 196 | 'remote': 'gatewoo', | ||
117 | 197 | |||
118 | 198 | 'ca': '/home/pete/.sesame/canonical_ca.crt' | ||
119 | 199 | |||
120 | 200 | 'username': 'usernoo', | ||
121 | 201 | 'password-flags': '1', | ||
122 | 202 | |||
123 | 203 | } | ||
124 | 204 | }, | ||
125 | 205 | 'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'}, | ||
126 | 206 | 'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'}} | ||
127 | 207 | |||
128 | 208 | password-tls: | ||
129 | 209 | { | ||
130 | 210 | 'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'password-cert', 'uuid': '2b4baf88-7cbb-40f2-b124-b57173a762bb'}, | ||
131 | 211 | 'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn', | ||
132 | 212 | 'data': { | ||
133 | 213 | 'connection-type': 'password-tls', | ||
134 | 214 | 'remote': 'gatewoo', | ||
135 | 215 | |||
136 | 216 | 'ca': '/home/pete/.sesame/canonical_ca.crt', | ||
137 | 217 | |||
138 | 218 | 'username': 'usernoo', | ||
139 | 219 | 'password-flags': '1', | ||
140 | 220 | |||
141 | 221 | 'cert': '/home/pete/.sesame/canonical-pete.crt', | ||
142 | 222 | 'cert-pass-flags': '1', | ||
143 | 223 | |||
144 | 224 | 'key': '/home/pete/.sesame/canonical-pete.key' | ||
145 | 225 | } | ||
146 | 226 | }, | ||
147 | 227 | 'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'}, | ||
148 | 228 | 'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'} | ||
149 | 229 | } | ||
150 | 230 | |||
151 | 231 | static-key: | ||
152 | 232 | { | ||
153 | 233 | 'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'static-key', 'uuid': '796e396b-0688-4639-ad60-82c26e8a717e'}, | ||
154 | 234 | 'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn', | ||
155 | 235 | 'data': { | ||
156 | 236 | 'connection-type': 'static-key', | ||
157 | 237 | 'remote': 'gatewoo', | ||
158 | 238 | |||
159 | 239 | 'local-ip': '10.1.1.1', | ||
160 | 240 | 'static-key': '/home/pete/.sesame/canonical_ta.key', | ||
161 | 241 | 'static-key-direction': '0', | ||
162 | 242 | 'remote-ip': '123.1.1.1' | ||
163 | 243 | } | ||
164 | 244 | }, | ||
165 | 245 | 'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'}, | ||
166 | 246 | 'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'} | ||
167 | 247 | } | ||
168 | 248 | |||
169 | 249 | --> | ||
170 | 250 | \ No newline at end of file | 88 | \ No newline at end of file |
171 | 251 | 89 | ||
172 | === added file 'data/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml' | |||
173 | --- data/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml 1970-01-01 00:00:00 +0000 | |||
174 | +++ data/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml 2016-02-15 09:40:45 +0000 | |||
175 | @@ -0,0 +1,34 @@ | |||
176 | 1 | <?xml version="1.0" encoding="UTF-8" ?> | ||
177 | 2 | |||
178 | 3 | <node name="/com/ubuntu/connectivity1/Connection/Pptp" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> | ||
179 | 4 | <interface name="com.ubuntu.connectivity1.vpn.VpnConnection.Pptp"> | ||
180 | 5 | |||
181 | 6 | <!-- basic --> | ||
182 | 7 | |||
183 | 8 | <property name="gateway" type="s" access="readwrite"/> | ||
184 | 9 | |||
185 | 10 | <property name="user" type="s" access="readwrite"/> | ||
186 | 11 | <property name="password" type="s" access="readwrite"/> | ||
187 | 12 | |||
188 | 13 | <property name="domain" type="s" access="readwrite"/> | ||
189 | 14 | |||
190 | 15 | <!-- advanced --> | ||
191 | 16 | |||
192 | 17 | <property name="allowPap" type="b" access="readwrite"/> | ||
193 | 18 | <property name="allowChap" type="b" access="readwrite"/> | ||
194 | 19 | <property name="allowMschap" type="b" access="readwrite"/> | ||
195 | 20 | <property name="allowMschapv2" type="b" access="readwrite"/> | ||
196 | 21 | <property name="allowEap" type="b" access="readwrite"/> | ||
197 | 22 | |||
198 | 23 | <property name="requireMppe" type="b" access="readwrite"/> | ||
199 | 24 | <property name="mppeType" type="i" access="readwrite"/> | ||
200 | 25 | <property name="mppeStateful" type="b" access="readwrite"/> | ||
201 | 26 | |||
202 | 27 | <property name="bsdCompression" type="b" access="readwrite"/> | ||
203 | 28 | <property name="deflateCompression" type="b" access="readwrite"/> | ||
204 | 29 | <property name="tcpHeaderCompression" type="b" access="readwrite"/> | ||
205 | 30 | |||
206 | 31 | <property name="sendPppEchoPackets" type="b" access="readwrite"/> | ||
207 | 32 | |||
208 | 33 | </interface> | ||
209 | 34 | </node> | ||
210 | 0 | 35 | ||
211 | === modified file 'debian/changelog' | |||
212 | --- debian/changelog 2016-01-06 23:07:43 +0000 | |||
213 | +++ debian/changelog 2016-02-15 09:40:45 +0000 | |||
214 | @@ -1,3 +1,9 @@ | |||
215 | 1 | indicator-network (0.7.0-0ubuntu1) UNRELEASED; urgency=medium | ||
216 | 2 | |||
217 | 3 | * Add PPTP support to VPN editor. | ||
218 | 4 | |||
219 | 5 | -- Pete Woods <pete.woods@canonical.com> Tue, 12 Jan 2016 18:10:06 +0000 | ||
220 | 6 | |||
221 | 1 | indicator-network (0.6.0+16.04.20160106.1-0ubuntu1) xenial; urgency=medium | 7 | indicator-network (0.6.0+16.04.20160106.1-0ubuntu1) xenial; urgency=medium |
222 | 2 | 8 | ||
223 | 3 | * Add file picker to VPN editor UI added: src/vpn- | 9 | * Add file picker to VPN editor UI added: src/vpn- |
224 | 4 | 10 | ||
225 | === modified file 'src/connectivity-api/connectivity-qt/CMakeLists.txt' | |||
226 | --- src/connectivity-api/connectivity-qt/CMakeLists.txt 2015-11-20 13:14:50 +0000 | |||
227 | +++ src/connectivity-api/connectivity-qt/CMakeLists.txt 2016-02-15 09:40:45 +0000 | |||
228 | @@ -20,6 +20,7 @@ | |||
229 | 20 | connectivityqt/internal/dbus-property-cache.cpp | 20 | connectivityqt/internal/dbus-property-cache.cpp |
230 | 21 | connectivityqt/connectivity.cpp | 21 | connectivityqt/connectivity.cpp |
231 | 22 | connectivityqt/openvpn-connection.cpp | 22 | connectivityqt/openvpn-connection.cpp |
232 | 23 | connectivityqt/pptp-connection.cpp | ||
233 | 23 | connectivityqt/vpn-connection.cpp | 24 | connectivityqt/vpn-connection.cpp |
234 | 24 | connectivityqt/vpn-connections-list-model.cpp | 25 | connectivityqt/vpn-connections-list-model.cpp |
235 | 25 | ubuntu/connectivity/networking-status.cpp | 26 | ubuntu/connectivity/networking-status.cpp |
236 | @@ -29,11 +30,13 @@ | |||
237 | 29 | "${DATA_DIR}/org.freedesktop.DBus.Properties.xml" | 30 | "${DATA_DIR}/org.freedesktop.DBus.Properties.xml" |
238 | 30 | "${DATA_DIR}/com.ubuntu.connectivity1.NetworkingStatus.xml" | 31 | "${DATA_DIR}/com.ubuntu.connectivity1.NetworkingStatus.xml" |
239 | 31 | "${DATA_DIR}/com.ubuntu.connectivity1.Private.xml" | 32 | "${DATA_DIR}/com.ubuntu.connectivity1.Private.xml" |
240 | 33 | "${DATA_DIR}/com.ubuntu.connectivity1.vpn.VpnConnection.xml" | ||
241 | 34 | "${DATA_DIR}/com.ubuntu.connectivity1.vpn.VpnConnection.OpenVpn.xml" | ||
242 | 35 | "${DATA_DIR}/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml" | ||
243 | 32 | PROPERTIES | 36 | PROPERTIES |
244 | 33 | NO_NAMESPACE YES | 37 | NO_NAMESPACE YES |
245 | 34 | ) | 38 | ) |
246 | 35 | 39 | ||
247 | 36 | |||
248 | 37 | qt5_add_dbus_interface( | 40 | qt5_add_dbus_interface( |
249 | 38 | CONNECTIVITY_QT_SRC | 41 | CONNECTIVITY_QT_SRC |
250 | 39 | "${DATA_DIR}/com.ubuntu.connectivity1.NetworkingStatus.xml" | 42 | "${DATA_DIR}/com.ubuntu.connectivity1.NetworkingStatus.xml" |
251 | @@ -60,6 +63,12 @@ | |||
252 | 60 | 63 | ||
253 | 61 | qt5_add_dbus_interface( | 64 | qt5_add_dbus_interface( |
254 | 62 | CONNECTIVITY_QT_SRC | 65 | CONNECTIVITY_QT_SRC |
255 | 66 | "${DATA_DIR}/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml" | ||
256 | 67 | PptpConnectionInterface | ||
257 | 68 | ) | ||
258 | 69 | |||
259 | 70 | qt5_add_dbus_interface( | ||
260 | 71 | CONNECTIVITY_QT_SRC | ||
261 | 63 | "${DATA_DIR}/org.freedesktop.DBus.Properties.xml" | 72 | "${DATA_DIR}/org.freedesktop.DBus.Properties.xml" |
262 | 64 | PropertiesInterface | 73 | PropertiesInterface |
263 | 65 | ) | 74 | ) |
264 | 66 | 75 | ||
265 | === added file 'src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.cpp' | |||
266 | --- src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.cpp 1970-01-01 00:00:00 +0000 | |||
267 | +++ src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.cpp 2016-02-15 09:40:45 +0000 | |||
268 | @@ -0,0 +1,189 @@ | |||
269 | 1 | /* | ||
270 | 2 | * Copyright © 2015 Canonical Ltd. | ||
271 | 3 | * | ||
272 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
273 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
274 | 6 | * as published by the Free Software Foundation. | ||
275 | 7 | * | ||
276 | 8 | * This program is distributed in the hope that it will be useful, | ||
277 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
278 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
279 | 11 | * GNU Lesser General Public License for more details. | ||
280 | 12 | * | ||
281 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
282 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
283 | 15 | * | ||
284 | 16 | * Authors: | ||
285 | 17 | * Pete Woods <pete.woods@canonical.com> | ||
286 | 18 | */ | ||
287 | 19 | |||
288 | 20 | #include <connectivityqt/pptp-connection.h> | ||
289 | 21 | #include <connectivityqt/internal/dbus-property-cache.h> | ||
290 | 22 | #include <dbus-types.h> | ||
291 | 23 | |||
292 | 24 | #include <PptpConnectionInterface.h> | ||
293 | 25 | |||
294 | 26 | using namespace std; | ||
295 | 27 | |||
296 | 28 | #define DEFINE_PROPERTY_GETTER(name, strname, type, conversion)\ | ||
297 | 29 | type PptpConnection::name() const\ | ||
298 | 30 | {\ | ||
299 | 31 | return d->m_propertyCache->get(strname).conversion();\ | ||
300 | 32 | }\ | ||
301 | 33 | |||
302 | 34 | #define DEFINE_PROPERTY_GETTER_ENUM(name, strname, type)\ | ||
303 | 35 | PptpConnection::type PptpConnection::name() const\ | ||
304 | 36 | {\ | ||
305 | 37 | return static_cast<type>(d->m_propertyCache->get(strname).toInt());\ | ||
306 | 38 | } | ||
307 | 39 | |||
308 | 40 | #define DEFINE_PROPERTY_SETTER(uppername, strname, type)\ | ||
309 | 41 | void PptpConnection::set##uppername(type value)\ | ||
310 | 42 | {\ | ||
311 | 43 | d->m_propertyCache->set(strname, value);\ | ||
312 | 44 | } | ||
313 | 45 | |||
314 | 46 | #define DEFINE_PROPERTY_SETTER_ENUM(uppername, strname, type)\ | ||
315 | 47 | void PptpConnection::set##uppername(type value)\ | ||
316 | 48 | {\ | ||
317 | 49 | d->m_propertyCache->set(strname, static_cast<int>(value));\ | ||
318 | 50 | } | ||
319 | 51 | |||
320 | 52 | #define DEFINE_PROPERTY_UPDATE(varname, strname, conversion)\ | ||
321 | 53 | else if (name == strname)\ | ||
322 | 54 | {\ | ||
323 | 55 | Q_EMIT p.varname##Changed(value.conversion());\ | ||
324 | 56 | } | ||
325 | 57 | |||
326 | 58 | #define DEFINE_PROPERTY_UPDATE_ENUM(varname, strname, type)\ | ||
327 | 59 | else if (name == strname)\ | ||
328 | 60 | {\ | ||
329 | 61 | Q_EMIT p.varname##Changed(static_cast<type>(value.toInt()));\ | ||
330 | 62 | } | ||
331 | 63 | |||
332 | 64 | namespace connectivityqt | ||
333 | 65 | { | ||
334 | 66 | |||
335 | 67 | class PptpConnection::Priv: public QObject | ||
336 | 68 | { | ||
337 | 69 | Q_OBJECT | ||
338 | 70 | |||
339 | 71 | public: | ||
340 | 72 | Priv(PptpConnection& parent) : | ||
341 | 73 | p(parent) | ||
342 | 74 | { | ||
343 | 75 | } | ||
344 | 76 | |||
345 | 77 | public Q_SLOTS: | ||
346 | 78 | void propertyChanged(const QString& name, const QVariant& value) | ||
347 | 79 | { | ||
348 | 80 | if (name == "") {} | ||
349 | 81 | |||
350 | 82 | // Basic properties | ||
351 | 83 | |||
352 | 84 | DEFINE_PROPERTY_UPDATE(gateway, "gateway", toString) | ||
353 | 85 | DEFINE_PROPERTY_UPDATE(user, "user", toString) | ||
354 | 86 | DEFINE_PROPERTY_UPDATE(password, "password", toString) | ||
355 | 87 | DEFINE_PROPERTY_UPDATE(domain, "domain", toString) | ||
356 | 88 | |||
357 | 89 | // Advanced properties | ||
358 | 90 | |||
359 | 91 | DEFINE_PROPERTY_UPDATE(allowPap, "allowPap", toBool) | ||
360 | 92 | DEFINE_PROPERTY_UPDATE(allowChap, "allowChap", toBool) | ||
361 | 93 | DEFINE_PROPERTY_UPDATE(allowMschap, "allowMschap", toBool) | ||
362 | 94 | DEFINE_PROPERTY_UPDATE(allowMschapv2, "allowMschapv2", toBool) | ||
363 | 95 | DEFINE_PROPERTY_UPDATE(allowEap, "allowEap", toBool) | ||
364 | 96 | DEFINE_PROPERTY_UPDATE(requireMppe, "requireMppe", toBool) | ||
365 | 97 | DEFINE_PROPERTY_UPDATE_ENUM(mppeType, "mppeType", MppeType) | ||
366 | 98 | DEFINE_PROPERTY_UPDATE(mppeStateful, "mppeStateful", toBool) | ||
367 | 99 | DEFINE_PROPERTY_UPDATE(bsdCompression, "bsdCompression", toBool) | ||
368 | 100 | DEFINE_PROPERTY_UPDATE(deflateCompression, "deflateCompression", toBool) | ||
369 | 101 | DEFINE_PROPERTY_UPDATE(tcpHeaderCompression, "tcpHeaderCompression", toBool) | ||
370 | 102 | DEFINE_PROPERTY_UPDATE(sendPppEchoPackets, "sendPppEchoPackets", toBool) | ||
371 | 103 | } | ||
372 | 104 | |||
373 | 105 | public: | ||
374 | 106 | PptpConnection& p; | ||
375 | 107 | |||
376 | 108 | unique_ptr<ComUbuntuConnectivity1VpnVpnConnectionPptpInterface> m_pptpInterface; | ||
377 | 109 | |||
378 | 110 | internal::DBusPropertyCache::UPtr m_propertyCache; | ||
379 | 111 | }; | ||
380 | 112 | |||
381 | 113 | PptpConnection::PptpConnection(const QDBusObjectPath& path, const QDBusConnection& connection) : | ||
382 | 114 | VpnConnection(path, connection), | ||
383 | 115 | d(new Priv(*this)) | ||
384 | 116 | { | ||
385 | 117 | d->m_pptpInterface = make_unique< | ||
386 | 118 | ComUbuntuConnectivity1VpnVpnConnectionPptpInterface>( | ||
387 | 119 | DBusTypes::DBUS_NAME, path.path(), connection); | ||
388 | 120 | |||
389 | 121 | d->m_propertyCache = | ||
390 | 122 | make_unique<internal::DBusPropertyCache>( | ||
391 | 123 | DBusTypes::DBUS_NAME, | ||
392 | 124 | ComUbuntuConnectivity1VpnVpnConnectionPptpInterface::staticInterfaceName(), | ||
393 | 125 | path.path(), connection); | ||
394 | 126 | |||
395 | 127 | connect(d->m_propertyCache.get(), | ||
396 | 128 | &internal::DBusPropertyCache::propertyChanged, d.get(), | ||
397 | 129 | &Priv::propertyChanged); | ||
398 | 130 | } | ||
399 | 131 | |||
400 | 132 | PptpConnection::~PptpConnection() | ||
401 | 133 | { | ||
402 | 134 | } | ||
403 | 135 | |||
404 | 136 | VpnConnection::Type PptpConnection::type() const | ||
405 | 137 | { | ||
406 | 138 | return Type::PPTP; | ||
407 | 139 | } | ||
408 | 140 | |||
409 | 141 | // Basic properties | ||
410 | 142 | |||
411 | 143 | DEFINE_PROPERTY_GETTER(gateway, "gateway", QString, toString) | ||
412 | 144 | DEFINE_PROPERTY_GETTER(user, "user", QString, toString) | ||
413 | 145 | DEFINE_PROPERTY_GETTER(password, "password", QString, toString) | ||
414 | 146 | DEFINE_PROPERTY_GETTER(domain, "domain", QString, toString) | ||
415 | 147 | |||
416 | 148 | // Advanced properties | ||
417 | 149 | |||
418 | 150 | DEFINE_PROPERTY_GETTER(allowPap, "allowPap", bool, toBool) | ||
419 | 151 | DEFINE_PROPERTY_GETTER(allowChap, "allowChap", bool, toBool) | ||
420 | 152 | DEFINE_PROPERTY_GETTER(allowMschap, "allowMschap", bool, toBool) | ||
421 | 153 | DEFINE_PROPERTY_GETTER(allowMschapv2, "allowMschapv2", bool, toBool) | ||
422 | 154 | DEFINE_PROPERTY_GETTER(allowEap, "allowEap", bool, toBool) | ||
423 | 155 | DEFINE_PROPERTY_GETTER(requireMppe, "requireMppe", bool, toBool) | ||
424 | 156 | DEFINE_PROPERTY_GETTER_ENUM(mppeType, "mppeType", MppeType) | ||
425 | 157 | DEFINE_PROPERTY_GETTER(mppeStateful, "mppeStateful", bool, toBool) | ||
426 | 158 | DEFINE_PROPERTY_GETTER(bsdCompression, "bsdCompression", bool, toBool) | ||
427 | 159 | DEFINE_PROPERTY_GETTER(deflateCompression, "deflateCompression", bool, toBool) | ||
428 | 160 | DEFINE_PROPERTY_GETTER(tcpHeaderCompression, "tcpHeaderCompression", bool, toBool) | ||
429 | 161 | DEFINE_PROPERTY_GETTER(sendPppEchoPackets, "sendPppEchoPackets", bool, toBool) | ||
430 | 162 | |||
431 | 163 | |||
432 | 164 | |||
433 | 165 | // Basic properties | ||
434 | 166 | |||
435 | 167 | DEFINE_PROPERTY_SETTER(Gateway, "gateway", const QString &) | ||
436 | 168 | DEFINE_PROPERTY_SETTER(User, "user", const QString &) | ||
437 | 169 | DEFINE_PROPERTY_SETTER(Password, "password", const QString &) | ||
438 | 170 | DEFINE_PROPERTY_SETTER(Domain, "domain", const QString &) | ||
439 | 171 | |||
440 | 172 | // Advanced properties | ||
441 | 173 | |||
442 | 174 | DEFINE_PROPERTY_SETTER(AllowPap, "allowPap", bool) | ||
443 | 175 | DEFINE_PROPERTY_SETTER(AllowChap, "allowChap", bool) | ||
444 | 176 | DEFINE_PROPERTY_SETTER(AllowMschap, "allowMschap", bool) | ||
445 | 177 | DEFINE_PROPERTY_SETTER(AllowMschapv2, "allowMschapv2", bool) | ||
446 | 178 | DEFINE_PROPERTY_SETTER(AllowEap, "allowEap", bool) | ||
447 | 179 | DEFINE_PROPERTY_SETTER(RequireMppe, "requireMppe", bool) | ||
448 | 180 | DEFINE_PROPERTY_SETTER_ENUM(MppeType, "mppeType", MppeType) | ||
449 | 181 | DEFINE_PROPERTY_SETTER(MppeStateful, "mppeStateful", bool) | ||
450 | 182 | DEFINE_PROPERTY_SETTER(BsdCompression, "bsdCompression", bool) | ||
451 | 183 | DEFINE_PROPERTY_SETTER(DeflateCompression, "deflateCompression", bool) | ||
452 | 184 | DEFINE_PROPERTY_SETTER(TcpHeaderCompression, "tcpHeaderCompression", bool) | ||
453 | 185 | DEFINE_PROPERTY_SETTER(SendPppEchoPackets, "sendPppEchoPackets", bool) | ||
454 | 186 | |||
455 | 187 | } | ||
456 | 188 | |||
457 | 189 | #include "pptp-connection.moc" | ||
458 | 0 | 190 | ||
459 | === added file 'src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.h' | |||
460 | --- src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.h 1970-01-01 00:00:00 +0000 | |||
461 | +++ src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.h 2016-02-15 09:40:45 +0000 | |||
462 | @@ -0,0 +1,179 @@ | |||
463 | 1 | /* | ||
464 | 2 | * Copyright © 2015 Canonical Ltd. | ||
465 | 3 | * | ||
466 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
467 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
468 | 6 | * as published by the Free Software Foundation. | ||
469 | 7 | * | ||
470 | 8 | * This program is distributed in the hope that it will be useful, | ||
471 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
472 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
473 | 11 | * GNU Lesser General Public License for more details. | ||
474 | 12 | * | ||
475 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
476 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
477 | 15 | * | ||
478 | 16 | * Authors: | ||
479 | 17 | * Pete Woods <pete.woods@canonical.com> | ||
480 | 18 | */ | ||
481 | 19 | |||
482 | 20 | #pragma once | ||
483 | 21 | |||
484 | 22 | #include <connectivityqt/vpn-connection.h> | ||
485 | 23 | |||
486 | 24 | namespace connectivityqt | ||
487 | 25 | { | ||
488 | 26 | |||
489 | 27 | class Q_DECL_EXPORT PptpConnection : public VpnConnection | ||
490 | 28 | { | ||
491 | 29 | Q_OBJECT | ||
492 | 30 | |||
493 | 31 | public: | ||
494 | 32 | UNITY_DEFINES_PTRS(PptpConnection); | ||
495 | 33 | |||
496 | 34 | Q_ENUMS(MppeType) | ||
497 | 35 | enum class MppeType | ||
498 | 36 | { | ||
499 | 37 | MPPE_ALL, | ||
500 | 38 | MPPE_128, | ||
501 | 39 | MPPE_40 | ||
502 | 40 | }; | ||
503 | 41 | |||
504 | 42 | PptpConnection(const QDBusObjectPath& path, const QDBusConnection& connection); | ||
505 | 43 | |||
506 | 44 | virtual ~PptpConnection(); | ||
507 | 45 | |||
508 | 46 | Type type() const override; | ||
509 | 47 | |||
510 | 48 | // Basic properties | ||
511 | 49 | |||
512 | 50 | Q_PROPERTY(QString gateway READ gateway WRITE setGateway NOTIFY gatewayChanged) | ||
513 | 51 | QString gateway() const; | ||
514 | 52 | |||
515 | 53 | Q_PROPERTY(QString user READ user WRITE setUser NOTIFY userChanged) | ||
516 | 54 | QString user() const; | ||
517 | 55 | |||
518 | 56 | Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) | ||
519 | 57 | QString password() const; | ||
520 | 58 | |||
521 | 59 | Q_PROPERTY(QString domain READ domain WRITE setDomain NOTIFY domainChanged) | ||
522 | 60 | QString domain() const; | ||
523 | 61 | |||
524 | 62 | // Advanced properties | ||
525 | 63 | |||
526 | 64 | Q_PROPERTY(bool allowPap READ allowPap WRITE setAllowPap NOTIFY allowPapChanged) | ||
527 | 65 | bool allowPap() const; | ||
528 | 66 | |||
529 | 67 | Q_PROPERTY(bool allowChap READ allowChap WRITE setAllowChap NOTIFY allowChapChanged) | ||
530 | 68 | bool allowChap() const; | ||
531 | 69 | |||
532 | 70 | Q_PROPERTY(bool allowMschap READ allowMschap WRITE setAllowMschap NOTIFY allowMschapChanged) | ||
533 | 71 | bool allowMschap() const; | ||
534 | 72 | |||
535 | 73 | Q_PROPERTY(bool allowMschapv2 READ allowMschapv2 WRITE setAllowMschapv2 NOTIFY allowMschapv2Changed) | ||
536 | 74 | bool allowMschapv2() const; | ||
537 | 75 | |||
538 | 76 | Q_PROPERTY(bool allowEap READ allowEap WRITE setAllowEap NOTIFY allowEapChanged) | ||
539 | 77 | bool allowEap() const; | ||
540 | 78 | |||
541 | 79 | Q_PROPERTY(bool requireMppe READ requireMppe WRITE setRequireMppe NOTIFY requireMppeChanged) | ||
542 | 80 | bool requireMppe() const; | ||
543 | 81 | |||
544 | 82 | Q_PROPERTY(MppeType mppeType READ mppeType WRITE setMppeType NOTIFY mppeTypeChanged) | ||
545 | 83 | MppeType mppeType() const; | ||
546 | 84 | |||
547 | 85 | Q_PROPERTY(bool mppeStateful READ mppeStateful WRITE setMppeStateful NOTIFY mppeStatefulChanged) | ||
548 | 86 | bool mppeStateful() const; | ||
549 | 87 | |||
550 | 88 | Q_PROPERTY(bool bsdCompression READ bsdCompression WRITE setBsdCompression NOTIFY bsdCompressionChanged) | ||
551 | 89 | bool bsdCompression() const; | ||
552 | 90 | |||
553 | 91 | Q_PROPERTY(bool deflateCompression READ deflateCompression WRITE setDeflateCompression NOTIFY deflateCompressionChanged) | ||
554 | 92 | bool deflateCompression() const; | ||
555 | 93 | |||
556 | 94 | Q_PROPERTY(bool tcpHeaderCompression READ tcpHeaderCompression WRITE setTcpHeaderCompression NOTIFY tcpHeaderCompressionChanged) | ||
557 | 95 | bool tcpHeaderCompression() const; | ||
558 | 96 | |||
559 | 97 | Q_PROPERTY(bool sendPppEchoPackets READ sendPppEchoPackets WRITE setSendPppEchoPackets NOTIFY sendPppEchoPacketsChanged) | ||
560 | 98 | bool sendPppEchoPackets() const; | ||
561 | 99 | |||
562 | 100 | public Q_SLOTS: | ||
563 | 101 | // Basic properties | ||
564 | 102 | |||
565 | 103 | void setGateway(const QString &value); | ||
566 | 104 | |||
567 | 105 | void setUser(const QString &value); | ||
568 | 106 | |||
569 | 107 | void setPassword(const QString &value); | ||
570 | 108 | |||
571 | 109 | void setDomain(const QString &value); | ||
572 | 110 | |||
573 | 111 | // Advanced properties | ||
574 | 112 | |||
575 | 113 | void setAllowPap(bool value); | ||
576 | 114 | |||
577 | 115 | void setAllowChap(bool value); | ||
578 | 116 | |||
579 | 117 | void setAllowMschap(bool value); | ||
580 | 118 | |||
581 | 119 | void setAllowMschapv2(bool value); | ||
582 | 120 | |||
583 | 121 | void setAllowEap(bool value); | ||
584 | 122 | |||
585 | 123 | void setRequireMppe(bool value); | ||
586 | 124 | |||
587 | 125 | void setMppeType(MppeType value); | ||
588 | 126 | |||
589 | 127 | void setMppeStateful(bool value); | ||
590 | 128 | |||
591 | 129 | void setBsdCompression(bool value); | ||
592 | 130 | |||
593 | 131 | void setDeflateCompression(bool value); | ||
594 | 132 | |||
595 | 133 | void setTcpHeaderCompression(bool value); | ||
596 | 134 | |||
597 | 135 | void setSendPppEchoPackets(bool value); | ||
598 | 136 | |||
599 | 137 | Q_SIGNALS: | ||
600 | 138 | // Basic properties | ||
601 | 139 | |||
602 | 140 | void gatewayChanged(const QString &value); | ||
603 | 141 | |||
604 | 142 | void userChanged(const QString &value); | ||
605 | 143 | |||
606 | 144 | void passwordChanged(const QString &value); | ||
607 | 145 | |||
608 | 146 | void domainChanged(const QString &value); | ||
609 | 147 | |||
610 | 148 | // Advanced properties | ||
611 | 149 | |||
612 | 150 | void allowPapChanged(bool value); | ||
613 | 151 | |||
614 | 152 | void allowChapChanged(bool value); | ||
615 | 153 | |||
616 | 154 | void allowMschapChanged(bool value); | ||
617 | 155 | |||
618 | 156 | void allowMschapv2Changed(bool value); | ||
619 | 157 | |||
620 | 158 | void allowEapChanged(bool value); | ||
621 | 159 | |||
622 | 160 | void requireMppeChanged(bool value); | ||
623 | 161 | |||
624 | 162 | void mppeTypeChanged(MppeType value); | ||
625 | 163 | |||
626 | 164 | void mppeStatefulChanged(bool value); | ||
627 | 165 | |||
628 | 166 | void bsdCompressionChanged(bool value); | ||
629 | 167 | |||
630 | 168 | void deflateCompressionChanged(bool value); | ||
631 | 169 | |||
632 | 170 | void tcpHeaderCompressionChanged(bool value); | ||
633 | 171 | |||
634 | 172 | void sendPppEchoPacketsChanged(bool value); | ||
635 | 173 | |||
636 | 174 | protected: | ||
637 | 175 | class Priv; | ||
638 | 176 | std::shared_ptr<Priv> d; | ||
639 | 177 | }; | ||
640 | 178 | |||
641 | 179 | } | ||
642 | 0 | 180 | ||
643 | === modified file 'src/connectivity-api/connectivity-qt/connectivityqt/vpn-connections-list-model.cpp' | |||
644 | --- src/connectivity-api/connectivity-qt/connectivityqt/vpn-connections-list-model.cpp 2015-12-14 11:56:23 +0000 | |||
645 | +++ src/connectivity-api/connectivity-qt/connectivityqt/vpn-connections-list-model.cpp 2016-02-15 09:40:45 +0000 | |||
646 | @@ -19,6 +19,7 @@ | |||
647 | 19 | 19 | ||
648 | 20 | #include <connectivityqt/internal/vpn-connection-list-model-parameters.h> | 20 | #include <connectivityqt/internal/vpn-connection-list-model-parameters.h> |
649 | 21 | #include <connectivityqt/openvpn-connection.h> | 21 | #include <connectivityqt/openvpn-connection.h> |
650 | 22 | #include <connectivityqt/pptp-connection.h> | ||
651 | 22 | #include <connectivityqt/vpn-connections-list-model.h> | 23 | #include <connectivityqt/vpn-connections-list-model.h> |
652 | 23 | 24 | ||
653 | 24 | #include <VpnConnectionInterface.h> | 25 | #include <VpnConnectionInterface.h> |
654 | @@ -97,7 +98,8 @@ | |||
655 | 97 | [](QObject* self){self->deleteLater();}); | 98 | [](QObject* self){self->deleteLater();}); |
656 | 98 | break; | 99 | break; |
657 | 99 | default: | 100 | default: |
659 | 100 | // TODO pptp, etc | 101 | vpnConnection.reset(new PptpConnection(path, m_propertyCache->connection()), |
660 | 102 | [](QObject* self){self->deleteLater();}); | ||
661 | 101 | break; | 103 | break; |
662 | 102 | } | 104 | } |
663 | 103 | if (vpnConnection) | 105 | if (vpnConnection) |
664 | 104 | 106 | ||
665 | === modified file 'src/indicator/CMakeLists.txt' | |||
666 | --- src/indicator/CMakeLists.txt 2015-12-11 14:58:11 +0000 | |||
667 | +++ src/indicator/CMakeLists.txt 2016-02-15 09:40:45 +0000 | |||
668 | @@ -39,6 +39,7 @@ | |||
669 | 39 | nmofono/wifi/wifi-link-impl.cpp | 39 | nmofono/wifi/wifi-link-impl.cpp |
670 | 40 | nmofono/wwan/modem.cpp | 40 | nmofono/wwan/modem.cpp |
671 | 41 | nmofono/vpn/openvpn-connection.cpp | 41 | nmofono/vpn/openvpn-connection.cpp |
672 | 42 | nmofono/vpn/pptp-connection.cpp | ||
673 | 42 | nmofono/vpn/vpn-connection.cpp | 43 | nmofono/vpn/vpn-connection.cpp |
674 | 43 | nmofono/vpn/vpn-manager.cpp | 44 | nmofono/vpn/vpn-manager.cpp |
675 | 44 | 45 | ||
676 | @@ -60,6 +61,7 @@ | |||
677 | 60 | 61 | ||
678 | 61 | connectivity-service/connectivity-service.cpp | 62 | connectivity-service/connectivity-service.cpp |
679 | 62 | connectivity-service/dbus-openvpn-connection.cpp | 63 | connectivity-service/dbus-openvpn-connection.cpp |
680 | 64 | connectivity-service/dbus-pptp-connection.cpp | ||
681 | 63 | connectivity-service/dbus-vpn-connection.cpp | 65 | connectivity-service/dbus-vpn-connection.cpp |
682 | 64 | 66 | ||
683 | 65 | menuitems/access-point-item.cpp | 67 | menuitems/access-point-item.cpp |
684 | @@ -108,6 +110,14 @@ | |||
685 | 108 | 110 | ||
686 | 109 | qt5_add_dbus_adaptor( | 111 | qt5_add_dbus_adaptor( |
687 | 110 | NETWORK_SERVICE_SOURCES | 112 | NETWORK_SERVICE_SOURCES |
688 | 113 | "${DATA_DIR}/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml" | ||
689 | 114 | connectivity-service/dbus-pptp-connection.h | ||
690 | 115 | connectivity_service::DBusPptpConnection | ||
691 | 116 | PptpAdaptor | ||
692 | 117 | ) | ||
693 | 118 | |||
694 | 119 | qt5_add_dbus_adaptor( | ||
695 | 120 | NETWORK_SERVICE_SOURCES | ||
696 | 111 | "${DATA_DIR}/nm-secret-agent.xml" | 121 | "${DATA_DIR}/nm-secret-agent.xml" |
697 | 112 | "agent/SecretAgentInclude.h" | 122 | "agent/SecretAgentInclude.h" |
698 | 113 | "agent::SecretAgent" | 123 | "agent::SecretAgent" |
699 | 114 | 124 | ||
700 | === modified file 'src/indicator/connectivity-service/connectivity-service.cpp' | |||
701 | --- src/indicator/connectivity-service/connectivity-service.cpp 2015-12-04 13:18:04 +0000 | |||
702 | +++ src/indicator/connectivity-service/connectivity-service.cpp 2016-02-15 09:40:45 +0000 | |||
703 | @@ -21,6 +21,7 @@ | |||
704 | 21 | #include <connectivity-service/connectivity-service.h> | 21 | #include <connectivity-service/connectivity-service.h> |
705 | 22 | #include <connectivity-service/dbus-vpn-connection.h> | 22 | #include <connectivity-service/dbus-vpn-connection.h> |
706 | 23 | #include <connectivity-service/dbus-openvpn-connection.h> | 23 | #include <connectivity-service/dbus-openvpn-connection.h> |
707 | 24 | #include <connectivity-service/dbus-pptp-connection.h> | ||
708 | 24 | #include <NetworkingStatusAdaptor.h> | 25 | #include <NetworkingStatusAdaptor.h> |
709 | 25 | #include <NetworkingStatusPrivateAdaptor.h> | 26 | #include <NetworkingStatusPrivateAdaptor.h> |
710 | 26 | #include <dbus-types.h> | 27 | #include <dbus-types.h> |
711 | @@ -236,7 +237,7 @@ | |||
712 | 236 | vpnConnection = make_shared<DBusOpenvpnConnection>(vpn, m_connection); | 237 | vpnConnection = make_shared<DBusOpenvpnConnection>(vpn, m_connection); |
713 | 237 | break; | 238 | break; |
714 | 238 | case VpnConnection::Type::pptp: | 239 | case VpnConnection::Type::pptp: |
716 | 239 | // TODO pptp | 240 | vpnConnection = make_shared<DBusPptpConnection>(vpn, m_connection); |
717 | 240 | break; | 241 | break; |
718 | 241 | } | 242 | } |
719 | 242 | if (vpnConnection) | 243 | if (vpnConnection) |
720 | 243 | 244 | ||
721 | === added file 'src/indicator/connectivity-service/dbus-pptp-connection.cpp' | |||
722 | --- src/indicator/connectivity-service/dbus-pptp-connection.cpp 1970-01-01 00:00:00 +0000 | |||
723 | +++ src/indicator/connectivity-service/dbus-pptp-connection.cpp 2016-02-15 09:40:45 +0000 | |||
724 | @@ -0,0 +1,198 @@ | |||
725 | 1 | /* | ||
726 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
727 | 3 | * | ||
728 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
729 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
730 | 6 | * by the Free Software Foundation. | ||
731 | 7 | * | ||
732 | 8 | * This program is distributed in the hope that it will be useful, but | ||
733 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
734 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
735 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
736 | 12 | * | ||
737 | 13 | * You should have received a copy of the GNU General Public License along | ||
738 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
739 | 15 | * | ||
740 | 16 | * Authors: | ||
741 | 17 | * Pete Woods <pete.woods@canonical.com> | ||
742 | 18 | */ | ||
743 | 19 | |||
744 | 20 | #include <connectivity-service/dbus-pptp-connection.h> | ||
745 | 21 | #include <PptpAdaptor.h> | ||
746 | 22 | #include <util/dbus-utils.h> | ||
747 | 23 | |||
748 | 24 | using namespace std; | ||
749 | 25 | using namespace nmofono::vpn; | ||
750 | 26 | |||
751 | 27 | #define DEFINE_PROPERTY_GETTER(varname, type)\ | ||
752 | 28 | type DBusPptpConnection::varname() const\ | ||
753 | 29 | {\ | ||
754 | 30 | return m_pptpConnection->varname();\ | ||
755 | 31 | } | ||
756 | 32 | |||
757 | 33 | #define DEFINE_PROPERTY_GETTER_ENUM(varname)\ | ||
758 | 34 | int DBusPptpConnection::varname() const\ | ||
759 | 35 | {\ | ||
760 | 36 | return static_cast<int>(m_pptpConnection->varname());\ | ||
761 | 37 | } | ||
762 | 38 | |||
763 | 39 | #define DEFINE_PROPERTY_SETTER_ENUM(uppername, type)\ | ||
764 | 40 | void DBusPptpConnection::set##uppername(int value)\ | ||
765 | 41 | {\ | ||
766 | 42 | m_pptpConnection->set##uppername(static_cast<PptpConnection::type>(value));\ | ||
767 | 43 | } | ||
768 | 44 | |||
769 | 45 | #define DEFINE_PROPERTY_UPDATER(varname, strname, type)\ | ||
770 | 46 | void DBusPptpConnection::varname##Updated(type)\ | ||
771 | 47 | {\ | ||
772 | 48 | notifyProperty(strname);\ | ||
773 | 49 | } | ||
774 | 50 | |||
775 | 51 | #define DEFINE_PROPERTY_UPDATER_ENUM(varname, strname, type)\ | ||
776 | 52 | void DBusPptpConnection::varname##Updated(PptpConnection::type)\ | ||
777 | 53 | {\ | ||
778 | 54 | notifyProperty(strname);\ | ||
779 | 55 | } | ||
780 | 56 | |||
781 | 57 | #define DEFINE_PROPERTY_CONNECTION_FORWARD(uppername)\ | ||
782 | 58 | connect(this, &DBusPptpConnection::set##uppername, m_pptpConnection.get(), &PptpConnection::set##uppername); | ||
783 | 59 | |||
784 | 60 | #define DEFINE_PROPERTY_CONNECTION_REVERSE(varname)\ | ||
785 | 61 | connect(m_pptpConnection.get(), &PptpConnection::varname##Changed, this, &DBusPptpConnection::varname##Updated); | ||
786 | 62 | |||
787 | 63 | namespace connectivity_service | ||
788 | 64 | { | ||
789 | 65 | |||
790 | 66 | DBusPptpConnection::DBusPptpConnection(VpnConnection::SPtr vpnConnection, | ||
791 | 67 | const QDBusConnection& connection) : | ||
792 | 68 | DBusVpnConnection(vpnConnection, connection), | ||
793 | 69 | m_pptpConnection(vpnConnection->pptpConnection()) | ||
794 | 70 | { | ||
795 | 71 | new PptpAdaptor(this); | ||
796 | 72 | |||
797 | 73 | // Basic properties | ||
798 | 74 | |||
799 | 75 | DEFINE_PROPERTY_CONNECTION_FORWARD(Gateway) | ||
800 | 76 | DEFINE_PROPERTY_CONNECTION_FORWARD(User) | ||
801 | 77 | DEFINE_PROPERTY_CONNECTION_FORWARD(Password) | ||
802 | 78 | DEFINE_PROPERTY_CONNECTION_FORWARD(Domain) | ||
803 | 79 | |||
804 | 80 | // Advanced properties | ||
805 | 81 | |||
806 | 82 | DEFINE_PROPERTY_CONNECTION_FORWARD(AllowPap) | ||
807 | 83 | DEFINE_PROPERTY_CONNECTION_FORWARD(AllowChap) | ||
808 | 84 | DEFINE_PROPERTY_CONNECTION_FORWARD(AllowMschap) | ||
809 | 85 | DEFINE_PROPERTY_CONNECTION_FORWARD(AllowMschapv2) | ||
810 | 86 | DEFINE_PROPERTY_CONNECTION_FORWARD(AllowEap) | ||
811 | 87 | DEFINE_PROPERTY_CONNECTION_FORWARD(RequireMppe) | ||
812 | 88 | // mppeType is enum | ||
813 | 89 | DEFINE_PROPERTY_CONNECTION_FORWARD(MppeStateful) | ||
814 | 90 | DEFINE_PROPERTY_CONNECTION_FORWARD(BsdCompression) | ||
815 | 91 | DEFINE_PROPERTY_CONNECTION_FORWARD(DeflateCompression) | ||
816 | 92 | DEFINE_PROPERTY_CONNECTION_FORWARD(TcpHeaderCompression) | ||
817 | 93 | DEFINE_PROPERTY_CONNECTION_FORWARD(SendPppEchoPackets) | ||
818 | 94 | |||
819 | 95 | |||
820 | 96 | |||
821 | 97 | |||
822 | 98 | // Basic properties | ||
823 | 99 | |||
824 | 100 | DEFINE_PROPERTY_CONNECTION_REVERSE(gateway) | ||
825 | 101 | DEFINE_PROPERTY_CONNECTION_REVERSE(user) | ||
826 | 102 | DEFINE_PROPERTY_CONNECTION_REVERSE(password) | ||
827 | 103 | DEFINE_PROPERTY_CONNECTION_REVERSE(domain) | ||
828 | 104 | |||
829 | 105 | // Advanced properties | ||
830 | 106 | |||
831 | 107 | DEFINE_PROPERTY_CONNECTION_REVERSE(allowPap) | ||
832 | 108 | DEFINE_PROPERTY_CONNECTION_REVERSE(allowChap) | ||
833 | 109 | DEFINE_PROPERTY_CONNECTION_REVERSE(allowMschap) | ||
834 | 110 | DEFINE_PROPERTY_CONNECTION_REVERSE(allowMschapv2) | ||
835 | 111 | DEFINE_PROPERTY_CONNECTION_REVERSE(allowEap) | ||
836 | 112 | DEFINE_PROPERTY_CONNECTION_REVERSE(requireMppe) | ||
837 | 113 | DEFINE_PROPERTY_CONNECTION_REVERSE(mppeType) | ||
838 | 114 | DEFINE_PROPERTY_CONNECTION_REVERSE(mppeStateful) | ||
839 | 115 | DEFINE_PROPERTY_CONNECTION_REVERSE(bsdCompression) | ||
840 | 116 | DEFINE_PROPERTY_CONNECTION_REVERSE(deflateCompression) | ||
841 | 117 | DEFINE_PROPERTY_CONNECTION_REVERSE(tcpHeaderCompression) | ||
842 | 118 | DEFINE_PROPERTY_CONNECTION_REVERSE(sendPppEchoPackets) | ||
843 | 119 | |||
844 | 120 | |||
845 | 121 | |||
846 | 122 | registerDBusObject(); | ||
847 | 123 | } | ||
848 | 124 | |||
849 | 125 | DBusPptpConnection::~DBusPptpConnection() | ||
850 | 126 | { | ||
851 | 127 | } | ||
852 | 128 | |||
853 | 129 | nmofono::vpn::VpnConnection::Type DBusPptpConnection::type() const | ||
854 | 130 | { | ||
855 | 131 | return nmofono::vpn::VpnConnection::Type::pptp; | ||
856 | 132 | } | ||
857 | 133 | |||
858 | 134 | // Enum properties | ||
859 | 135 | |||
860 | 136 | DEFINE_PROPERTY_SETTER_ENUM(MppeType, MppeType) | ||
861 | 137 | |||
862 | 138 | // Basic properties | ||
863 | 139 | |||
864 | 140 | |||
865 | 141 | // Basic properties | ||
866 | 142 | |||
867 | 143 | DEFINE_PROPERTY_GETTER(gateway, QString) | ||
868 | 144 | DEFINE_PROPERTY_GETTER(user, QString) | ||
869 | 145 | DEFINE_PROPERTY_GETTER(password, QString) | ||
870 | 146 | DEFINE_PROPERTY_GETTER(domain, QString) | ||
871 | 147 | |||
872 | 148 | // Advanced properties | ||
873 | 149 | |||
874 | 150 | DEFINE_PROPERTY_GETTER(allowPap, bool) | ||
875 | 151 | DEFINE_PROPERTY_GETTER(allowChap, bool) | ||
876 | 152 | DEFINE_PROPERTY_GETTER(allowMschap, bool) | ||
877 | 153 | DEFINE_PROPERTY_GETTER(allowMschapv2, bool) | ||
878 | 154 | DEFINE_PROPERTY_GETTER(allowEap, bool) | ||
879 | 155 | DEFINE_PROPERTY_GETTER(requireMppe, bool) | ||
880 | 156 | DEFINE_PROPERTY_GETTER_ENUM(mppeType) | ||
881 | 157 | DEFINE_PROPERTY_GETTER(mppeStateful, bool) | ||
882 | 158 | DEFINE_PROPERTY_GETTER(bsdCompression, bool) | ||
883 | 159 | DEFINE_PROPERTY_GETTER(deflateCompression, bool) | ||
884 | 160 | DEFINE_PROPERTY_GETTER(tcpHeaderCompression, bool) | ||
885 | 161 | DEFINE_PROPERTY_GETTER(sendPppEchoPackets, bool) | ||
886 | 162 | |||
887 | 163 | |||
888 | 164 | void DBusPptpConnection::notifyProperty(const QString& propertyName) | ||
889 | 165 | { | ||
890 | 166 | DBusUtils::notifyPropertyChanged( | ||
891 | 167 | m_connection, | ||
892 | 168 | *this, | ||
893 | 169 | m_path.path(), | ||
894 | 170 | PptpAdaptor::staticMetaObject.classInfo(PptpAdaptor::staticMetaObject.indexOfClassInfo("D-Bus Interface")).value(), | ||
895 | 171 | {propertyName} | ||
896 | 172 | ); | ||
897 | 173 | } | ||
898 | 174 | |||
899 | 175 | // Basic properties | ||
900 | 176 | |||
901 | 177 | DEFINE_PROPERTY_UPDATER(gateway, "gateway", const QString &) | ||
902 | 178 | DEFINE_PROPERTY_UPDATER(user, "user", const QString &) | ||
903 | 179 | DEFINE_PROPERTY_UPDATER(password, "password", const QString &) | ||
904 | 180 | DEFINE_PROPERTY_UPDATER(domain, "domain", const QString &) | ||
905 | 181 | |||
906 | 182 | // Advanced properties | ||
907 | 183 | |||
908 | 184 | DEFINE_PROPERTY_UPDATER(allowPap, "allowPap", bool) | ||
909 | 185 | DEFINE_PROPERTY_UPDATER(allowChap, "allowChap", bool) | ||
910 | 186 | DEFINE_PROPERTY_UPDATER(allowMschap, "allowMschap", bool) | ||
911 | 187 | DEFINE_PROPERTY_UPDATER(allowMschapv2, "allowMschapv2", bool) | ||
912 | 188 | DEFINE_PROPERTY_UPDATER(allowEap, "allowEap", bool) | ||
913 | 189 | DEFINE_PROPERTY_UPDATER(requireMppe, "requireMppe", bool) | ||
914 | 190 | DEFINE_PROPERTY_UPDATER_ENUM(mppeType, "mppeType", MppeType) | ||
915 | 191 | DEFINE_PROPERTY_UPDATER(mppeStateful, "mppeStateful", bool) | ||
916 | 192 | DEFINE_PROPERTY_UPDATER(bsdCompression, "bsdCompression", bool) | ||
917 | 193 | DEFINE_PROPERTY_UPDATER(deflateCompression, "deflateCompression", bool) | ||
918 | 194 | DEFINE_PROPERTY_UPDATER(tcpHeaderCompression, "tcpHeaderCompression", bool) | ||
919 | 195 | DEFINE_PROPERTY_UPDATER(sendPppEchoPackets, "sendPppEchoPackets", bool) | ||
920 | 196 | |||
921 | 197 | |||
922 | 198 | } | ||
923 | 0 | 199 | ||
924 | === added file 'src/indicator/connectivity-service/dbus-pptp-connection.h' | |||
925 | --- src/indicator/connectivity-service/dbus-pptp-connection.h 1970-01-01 00:00:00 +0000 | |||
926 | +++ src/indicator/connectivity-service/dbus-pptp-connection.h 2016-02-15 09:40:45 +0000 | |||
927 | @@ -0,0 +1,177 @@ | |||
928 | 1 | /* | ||
929 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
930 | 3 | * | ||
931 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
932 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
933 | 6 | * by the Free Software Foundation. | ||
934 | 7 | * | ||
935 | 8 | * This program is distributed in the hope that it will be useful, but | ||
936 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
937 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
938 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
939 | 12 | * | ||
940 | 13 | * You should have received a copy of the GNU General Public License along | ||
941 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
942 | 15 | * | ||
943 | 16 | * Authors: | ||
944 | 17 | * Pete Woods <pete.woods@canonical.com> | ||
945 | 18 | */ | ||
946 | 19 | |||
947 | 20 | #pragma once | ||
948 | 21 | |||
949 | 22 | #include <connectivity-service/dbus-vpn-connection.h> | ||
950 | 23 | #include <nmofono/vpn/pptp-connection.h> | ||
951 | 24 | |||
952 | 25 | class PptpAdaptor; | ||
953 | 26 | |||
954 | 27 | namespace connectivity_service | ||
955 | 28 | { | ||
956 | 29 | |||
957 | 30 | class DBusPptpConnection : public DBusVpnConnection | ||
958 | 31 | { | ||
959 | 32 | friend PptpAdaptor; | ||
960 | 33 | |||
961 | 34 | Q_OBJECT | ||
962 | 35 | |||
963 | 36 | public: | ||
964 | 37 | DBusPptpConnection(nmofono::vpn::VpnConnection::SPtr vpnConnection, const QDBusConnection& connection); | ||
965 | 38 | |||
966 | 39 | ~DBusPptpConnection(); | ||
967 | 40 | |||
968 | 41 | nmofono::vpn::VpnConnection::Type type() const override; | ||
969 | 42 | |||
970 | 43 | // Basic properties | ||
971 | 44 | |||
972 | 45 | Q_PROPERTY(QString gateway READ gateway WRITE setGateway) | ||
973 | 46 | QString gateway() const; | ||
974 | 47 | |||
975 | 48 | Q_PROPERTY(QString user READ user WRITE setUser) | ||
976 | 49 | QString user() const; | ||
977 | 50 | |||
978 | 51 | Q_PROPERTY(QString password READ password WRITE setPassword) | ||
979 | 52 | QString password() const; | ||
980 | 53 | |||
981 | 54 | Q_PROPERTY(QString domain READ domain WRITE setDomain) | ||
982 | 55 | QString domain() const; | ||
983 | 56 | |||
984 | 57 | // Advanced properties | ||
985 | 58 | |||
986 | 59 | Q_PROPERTY(bool allowPap READ allowPap WRITE setAllowPap) | ||
987 | 60 | bool allowPap() const; | ||
988 | 61 | |||
989 | 62 | Q_PROPERTY(bool allowChap READ allowChap WRITE setAllowChap) | ||
990 | 63 | bool allowChap() const; | ||
991 | 64 | |||
992 | 65 | Q_PROPERTY(bool allowMschap READ allowMschap WRITE setAllowMschap) | ||
993 | 66 | bool allowMschap() const; | ||
994 | 67 | |||
995 | 68 | Q_PROPERTY(bool allowMschapv2 READ allowMschapv2 WRITE setAllowMschapv2) | ||
996 | 69 | bool allowMschapv2() const; | ||
997 | 70 | |||
998 | 71 | Q_PROPERTY(bool allowEap READ allowEap WRITE setAllowEap) | ||
999 | 72 | bool allowEap() const; | ||
1000 | 73 | |||
1001 | 74 | Q_PROPERTY(bool requireMppe READ requireMppe WRITE setRequireMppe) | ||
1002 | 75 | bool requireMppe() const; | ||
1003 | 76 | |||
1004 | 77 | Q_PROPERTY(int mppeType READ mppeType WRITE setMppeType) | ||
1005 | 78 | int mppeType() const; | ||
1006 | 79 | |||
1007 | 80 | Q_PROPERTY(bool mppeStateful READ mppeStateful WRITE setMppeStateful) | ||
1008 | 81 | bool mppeStateful() const; | ||
1009 | 82 | |||
1010 | 83 | Q_PROPERTY(bool bsdCompression READ bsdCompression WRITE setBsdCompression) | ||
1011 | 84 | bool bsdCompression() const; | ||
1012 | 85 | |||
1013 | 86 | Q_PROPERTY(bool deflateCompression READ deflateCompression WRITE setDeflateCompression) | ||
1014 | 87 | bool deflateCompression() const; | ||
1015 | 88 | |||
1016 | 89 | Q_PROPERTY(bool tcpHeaderCompression READ tcpHeaderCompression WRITE setTcpHeaderCompression) | ||
1017 | 90 | bool tcpHeaderCompression() const; | ||
1018 | 91 | |||
1019 | 92 | Q_PROPERTY(bool sendPppEchoPackets READ sendPppEchoPackets WRITE setSendPppEchoPackets) | ||
1020 | 93 | bool sendPppEchoPackets() const; | ||
1021 | 94 | |||
1022 | 95 | protected: | ||
1023 | 96 | void notifyProperty(const QString& propertyName); | ||
1024 | 97 | |||
1025 | 98 | protected Q_SLOTS: | ||
1026 | 99 | // Enum properties | ||
1027 | 100 | void setMppeType(int value); | ||
1028 | 101 | |||
1029 | 102 | // Basic properties | ||
1030 | 103 | |||
1031 | 104 | void gatewayUpdated(const QString &value); | ||
1032 | 105 | |||
1033 | 106 | void userUpdated(const QString &value); | ||
1034 | 107 | |||
1035 | 108 | void passwordUpdated(const QString &value); | ||
1036 | 109 | |||
1037 | 110 | void domainUpdated(const QString &value); | ||
1038 | 111 | |||
1039 | 112 | // Advanced properties | ||
1040 | 113 | |||
1041 | 114 | void allowPapUpdated(bool value); | ||
1042 | 115 | |||
1043 | 116 | void allowChapUpdated(bool value); | ||
1044 | 117 | |||
1045 | 118 | void allowMschapUpdated(bool value); | ||
1046 | 119 | |||
1047 | 120 | void allowMschapv2Updated(bool value); | ||
1048 | 121 | |||
1049 | 122 | void allowEapUpdated(bool value); | ||
1050 | 123 | |||
1051 | 124 | void requireMppeUpdated(bool value); | ||
1052 | 125 | |||
1053 | 126 | void mppeTypeUpdated(nmofono::vpn::PptpConnection::MppeType value); | ||
1054 | 127 | |||
1055 | 128 | void mppeStatefulUpdated(bool value); | ||
1056 | 129 | |||
1057 | 130 | void bsdCompressionUpdated(bool value); | ||
1058 | 131 | |||
1059 | 132 | void deflateCompressionUpdated(bool value); | ||
1060 | 133 | |||
1061 | 134 | void tcpHeaderCompressionUpdated(bool value); | ||
1062 | 135 | |||
1063 | 136 | void sendPppEchoPacketsUpdated(bool value); | ||
1064 | 137 | |||
1065 | 138 | Q_SIGNALS: | ||
1066 | 139 | // Basic properties | ||
1067 | 140 | |||
1068 | 141 | void setGateway(const QString &value); | ||
1069 | 142 | |||
1070 | 143 | void setUser(const QString &value); | ||
1071 | 144 | |||
1072 | 145 | void setPassword(const QString &value); | ||
1073 | 146 | |||
1074 | 147 | void setDomain(const QString &value); | ||
1075 | 148 | |||
1076 | 149 | // Advanced properties | ||
1077 | 150 | |||
1078 | 151 | void setAllowPap(bool value); | ||
1079 | 152 | |||
1080 | 153 | void setAllowChap(bool value); | ||
1081 | 154 | |||
1082 | 155 | void setAllowMschap(bool value); | ||
1083 | 156 | |||
1084 | 157 | void setAllowMschapv2(bool value); | ||
1085 | 158 | |||
1086 | 159 | void setAllowEap(bool value); | ||
1087 | 160 | |||
1088 | 161 | void setRequireMppe(bool value); | ||
1089 | 162 | |||
1090 | 163 | void setMppeStateful(bool value); | ||
1091 | 164 | |||
1092 | 165 | void setBsdCompression(bool value); | ||
1093 | 166 | |||
1094 | 167 | void setDeflateCompression(bool value); | ||
1095 | 168 | |||
1096 | 169 | void setTcpHeaderCompression(bool value); | ||
1097 | 170 | |||
1098 | 171 | void setSendPppEchoPackets(bool value); | ||
1099 | 172 | |||
1100 | 173 | protected: | ||
1101 | 174 | nmofono::vpn::PptpConnection::SPtr m_pptpConnection; | ||
1102 | 175 | }; | ||
1103 | 176 | |||
1104 | 177 | } | ||
1105 | 0 | 178 | ||
1106 | === added file 'src/indicator/nmofono/vpn/pptp-connection.cpp' | |||
1107 | --- src/indicator/nmofono/vpn/pptp-connection.cpp 1970-01-01 00:00:00 +0000 | |||
1108 | +++ src/indicator/nmofono/vpn/pptp-connection.cpp 2016-02-15 09:40:45 +0000 | |||
1109 | @@ -0,0 +1,417 @@ | |||
1110 | 1 | /* | ||
1111 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
1112 | 3 | * | ||
1113 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1114 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
1115 | 6 | * by the Free Software Foundation. | ||
1116 | 7 | * | ||
1117 | 8 | * This program is distributed in the hope that it will be useful, but | ||
1118 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
1119 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
1120 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
1121 | 12 | * | ||
1122 | 13 | * You should have received a copy of the GNU General Public License along | ||
1123 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1124 | 15 | * | ||
1125 | 16 | * Authors: | ||
1126 | 17 | * Pete Woods <pete.woods@canonical.com> | ||
1127 | 18 | */ | ||
1128 | 19 | |||
1129 | 20 | #include <nmofono/vpn/pptp-connection.h> | ||
1130 | 21 | |||
1131 | 22 | #include <NetworkManagerSettingsConnectionInterface.h> | ||
1132 | 23 | |||
1133 | 24 | using namespace std; | ||
1134 | 25 | |||
1135 | 26 | #define DEFINE_UPDATE_SETTER(name, uppername, type)\ | ||
1136 | 27 | void set##uppername(type value)\ | ||
1137 | 28 | {\ | ||
1138 | 29 | if (m_data.m_##name == value)\ | ||
1139 | 30 | {\ | ||
1140 | 31 | return;\ | ||
1141 | 32 | }\ | ||
1142 | 33 | m_data.m_##name = value;\ | ||
1143 | 34 | Q_EMIT p.name##Changed(m_data.m_##name);\ | ||
1144 | 35 | } | ||
1145 | 36 | |||
1146 | 37 | #define DEFINE_UPDATE_PROPERTY_STRING(name, uppername, strname) \ | ||
1147 | 38 | void update##uppername(const QStringMap& data)\ | ||
1148 | 39 | {\ | ||
1149 | 40 | set##uppername(data.value(strname));\ | ||
1150 | 41 | }\ | ||
1151 | 42 | \ | ||
1152 | 43 | DEFINE_UPDATE_SETTER(name, uppername, const QString &) | ||
1153 | 44 | |||
1154 | 45 | #define DEFINE_UPDATE_PROPERTY_ANTIBOOL(name, uppername, strname) \ | ||
1155 | 46 | void update##uppername(const QStringMap& data)\ | ||
1156 | 47 | {\ | ||
1157 | 48 | set##uppername(data.value(strname) != "yes");\ | ||
1158 | 49 | }\ | ||
1159 | 50 | \ | ||
1160 | 51 | DEFINE_UPDATE_SETTER(name, uppername, bool) | ||
1161 | 52 | |||
1162 | 53 | #define DEFINE_UPDATE_PROPERTY_PAIR(name, uppername, strname, type, conversion)\ | ||
1163 | 54 | void update##uppername(const QStringMap& data)\ | ||
1164 | 55 | {\ | ||
1165 | 56 | auto it = data.constFind(strname);\ | ||
1166 | 57 | bool found = (it != data.constEnd());\ | ||
1167 | 58 | set##uppername##Set(found);\ | ||
1168 | 59 | if (found)\ | ||
1169 | 60 | {\ | ||
1170 | 61 | set##uppername(it->conversion);\ | ||
1171 | 62 | }\ | ||
1172 | 63 | }\ | ||
1173 | 64 | \ | ||
1174 | 65 | DEFINE_UPDATE_SETTER(name, uppername, type)\ | ||
1175 | 66 | \ | ||
1176 | 67 | DEFINE_UPDATE_SETTER(name##Set, uppername##Set, bool)\ | ||
1177 | 68 | |||
1178 | 69 | #define DEFINE_PROPERTY_GETTER(name,type) \ | ||
1179 | 70 | type PptpConnection::name() const\ | ||
1180 | 71 | {\ | ||
1181 | 72 | return d->m_data.m_##name;\ | ||
1182 | 73 | }\ | ||
1183 | 74 | |||
1184 | 75 | #define DEFINE_PROPERTY_SETTER(varname, uppername, type) \ | ||
1185 | 76 | void PptpConnection::set##uppername(type value)\ | ||
1186 | 77 | {\ | ||
1187 | 78 | if (d->m_data.m_##varname == value)\ | ||
1188 | 79 | {\ | ||
1189 | 80 | return;\ | ||
1190 | 81 | }\ | ||
1191 | 82 | Priv::Data data(d->m_data);\ | ||
1192 | 83 | data.m_##varname = value;\ | ||
1193 | 84 | Q_EMIT updateVpnData(data.buildData());\ | ||
1194 | 85 | } | ||
1195 | 86 | |||
1196 | 87 | #define DEFINE_SECRET_PROPERTY_SETTER(varname, uppername, type) \ | ||
1197 | 88 | void PptpConnection::set##uppername(type value)\ | ||
1198 | 89 | {\ | ||
1199 | 90 | if (d->m_data.m_##varname == value)\ | ||
1200 | 91 | {\ | ||
1201 | 92 | return;\ | ||
1202 | 93 | }\ | ||
1203 | 94 | Priv::Data data(d->m_data);\ | ||
1204 | 95 | data.m_##varname = value;\ | ||
1205 | 96 | Q_EMIT updateVpnSecrets(data.buildSecrets());\ | ||
1206 | 97 | } | ||
1207 | 98 | |||
1208 | 99 | namespace nmofono | ||
1209 | 100 | { | ||
1210 | 101 | namespace vpn | ||
1211 | 102 | { | ||
1212 | 103 | |||
1213 | 104 | class PptpConnection::Priv | ||
1214 | 105 | { | ||
1215 | 106 | public: | ||
1216 | 107 | struct Data | ||
1217 | 108 | { | ||
1218 | 109 | Data() | ||
1219 | 110 | { | ||
1220 | 111 | } | ||
1221 | 112 | |||
1222 | 113 | Data(const Data& other) : | ||
1223 | 114 | // Basic properties | ||
1224 | 115 | |||
1225 | 116 | m_gateway(other.m_gateway), | ||
1226 | 117 | m_user(other.m_user), | ||
1227 | 118 | m_password(other.m_password), | ||
1228 | 119 | m_domain(other.m_domain), | ||
1229 | 120 | |||
1230 | 121 | // Advanced properties | ||
1231 | 122 | |||
1232 | 123 | m_allowPap(other.m_allowPap), | ||
1233 | 124 | m_allowChap(other.m_allowChap), | ||
1234 | 125 | m_allowMschap(other.m_allowMschap), | ||
1235 | 126 | m_allowMschapv2(other.m_allowMschapv2), | ||
1236 | 127 | m_allowEap(other.m_allowEap), | ||
1237 | 128 | m_requireMppe(other.m_requireMppe), | ||
1238 | 129 | m_mppeType(other.m_mppeType), | ||
1239 | 130 | m_mppeStateful(other.m_mppeStateful), | ||
1240 | 131 | m_bsdCompression(other.m_bsdCompression), | ||
1241 | 132 | m_deflateCompression(other.m_deflateCompression), | ||
1242 | 133 | m_tcpHeaderCompression(other.m_tcpHeaderCompression), | ||
1243 | 134 | m_sendPppEchoPackets(other.m_sendPppEchoPackets) | ||
1244 | 135 | { | ||
1245 | 136 | } | ||
1246 | 137 | |||
1247 | 138 | Data& operator=(const Data& other) = delete; | ||
1248 | 139 | |||
1249 | 140 | QStringMap buildSecrets() | ||
1250 | 141 | { | ||
1251 | 142 | QStringMap secrets; | ||
1252 | 143 | |||
1253 | 144 | if (!m_password.isEmpty()) | ||
1254 | 145 | { | ||
1255 | 146 | secrets["password"] = m_password; | ||
1256 | 147 | } | ||
1257 | 148 | |||
1258 | 149 | return secrets; | ||
1259 | 150 | } | ||
1260 | 151 | |||
1261 | 152 | QStringMap buildData() | ||
1262 | 153 | { | ||
1263 | 154 | QStringMap data; | ||
1264 | 155 | |||
1265 | 156 | // Basic properties | ||
1266 | 157 | |||
1267 | 158 | data["gateway"] = m_gateway; | ||
1268 | 159 | data["user"] = m_user; | ||
1269 | 160 | if (!m_domain.isEmpty()) | ||
1270 | 161 | { | ||
1271 | 162 | data["domain"] = m_domain; | ||
1272 | 163 | } | ||
1273 | 164 | |||
1274 | 165 | data["password-flags"] = "1"; | ||
1275 | 166 | |||
1276 | 167 | // Advanced properties | ||
1277 | 168 | |||
1278 | 169 | static const QMap<MppeType, QString> mppeTypeMap | ||
1279 | 170 | { | ||
1280 | 171 | {MppeType::MPPE_ALL, "require-mppe"}, | ||
1281 | 172 | {MppeType::MPPE_128, "require-mppe-128"}, | ||
1282 | 173 | {MppeType::MPPE_40, "require-mppe-40"}, | ||
1283 | 174 | }; | ||
1284 | 175 | |||
1285 | 176 | if (!m_requireMppe) | ||
1286 | 177 | { | ||
1287 | 178 | if (!m_allowPap) | ||
1288 | 179 | { | ||
1289 | 180 | data["refuse-pap"] = "yes"; | ||
1290 | 181 | } | ||
1291 | 182 | if (!m_allowChap) | ||
1292 | 183 | { | ||
1293 | 184 | data["refuse-chap"] = "yes"; | ||
1294 | 185 | } | ||
1295 | 186 | } | ||
1296 | 187 | if (!m_allowMschap) | ||
1297 | 188 | { | ||
1298 | 189 | data["refuse-mschap"] = "yes"; | ||
1299 | 190 | } | ||
1300 | 191 | if (!m_allowMschapv2) | ||
1301 | 192 | { | ||
1302 | 193 | data["refuse-mschapv2"] = "yes"; | ||
1303 | 194 | } | ||
1304 | 195 | if (!m_requireMppe) | ||
1305 | 196 | { | ||
1306 | 197 | if (!m_allowEap) | ||
1307 | 198 | { | ||
1308 | 199 | data["refuse-eap"] = "yes"; | ||
1309 | 200 | } | ||
1310 | 201 | } | ||
1311 | 202 | |||
1312 | 203 | if ((m_allowMschap || m_allowMschapv2) && m_requireMppe) | ||
1313 | 204 | { | ||
1314 | 205 | data[mppeTypeMap[m_mppeType]] = "yes"; | ||
1315 | 206 | if (m_mppeStateful) | ||
1316 | 207 | { | ||
1317 | 208 | data["mppe-stateful"] = "yes"; | ||
1318 | 209 | } | ||
1319 | 210 | } | ||
1320 | 211 | |||
1321 | 212 | if (!m_bsdCompression) | ||
1322 | 213 | { | ||
1323 | 214 | data["nobsdcomp"] = "yes"; | ||
1324 | 215 | } | ||
1325 | 216 | if (!m_deflateCompression) | ||
1326 | 217 | { | ||
1327 | 218 | data["nodeflate"] = "yes"; | ||
1328 | 219 | } | ||
1329 | 220 | if (!m_tcpHeaderCompression) | ||
1330 | 221 | { | ||
1331 | 222 | data["no-vj-comp"] = "yes"; | ||
1332 | 223 | } | ||
1333 | 224 | |||
1334 | 225 | if (m_sendPppEchoPackets) | ||
1335 | 226 | { | ||
1336 | 227 | data["lcp-echo-interval"] = "30"; | ||
1337 | 228 | data["lcp-echo-failure"] = "5"; | ||
1338 | 229 | } | ||
1339 | 230 | |||
1340 | 231 | return data; | ||
1341 | 232 | } | ||
1342 | 233 | |||
1343 | 234 | // Basic properties | ||
1344 | 235 | |||
1345 | 236 | QString m_gateway; | ||
1346 | 237 | QString m_user; | ||
1347 | 238 | QString m_password; | ||
1348 | 239 | QString m_domain; | ||
1349 | 240 | |||
1350 | 241 | // Advanced properties | ||
1351 | 242 | |||
1352 | 243 | bool m_allowPap = true; | ||
1353 | 244 | bool m_allowChap = true; | ||
1354 | 245 | bool m_allowMschap = true; | ||
1355 | 246 | bool m_allowMschapv2 = true; | ||
1356 | 247 | bool m_allowEap = true; | ||
1357 | 248 | bool m_requireMppe = false; | ||
1358 | 249 | MppeType m_mppeType = MppeType::MPPE_ALL; | ||
1359 | 250 | bool m_mppeStateful = false; | ||
1360 | 251 | bool m_bsdCompression = true; | ||
1361 | 252 | bool m_deflateCompression = true; | ||
1362 | 253 | bool m_tcpHeaderCompression = true; | ||
1363 | 254 | bool m_sendPppEchoPackets = false; | ||
1364 | 255 | }; | ||
1365 | 256 | |||
1366 | 257 | Priv(PptpConnection& parent) : | ||
1367 | 258 | p(parent) | ||
1368 | 259 | { | ||
1369 | 260 | } | ||
1370 | 261 | |||
1371 | 262 | // Basic properties | ||
1372 | 263 | |||
1373 | 264 | DEFINE_UPDATE_PROPERTY_STRING(gateway, Gateway, "gateway") | ||
1374 | 265 | DEFINE_UPDATE_PROPERTY_STRING(user, User, "user") | ||
1375 | 266 | DEFINE_UPDATE_PROPERTY_STRING(password, Password, "password") | ||
1376 | 267 | DEFINE_UPDATE_PROPERTY_STRING(domain, Domain, "domain") | ||
1377 | 268 | |||
1378 | 269 | // Advanced properties | ||
1379 | 270 | |||
1380 | 271 | DEFINE_UPDATE_PROPERTY_ANTIBOOL(allowPap, AllowPap, "refuse-pap") | ||
1381 | 272 | DEFINE_UPDATE_PROPERTY_ANTIBOOL(allowChap, AllowChap, "refuse-chap") | ||
1382 | 273 | DEFINE_UPDATE_PROPERTY_ANTIBOOL(allowMschap, AllowMschap, "refuse-mschap") | ||
1383 | 274 | DEFINE_UPDATE_PROPERTY_ANTIBOOL(allowMschapv2, AllowMschapv2, "refuse-mschapv2") | ||
1384 | 275 | DEFINE_UPDATE_PROPERTY_ANTIBOOL(allowEap, AllowEap, "refuse-eap") | ||
1385 | 276 | |||
1386 | 277 | void updateMppe(const QStringMap& data) | ||
1387 | 278 | { | ||
1388 | 279 | bool requireMppe = false; | ||
1389 | 280 | MppeType mppeType = MppeType::MPPE_ALL; | ||
1390 | 281 | |||
1391 | 282 | QString tmp = data.value("require-mppe"); | ||
1392 | 283 | if (tmp == "yes") | ||
1393 | 284 | { | ||
1394 | 285 | requireMppe = true; | ||
1395 | 286 | mppeType = MppeType::MPPE_ALL; | ||
1396 | 287 | } | ||
1397 | 288 | else | ||
1398 | 289 | { | ||
1399 | 290 | tmp = data.value("require-mppe-128"); | ||
1400 | 291 | if (tmp == "yes") | ||
1401 | 292 | { | ||
1402 | 293 | requireMppe = true; | ||
1403 | 294 | mppeType = MppeType::MPPE_128; | ||
1404 | 295 | } | ||
1405 | 296 | else | ||
1406 | 297 | { | ||
1407 | 298 | tmp = data.value("require-mppe-40"); | ||
1408 | 299 | if (tmp == "yes") | ||
1409 | 300 | { | ||
1410 | 301 | requireMppe = true; | ||
1411 | 302 | mppeType = MppeType::MPPE_40; | ||
1412 | 303 | } | ||
1413 | 304 | } | ||
1414 | 305 | } | ||
1415 | 306 | |||
1416 | 307 | setRequireMppe(requireMppe); | ||
1417 | 308 | if (requireMppe) | ||
1418 | 309 | { | ||
1419 | 310 | setMppeType(mppeType); | ||
1420 | 311 | } | ||
1421 | 312 | setMppeStateful(data.value("mppe-stateful") == "yes"); | ||
1422 | 313 | } | ||
1423 | 314 | DEFINE_UPDATE_SETTER(requireMppe, RequireMppe, bool) | ||
1424 | 315 | DEFINE_UPDATE_SETTER(mppeType, MppeType, PptpConnection::MppeType) | ||
1425 | 316 | DEFINE_UPDATE_SETTER(mppeStateful, MppeStateful, bool) | ||
1426 | 317 | |||
1427 | 318 | DEFINE_UPDATE_PROPERTY_ANTIBOOL(bsdCompression, BsdCompression, "nobsdcomp") | ||
1428 | 319 | DEFINE_UPDATE_PROPERTY_ANTIBOOL(deflateCompression, DeflateCompression, "nodeflate") | ||
1429 | 320 | DEFINE_UPDATE_PROPERTY_ANTIBOOL(tcpHeaderCompression, TcpHeaderCompression, "no-vj-comp") | ||
1430 | 321 | |||
1431 | 322 | void updateSendPppEchoPackets(const QStringMap& data) | ||
1432 | 323 | { | ||
1433 | 324 | setSendPppEchoPackets(data.contains("lcp-echo-interval") || data.contains("lcp-echo-failure")); | ||
1434 | 325 | } | ||
1435 | 326 | DEFINE_UPDATE_SETTER(sendPppEchoPackets, SendPppEchoPackets, bool) | ||
1436 | 327 | |||
1437 | 328 | PptpConnection& p; | ||
1438 | 329 | |||
1439 | 330 | Data m_data; | ||
1440 | 331 | }; | ||
1441 | 332 | |||
1442 | 333 | PptpConnection::PptpConnection() : | ||
1443 | 334 | d(new Priv(*this)) | ||
1444 | 335 | { | ||
1445 | 336 | } | ||
1446 | 337 | |||
1447 | 338 | PptpConnection::~PptpConnection() | ||
1448 | 339 | { | ||
1449 | 340 | } | ||
1450 | 341 | |||
1451 | 342 | void PptpConnection::updateData(const QStringMap& data) | ||
1452 | 343 | { | ||
1453 | 344 | // Basic properties | ||
1454 | 345 | |||
1455 | 346 | d->updateGateway(data); | ||
1456 | 347 | d->updateUser(data); | ||
1457 | 348 | d->updateDomain(data); | ||
1458 | 349 | |||
1459 | 350 | // Advanced properties | ||
1460 | 351 | |||
1461 | 352 | d->updateAllowPap(data); | ||
1462 | 353 | d->updateAllowChap(data); | ||
1463 | 354 | d->updateAllowMschap(data); | ||
1464 | 355 | d->updateAllowMschapv2(data); | ||
1465 | 356 | d->updateAllowEap(data); | ||
1466 | 357 | d->updateMppe(data); | ||
1467 | 358 | d->updateBsdCompression(data); | ||
1468 | 359 | d->updateDeflateCompression(data); | ||
1469 | 360 | d->updateTcpHeaderCompression(data); | ||
1470 | 361 | d->updateSendPppEchoPackets(data); | ||
1471 | 362 | |||
1472 | 363 | } | ||
1473 | 364 | |||
1474 | 365 | void PptpConnection::updateSecrets(const QStringMap& secrets) | ||
1475 | 366 | { | ||
1476 | 367 | d->updatePassword(secrets); | ||
1477 | 368 | } | ||
1478 | 369 | |||
1479 | 370 | // Basic properties | ||
1480 | 371 | |||
1481 | 372 | DEFINE_PROPERTY_GETTER(gateway, QString) | ||
1482 | 373 | DEFINE_PROPERTY_GETTER(user, QString) | ||
1483 | 374 | DEFINE_PROPERTY_GETTER(password, QString) | ||
1484 | 375 | DEFINE_PROPERTY_GETTER(domain, QString) | ||
1485 | 376 | |||
1486 | 377 | // Advanced properties | ||
1487 | 378 | |||
1488 | 379 | DEFINE_PROPERTY_GETTER(allowPap, bool) | ||
1489 | 380 | DEFINE_PROPERTY_GETTER(allowChap, bool) | ||
1490 | 381 | DEFINE_PROPERTY_GETTER(allowMschap, bool) | ||
1491 | 382 | DEFINE_PROPERTY_GETTER(allowMschapv2, bool) | ||
1492 | 383 | DEFINE_PROPERTY_GETTER(allowEap, bool) | ||
1493 | 384 | DEFINE_PROPERTY_GETTER(requireMppe, bool) | ||
1494 | 385 | DEFINE_PROPERTY_GETTER(mppeType, PptpConnection::MppeType) | ||
1495 | 386 | DEFINE_PROPERTY_GETTER(mppeStateful, bool) | ||
1496 | 387 | DEFINE_PROPERTY_GETTER(bsdCompression, bool) | ||
1497 | 388 | DEFINE_PROPERTY_GETTER(deflateCompression, bool) | ||
1498 | 389 | DEFINE_PROPERTY_GETTER(tcpHeaderCompression, bool) | ||
1499 | 390 | DEFINE_PROPERTY_GETTER(sendPppEchoPackets, bool) | ||
1500 | 391 | |||
1501 | 392 | |||
1502 | 393 | |||
1503 | 394 | // Basic properties | ||
1504 | 395 | |||
1505 | 396 | DEFINE_PROPERTY_SETTER(gateway, Gateway, const QString &) | ||
1506 | 397 | DEFINE_PROPERTY_SETTER(user, User, const QString &) | ||
1507 | 398 | DEFINE_SECRET_PROPERTY_SETTER(password, Password, const QString &) | ||
1508 | 399 | DEFINE_PROPERTY_SETTER(domain, Domain, const QString &) | ||
1509 | 400 | |||
1510 | 401 | // Advanced properties | ||
1511 | 402 | |||
1512 | 403 | DEFINE_PROPERTY_SETTER(allowPap, AllowPap, bool) | ||
1513 | 404 | DEFINE_PROPERTY_SETTER(allowChap, AllowChap, bool) | ||
1514 | 405 | DEFINE_PROPERTY_SETTER(allowMschap, AllowMschap, bool) | ||
1515 | 406 | DEFINE_PROPERTY_SETTER(allowMschapv2, AllowMschapv2, bool) | ||
1516 | 407 | DEFINE_PROPERTY_SETTER(allowEap, AllowEap, bool) | ||
1517 | 408 | DEFINE_PROPERTY_SETTER(requireMppe, RequireMppe, bool) | ||
1518 | 409 | DEFINE_PROPERTY_SETTER(mppeType, MppeType, MppeType) | ||
1519 | 410 | DEFINE_PROPERTY_SETTER(mppeStateful, MppeStateful, bool) | ||
1520 | 411 | DEFINE_PROPERTY_SETTER(bsdCompression, BsdCompression, bool) | ||
1521 | 412 | DEFINE_PROPERTY_SETTER(deflateCompression, DeflateCompression, bool) | ||
1522 | 413 | DEFINE_PROPERTY_SETTER(tcpHeaderCompression, TcpHeaderCompression, bool) | ||
1523 | 414 | DEFINE_PROPERTY_SETTER(sendPppEchoPackets, SendPppEchoPackets, bool) | ||
1524 | 415 | |||
1525 | 416 | } | ||
1526 | 417 | } | ||
1527 | 0 | 418 | ||
1528 | === added file 'src/indicator/nmofono/vpn/pptp-connection.h' | |||
1529 | --- src/indicator/nmofono/vpn/pptp-connection.h 1970-01-01 00:00:00 +0000 | |||
1530 | +++ src/indicator/nmofono/vpn/pptp-connection.h 2016-02-15 09:40:45 +0000 | |||
1531 | @@ -0,0 +1,192 @@ | |||
1532 | 1 | /* | ||
1533 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
1534 | 3 | * | ||
1535 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1536 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
1537 | 6 | * by the Free Software Foundation. | ||
1538 | 7 | * | ||
1539 | 8 | * This program is distributed in the hope that it will be useful, but | ||
1540 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
1541 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
1542 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
1543 | 12 | * | ||
1544 | 13 | * You should have received a copy of the GNU General Public License along | ||
1545 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1546 | 15 | * | ||
1547 | 16 | * Authors: | ||
1548 | 17 | * Pete Woods <pete.woods@canonical.com> | ||
1549 | 18 | */ | ||
1550 | 19 | |||
1551 | 20 | #pragma once | ||
1552 | 21 | |||
1553 | 22 | #include <QObject> | ||
1554 | 23 | #include <QVariantMap> | ||
1555 | 24 | |||
1556 | 25 | #include <unity/util/DefinesPtrs.h> | ||
1557 | 26 | |||
1558 | 27 | class OrgFreedesktopNetworkManagerSettingsConnectionInterface; | ||
1559 | 28 | |||
1560 | 29 | namespace nmofono | ||
1561 | 30 | { | ||
1562 | 31 | namespace vpn | ||
1563 | 32 | { | ||
1564 | 33 | |||
1565 | 34 | class PptpConnection : public QObject | ||
1566 | 35 | { | ||
1567 | 36 | Q_OBJECT | ||
1568 | 37 | |||
1569 | 38 | public: | ||
1570 | 39 | UNITY_DEFINES_PTRS(PptpConnection); | ||
1571 | 40 | |||
1572 | 41 | enum class MppeType | ||
1573 | 42 | { | ||
1574 | 43 | MPPE_ALL, | ||
1575 | 44 | MPPE_128, | ||
1576 | 45 | MPPE_40 | ||
1577 | 46 | }; | ||
1578 | 47 | |||
1579 | 48 | PptpConnection(); | ||
1580 | 49 | |||
1581 | 50 | ~PptpConnection(); | ||
1582 | 51 | |||
1583 | 52 | // Basic properties | ||
1584 | 53 | |||
1585 | 54 | Q_PROPERTY(QString gateway READ gateway WRITE setGateway NOTIFY gatewayChanged) | ||
1586 | 55 | QString gateway() const; | ||
1587 | 56 | |||
1588 | 57 | Q_PROPERTY(QString user READ user WRITE setUser NOTIFY userChanged) | ||
1589 | 58 | QString user() const; | ||
1590 | 59 | |||
1591 | 60 | Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) | ||
1592 | 61 | QString password() const; | ||
1593 | 62 | |||
1594 | 63 | Q_PROPERTY(QString domain READ domain WRITE setDomain NOTIFY domainChanged) | ||
1595 | 64 | QString domain() const; | ||
1596 | 65 | |||
1597 | 66 | // Advanced properties | ||
1598 | 67 | |||
1599 | 68 | Q_PROPERTY(bool allowPap READ allowPap WRITE setAllowPap NOTIFY allowPapChanged) | ||
1600 | 69 | bool allowPap() const; | ||
1601 | 70 | |||
1602 | 71 | Q_PROPERTY(bool allowChap READ allowChap WRITE setAllowChap NOTIFY allowChapChanged) | ||
1603 | 72 | bool allowChap() const; | ||
1604 | 73 | |||
1605 | 74 | Q_PROPERTY(bool allowMschap READ allowMschap WRITE setAllowMschap NOTIFY allowMschapChanged) | ||
1606 | 75 | bool allowMschap() const; | ||
1607 | 76 | |||
1608 | 77 | Q_PROPERTY(bool allowMschapv2 READ allowMschapv2 WRITE setAllowMschapv2 NOTIFY allowMschapv2Changed) | ||
1609 | 78 | bool allowMschapv2() const; | ||
1610 | 79 | |||
1611 | 80 | Q_PROPERTY(bool allowEap READ allowEap WRITE setAllowEap NOTIFY allowEapChanged) | ||
1612 | 81 | bool allowEap() const; | ||
1613 | 82 | |||
1614 | 83 | Q_PROPERTY(bool requireMppe READ requireMppe WRITE setRequireMppe NOTIFY requireMppeChanged) | ||
1615 | 84 | bool requireMppe() const; | ||
1616 | 85 | |||
1617 | 86 | Q_PROPERTY(MppeType mppeType READ mppeType WRITE setMppeType NOTIFY mppeTypeChanged) | ||
1618 | 87 | MppeType mppeType() const; | ||
1619 | 88 | |||
1620 | 89 | Q_PROPERTY(bool mppeStateful READ mppeStateful WRITE setMppeStateful NOTIFY mppeStatefulChanged) | ||
1621 | 90 | bool mppeStateful() const; | ||
1622 | 91 | |||
1623 | 92 | Q_PROPERTY(bool bsdCompression READ bsdCompression WRITE setBsdCompression NOTIFY bsdCompressionChanged) | ||
1624 | 93 | bool bsdCompression() const; | ||
1625 | 94 | |||
1626 | 95 | Q_PROPERTY(bool deflateCompression READ deflateCompression WRITE setDeflateCompression NOTIFY deflateCompressionChanged) | ||
1627 | 96 | bool deflateCompression() const; | ||
1628 | 97 | |||
1629 | 98 | Q_PROPERTY(bool tcpHeaderCompression READ tcpHeaderCompression WRITE setTcpHeaderCompression NOTIFY tcpHeaderCompressionChanged) | ||
1630 | 99 | bool tcpHeaderCompression() const; | ||
1631 | 100 | |||
1632 | 101 | Q_PROPERTY(bool sendPppEchoPackets READ sendPppEchoPackets WRITE setSendPppEchoPackets NOTIFY sendPppEchoPacketsChanged) | ||
1633 | 102 | bool sendPppEchoPackets() const; | ||
1634 | 103 | |||
1635 | 104 | public Q_SLOTS: | ||
1636 | 105 | void updateData(const QMap<QString, QString>& data); | ||
1637 | 106 | |||
1638 | 107 | void updateSecrets(const QMap<QString, QString>& data); | ||
1639 | 108 | |||
1640 | 109 | // Basic properties | ||
1641 | 110 | |||
1642 | 111 | void setGateway(const QString &value); | ||
1643 | 112 | |||
1644 | 113 | void setUser(const QString &value); | ||
1645 | 114 | |||
1646 | 115 | void setPassword(const QString &value); | ||
1647 | 116 | |||
1648 | 117 | void setDomain(const QString &value); | ||
1649 | 118 | |||
1650 | 119 | // Advanced properties | ||
1651 | 120 | |||
1652 | 121 | void setAllowPap(bool value); | ||
1653 | 122 | |||
1654 | 123 | void setAllowChap(bool value); | ||
1655 | 124 | |||
1656 | 125 | void setAllowMschap(bool value); | ||
1657 | 126 | |||
1658 | 127 | void setAllowMschapv2(bool value); | ||
1659 | 128 | |||
1660 | 129 | void setAllowEap(bool value); | ||
1661 | 130 | |||
1662 | 131 | void setRequireMppe(bool value); | ||
1663 | 132 | |||
1664 | 133 | void setMppeType(MppeType value); | ||
1665 | 134 | |||
1666 | 135 | void setMppeStateful(bool value); | ||
1667 | 136 | |||
1668 | 137 | void setBsdCompression(bool value); | ||
1669 | 138 | |||
1670 | 139 | void setDeflateCompression(bool value); | ||
1671 | 140 | |||
1672 | 141 | void setTcpHeaderCompression(bool value); | ||
1673 | 142 | |||
1674 | 143 | void setSendPppEchoPackets(bool value); | ||
1675 | 144 | |||
1676 | 145 | Q_SIGNALS: | ||
1677 | 146 | void updateVpnData(const QMap<QString, QString>& vpnData); | ||
1678 | 147 | |||
1679 | 148 | void updateVpnSecrets(const QMap<QString, QString>& vpnSecrets); | ||
1680 | 149 | |||
1681 | 150 | // Basic properties | ||
1682 | 151 | |||
1683 | 152 | void gatewayChanged(const QString &value); | ||
1684 | 153 | |||
1685 | 154 | void userChanged(const QString &value); | ||
1686 | 155 | |||
1687 | 156 | void passwordChanged(const QString &value); | ||
1688 | 157 | |||
1689 | 158 | void domainChanged(const QString &value); | ||
1690 | 159 | |||
1691 | 160 | // Advanced properties | ||
1692 | 161 | |||
1693 | 162 | void allowPapChanged(bool value); | ||
1694 | 163 | |||
1695 | 164 | void allowChapChanged(bool value); | ||
1696 | 165 | |||
1697 | 166 | void allowMschapChanged(bool value); | ||
1698 | 167 | |||
1699 | 168 | void allowMschapv2Changed(bool value); | ||
1700 | 169 | |||
1701 | 170 | void allowEapChanged(bool value); | ||
1702 | 171 | |||
1703 | 172 | void requireMppeChanged(bool value); | ||
1704 | 173 | |||
1705 | 174 | void mppeTypeChanged(MppeType value); | ||
1706 | 175 | |||
1707 | 176 | void mppeStatefulChanged(bool value); | ||
1708 | 177 | |||
1709 | 178 | void bsdCompressionChanged(bool value); | ||
1710 | 179 | |||
1711 | 180 | void deflateCompressionChanged(bool value); | ||
1712 | 181 | |||
1713 | 182 | void tcpHeaderCompressionChanged(bool value); | ||
1714 | 183 | |||
1715 | 184 | void sendPppEchoPacketsChanged(bool value); | ||
1716 | 185 | |||
1717 | 186 | protected: | ||
1718 | 187 | class Priv; | ||
1719 | 188 | std::shared_ptr<Priv> d; | ||
1720 | 189 | }; | ||
1721 | 190 | |||
1722 | 191 | } | ||
1723 | 192 | } | ||
1724 | 0 | 193 | ||
1725 | === modified file 'src/indicator/nmofono/vpn/vpn-connection.cpp' | |||
1726 | --- src/indicator/nmofono/vpn/vpn-connection.cpp 2015-12-15 11:18:55 +0000 | |||
1727 | +++ src/indicator/nmofono/vpn/vpn-connection.cpp 2016-02-15 09:40:45 +0000 | |||
1728 | @@ -342,6 +342,8 @@ | |||
1729 | 342 | QDBusObjectPath m_otherActiveConnectionPath; | 342 | QDBusObjectPath m_otherActiveConnectionPath; |
1730 | 343 | 343 | ||
1731 | 344 | OpenvpnConnection::SPtr m_openvpnConnection; | 344 | OpenvpnConnection::SPtr m_openvpnConnection; |
1732 | 345 | |||
1733 | 346 | PptpConnection::SPtr m_pptpConnection; | ||
1734 | 345 | }; | 347 | }; |
1735 | 346 | 348 | ||
1736 | 347 | VpnConnection::VpnConnection( | 349 | VpnConnection::VpnConnection( |
1737 | @@ -381,7 +383,14 @@ | |||
1738 | 381 | connect(d->m_openvpnConnection.get(), &OpenvpnConnection::updateVpnData, d.get(), &Priv::updateVpnData); | 383 | connect(d->m_openvpnConnection.get(), &OpenvpnConnection::updateVpnData, d.get(), &Priv::updateVpnData); |
1739 | 382 | connect(d->m_openvpnConnection.get(), &OpenvpnConnection::updateVpnSecrets, d.get(), &Priv::updateVpnSecrets); | 384 | connect(d->m_openvpnConnection.get(), &OpenvpnConnection::updateVpnSecrets, d.get(), &Priv::updateVpnSecrets); |
1740 | 383 | break; | 385 | break; |
1742 | 384 | //TODO pptp, etc | 386 | case Type::pptp: |
1743 | 387 | d->m_pptpConnection = make_shared<PptpConnection>(); | ||
1744 | 388 | d->m_pptpConnection->updateData(d->m_settings["vpn"]["data"].value<QStringMap>()); | ||
1745 | 389 | connect(d.get(), &Priv::updateData, d->m_pptpConnection.get(), &PptpConnection::updateData); | ||
1746 | 390 | connect(d.get(), &Priv::updateSecrets, d->m_pptpConnection.get(), &PptpConnection::updateSecrets); | ||
1747 | 391 | connect(d->m_pptpConnection.get(), &PptpConnection::updateVpnData, d.get(), &Priv::updateVpnData); | ||
1748 | 392 | connect(d->m_pptpConnection.get(), &PptpConnection::updateVpnSecrets, d.get(), &Priv::updateVpnSecrets); | ||
1749 | 393 | break; | ||
1750 | 385 | default: | 394 | default: |
1751 | 386 | break; | 395 | break; |
1752 | 387 | } | 396 | } |
1753 | @@ -485,6 +494,11 @@ | |||
1754 | 485 | return d->m_openvpnConnection; | 494 | return d->m_openvpnConnection; |
1755 | 486 | } | 495 | } |
1756 | 487 | 496 | ||
1757 | 497 | PptpConnection::SPtr VpnConnection::pptpConnection() const | ||
1758 | 498 | { | ||
1759 | 499 | return d->m_pptpConnection; | ||
1760 | 500 | } | ||
1761 | 501 | |||
1762 | 488 | } | 502 | } |
1763 | 489 | } | 503 | } |
1764 | 490 | 504 | ||
1765 | 491 | 505 | ||
1766 | === modified file 'src/indicator/nmofono/vpn/vpn-connection.h' | |||
1767 | --- src/indicator/nmofono/vpn/vpn-connection.h 2015-12-04 13:18:04 +0000 | |||
1768 | +++ src/indicator/nmofono/vpn/vpn-connection.h 2016-02-15 09:40:45 +0000 | |||
1769 | @@ -27,6 +27,7 @@ | |||
1770 | 27 | 27 | ||
1771 | 28 | #include <nmofono/connection/active-connection-manager.h> | 28 | #include <nmofono/connection/active-connection-manager.h> |
1772 | 29 | #include <nmofono/vpn/openvpn-connection.h> | 29 | #include <nmofono/vpn/openvpn-connection.h> |
1773 | 30 | #include <nmofono/vpn/pptp-connection.h> | ||
1774 | 30 | 31 | ||
1775 | 31 | #include <unity/util/DefinesPtrs.h> | 32 | #include <unity/util/DefinesPtrs.h> |
1776 | 32 | 33 | ||
1777 | @@ -70,6 +71,8 @@ | |||
1778 | 70 | 71 | ||
1779 | 71 | OpenvpnConnection::SPtr openvpnConnection() const; | 72 | OpenvpnConnection::SPtr openvpnConnection() const; |
1780 | 72 | 73 | ||
1781 | 74 | PptpConnection::SPtr pptpConnection() const; | ||
1782 | 75 | |||
1783 | 73 | public Q_SLOTS: | 76 | public Q_SLOTS: |
1784 | 74 | void setActive(bool active); | 77 | void setActive(bool active); |
1785 | 75 | 78 | ||
1786 | 76 | 79 | ||
1787 | === modified file 'src/indicator/nmofono/vpn/vpn-manager.cpp' | |||
1788 | --- src/indicator/nmofono/vpn/vpn-manager.cpp 2015-12-11 14:58:11 +0000 | |||
1789 | +++ src/indicator/nmofono/vpn/vpn-manager.cpp 2016-02-15 09:40:45 +0000 | |||
1790 | @@ -233,7 +233,6 @@ | |||
1791 | 233 | 233 | ||
1792 | 234 | QString uuid = QUuid::createUuid().toString().mid(1,36); | 234 | QString uuid = QUuid::createUuid().toString().mid(1,36); |
1793 | 235 | 235 | ||
1794 | 236 | |||
1795 | 237 | QStringMap vpnData; | 236 | QStringMap vpnData; |
1796 | 238 | switch (type) | 237 | switch (type) |
1797 | 239 | { | 238 | { |
1798 | @@ -241,7 +240,7 @@ | |||
1799 | 241 | vpnData["connection-type"] = "tls"; | 240 | vpnData["connection-type"] = "tls"; |
1800 | 242 | break; | 241 | break; |
1801 | 243 | case VpnConnection::Type::pptp: | 242 | case VpnConnection::Type::pptp: |
1803 | 244 | // TODO PPTP | 243 | vpnData["password-flags"] = "1"; |
1804 | 245 | break; | 244 | break; |
1805 | 246 | }; | 245 | }; |
1806 | 247 | 246 | ||
1807 | @@ -251,13 +250,23 @@ | |||
1808 | 251 | { | 250 | { |
1809 | 252 | {"type", "vpn"}, | 251 | {"type", "vpn"}, |
1810 | 253 | {"id", d->newConnectionName()}, | 252 | {"id", d->newConnectionName()}, |
1812 | 254 | {"uuid", uuid} | 253 | {"uuid", uuid}, |
1813 | 254 | {"autoconnect", "false"} | ||
1814 | 255 | |||
1815 | 255 | }; | 256 | }; |
1816 | 256 | connection["vpn"] = QVariantMap | 257 | connection["vpn"] = QVariantMap |
1817 | 257 | { | 258 | { |
1818 | 258 | {"service-type", typeMap[type]}, | 259 | {"service-type", typeMap[type]}, |
1819 | 259 | {"data", QVariant::fromValue(vpnData)} | 260 | {"data", QVariant::fromValue(vpnData)} |
1820 | 260 | }; | 261 | }; |
1821 | 262 | connection["ipv4"] = QVariantMap | ||
1822 | 263 | { | ||
1823 | 264 | {"method", "auto"} | ||
1824 | 265 | }; | ||
1825 | 266 | connection["ipv6"] = QVariantMap | ||
1826 | 267 | { | ||
1827 | 268 | {"method", "auto"} | ||
1828 | 269 | }; | ||
1829 | 261 | 270 | ||
1830 | 262 | auto reply = d->m_settingsInterface->AddConnection(connection); | 271 | auto reply = d->m_settingsInterface->AddConnection(connection); |
1831 | 263 | reply.waitForFinished(); | 272 | reply.waitForFinished(); |
1832 | 264 | 273 | ||
1833 | === added directory 'src/vpn-editor/DialogFile' | |||
1834 | === renamed file 'src/vpn-editor/DialogFile.qml' => 'src/vpn-editor/DialogFile/DialogFile.qml' | |||
1835 | === renamed file 'src/vpn-editor/DialogFileProperties.qml' => 'src/vpn-editor/DialogFile/DialogFileProperties.qml' | |||
1836 | === renamed file 'src/vpn-editor/Openvpn/FileSelector.qml' => 'src/vpn-editor/DialogFile/FileSelector.qml' | |||
1837 | === renamed file 'src/vpn-editor/qmldir' => 'src/vpn-editor/DialogFile/qmldir' | |||
1838 | === modified file 'src/vpn-editor/Main.qml' | |||
1839 | --- src/vpn-editor/Main.qml 2016-01-06 16:38:31 +0000 | |||
1840 | +++ src/vpn-editor/Main.qml 2016-02-15 09:40:45 +0000 | |||
1841 | @@ -17,6 +17,7 @@ | |||
1842 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
1843 | 18 | import Ubuntu.Components 1.3 | 18 | import Ubuntu.Components 1.3 |
1844 | 19 | import Ubuntu.Connectivity 1.0 | 19 | import Ubuntu.Connectivity 1.0 |
1845 | 20 | import "DialogFile" | ||
1846 | 20 | 21 | ||
1847 | 21 | MainView { | 22 | MainView { |
1848 | 22 | id: root | 23 | id: root |
1849 | 23 | 24 | ||
1850 | === modified file 'src/vpn-editor/Openvpn/AdvancedGeneral.qml' | |||
1851 | --- src/vpn-editor/Openvpn/AdvancedGeneral.qml 2015-12-11 15:28:29 +0000 | |||
1852 | +++ src/vpn-editor/Openvpn/AdvancedGeneral.qml 2016-02-15 09:40:45 +0000 | |||
1853 | @@ -69,7 +69,8 @@ | |||
1854 | 69 | 69 | ||
1855 | 70 | ListItems.Standard { | 70 | ListItems.Standard { |
1856 | 71 | control: CheckBox { | 71 | control: CheckBox { |
1858 | 72 | checked: connection.compLzo | 72 | id: compLzoCheckbox |
1859 | 73 | Binding {target: compLzoCheckbox; property: "checked"; value: connection.compLzo} | ||
1860 | 73 | onCheckedChanged: connection.compLzo = checked | 74 | onCheckedChanged: connection.compLzo = checked |
1861 | 74 | } | 75 | } |
1862 | 75 | text: i18n.tr("Use LZO data compression") | 76 | text: i18n.tr("Use LZO data compression") |
1863 | @@ -77,7 +78,8 @@ | |||
1864 | 77 | 78 | ||
1865 | 78 | ListItems.Standard { | 79 | ListItems.Standard { |
1866 | 79 | control: CheckBox { | 80 | control: CheckBox { |
1868 | 80 | checked: connection.protoTcp | 81 | id: protoTcpCheckbox |
1869 | 82 | Binding {target: protoTcpCheckbox; property: "checked"; value: connection.protoTcp} | ||
1870 | 81 | onCheckedChanged: connection.protoTcp = checked | 83 | onCheckedChanged: connection.protoTcp = checked |
1871 | 82 | } | 84 | } |
1872 | 83 | text: i18n.tr("Use a TCP connection") | 85 | text: i18n.tr("Use a TCP connection") |
1873 | @@ -85,8 +87,8 @@ | |||
1874 | 85 | 87 | ||
1875 | 86 | OptionalValue { | 88 | OptionalValue { |
1876 | 87 | text: i18n.tr("Use custom virtual device type:") | 89 | text: i18n.tr("Use custom virtual device type:") |
1879 | 88 | 90 | id: devTypeSetCheckbox | |
1880 | 89 | checked: connection.devTypeSet | 91 | Binding {target: devTypeSetCheckbox; property: "checked"; value: connection.devTypeSet} |
1881 | 90 | onCheckedChanged: connection.devTypeSet = checked | 92 | onCheckedChanged: connection.devTypeSet = checked |
1882 | 91 | } | 93 | } |
1883 | 92 | ListItems.ItemSelector { | 94 | ListItems.ItemSelector { |
1884 | @@ -113,7 +115,8 @@ | |||
1885 | 113 | OptionalValue { | 115 | OptionalValue { |
1886 | 114 | text: i18n.tr("Use custom tunnel MTU:") | 116 | text: i18n.tr("Use custom tunnel MTU:") |
1887 | 115 | 117 | ||
1889 | 116 | checked: connection.tunnelMtuSet | 118 | id: tunnelMtuSetCheckbox |
1890 | 119 | Binding {target: tunnelMtuSetCheckbox; property: "checked"; value: connection.tunnelMtuSet} | ||
1891 | 117 | onCheckedChanged: connection.tunnelMtuSet = checked | 120 | onCheckedChanged: connection.tunnelMtuSet = checked |
1892 | 118 | 121 | ||
1893 | 119 | control: TextField { | 122 | control: TextField { |
1894 | @@ -129,7 +132,8 @@ | |||
1895 | 129 | OptionalValue { | 132 | OptionalValue { |
1896 | 130 | text: i18n.tr("Use UDP fragment size:") | 133 | text: i18n.tr("Use UDP fragment size:") |
1897 | 131 | 134 | ||
1899 | 132 | checked: connection.fragmentSizeSet | 135 | id: fragmentSizeSetCheckbox |
1900 | 136 | Binding {target: fragmentSizeSetCheckbox; property: "checked"; value: connection.fragmentSizeSet} | ||
1901 | 133 | onCheckedChanged: connection.fragmentSizeSet = checked | 137 | onCheckedChanged: connection.fragmentSizeSet = checked |
1902 | 134 | 138 | ||
1903 | 135 | control: TextField { | 139 | control: TextField { |
1904 | @@ -144,7 +148,8 @@ | |||
1905 | 144 | 148 | ||
1906 | 145 | ListItems.Standard { | 149 | ListItems.Standard { |
1907 | 146 | control: CheckBox { | 150 | control: CheckBox { |
1909 | 147 | checked: connection.mssFix | 151 | id: mssFixCheckbox |
1910 | 152 | Binding {target: mssFixCheckbox; property: "checked"; value: connection.mssFix} | ||
1911 | 148 | onCheckedChanged: connection.mssFix = checked | 153 | onCheckedChanged: connection.mssFix = checked |
1912 | 149 | } | 154 | } |
1913 | 150 | text: i18n.tr("Restrict tunnel TCP MSS") | 155 | text: i18n.tr("Restrict tunnel TCP MSS") |
1914 | @@ -152,7 +157,8 @@ | |||
1915 | 152 | 157 | ||
1916 | 153 | ListItems.Standard { | 158 | ListItems.Standard { |
1917 | 154 | control: CheckBox { | 159 | control: CheckBox { |
1919 | 155 | checked: connection.remoteRandom | 160 | id: remoteRandomCheckbox |
1920 | 161 | Binding {target: remoteRandomCheckbox; property: "checked"; value: connection.remoteRandom} | ||
1921 | 156 | onCheckedChanged: connection.remoteRandom = checked | 162 | onCheckedChanged: connection.remoteRandom = checked |
1922 | 157 | } | 163 | } |
1923 | 158 | text: i18n.tr("Randomize remote hosts") | 164 | text: i18n.tr("Randomize remote hosts") |
1924 | 159 | 165 | ||
1925 | === modified file 'src/vpn-editor/Openvpn/AdvancedProxies.qml' | |||
1926 | --- src/vpn-editor/Openvpn/AdvancedProxies.qml 2015-12-11 15:28:29 +0000 | |||
1927 | +++ src/vpn-editor/Openvpn/AdvancedProxies.qml 2016-02-15 09:40:45 +0000 | |||
1928 | @@ -76,7 +76,8 @@ | |||
1929 | 76 | ListItems.Standard { | 76 | ListItems.Standard { |
1930 | 77 | text: i18n.tr("Retry indefinitely:") | 77 | text: i18n.tr("Retry indefinitely:") |
1931 | 78 | control: CheckBox { | 78 | control: CheckBox { |
1933 | 79 | checked: connection.proxyRetry | 79 | id: proxyRetryCheckbox |
1934 | 80 | Binding {target: proxyRetryCheckbox; property: "checked"; value: connection.proxyRetry} | ||
1935 | 80 | onCheckedChanged: connection.proxyRetry = checked | 81 | onCheckedChanged: connection.proxyRetry = checked |
1936 | 81 | } | 82 | } |
1937 | 82 | enabled: usesProxy | 83 | enabled: usesProxy |
1938 | 83 | 84 | ||
1939 | === modified file 'src/vpn-editor/Openvpn/AdvancedSecurity.qml' | |||
1940 | --- src/vpn-editor/Openvpn/AdvancedSecurity.qml 2016-01-06 21:33:36 +0000 | |||
1941 | +++ src/vpn-editor/Openvpn/AdvancedSecurity.qml 2016-02-15 09:40:45 +0000 | |||
1942 | @@ -63,7 +63,8 @@ | |||
1943 | 63 | OptionalValue { | 63 | OptionalValue { |
1944 | 64 | text: i18n.tr("Use cipher key size:") | 64 | text: i18n.tr("Use cipher key size:") |
1945 | 65 | 65 | ||
1947 | 66 | checked: connection.keysizeSet | 66 | id: keysizeSetCheckbox |
1948 | 67 | Binding {target: keysizeSetCheckbox; property: "checked"; value: connection.keysizeSet} | ||
1949 | 67 | onCheckedChanged: connection.keysizeSet = checked | 68 | onCheckedChanged: connection.keysizeSet = checked |
1950 | 68 | 69 | ||
1951 | 69 | control: TextField { | 70 | control: TextField { |
1952 | 70 | 71 | ||
1953 | === modified file 'src/vpn-editor/Openvpn/AdvancedTls.qml' | |||
1954 | --- src/vpn-editor/Openvpn/AdvancedTls.qml 2016-01-06 16:38:31 +0000 | |||
1955 | +++ src/vpn-editor/Openvpn/AdvancedTls.qml 2016-02-15 09:40:45 +0000 | |||
1956 | @@ -17,6 +17,7 @@ | |||
1957 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
1958 | 18 | import Ubuntu.Components 1.3 | 18 | import Ubuntu.Components 1.3 |
1959 | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems |
1960 | 20 | import "../DialogFile" | ||
1961 | 20 | 21 | ||
1962 | 21 | Page { | 22 | Page { |
1963 | 22 | property var connection | 23 | property var connection |
1964 | @@ -48,7 +49,8 @@ | |||
1965 | 48 | OptionalValue { | 49 | OptionalValue { |
1966 | 49 | text: i18n.tr("Verify peer certificate:") | 50 | text: i18n.tr("Verify peer certificate:") |
1967 | 50 | 51 | ||
1969 | 51 | checked: connection.remoteCertTlsSet | 52 | id: remoteCertTlsSetCheckbox |
1970 | 53 | Binding {target: remoteCertTlsSetCheckbox; property: "checked"; value: connection.remoteCertTlsSet} | ||
1971 | 52 | onCheckedChanged: connection.remoteCertTlsSet = checked | 54 | onCheckedChanged: connection.remoteCertTlsSet = checked |
1972 | 53 | } | 55 | } |
1973 | 54 | ListItems.ValueSelector { | 56 | ListItems.ValueSelector { |
1974 | @@ -65,7 +67,8 @@ | |||
1975 | 65 | OptionalValue { | 67 | OptionalValue { |
1976 | 66 | text: i18n.tr("Use additional TLS authentication:") | 68 | text: i18n.tr("Use additional TLS authentication:") |
1977 | 67 | 69 | ||
1979 | 68 | checked: connection.taSet | 70 | id: taSetCheckbox |
1980 | 71 | Binding {target: taSetCheckbox; property: "checked"; value: connection.taSet} | ||
1981 | 69 | onCheckedChanged: connection.taSet = checked | 72 | onCheckedChanged: connection.taSet = checked |
1982 | 70 | } | 73 | } |
1983 | 71 | ListItems.Standard { | 74 | ListItems.Standard { |
1984 | 72 | 75 | ||
1985 | === modified file 'src/vpn-editor/Openvpn/Password.qml' | |||
1986 | --- src/vpn-editor/Openvpn/Password.qml 2015-12-11 14:56:59 +0000 | |||
1987 | +++ src/vpn-editor/Openvpn/Password.qml 2016-02-15 09:40:45 +0000 | |||
1988 | @@ -17,6 +17,7 @@ | |||
1989 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
1990 | 18 | import Ubuntu.Components 1.3 | 18 | import Ubuntu.Components 1.3 |
1991 | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems |
1992 | 20 | import "../DialogFile" | ||
1993 | 20 | 21 | ||
1994 | 21 | Column { | 22 | Column { |
1995 | 22 | property var connection | 23 | property var connection |
1996 | @@ -42,11 +43,10 @@ | |||
1997 | 42 | } | 43 | } |
1998 | 43 | 44 | ||
1999 | 44 | ListItems.Standard { | 45 | ListItems.Standard { |
2003 | 45 | control: TextField { | 46 | control: FileSelector { |
2004 | 46 | text: connection.ca | 47 | path: connection.ca |
2005 | 47 | onTextChanged: connection.ca = text | 48 | onPathChanged: connection.ca = path |
2006 | 48 | width: units.gu(20) | 49 | width: units.gu(20) |
2007 | 49 | inputMethodHints: Qt.ImhNoPredictiveText | ||
2008 | 50 | } | 50 | } |
2009 | 51 | text: i18n.tr("CA certificate:") | 51 | text: i18n.tr("CA certificate:") |
2010 | 52 | } | 52 | } |
2011 | 53 | 53 | ||
2012 | === modified file 'src/vpn-editor/Openvpn/PasswordTls.qml' | |||
2013 | --- src/vpn-editor/Openvpn/PasswordTls.qml 2016-01-06 16:38:31 +0000 | |||
2014 | +++ src/vpn-editor/Openvpn/PasswordTls.qml 2016-02-15 09:40:45 +0000 | |||
2015 | @@ -17,6 +17,7 @@ | |||
2016 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
2017 | 18 | import Ubuntu.Components 1.3 | 18 | import Ubuntu.Components 1.3 |
2018 | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems |
2019 | 20 | import "../DialogFile" | ||
2020 | 20 | 21 | ||
2021 | 21 | Column { | 22 | Column { |
2022 | 22 | property var connection | 23 | property var connection |
2023 | 23 | 24 | ||
2024 | === removed file 'src/vpn-editor/Openvpn/SettingTitle.qml' | |||
2025 | --- src/vpn-editor/Openvpn/SettingTitle.qml 2015-12-11 14:56:59 +0000 | |||
2026 | +++ src/vpn-editor/Openvpn/SettingTitle.qml 1970-01-01 00:00:00 +0000 | |||
2027 | @@ -1,23 +0,0 @@ | |||
2028 | 1 | /* | ||
2029 | 2 | * Copyright (C) 2015 Canonical Ltd. | ||
2030 | 3 | * | ||
2031 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2032 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
2033 | 6 | * as published by the Free Software Foundation. | ||
2034 | 7 | * | ||
2035 | 8 | * This program is distributed in the hope that it will be useful, | ||
2036 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2037 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2038 | 11 | * GNU Lesser General Public License for more details. | ||
2039 | 12 | * | ||
2040 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2041 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2042 | 15 | */ | ||
2043 | 16 | |||
2044 | 17 | import QtQuick 2.4 | ||
2045 | 18 | import Ubuntu.Components 1.3 | ||
2046 | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems | ||
2047 | 20 | |||
2048 | 21 | ListItems.Standard { | ||
2049 | 22 | highlightWhenPressed: false | ||
2050 | 23 | } | ||
2051 | 24 | 0 | ||
2052 | === modified file 'src/vpn-editor/Openvpn/StaticKey.qml' | |||
2053 | --- src/vpn-editor/Openvpn/StaticKey.qml 2016-01-06 16:38:31 +0000 | |||
2054 | +++ src/vpn-editor/Openvpn/StaticKey.qml 2016-02-15 09:40:45 +0000 | |||
2055 | @@ -17,6 +17,7 @@ | |||
2056 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
2057 | 18 | import Ubuntu.Components 1.3 | 18 | import Ubuntu.Components 1.3 |
2058 | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems |
2059 | 20 | import "../DialogFile" | ||
2060 | 20 | 21 | ||
2061 | 21 | Column { | 22 | Column { |
2062 | 22 | property var connection | 23 | property var connection |
2063 | @@ -24,7 +25,7 @@ | |||
2064 | 24 | ListItems.Standard { | 25 | ListItems.Standard { |
2065 | 25 | control: FileSelector { | 26 | control: FileSelector { |
2066 | 26 | path: connection.staticKey | 27 | path: connection.staticKey |
2068 | 27 | onPathChanged: connection.staticKey = text | 28 | onPathChanged: connection.staticKey = path |
2069 | 28 | width: units.gu(20) | 29 | width: units.gu(20) |
2070 | 29 | } | 30 | } |
2071 | 30 | text: i18n.tr("Static key:") | 31 | text: i18n.tr("Static key:") |
2072 | 31 | 32 | ||
2073 | === modified file 'src/vpn-editor/Openvpn/Tls.qml' | |||
2074 | --- src/vpn-editor/Openvpn/Tls.qml 2016-01-06 16:38:31 +0000 | |||
2075 | +++ src/vpn-editor/Openvpn/Tls.qml 2016-02-15 09:40:45 +0000 | |||
2076 | @@ -17,6 +17,7 @@ | |||
2077 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
2078 | 18 | import Ubuntu.Components 1.3 | 18 | import Ubuntu.Components 1.3 |
2079 | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems |
2080 | 20 | import "../DialogFile" | ||
2081 | 20 | 21 | ||
2082 | 21 | Column { | 22 | Column { |
2083 | 22 | property var connection | 23 | property var connection |
2084 | 23 | 24 | ||
2085 | === added directory 'src/vpn-editor/Pptp' | |||
2086 | === added file 'src/vpn-editor/Pptp/Advanced.qml' | |||
2087 | --- src/vpn-editor/Pptp/Advanced.qml 1970-01-01 00:00:00 +0000 | |||
2088 | +++ src/vpn-editor/Pptp/Advanced.qml 2016-02-15 09:40:45 +0000 | |||
2089 | @@ -0,0 +1,160 @@ | |||
2090 | 1 | /* | ||
2091 | 2 | * Copyright (C) 2015 Canonical Ltd. | ||
2092 | 3 | * | ||
2093 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2094 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
2095 | 6 | * as published by the Free Software Foundation. | ||
2096 | 7 | * | ||
2097 | 8 | * This program is distributed in the hope that it will be useful, | ||
2098 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2099 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2100 | 11 | * GNU Lesser General Public License for more details. | ||
2101 | 12 | * | ||
2102 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2103 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2104 | 15 | */ | ||
2105 | 16 | |||
2106 | 17 | import QtQuick 2.4 | ||
2107 | 18 | import Ubuntu.Components 1.3 | ||
2108 | 19 | import Ubuntu.Components.ListItems 1.3 as ListItems | ||
2109 | 20 | |||
2110 | 21 | Page { | ||
2111 | 22 | property var connection | ||
2112 | 23 | |||
2113 | 24 | title: i18n.tr("Advanced") | ||
2114 | 25 | |||
2115 | 26 | Flickable { | ||
2116 | 27 | anchors.fill: parent | ||
2117 | 28 | contentHeight: contentItem.childrenRect.height | ||
2118 | 29 | boundsBehavior: (contentHeight > root.height) ? | ||
2119 | 30 | Flickable.DragAndOvershootBounds : | ||
2120 | 31 | Flickable.StopAtBounds | ||
2121 | 32 | flickableDirection: Flickable.VerticalFlick | ||
2122 | 33 | |||
2123 | 34 | Column { | ||
2124 | 35 | anchors.left: parent.left | ||
2125 | 36 | anchors.right: parent.right | ||
2126 | 37 | |||
2127 | 38 | ListItems.Header {text: i18n.tr("Authentication methods")} | ||
2128 | 39 | |||
2129 | 40 | ListItems.Standard { | ||
2130 | 41 | control: CheckBox { | ||
2131 | 42 | id: allowPapCheckbox | ||
2132 | 43 | Binding {target: allowPapCheckbox; property: "checked"; value: connection.allowPap} | ||
2133 | 44 | onCheckedChanged: connection.allowPap = checked | ||
2134 | 45 | } | ||
2135 | 46 | text: i18n.tr("PAP") | ||
2136 | 47 | enabled: !connection.requireMppe | ||
2137 | 48 | } | ||
2138 | 49 | |||
2139 | 50 | ListItems.Standard { | ||
2140 | 51 | control: CheckBox { | ||
2141 | 52 | id: allowChapCheckbox | ||
2142 | 53 | Binding {target: allowChapCheckbox; property: "checked"; value: connection.allowChap} | ||
2143 | 54 | onCheckedChanged: connection.allowChap = checked | ||
2144 | 55 | } | ||
2145 | 56 | text: i18n.tr("CHAP") | ||
2146 | 57 | enabled: !connection.requireMppe | ||
2147 | 58 | } | ||
2148 | 59 | |||
2149 | 60 | ListItems.Standard { | ||
2150 | 61 | control: CheckBox { | ||
2151 | 62 | id: allowMschapCheckbox | ||
2152 | 63 | Binding {target: allowMschapCheckbox; property: "checked"; value: connection.allowMschap} | ||
2153 | 64 | onCheckedChanged: connection.allowMschap = checked | ||
2154 | 65 | } | ||
2155 | 66 | text: i18n.tr("MSCHAP") | ||
2156 | 67 | } | ||
2157 | 68 | |||
2158 | 69 | ListItems.Standard { | ||
2159 | 70 | control: CheckBox { | ||
2160 | 71 | id: allowMschapv2Checkbox | ||
2161 | 72 | Binding {target: allowMschapv2Checkbox; property: "checked"; value: connection.allowMschapv2} | ||
2162 | 73 | onCheckedChanged: connection.allowMschapv2 = checked | ||
2163 | 74 | } | ||
2164 | 75 | text: i18n.tr("MSCHAPv2") | ||
2165 | 76 | } | ||
2166 | 77 | |||
2167 | 78 | ListItems.Standard { | ||
2168 | 79 | control: CheckBox { | ||
2169 | 80 | id: allowEapCheckbox | ||
2170 | 81 | Binding {target: allowEapCheckbox; property: "checked"; value: connection.allowEap} | ||
2171 | 82 | onCheckedChanged: connection.allowEap = checked | ||
2172 | 83 | } | ||
2173 | 84 | text: i18n.tr("EAP") | ||
2174 | 85 | enabled: !connection.requireMppe | ||
2175 | 86 | } | ||
2176 | 87 | |||
2177 | 88 | ListItems.Header {text: i18n.tr("Security")} | ||
2178 | 89 | |||
2179 | 90 | ListItems.Standard { | ||
2180 | 91 | control: CheckBox { | ||
2181 | 92 | id: requireMppeCheckbox | ||
2182 | 93 | Binding {target: requireMppeCheckbox; property: "checked"; value: connection.requireMppe} | ||
2183 | 94 | onCheckedChanged: connection.requireMppe = checked | ||
2184 | 95 | } | ||
2185 | 96 | text: i18n.tr("Use Point-to-Point encryption") | ||
2186 | 97 | } | ||
2187 | 98 | |||
2188 | 99 | ListItems.ItemSelector { | ||
2189 | 100 | model: [ | ||
2190 | 101 | i18n.tr("All Availale (Default)"), | ||
2191 | 102 | i18n.tr("128-bit (most secure)"), | ||
2192 | 103 | i18n.tr("40-bit (less secure)") | ||
2193 | 104 | ] | ||
2194 | 105 | selectedIndex: connection.mppeType | ||
2195 | 106 | onSelectedIndexChanged: connection.mppeType = selectedIndex | ||
2196 | 107 | enabled: connection.requireMppe | ||
2197 | 108 | } | ||
2198 | 109 | |||
2199 | 110 | ListItems.Standard { | ||
2200 | 111 | control: CheckBox { | ||
2201 | 112 | id: mppeStatefulCheckbox | ||
2202 | 113 | Binding {target: mppeStatefulCheckbox; property: "checked"; value: connection.mppeStateful} | ||
2203 | 114 | onCheckedChanged: connection.mppeStateful = checked | ||
2204 | 115 | } | ||
2205 | 116 | text: i18n.tr("Allow stateful encryption") | ||
2206 | 117 | } | ||
2207 | 118 | |||
2208 | 119 | ListItems.Header {text: i18n.tr("Compression")} | ||
2209 | 120 | |||
2210 | 121 | ListItems.Standard { | ||
2211 | 122 | control: CheckBox { | ||
2212 | 123 | id: bsdCompressionCheckbox | ||
2213 | 124 | Binding {target: bsdCompressionCheckbox; property: "checked"; value: connection.bsdCompression} | ||
2214 | 125 | onCheckedChanged: connection.bsdCompression = checked | ||
2215 | 126 | } | ||
2216 | 127 | text: i18n.tr("Allow BSD data compression") | ||
2217 | 128 | } | ||
2218 | 129 | |||
2219 | 130 | ListItems.Standard { | ||
2220 | 131 | control: CheckBox { | ||
2221 | 132 | id: deflateCompressionCheckbox | ||
2222 | 133 | Binding {target: deflateCompressionCheckbox; property: "checked"; value: connection.deflateCompression} | ||
2223 | 134 | onCheckedChanged: connection.deflateCompression = checked | ||
2224 | 135 | } | ||
2225 | 136 | text: i18n.tr("Allow Deflate data compression") | ||
2226 | 137 | } | ||
2227 | 138 | |||
2228 | 139 | ListItems.Standard { | ||
2229 | 140 | control: CheckBox { | ||
2230 | 141 | id: tcpHeaderCompressionCheckbox | ||
2231 | 142 | Binding {target: tcpHeaderCompressionCheckbox; property: "checked"; value: connection.tcpHeaderCompression} | ||
2232 | 143 | onCheckedChanged: connection.tcpHeaderCompression = checked | ||
2233 | 144 | } | ||
2234 | 145 | text: i18n.tr("Use TCP header compression") | ||
2235 | 146 | } | ||
2236 | 147 | |||
2237 | 148 | ListItems.Header {text: i18n.tr("Echo")} | ||
2238 | 149 | |||
2239 | 150 | ListItems.Standard { | ||
2240 | 151 | control: CheckBox { | ||
2241 | 152 | id: sendPppEchoPacketsCheckbox | ||
2242 | 153 | Binding {target: sendPppEchoPacketsCheckbox; property: "checked"; value: connection.sendPppEchoPackets} | ||
2243 | 154 | onCheckedChanged: connection.sendPppEchoPackets = checked | ||
2244 | 155 | } | ||
2245 | 156 | text: i18n.tr("Send PPP echo packets") | ||
2246 | 157 | } | ||
2247 | 158 | } | ||
2248 | 159 | } | ||
2249 | 160 | } | ||
2250 | 0 | 161 | ||
2251 | === added file 'src/vpn-editor/Pptp/Editor.qml' | |||
2252 | --- src/vpn-editor/Pptp/Editor.qml 1970-01-01 00:00:00 +0000 | |||
2253 | +++ src/vpn-editor/Pptp/Editor.qml 2016-02-15 09:40:45 +0000 | |||
2254 | @@ -0,0 +1,97 @@ | |||
2255 | 1 | /* | ||
2256 | 2 | * Copyright (C) 2015 Canonical Ltd. | ||
2257 | 3 | * | ||
2258 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2259 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
2260 | 6 | * as published by the Free Software Foundation. | ||
2261 | 7 | * | ||
2262 | 8 | * This program is distributed in the hope that it will be useful, | ||
2263 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2264 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2265 | 11 | * GNU Lesser General Public License for more details. | ||
2266 | 12 | * | ||
2267 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2268 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2269 | 15 | */ | ||
2270 | 16 | |||
2271 | 17 | import QtQuick 2.4 | ||
2272 | 18 | import QtQuick.Layouts 1.1 | ||
2273 | 19 | import Ubuntu.Components 1.3 | ||
2274 | 20 | import Ubuntu.Components.ListItems 1.3 as ListItems | ||
2275 | 21 | import Ubuntu.Connectivity 1.0 | ||
2276 | 22 | import "../DialogFile" | ||
2277 | 23 | |||
2278 | 24 | Item { | ||
2279 | 25 | property var connection | ||
2280 | 26 | |||
2281 | 27 | id: root | ||
2282 | 28 | |||
2283 | 29 | Column { | ||
2284 | 30 | id: topPart | ||
2285 | 31 | anchors.left: parent.left | ||
2286 | 32 | anchors.right: parent.right | ||
2287 | 33 | |||
2288 | 34 | |||
2289 | 35 | ListItems.Header {text: i18n.tr("General")} | ||
2290 | 36 | |||
2291 | 37 | ListItems.Standard { | ||
2292 | 38 | control: TextField { | ||
2293 | 39 | text: connection.id | ||
2294 | 40 | onTextChanged: connection.id = text | ||
2295 | 41 | width: units.gu(20) | ||
2296 | 42 | inputMethodHints: Qt.ImhNoPredictiveText | ||
2297 | 43 | } | ||
2298 | 44 | text: i18n.tr("ID:") | ||
2299 | 45 | } | ||
2300 | 46 | |||
2301 | 47 | ListItems.Standard { | ||
2302 | 48 | control: TextField { | ||
2303 | 49 | text: connection.gateway | ||
2304 | 50 | onTextChanged: connection.gateway = text | ||
2305 | 51 | width: units.gu(20) | ||
2306 | 52 | inputMethodHints: Qt.ImhNoPredictiveText | ||
2307 | 53 | } | ||
2308 | 54 | text: i18n.tr("Gateway:") | ||
2309 | 55 | } | ||
2310 | 56 | |||
2311 | 57 | ListItems.Header {text: i18n.tr("Optional")} | ||
2312 | 58 | |||
2313 | 59 | ListItems.Standard { | ||
2314 | 60 | control: TextField { | ||
2315 | 61 | text: connection.user | ||
2316 | 62 | onTextChanged: connection.user = text | ||
2317 | 63 | width: units.gu(20) | ||
2318 | 64 | inputMethodHints: Qt.ImhNoPredictiveText | ||
2319 | 65 | } | ||
2320 | 66 | text: i18n.tr("User name:") | ||
2321 | 67 | } | ||
2322 | 68 | |||
2323 | 69 | ListItems.Standard { | ||
2324 | 70 | control: TextField { | ||
2325 | 71 | text: connection.password | ||
2326 | 72 | onTextChanged: connection.password = text | ||
2327 | 73 | width: units.gu(20) | ||
2328 | 74 | echoMode:TextInput.Password | ||
2329 | 75 | } | ||
2330 | 76 | text: i18n.tr("Password:") | ||
2331 | 77 | } | ||
2332 | 78 | |||
2333 | 79 | ListItems.Standard { | ||
2334 | 80 | control: TextField { | ||
2335 | 81 | text: connection.domain | ||
2336 | 82 | onTextChanged: password.domain = text | ||
2337 | 83 | width: units.gu(20) | ||
2338 | 84 | inputMethodHints: Qt.ImhNoPredictiveText | ||
2339 | 85 | } | ||
2340 | 86 | text: i18n.tr("NT Domain:") | ||
2341 | 87 | } | ||
2342 | 88 | |||
2343 | 89 | ListItems.Divider {} | ||
2344 | 90 | |||
2345 | 91 | ListItems.Standard { | ||
2346 | 92 | text: i18n.tr("Advanced") | ||
2347 | 93 | progression: true | ||
2348 | 94 | onClicked: pageStack.push(Qt.resolvedUrl("Advanced.qml"), {connection: root.connection}) | ||
2349 | 95 | } | ||
2350 | 96 | } | ||
2351 | 97 | } | ||
2352 | 0 | 98 | ||
2353 | === modified file 'src/vpn-editor/VpnList.qml' | |||
2354 | --- src/vpn-editor/VpnList.qml 2015-12-15 11:19:25 +0000 | |||
2355 | +++ src/vpn-editor/VpnList.qml 2016-02-15 09:40:45 +0000 | |||
2356 | @@ -26,11 +26,23 @@ | |||
2357 | 26 | title: i18n.tr("VPN configurations") | 26 | title: i18n.tr("VPN configurations") |
2358 | 27 | 27 | ||
2359 | 28 | head.actions: [ | 28 | head.actions: [ |
2360 | 29 | // There has to be a better way to force all the actions | ||
2361 | 30 | // into the menu | ||
2362 | 31 | Action { | ||
2363 | 32 | enabled: false | ||
2364 | 33 | }, | ||
2365 | 34 | Action { | ||
2366 | 35 | enabled: false | ||
2367 | 36 | }, | ||
2368 | 29 | Action { | 37 | Action { |
2369 | 30 | iconName: "add" | 38 | iconName: "add" |
2370 | 31 | text: i18n.tr("New configuration") | ||
2371 | 32 | // TODO Pick from OpenVPN or PPTP when supported | ||
2372 | 33 | onTriggered: model.add(VpnConnection.OPENVPN) | 39 | onTriggered: model.add(VpnConnection.OPENVPN) |
2373 | 40 | text: i18n.tr("OpenVPN") | ||
2374 | 41 | }, | ||
2375 | 42 | Action { | ||
2376 | 43 | iconName: "add" | ||
2377 | 44 | onTriggered: model.add(VpnConnection.PPTP) | ||
2378 | 45 | text: i18n.tr("PPTP") | ||
2379 | 34 | } | 46 | } |
2380 | 35 | ] | 47 | ] |
2381 | 36 | 48 | ||
2382 | @@ -46,6 +58,7 @@ | |||
2383 | 46 | ListView { | 58 | ListView { |
2384 | 47 | id: listView | 59 | id: listView |
2385 | 48 | anchors.fill: parent | 60 | anchors.fill: parent |
2386 | 61 | visible: (listView.count !== 0) | ||
2387 | 49 | model: root.model | 62 | model: root.model |
2388 | 50 | 63 | ||
2389 | 51 | delegate: ListItem { | 64 | delegate: ListItem { |
2390 | @@ -77,4 +90,16 @@ | |||
2391 | 77 | } | 90 | } |
2392 | 78 | } | 91 | } |
2393 | 79 | } | 92 | } |
2394 | 93 | |||
2395 | 94 | Rectangle { | ||
2396 | 95 | visible: (listView.count === 0) | ||
2397 | 96 | color: "lightgrey" | ||
2398 | 97 | anchors.fill: parent | ||
2399 | 98 | |||
2400 | 99 | Label { | ||
2401 | 100 | text: i18n.tr("No VPN connections") | ||
2402 | 101 | fontSize: "x-large" | ||
2403 | 102 | anchors.centerIn: parent | ||
2404 | 103 | } | ||
2405 | 104 | } | ||
2406 | 80 | } | 105 | } |
2407 | 81 | 106 | ||
2408 | === modified file 'src/vpn-editor/manifest.json' | |||
2409 | --- src/vpn-editor/manifest.json 2016-01-06 16:38:31 +0000 | |||
2410 | +++ src/vpn-editor/manifest.json 2016-02-15 09:40:45 +0000 | |||
2411 | @@ -10,5 +10,5 @@ | |||
2412 | 10 | "maintainer": "Pete Woods <pete.woods@canonical.com>", | 10 | "maintainer": "Pete Woods <pete.woods@canonical.com>", |
2413 | 11 | "name": "com.ubuntu.developer.pete-woods.vpn-editor", | 11 | "name": "com.ubuntu.developer.pete-woods.vpn-editor", |
2414 | 12 | "title": "VPN editor", | 12 | "title": "VPN editor", |
2416 | 13 | "version": "0.2.0" | 13 | "version": "0.3.0" |
2417 | 14 | } | 14 | } |