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