Merge lp:~pete-woods/indicator-network/pptp into lp:indicator-network/15.10

Proposed by Pete Woods
Status: Merged
Approved by: Pete Woods
Approved revision: 554
Merged at revision: 557
Proposed branch: lp:~pete-woods/indicator-network/pptp
Merge into: lp:indicator-network/15.10
Diff against target: 2417 lines (+1764/-212)
30 files modified
data/com.ubuntu.connectivity1.vpn.VpnConnection.OpenVpn.xml (+0/-162)
data/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml (+34/-0)
debian/changelog (+6/-0)
src/connectivity-api/connectivity-qt/CMakeLists.txt (+10/-1)
src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.cpp (+189/-0)
src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.h (+179/-0)
src/connectivity-api/connectivity-qt/connectivityqt/vpn-connections-list-model.cpp (+3/-1)
src/indicator/CMakeLists.txt (+10/-0)
src/indicator/connectivity-service/connectivity-service.cpp (+2/-1)
src/indicator/connectivity-service/dbus-pptp-connection.cpp (+198/-0)
src/indicator/connectivity-service/dbus-pptp-connection.h (+177/-0)
src/indicator/nmofono/vpn/pptp-connection.cpp (+417/-0)
src/indicator/nmofono/vpn/pptp-connection.h (+192/-0)
src/indicator/nmofono/vpn/vpn-connection.cpp (+15/-1)
src/indicator/nmofono/vpn/vpn-connection.h (+3/-0)
src/indicator/nmofono/vpn/vpn-manager.cpp (+12/-3)
src/vpn-editor/Main.qml (+1/-0)
src/vpn-editor/Openvpn/AdvancedGeneral.qml (+14/-8)
src/vpn-editor/Openvpn/AdvancedProxies.qml (+2/-1)
src/vpn-editor/Openvpn/AdvancedSecurity.qml (+2/-1)
src/vpn-editor/Openvpn/AdvancedTls.qml (+5/-2)
src/vpn-editor/Openvpn/Password.qml (+4/-4)
src/vpn-editor/Openvpn/PasswordTls.qml (+1/-0)
src/vpn-editor/Openvpn/SettingTitle.qml (+0/-23)
src/vpn-editor/Openvpn/StaticKey.qml (+2/-1)
src/vpn-editor/Openvpn/Tls.qml (+1/-0)
src/vpn-editor/Pptp/Advanced.qml (+160/-0)
src/vpn-editor/Pptp/Editor.qml (+97/-0)
src/vpn-editor/VpnList.qml (+27/-2)
src/vpn-editor/manifest.json (+1/-1)
To merge this branch: bzr merge lp:~pete-woods/indicator-network/pptp
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+282572@code.launchpad.net

Commit message

Add PPTP support to VPN editor

Description of the change

Add PPTP support to VPN editor

To post a comment you must log in.

Preview Diff

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

Subscribers

People subscribed via source and target branches