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
=== modified file 'data/com.ubuntu.connectivity1.vpn.VpnConnection.OpenVpn.xml'
--- data/com.ubuntu.connectivity1.vpn.VpnConnection.OpenVpn.xml 2015-12-04 13:18:04 +0000
+++ data/com.ubuntu.connectivity1.vpn.VpnConnection.OpenVpn.xml 2016-02-15 09:40:45 +0000
@@ -85,165 +85,3 @@
8585
86 </interface>86 </interface>
87</node>87</node>
88
89<!--
90
91tls:
92{
93'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'tls', 'uuid': '799623fc-e37a-4b39-9841-87588f2e8b8d'},
94'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn',
95 'data': {
96 'connection-type': 'tls',
97 'remote': 'gatewoo',
98
99 'ca': '/home/pete/.sesame/canonical_ca.crt',
100
101 'cert': '/home/pete/.sesame/canonical-pete.crt',
102 'cert-pass-flags': '1',
103
104 'key': '/home/pete/.sesame/canonical-pete.key'
105 }
106},
107'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'},
108'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'}
109}
110
111tls (all options):
112{
113'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'tls', 'uuid': '799623fc-e37a-4b39-9841-87588f2e8b8d'},
114'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn',
115 'data': {
116 'connection-type': 'tls',
117
118 Basic:
119 'key': '/home/pete/.sesame/canonical-pete.key',
120 'ca': '/home/pete/.sesame/canonical_ca.crt',
121 'remote': 'gatewoo',
122 'cert': '/home/pete/.sesame/canonical-pete.crt',
123 'cert-pass-flags': '1',
124
125 General:
126 'port': '1234',
127 'reneg-seconds': '123',
128 'comp-lzo': 'yes',
129 'proto-tcp': 'yes',
130 'dev-type': 'tun',
131 'dev': 'banana',
132 'tunnel-mtu': '1495',
133 'fragment-size': '1301',
134 'mssfix': 'yes',
135 'remote-random': 'yes',
136
137 Security:
138 'cipher': 'DES-CBC',
139 'keysize': '128',
140 'auth': 'RSA-MD4',
141
142 TLS Auth:
143 'tls-remote': '/banana',
144 'remote-cert-tls': 'server',
145 'ta': '/home/pete/.sesame/canonical_ta.key'
146 'ta-dir': '1',
147
148 Proxies:
149 'proxy-type': 'http',
150 'proxy-server': '1234',
151 'proxy-port': '4567',
152 'proxy-retry': 'yes',
153 'http-proxy-username': 'proxyuser',
154 }
155},
156'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'},
157'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'}}
158
159{'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'tls', 'uuid': '799623fc-e37a-4b39-9841-87588f2e8b8d'},
160'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn',
161 'data': {
162 'key': '/home/pete/.sesame/canonical-pete.key',
163 'mssfix': 'yes',
164 'proxy-port': '4567',
165 'http-proxy-username': 'proxyuser',
166 'connection-type': 'tls',
167 'reneg-seconds': '123',
168 'port': '1234',
169 'dev-type': 'tun',
170 'remote-random': 'yes',
171 'ta-dir': '1',
172 'proxy-server': '1234',
173 'ca': '/home/pete/.sesame/canonical_ca.crt',
174 'keysize': '128',
175 'fragment-size': '1301',
176 'tunnel-mtu': '1495',
177 'proxy-retry': 'yes',
178 'remote-cert-tls': 'server',
179 'comp-lzo': 'yes',
180 'remote': 'gatewoo',
181 'proto-tcp': 'yes',
182 'dev': 'banana',
183 'proxy-type': 'http',
184 'cert': '/home/pete/.sesame/canonical-pete.crt',
185 'tls-remote': '/banana',
186 'cert-pass-flags': '1',
187 'ta': '/home/pete/.sesame/canonical_ta.key'
188}}, 'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'}, 'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'}}
189
190password:
191{
192'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'username-password', 'uuid': '330cc533-102e-4a1f-b854-79eb6016a68b'},
193'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn',
194 'data': {
195 'connection-type': 'password',
196 'remote': 'gatewoo',
197
198 'ca': '/home/pete/.sesame/canonical_ca.crt'
199
200 'username': 'usernoo',
201 'password-flags': '1',
202
203 }
204},
205'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'},
206'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'}}
207
208password-tls:
209{
210'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'password-cert', 'uuid': '2b4baf88-7cbb-40f2-b124-b57173a762bb'},
211'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn',
212 'data': {
213 'connection-type': 'password-tls',
214 'remote': 'gatewoo',
215
216 'ca': '/home/pete/.sesame/canonical_ca.crt',
217
218 'username': 'usernoo',
219 'password-flags': '1',
220
221 'cert': '/home/pete/.sesame/canonical-pete.crt',
222 'cert-pass-flags': '1',
223
224 'key': '/home/pete/.sesame/canonical-pete.key'
225 }
226},
227'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'},
228'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'}
229}
230
231static-key:
232{
233'connection': {'autoconnect': False, 'permissions': ['user:pete:'], 'type': 'vpn', 'id': 'static-key', 'uuid': '796e396b-0688-4639-ad60-82c26e8a717e'},
234'vpn': {'service-type': 'org.freedesktop.NetworkManager.openvpn',
235 'data': {
236 'connection-type': 'static-key',
237 'remote': 'gatewoo',
238
239 'local-ip': '10.1.1.1',
240 'static-key': '/home/pete/.sesame/canonical_ta.key',
241 'static-key-direction': '0',
242 'remote-ip': '123.1.1.1'
243 }
244},
245'ipv4': {'routes': [], 'addresses': [], 'dns': [], 'method': 'auto'},
246'ipv6': {'routes': [], 'ip6-privacy': 0, 'addresses': [], 'dns': [], 'method': 'auto'}
247}
248
249-->
250\ No newline at end of file88\ No newline at end of file
25189
=== added file 'data/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml'
--- data/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml 1970-01-01 00:00:00 +0000
+++ data/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml 2016-02-15 09:40:45 +0000
@@ -0,0 +1,34 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2
3<node name="/com/ubuntu/connectivity1/Connection/Pptp" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
4 <interface name="com.ubuntu.connectivity1.vpn.VpnConnection.Pptp">
5
6 <!-- basic -->
7
8 <property name="gateway" type="s" access="readwrite"/>
9
10 <property name="user" type="s" access="readwrite"/>
11 <property name="password" type="s" access="readwrite"/>
12
13 <property name="domain" type="s" access="readwrite"/>
14
15 <!-- advanced -->
16
17 <property name="allowPap" type="b" access="readwrite"/>
18 <property name="allowChap" type="b" access="readwrite"/>
19 <property name="allowMschap" type="b" access="readwrite"/>
20 <property name="allowMschapv2" type="b" access="readwrite"/>
21 <property name="allowEap" type="b" access="readwrite"/>
22
23 <property name="requireMppe" type="b" access="readwrite"/>
24 <property name="mppeType" type="i" access="readwrite"/>
25 <property name="mppeStateful" type="b" access="readwrite"/>
26
27 <property name="bsdCompression" type="b" access="readwrite"/>
28 <property name="deflateCompression" type="b" access="readwrite"/>
29 <property name="tcpHeaderCompression" type="b" access="readwrite"/>
30
31 <property name="sendPppEchoPackets" type="b" access="readwrite"/>
32
33 </interface>
34</node>
035
=== modified file 'debian/changelog'
--- debian/changelog 2016-01-06 23:07:43 +0000
+++ debian/changelog 2016-02-15 09:40:45 +0000
@@ -1,3 +1,9 @@
1indicator-network (0.7.0-0ubuntu1) UNRELEASED; urgency=medium
2
3 * Add PPTP support to VPN editor.
4
5 -- Pete Woods <pete.woods@canonical.com> Tue, 12 Jan 2016 18:10:06 +0000
6
1indicator-network (0.6.0+16.04.20160106.1-0ubuntu1) xenial; urgency=medium7indicator-network (0.6.0+16.04.20160106.1-0ubuntu1) xenial; urgency=medium
28
3 * Add file picker to VPN editor UI added: src/vpn-9 * Add file picker to VPN editor UI added: src/vpn-
410
=== modified file 'src/connectivity-api/connectivity-qt/CMakeLists.txt'
--- src/connectivity-api/connectivity-qt/CMakeLists.txt 2015-11-20 13:14:50 +0000
+++ src/connectivity-api/connectivity-qt/CMakeLists.txt 2016-02-15 09:40:45 +0000
@@ -20,6 +20,7 @@
20 connectivityqt/internal/dbus-property-cache.cpp20 connectivityqt/internal/dbus-property-cache.cpp
21 connectivityqt/connectivity.cpp21 connectivityqt/connectivity.cpp
22 connectivityqt/openvpn-connection.cpp22 connectivityqt/openvpn-connection.cpp
23 connectivityqt/pptp-connection.cpp
23 connectivityqt/vpn-connection.cpp24 connectivityqt/vpn-connection.cpp
24 connectivityqt/vpn-connections-list-model.cpp25 connectivityqt/vpn-connections-list-model.cpp
25 ubuntu/connectivity/networking-status.cpp26 ubuntu/connectivity/networking-status.cpp
@@ -29,11 +30,13 @@
29 "${DATA_DIR}/org.freedesktop.DBus.Properties.xml"30 "${DATA_DIR}/org.freedesktop.DBus.Properties.xml"
30 "${DATA_DIR}/com.ubuntu.connectivity1.NetworkingStatus.xml"31 "${DATA_DIR}/com.ubuntu.connectivity1.NetworkingStatus.xml"
31 "${DATA_DIR}/com.ubuntu.connectivity1.Private.xml"32 "${DATA_DIR}/com.ubuntu.connectivity1.Private.xml"
33 "${DATA_DIR}/com.ubuntu.connectivity1.vpn.VpnConnection.xml"
34 "${DATA_DIR}/com.ubuntu.connectivity1.vpn.VpnConnection.OpenVpn.xml"
35 "${DATA_DIR}/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml"
32 PROPERTIES36 PROPERTIES
33 NO_NAMESPACE YES37 NO_NAMESPACE YES
34)38)
3539
36
37qt5_add_dbus_interface(40qt5_add_dbus_interface(
38 CONNECTIVITY_QT_SRC41 CONNECTIVITY_QT_SRC
39 "${DATA_DIR}/com.ubuntu.connectivity1.NetworkingStatus.xml"42 "${DATA_DIR}/com.ubuntu.connectivity1.NetworkingStatus.xml"
@@ -60,6 +63,12 @@
6063
61qt5_add_dbus_interface(64qt5_add_dbus_interface(
62 CONNECTIVITY_QT_SRC65 CONNECTIVITY_QT_SRC
66 "${DATA_DIR}/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml"
67 PptpConnectionInterface
68)
69
70qt5_add_dbus_interface(
71 CONNECTIVITY_QT_SRC
63 "${DATA_DIR}/org.freedesktop.DBus.Properties.xml"72 "${DATA_DIR}/org.freedesktop.DBus.Properties.xml"
64 PropertiesInterface73 PropertiesInterface
65)74)
6675
=== added file 'src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.cpp'
--- src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.cpp 1970-01-01 00:00:00 +0000
+++ src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.cpp 2016-02-15 09:40:45 +0000
@@ -0,0 +1,189 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Pete Woods <pete.woods@canonical.com>
18 */
19
20#include <connectivityqt/pptp-connection.h>
21#include <connectivityqt/internal/dbus-property-cache.h>
22#include <dbus-types.h>
23
24#include <PptpConnectionInterface.h>
25
26using namespace std;
27
28#define DEFINE_PROPERTY_GETTER(name, strname, type, conversion)\
29type PptpConnection::name() const\
30{\
31 return d->m_propertyCache->get(strname).conversion();\
32}\
33
34#define DEFINE_PROPERTY_GETTER_ENUM(name, strname, type)\
35PptpConnection::type PptpConnection::name() const\
36{\
37 return static_cast<type>(d->m_propertyCache->get(strname).toInt());\
38}
39
40#define DEFINE_PROPERTY_SETTER(uppername, strname, type)\
41void PptpConnection::set##uppername(type value)\
42{\
43 d->m_propertyCache->set(strname, value);\
44}
45
46#define DEFINE_PROPERTY_SETTER_ENUM(uppername, strname, type)\
47void PptpConnection::set##uppername(type value)\
48{\
49 d->m_propertyCache->set(strname, static_cast<int>(value));\
50}
51
52#define DEFINE_PROPERTY_UPDATE(varname, strname, conversion)\
53else if (name == strname)\
54{\
55 Q_EMIT p.varname##Changed(value.conversion());\
56}
57
58#define DEFINE_PROPERTY_UPDATE_ENUM(varname, strname, type)\
59else if (name == strname)\
60{\
61 Q_EMIT p.varname##Changed(static_cast<type>(value.toInt()));\
62}
63
64namespace connectivityqt
65{
66
67class PptpConnection::Priv: public QObject
68{
69 Q_OBJECT
70
71public:
72 Priv(PptpConnection& parent) :
73 p(parent)
74 {
75 }
76
77public Q_SLOTS:
78 void propertyChanged(const QString& name, const QVariant& value)
79 {
80 if (name == "") {}
81
82 // Basic properties
83
84 DEFINE_PROPERTY_UPDATE(gateway, "gateway", toString)
85 DEFINE_PROPERTY_UPDATE(user, "user", toString)
86 DEFINE_PROPERTY_UPDATE(password, "password", toString)
87 DEFINE_PROPERTY_UPDATE(domain, "domain", toString)
88
89 // Advanced properties
90
91 DEFINE_PROPERTY_UPDATE(allowPap, "allowPap", toBool)
92 DEFINE_PROPERTY_UPDATE(allowChap, "allowChap", toBool)
93 DEFINE_PROPERTY_UPDATE(allowMschap, "allowMschap", toBool)
94 DEFINE_PROPERTY_UPDATE(allowMschapv2, "allowMschapv2", toBool)
95 DEFINE_PROPERTY_UPDATE(allowEap, "allowEap", toBool)
96 DEFINE_PROPERTY_UPDATE(requireMppe, "requireMppe", toBool)
97 DEFINE_PROPERTY_UPDATE_ENUM(mppeType, "mppeType", MppeType)
98 DEFINE_PROPERTY_UPDATE(mppeStateful, "mppeStateful", toBool)
99 DEFINE_PROPERTY_UPDATE(bsdCompression, "bsdCompression", toBool)
100 DEFINE_PROPERTY_UPDATE(deflateCompression, "deflateCompression", toBool)
101 DEFINE_PROPERTY_UPDATE(tcpHeaderCompression, "tcpHeaderCompression", toBool)
102 DEFINE_PROPERTY_UPDATE(sendPppEchoPackets, "sendPppEchoPackets", toBool)
103 }
104
105public:
106 PptpConnection& p;
107
108 unique_ptr<ComUbuntuConnectivity1VpnVpnConnectionPptpInterface> m_pptpInterface;
109
110 internal::DBusPropertyCache::UPtr m_propertyCache;
111};
112
113PptpConnection::PptpConnection(const QDBusObjectPath& path, const QDBusConnection& connection) :
114 VpnConnection(path, connection),
115 d(new Priv(*this))
116{
117 d->m_pptpInterface = make_unique<
118 ComUbuntuConnectivity1VpnVpnConnectionPptpInterface>(
119 DBusTypes::DBUS_NAME, path.path(), connection);
120
121 d->m_propertyCache =
122 make_unique<internal::DBusPropertyCache>(
123 DBusTypes::DBUS_NAME,
124 ComUbuntuConnectivity1VpnVpnConnectionPptpInterface::staticInterfaceName(),
125 path.path(), connection);
126
127 connect(d->m_propertyCache.get(),
128 &internal::DBusPropertyCache::propertyChanged, d.get(),
129 &Priv::propertyChanged);
130}
131
132PptpConnection::~PptpConnection()
133{
134}
135
136VpnConnection::Type PptpConnection::type() const
137{
138 return Type::PPTP;
139}
140
141// Basic properties
142
143DEFINE_PROPERTY_GETTER(gateway, "gateway", QString, toString)
144DEFINE_PROPERTY_GETTER(user, "user", QString, toString)
145DEFINE_PROPERTY_GETTER(password, "password", QString, toString)
146DEFINE_PROPERTY_GETTER(domain, "domain", QString, toString)
147
148// Advanced properties
149
150DEFINE_PROPERTY_GETTER(allowPap, "allowPap", bool, toBool)
151DEFINE_PROPERTY_GETTER(allowChap, "allowChap", bool, toBool)
152DEFINE_PROPERTY_GETTER(allowMschap, "allowMschap", bool, toBool)
153DEFINE_PROPERTY_GETTER(allowMschapv2, "allowMschapv2", bool, toBool)
154DEFINE_PROPERTY_GETTER(allowEap, "allowEap", bool, toBool)
155DEFINE_PROPERTY_GETTER(requireMppe, "requireMppe", bool, toBool)
156DEFINE_PROPERTY_GETTER_ENUM(mppeType, "mppeType", MppeType)
157DEFINE_PROPERTY_GETTER(mppeStateful, "mppeStateful", bool, toBool)
158DEFINE_PROPERTY_GETTER(bsdCompression, "bsdCompression", bool, toBool)
159DEFINE_PROPERTY_GETTER(deflateCompression, "deflateCompression", bool, toBool)
160DEFINE_PROPERTY_GETTER(tcpHeaderCompression, "tcpHeaderCompression", bool, toBool)
161DEFINE_PROPERTY_GETTER(sendPppEchoPackets, "sendPppEchoPackets", bool, toBool)
162
163
164
165// Basic properties
166
167DEFINE_PROPERTY_SETTER(Gateway, "gateway", const QString &)
168DEFINE_PROPERTY_SETTER(User, "user", const QString &)
169DEFINE_PROPERTY_SETTER(Password, "password", const QString &)
170DEFINE_PROPERTY_SETTER(Domain, "domain", const QString &)
171
172// Advanced properties
173
174DEFINE_PROPERTY_SETTER(AllowPap, "allowPap", bool)
175DEFINE_PROPERTY_SETTER(AllowChap, "allowChap", bool)
176DEFINE_PROPERTY_SETTER(AllowMschap, "allowMschap", bool)
177DEFINE_PROPERTY_SETTER(AllowMschapv2, "allowMschapv2", bool)
178DEFINE_PROPERTY_SETTER(AllowEap, "allowEap", bool)
179DEFINE_PROPERTY_SETTER(RequireMppe, "requireMppe", bool)
180DEFINE_PROPERTY_SETTER_ENUM(MppeType, "mppeType", MppeType)
181DEFINE_PROPERTY_SETTER(MppeStateful, "mppeStateful", bool)
182DEFINE_PROPERTY_SETTER(BsdCompression, "bsdCompression", bool)
183DEFINE_PROPERTY_SETTER(DeflateCompression, "deflateCompression", bool)
184DEFINE_PROPERTY_SETTER(TcpHeaderCompression, "tcpHeaderCompression", bool)
185DEFINE_PROPERTY_SETTER(SendPppEchoPackets, "sendPppEchoPackets", bool)
186
187}
188
189#include "pptp-connection.moc"
0190
=== added file 'src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.h'
--- src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.h 1970-01-01 00:00:00 +0000
+++ src/connectivity-api/connectivity-qt/connectivityqt/pptp-connection.h 2016-02-15 09:40:45 +0000
@@ -0,0 +1,179 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Pete Woods <pete.woods@canonical.com>
18 */
19
20#pragma once
21
22#include <connectivityqt/vpn-connection.h>
23
24namespace connectivityqt
25{
26
27class Q_DECL_EXPORT PptpConnection : public VpnConnection
28{
29 Q_OBJECT
30
31public:
32 UNITY_DEFINES_PTRS(PptpConnection);
33
34 Q_ENUMS(MppeType)
35 enum class MppeType
36 {
37 MPPE_ALL,
38 MPPE_128,
39 MPPE_40
40 };
41
42 PptpConnection(const QDBusObjectPath& path, const QDBusConnection& connection);
43
44 virtual ~PptpConnection();
45
46 Type type() const override;
47
48 // Basic properties
49
50 Q_PROPERTY(QString gateway READ gateway WRITE setGateway NOTIFY gatewayChanged)
51 QString gateway() const;
52
53 Q_PROPERTY(QString user READ user WRITE setUser NOTIFY userChanged)
54 QString user() const;
55
56 Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
57 QString password() const;
58
59 Q_PROPERTY(QString domain READ domain WRITE setDomain NOTIFY domainChanged)
60 QString domain() const;
61
62 // Advanced properties
63
64 Q_PROPERTY(bool allowPap READ allowPap WRITE setAllowPap NOTIFY allowPapChanged)
65 bool allowPap() const;
66
67 Q_PROPERTY(bool allowChap READ allowChap WRITE setAllowChap NOTIFY allowChapChanged)
68 bool allowChap() const;
69
70 Q_PROPERTY(bool allowMschap READ allowMschap WRITE setAllowMschap NOTIFY allowMschapChanged)
71 bool allowMschap() const;
72
73 Q_PROPERTY(bool allowMschapv2 READ allowMschapv2 WRITE setAllowMschapv2 NOTIFY allowMschapv2Changed)
74 bool allowMschapv2() const;
75
76 Q_PROPERTY(bool allowEap READ allowEap WRITE setAllowEap NOTIFY allowEapChanged)
77 bool allowEap() const;
78
79 Q_PROPERTY(bool requireMppe READ requireMppe WRITE setRequireMppe NOTIFY requireMppeChanged)
80 bool requireMppe() const;
81
82 Q_PROPERTY(MppeType mppeType READ mppeType WRITE setMppeType NOTIFY mppeTypeChanged)
83 MppeType mppeType() const;
84
85 Q_PROPERTY(bool mppeStateful READ mppeStateful WRITE setMppeStateful NOTIFY mppeStatefulChanged)
86 bool mppeStateful() const;
87
88 Q_PROPERTY(bool bsdCompression READ bsdCompression WRITE setBsdCompression NOTIFY bsdCompressionChanged)
89 bool bsdCompression() const;
90
91 Q_PROPERTY(bool deflateCompression READ deflateCompression WRITE setDeflateCompression NOTIFY deflateCompressionChanged)
92 bool deflateCompression() const;
93
94 Q_PROPERTY(bool tcpHeaderCompression READ tcpHeaderCompression WRITE setTcpHeaderCompression NOTIFY tcpHeaderCompressionChanged)
95 bool tcpHeaderCompression() const;
96
97 Q_PROPERTY(bool sendPppEchoPackets READ sendPppEchoPackets WRITE setSendPppEchoPackets NOTIFY sendPppEchoPacketsChanged)
98 bool sendPppEchoPackets() const;
99
100public Q_SLOTS:
101 // Basic properties
102
103 void setGateway(const QString &value);
104
105 void setUser(const QString &value);
106
107 void setPassword(const QString &value);
108
109 void setDomain(const QString &value);
110
111 // Advanced properties
112
113 void setAllowPap(bool value);
114
115 void setAllowChap(bool value);
116
117 void setAllowMschap(bool value);
118
119 void setAllowMschapv2(bool value);
120
121 void setAllowEap(bool value);
122
123 void setRequireMppe(bool value);
124
125 void setMppeType(MppeType value);
126
127 void setMppeStateful(bool value);
128
129 void setBsdCompression(bool value);
130
131 void setDeflateCompression(bool value);
132
133 void setTcpHeaderCompression(bool value);
134
135 void setSendPppEchoPackets(bool value);
136
137Q_SIGNALS:
138 // Basic properties
139
140 void gatewayChanged(const QString &value);
141
142 void userChanged(const QString &value);
143
144 void passwordChanged(const QString &value);
145
146 void domainChanged(const QString &value);
147
148 // Advanced properties
149
150 void allowPapChanged(bool value);
151
152 void allowChapChanged(bool value);
153
154 void allowMschapChanged(bool value);
155
156 void allowMschapv2Changed(bool value);
157
158 void allowEapChanged(bool value);
159
160 void requireMppeChanged(bool value);
161
162 void mppeTypeChanged(MppeType value);
163
164 void mppeStatefulChanged(bool value);
165
166 void bsdCompressionChanged(bool value);
167
168 void deflateCompressionChanged(bool value);
169
170 void tcpHeaderCompressionChanged(bool value);
171
172 void sendPppEchoPacketsChanged(bool value);
173
174protected:
175 class Priv;
176 std::shared_ptr<Priv> d;
177};
178
179}
0180
=== modified file 'src/connectivity-api/connectivity-qt/connectivityqt/vpn-connections-list-model.cpp'
--- src/connectivity-api/connectivity-qt/connectivityqt/vpn-connections-list-model.cpp 2015-12-14 11:56:23 +0000
+++ src/connectivity-api/connectivity-qt/connectivityqt/vpn-connections-list-model.cpp 2016-02-15 09:40:45 +0000
@@ -19,6 +19,7 @@
1919
20#include <connectivityqt/internal/vpn-connection-list-model-parameters.h>20#include <connectivityqt/internal/vpn-connection-list-model-parameters.h>
21#include <connectivityqt/openvpn-connection.h>21#include <connectivityqt/openvpn-connection.h>
22#include <connectivityqt/pptp-connection.h>
22#include <connectivityqt/vpn-connections-list-model.h>23#include <connectivityqt/vpn-connections-list-model.h>
2324
24#include <VpnConnectionInterface.h>25#include <VpnConnectionInterface.h>
@@ -97,7 +98,8 @@
97 [](QObject* self){self->deleteLater();});98 [](QObject* self){self->deleteLater();});
98 break;99 break;
99 default:100 default:
100 // TODO pptp, etc101 vpnConnection.reset(new PptpConnection(path, m_propertyCache->connection()),
102 [](QObject* self){self->deleteLater();});
101 break;103 break;
102 }104 }
103 if (vpnConnection)105 if (vpnConnection)
104106
=== modified file 'src/indicator/CMakeLists.txt'
--- src/indicator/CMakeLists.txt 2015-12-11 14:58:11 +0000
+++ src/indicator/CMakeLists.txt 2016-02-15 09:40:45 +0000
@@ -39,6 +39,7 @@
39 nmofono/wifi/wifi-link-impl.cpp39 nmofono/wifi/wifi-link-impl.cpp
40 nmofono/wwan/modem.cpp40 nmofono/wwan/modem.cpp
41 nmofono/vpn/openvpn-connection.cpp41 nmofono/vpn/openvpn-connection.cpp
42 nmofono/vpn/pptp-connection.cpp
42 nmofono/vpn/vpn-connection.cpp43 nmofono/vpn/vpn-connection.cpp
43 nmofono/vpn/vpn-manager.cpp44 nmofono/vpn/vpn-manager.cpp
4445
@@ -60,6 +61,7 @@
6061
61 connectivity-service/connectivity-service.cpp62 connectivity-service/connectivity-service.cpp
62 connectivity-service/dbus-openvpn-connection.cpp63 connectivity-service/dbus-openvpn-connection.cpp
64 connectivity-service/dbus-pptp-connection.cpp
63 connectivity-service/dbus-vpn-connection.cpp65 connectivity-service/dbus-vpn-connection.cpp
6466
65 menuitems/access-point-item.cpp67 menuitems/access-point-item.cpp
@@ -108,6 +110,14 @@
108110
109qt5_add_dbus_adaptor(111qt5_add_dbus_adaptor(
110 NETWORK_SERVICE_SOURCES112 NETWORK_SERVICE_SOURCES
113 "${DATA_DIR}/com.ubuntu.connectivity1.vpn.VpnConnection.Pptp.xml"
114 connectivity-service/dbus-pptp-connection.h
115 connectivity_service::DBusPptpConnection
116 PptpAdaptor
117)
118
119qt5_add_dbus_adaptor(
120 NETWORK_SERVICE_SOURCES
111 "${DATA_DIR}/nm-secret-agent.xml"121 "${DATA_DIR}/nm-secret-agent.xml"
112 "agent/SecretAgentInclude.h"122 "agent/SecretAgentInclude.h"
113 "agent::SecretAgent"123 "agent::SecretAgent"
114124
=== modified file 'src/indicator/connectivity-service/connectivity-service.cpp'
--- src/indicator/connectivity-service/connectivity-service.cpp 2015-12-04 13:18:04 +0000
+++ src/indicator/connectivity-service/connectivity-service.cpp 2016-02-15 09:40:45 +0000
@@ -21,6 +21,7 @@
21#include <connectivity-service/connectivity-service.h>21#include <connectivity-service/connectivity-service.h>
22#include <connectivity-service/dbus-vpn-connection.h>22#include <connectivity-service/dbus-vpn-connection.h>
23#include <connectivity-service/dbus-openvpn-connection.h>23#include <connectivity-service/dbus-openvpn-connection.h>
24#include <connectivity-service/dbus-pptp-connection.h>
24#include <NetworkingStatusAdaptor.h>25#include <NetworkingStatusAdaptor.h>
25#include <NetworkingStatusPrivateAdaptor.h>26#include <NetworkingStatusPrivateAdaptor.h>
26#include <dbus-types.h>27#include <dbus-types.h>
@@ -236,7 +237,7 @@
236 vpnConnection = make_shared<DBusOpenvpnConnection>(vpn, m_connection);237 vpnConnection = make_shared<DBusOpenvpnConnection>(vpn, m_connection);
237 break;238 break;
238 case VpnConnection::Type::pptp:239 case VpnConnection::Type::pptp:
239 // TODO pptp240 vpnConnection = make_shared<DBusPptpConnection>(vpn, m_connection);
240 break;241 break;
241 }242 }
242 if (vpnConnection)243 if (vpnConnection)
243244
=== added file 'src/indicator/connectivity-service/dbus-pptp-connection.cpp'
--- src/indicator/connectivity-service/dbus-pptp-connection.cpp 1970-01-01 00:00:00 +0000
+++ src/indicator/connectivity-service/dbus-pptp-connection.cpp 2016-02-15 09:40:45 +0000
@@ -0,0 +1,198 @@
1/*
2 * Copyright (C) 2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Pete Woods <pete.woods@canonical.com>
18 */
19
20#include <connectivity-service/dbus-pptp-connection.h>
21#include <PptpAdaptor.h>
22#include <util/dbus-utils.h>
23
24using namespace std;
25using namespace nmofono::vpn;
26
27#define DEFINE_PROPERTY_GETTER(varname, type)\
28type DBusPptpConnection::varname() const\
29{\
30 return m_pptpConnection->varname();\
31}
32
33#define DEFINE_PROPERTY_GETTER_ENUM(varname)\
34int DBusPptpConnection::varname() const\
35{\
36 return static_cast<int>(m_pptpConnection->varname());\
37}
38
39#define DEFINE_PROPERTY_SETTER_ENUM(uppername, type)\
40void DBusPptpConnection::set##uppername(int value)\
41{\
42 m_pptpConnection->set##uppername(static_cast<PptpConnection::type>(value));\
43}
44
45#define DEFINE_PROPERTY_UPDATER(varname, strname, type)\
46void DBusPptpConnection::varname##Updated(type)\
47{\
48 notifyProperty(strname);\
49}
50
51#define DEFINE_PROPERTY_UPDATER_ENUM(varname, strname, type)\
52void DBusPptpConnection::varname##Updated(PptpConnection::type)\
53{\
54 notifyProperty(strname);\
55}
56
57#define DEFINE_PROPERTY_CONNECTION_FORWARD(uppername)\
58connect(this, &DBusPptpConnection::set##uppername, m_pptpConnection.get(), &PptpConnection::set##uppername);
59
60#define DEFINE_PROPERTY_CONNECTION_REVERSE(varname)\
61connect(m_pptpConnection.get(), &PptpConnection::varname##Changed, this, &DBusPptpConnection::varname##Updated);
62
63namespace connectivity_service
64{
65
66DBusPptpConnection::DBusPptpConnection(VpnConnection::SPtr vpnConnection,
67 const QDBusConnection& connection) :
68 DBusVpnConnection(vpnConnection, connection),
69 m_pptpConnection(vpnConnection->pptpConnection())
70{
71 new PptpAdaptor(this);
72
73 // Basic properties
74
75 DEFINE_PROPERTY_CONNECTION_FORWARD(Gateway)
76 DEFINE_PROPERTY_CONNECTION_FORWARD(User)
77 DEFINE_PROPERTY_CONNECTION_FORWARD(Password)
78 DEFINE_PROPERTY_CONNECTION_FORWARD(Domain)
79
80 // Advanced properties
81
82 DEFINE_PROPERTY_CONNECTION_FORWARD(AllowPap)
83 DEFINE_PROPERTY_CONNECTION_FORWARD(AllowChap)
84 DEFINE_PROPERTY_CONNECTION_FORWARD(AllowMschap)
85 DEFINE_PROPERTY_CONNECTION_FORWARD(AllowMschapv2)
86 DEFINE_PROPERTY_CONNECTION_FORWARD(AllowEap)
87 DEFINE_PROPERTY_CONNECTION_FORWARD(RequireMppe)
88 // mppeType is enum
89 DEFINE_PROPERTY_CONNECTION_FORWARD(MppeStateful)
90 DEFINE_PROPERTY_CONNECTION_FORWARD(BsdCompression)
91 DEFINE_PROPERTY_CONNECTION_FORWARD(DeflateCompression)
92 DEFINE_PROPERTY_CONNECTION_FORWARD(TcpHeaderCompression)
93 DEFINE_PROPERTY_CONNECTION_FORWARD(SendPppEchoPackets)
94
95
96
97
98 // Basic properties
99
100 DEFINE_PROPERTY_CONNECTION_REVERSE(gateway)
101 DEFINE_PROPERTY_CONNECTION_REVERSE(user)
102 DEFINE_PROPERTY_CONNECTION_REVERSE(password)
103 DEFINE_PROPERTY_CONNECTION_REVERSE(domain)
104
105 // Advanced properties
106
107 DEFINE_PROPERTY_CONNECTION_REVERSE(allowPap)
108 DEFINE_PROPERTY_CONNECTION_REVERSE(allowChap)
109 DEFINE_PROPERTY_CONNECTION_REVERSE(allowMschap)
110 DEFINE_PROPERTY_CONNECTION_REVERSE(allowMschapv2)
111 DEFINE_PROPERTY_CONNECTION_REVERSE(allowEap)
112 DEFINE_PROPERTY_CONNECTION_REVERSE(requireMppe)
113 DEFINE_PROPERTY_CONNECTION_REVERSE(mppeType)
114 DEFINE_PROPERTY_CONNECTION_REVERSE(mppeStateful)
115 DEFINE_PROPERTY_CONNECTION_REVERSE(bsdCompression)
116 DEFINE_PROPERTY_CONNECTION_REVERSE(deflateCompression)
117 DEFINE_PROPERTY_CONNECTION_REVERSE(tcpHeaderCompression)
118 DEFINE_PROPERTY_CONNECTION_REVERSE(sendPppEchoPackets)
119
120
121
122 registerDBusObject();
123}
124
125DBusPptpConnection::~DBusPptpConnection()
126{
127}
128
129nmofono::vpn::VpnConnection::Type DBusPptpConnection::type() const
130{
131 return nmofono::vpn::VpnConnection::Type::pptp;
132}
133
134// Enum properties
135
136DEFINE_PROPERTY_SETTER_ENUM(MppeType, MppeType)
137
138// Basic properties
139
140
141// Basic properties
142
143DEFINE_PROPERTY_GETTER(gateway, QString)
144DEFINE_PROPERTY_GETTER(user, QString)
145DEFINE_PROPERTY_GETTER(password, QString)
146DEFINE_PROPERTY_GETTER(domain, QString)
147
148// Advanced properties
149
150DEFINE_PROPERTY_GETTER(allowPap, bool)
151DEFINE_PROPERTY_GETTER(allowChap, bool)
152DEFINE_PROPERTY_GETTER(allowMschap, bool)
153DEFINE_PROPERTY_GETTER(allowMschapv2, bool)
154DEFINE_PROPERTY_GETTER(allowEap, bool)
155DEFINE_PROPERTY_GETTER(requireMppe, bool)
156DEFINE_PROPERTY_GETTER_ENUM(mppeType)
157DEFINE_PROPERTY_GETTER(mppeStateful, bool)
158DEFINE_PROPERTY_GETTER(bsdCompression, bool)
159DEFINE_PROPERTY_GETTER(deflateCompression, bool)
160DEFINE_PROPERTY_GETTER(tcpHeaderCompression, bool)
161DEFINE_PROPERTY_GETTER(sendPppEchoPackets, bool)
162
163
164void DBusPptpConnection::notifyProperty(const QString& propertyName)
165{
166 DBusUtils::notifyPropertyChanged(
167 m_connection,
168 *this,
169 m_path.path(),
170 PptpAdaptor::staticMetaObject.classInfo(PptpAdaptor::staticMetaObject.indexOfClassInfo("D-Bus Interface")).value(),
171 {propertyName}
172 );
173}
174
175// Basic properties
176
177DEFINE_PROPERTY_UPDATER(gateway, "gateway", const QString &)
178DEFINE_PROPERTY_UPDATER(user, "user", const QString &)
179DEFINE_PROPERTY_UPDATER(password, "password", const QString &)
180DEFINE_PROPERTY_UPDATER(domain, "domain", const QString &)
181
182// Advanced properties
183
184DEFINE_PROPERTY_UPDATER(allowPap, "allowPap", bool)
185DEFINE_PROPERTY_UPDATER(allowChap, "allowChap", bool)
186DEFINE_PROPERTY_UPDATER(allowMschap, "allowMschap", bool)
187DEFINE_PROPERTY_UPDATER(allowMschapv2, "allowMschapv2", bool)
188DEFINE_PROPERTY_UPDATER(allowEap, "allowEap", bool)
189DEFINE_PROPERTY_UPDATER(requireMppe, "requireMppe", bool)
190DEFINE_PROPERTY_UPDATER_ENUM(mppeType, "mppeType", MppeType)
191DEFINE_PROPERTY_UPDATER(mppeStateful, "mppeStateful", bool)
192DEFINE_PROPERTY_UPDATER(bsdCompression, "bsdCompression", bool)
193DEFINE_PROPERTY_UPDATER(deflateCompression, "deflateCompression", bool)
194DEFINE_PROPERTY_UPDATER(tcpHeaderCompression, "tcpHeaderCompression", bool)
195DEFINE_PROPERTY_UPDATER(sendPppEchoPackets, "sendPppEchoPackets", bool)
196
197
198}
0199
=== added file 'src/indicator/connectivity-service/dbus-pptp-connection.h'
--- src/indicator/connectivity-service/dbus-pptp-connection.h 1970-01-01 00:00:00 +0000
+++ src/indicator/connectivity-service/dbus-pptp-connection.h 2016-02-15 09:40:45 +0000
@@ -0,0 +1,177 @@
1/*
2 * Copyright (C) 2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Pete Woods <pete.woods@canonical.com>
18 */
19
20#pragma once
21
22#include <connectivity-service/dbus-vpn-connection.h>
23#include <nmofono/vpn/pptp-connection.h>
24
25class PptpAdaptor;
26
27namespace connectivity_service
28{
29
30class DBusPptpConnection : public DBusVpnConnection
31{
32 friend PptpAdaptor;
33
34 Q_OBJECT
35
36public:
37 DBusPptpConnection(nmofono::vpn::VpnConnection::SPtr vpnConnection, const QDBusConnection& connection);
38
39 ~DBusPptpConnection();
40
41 nmofono::vpn::VpnConnection::Type type() const override;
42
43 // Basic properties
44
45 Q_PROPERTY(QString gateway READ gateway WRITE setGateway)
46 QString gateway() const;
47
48 Q_PROPERTY(QString user READ user WRITE setUser)
49 QString user() const;
50
51 Q_PROPERTY(QString password READ password WRITE setPassword)
52 QString password() const;
53
54 Q_PROPERTY(QString domain READ domain WRITE setDomain)
55 QString domain() const;
56
57 // Advanced properties
58
59 Q_PROPERTY(bool allowPap READ allowPap WRITE setAllowPap)
60 bool allowPap() const;
61
62 Q_PROPERTY(bool allowChap READ allowChap WRITE setAllowChap)
63 bool allowChap() const;
64
65 Q_PROPERTY(bool allowMschap READ allowMschap WRITE setAllowMschap)
66 bool allowMschap() const;
67
68 Q_PROPERTY(bool allowMschapv2 READ allowMschapv2 WRITE setAllowMschapv2)
69 bool allowMschapv2() const;
70
71 Q_PROPERTY(bool allowEap READ allowEap WRITE setAllowEap)
72 bool allowEap() const;
73
74 Q_PROPERTY(bool requireMppe READ requireMppe WRITE setRequireMppe)
75 bool requireMppe() const;
76
77 Q_PROPERTY(int mppeType READ mppeType WRITE setMppeType)
78 int mppeType() const;
79
80 Q_PROPERTY(bool mppeStateful READ mppeStateful WRITE setMppeStateful)
81 bool mppeStateful() const;
82
83 Q_PROPERTY(bool bsdCompression READ bsdCompression WRITE setBsdCompression)
84 bool bsdCompression() const;
85
86 Q_PROPERTY(bool deflateCompression READ deflateCompression WRITE setDeflateCompression)
87 bool deflateCompression() const;
88
89 Q_PROPERTY(bool tcpHeaderCompression READ tcpHeaderCompression WRITE setTcpHeaderCompression)
90 bool tcpHeaderCompression() const;
91
92 Q_PROPERTY(bool sendPppEchoPackets READ sendPppEchoPackets WRITE setSendPppEchoPackets)
93 bool sendPppEchoPackets() const;
94
95protected:
96 void notifyProperty(const QString& propertyName);
97
98protected Q_SLOTS:
99 // Enum properties
100 void setMppeType(int value);
101
102 // Basic properties
103
104 void gatewayUpdated(const QString &value);
105
106 void userUpdated(const QString &value);
107
108 void passwordUpdated(const QString &value);
109
110 void domainUpdated(const QString &value);
111
112 // Advanced properties
113
114 void allowPapUpdated(bool value);
115
116 void allowChapUpdated(bool value);
117
118 void allowMschapUpdated(bool value);
119
120 void allowMschapv2Updated(bool value);
121
122 void allowEapUpdated(bool value);
123
124 void requireMppeUpdated(bool value);
125
126 void mppeTypeUpdated(nmofono::vpn::PptpConnection::MppeType value);
127
128 void mppeStatefulUpdated(bool value);
129
130 void bsdCompressionUpdated(bool value);
131
132 void deflateCompressionUpdated(bool value);
133
134 void tcpHeaderCompressionUpdated(bool value);
135
136 void sendPppEchoPacketsUpdated(bool value);
137
138Q_SIGNALS:
139 // Basic properties
140
141 void setGateway(const QString &value);
142
143 void setUser(const QString &value);
144
145 void setPassword(const QString &value);
146
147 void setDomain(const QString &value);
148
149 // Advanced properties
150
151 void setAllowPap(bool value);
152
153 void setAllowChap(bool value);
154
155 void setAllowMschap(bool value);
156
157 void setAllowMschapv2(bool value);
158
159 void setAllowEap(bool value);
160
161 void setRequireMppe(bool value);
162
163 void setMppeStateful(bool value);
164
165 void setBsdCompression(bool value);
166
167 void setDeflateCompression(bool value);
168
169 void setTcpHeaderCompression(bool value);
170
171 void setSendPppEchoPackets(bool value);
172
173protected:
174 nmofono::vpn::PptpConnection::SPtr m_pptpConnection;
175};
176
177}
0178
=== added file 'src/indicator/nmofono/vpn/pptp-connection.cpp'
--- src/indicator/nmofono/vpn/pptp-connection.cpp 1970-01-01 00:00:00 +0000
+++ src/indicator/nmofono/vpn/pptp-connection.cpp 2016-02-15 09:40:45 +0000
@@ -0,0 +1,417 @@
1/*
2 * Copyright (C) 2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Pete Woods <pete.woods@canonical.com>
18 */
19
20#include <nmofono/vpn/pptp-connection.h>
21
22#include <NetworkManagerSettingsConnectionInterface.h>
23
24using namespace std;
25
26#define DEFINE_UPDATE_SETTER(name, uppername, type)\
27void set##uppername(type value)\
28{\
29 if (m_data.m_##name == value)\
30 {\
31 return;\
32 }\
33 m_data.m_##name = value;\
34 Q_EMIT p.name##Changed(m_data.m_##name);\
35}
36
37#define DEFINE_UPDATE_PROPERTY_STRING(name, uppername, strname) \
38void update##uppername(const QStringMap& data)\
39{\
40 set##uppername(data.value(strname));\
41}\
42\
43DEFINE_UPDATE_SETTER(name, uppername, const QString &)
44
45#define DEFINE_UPDATE_PROPERTY_ANTIBOOL(name, uppername, strname) \
46void update##uppername(const QStringMap& data)\
47{\
48 set##uppername(data.value(strname) != "yes");\
49}\
50\
51DEFINE_UPDATE_SETTER(name, uppername, bool)
52
53#define DEFINE_UPDATE_PROPERTY_PAIR(name, uppername, strname, type, conversion)\
54void update##uppername(const QStringMap& data)\
55{\
56 auto it = data.constFind(strname);\
57 bool found = (it != data.constEnd());\
58 set##uppername##Set(found);\
59 if (found)\
60 {\
61 set##uppername(it->conversion);\
62 }\
63}\
64\
65DEFINE_UPDATE_SETTER(name, uppername, type)\
66\
67DEFINE_UPDATE_SETTER(name##Set, uppername##Set, bool)\
68
69#define DEFINE_PROPERTY_GETTER(name,type) \
70type PptpConnection::name() const\
71{\
72 return d->m_data.m_##name;\
73}\
74
75#define DEFINE_PROPERTY_SETTER(varname, uppername, type) \
76void PptpConnection::set##uppername(type value)\
77{\
78 if (d->m_data.m_##varname == value)\
79 {\
80 return;\
81 }\
82 Priv::Data data(d->m_data);\
83 data.m_##varname = value;\
84 Q_EMIT updateVpnData(data.buildData());\
85}
86
87#define DEFINE_SECRET_PROPERTY_SETTER(varname, uppername, type) \
88void PptpConnection::set##uppername(type value)\
89{\
90 if (d->m_data.m_##varname == value)\
91 {\
92 return;\
93 }\
94 Priv::Data data(d->m_data);\
95 data.m_##varname = value;\
96 Q_EMIT updateVpnSecrets(data.buildSecrets());\
97}
98
99namespace nmofono
100{
101namespace vpn
102{
103
104class PptpConnection::Priv
105{
106public:
107 struct Data
108 {
109 Data()
110 {
111 }
112
113 Data(const Data& other) :
114 // Basic properties
115
116 m_gateway(other.m_gateway),
117 m_user(other.m_user),
118 m_password(other.m_password),
119 m_domain(other.m_domain),
120
121 // Advanced properties
122
123 m_allowPap(other.m_allowPap),
124 m_allowChap(other.m_allowChap),
125 m_allowMschap(other.m_allowMschap),
126 m_allowMschapv2(other.m_allowMschapv2),
127 m_allowEap(other.m_allowEap),
128 m_requireMppe(other.m_requireMppe),
129 m_mppeType(other.m_mppeType),
130 m_mppeStateful(other.m_mppeStateful),
131 m_bsdCompression(other.m_bsdCompression),
132 m_deflateCompression(other.m_deflateCompression),
133 m_tcpHeaderCompression(other.m_tcpHeaderCompression),
134 m_sendPppEchoPackets(other.m_sendPppEchoPackets)
135 {
136 }
137
138 Data& operator=(const Data& other) = delete;
139
140 QStringMap buildSecrets()
141 {
142 QStringMap secrets;
143
144 if (!m_password.isEmpty())
145 {
146 secrets["password"] = m_password;
147 }
148
149 return secrets;
150 }
151
152 QStringMap buildData()
153 {
154 QStringMap data;
155
156 // Basic properties
157
158 data["gateway"] = m_gateway;
159 data["user"] = m_user;
160 if (!m_domain.isEmpty())
161 {
162 data["domain"] = m_domain;
163 }
164
165 data["password-flags"] = "1";
166
167 // Advanced properties
168
169 static const QMap<MppeType, QString> mppeTypeMap
170 {
171 {MppeType::MPPE_ALL, "require-mppe"},
172 {MppeType::MPPE_128, "require-mppe-128"},
173 {MppeType::MPPE_40, "require-mppe-40"},
174 };
175
176 if (!m_requireMppe)
177 {
178 if (!m_allowPap)
179 {
180 data["refuse-pap"] = "yes";
181 }
182 if (!m_allowChap)
183 {
184 data["refuse-chap"] = "yes";
185 }
186 }
187 if (!m_allowMschap)
188 {
189 data["refuse-mschap"] = "yes";
190 }
191 if (!m_allowMschapv2)
192 {
193 data["refuse-mschapv2"] = "yes";
194 }
195 if (!m_requireMppe)
196 {
197 if (!m_allowEap)
198 {
199 data["refuse-eap"] = "yes";
200 }
201 }
202
203 if ((m_allowMschap || m_allowMschapv2) && m_requireMppe)
204 {
205 data[mppeTypeMap[m_mppeType]] = "yes";
206 if (m_mppeStateful)
207 {
208 data["mppe-stateful"] = "yes";
209 }
210 }
211
212 if (!m_bsdCompression)
213 {
214 data["nobsdcomp"] = "yes";
215 }
216 if (!m_deflateCompression)
217 {
218 data["nodeflate"] = "yes";
219 }
220 if (!m_tcpHeaderCompression)
221 {
222 data["no-vj-comp"] = "yes";
223 }
224
225 if (m_sendPppEchoPackets)
226 {
227 data["lcp-echo-interval"] = "30";
228 data["lcp-echo-failure"] = "5";
229 }
230
231 return data;
232 }
233
234 // Basic properties
235
236 QString m_gateway;
237 QString m_user;
238 QString m_password;
239 QString m_domain;
240
241 // Advanced properties
242
243 bool m_allowPap = true;
244 bool m_allowChap = true;
245 bool m_allowMschap = true;
246 bool m_allowMschapv2 = true;
247 bool m_allowEap = true;
248 bool m_requireMppe = false;
249 MppeType m_mppeType = MppeType::MPPE_ALL;
250 bool m_mppeStateful = false;
251 bool m_bsdCompression = true;
252 bool m_deflateCompression = true;
253 bool m_tcpHeaderCompression = true;
254 bool m_sendPppEchoPackets = false;
255 };
256
257 Priv(PptpConnection& parent) :
258 p(parent)
259 {
260 }
261
262 // Basic properties
263
264 DEFINE_UPDATE_PROPERTY_STRING(gateway, Gateway, "gateway")
265 DEFINE_UPDATE_PROPERTY_STRING(user, User, "user")
266 DEFINE_UPDATE_PROPERTY_STRING(password, Password, "password")
267 DEFINE_UPDATE_PROPERTY_STRING(domain, Domain, "domain")
268
269 // Advanced properties
270
271 DEFINE_UPDATE_PROPERTY_ANTIBOOL(allowPap, AllowPap, "refuse-pap")
272 DEFINE_UPDATE_PROPERTY_ANTIBOOL(allowChap, AllowChap, "refuse-chap")
273 DEFINE_UPDATE_PROPERTY_ANTIBOOL(allowMschap, AllowMschap, "refuse-mschap")
274 DEFINE_UPDATE_PROPERTY_ANTIBOOL(allowMschapv2, AllowMschapv2, "refuse-mschapv2")
275 DEFINE_UPDATE_PROPERTY_ANTIBOOL(allowEap, AllowEap, "refuse-eap")
276
277 void updateMppe(const QStringMap& data)
278 {
279 bool requireMppe = false;
280 MppeType mppeType = MppeType::MPPE_ALL;
281
282 QString tmp = data.value("require-mppe");
283 if (tmp == "yes")
284 {
285 requireMppe = true;
286 mppeType = MppeType::MPPE_ALL;
287 }
288 else
289 {
290 tmp = data.value("require-mppe-128");
291 if (tmp == "yes")
292 {
293 requireMppe = true;
294 mppeType = MppeType::MPPE_128;
295 }
296 else
297 {
298 tmp = data.value("require-mppe-40");
299 if (tmp == "yes")
300 {
301 requireMppe = true;
302 mppeType = MppeType::MPPE_40;
303 }
304 }
305 }
306
307 setRequireMppe(requireMppe);
308 if (requireMppe)
309 {
310 setMppeType(mppeType);
311 }
312 setMppeStateful(data.value("mppe-stateful") == "yes");
313 }
314 DEFINE_UPDATE_SETTER(requireMppe, RequireMppe, bool)
315 DEFINE_UPDATE_SETTER(mppeType, MppeType, PptpConnection::MppeType)
316 DEFINE_UPDATE_SETTER(mppeStateful, MppeStateful, bool)
317
318 DEFINE_UPDATE_PROPERTY_ANTIBOOL(bsdCompression, BsdCompression, "nobsdcomp")
319 DEFINE_UPDATE_PROPERTY_ANTIBOOL(deflateCompression, DeflateCompression, "nodeflate")
320 DEFINE_UPDATE_PROPERTY_ANTIBOOL(tcpHeaderCompression, TcpHeaderCompression, "no-vj-comp")
321
322 void updateSendPppEchoPackets(const QStringMap& data)
323 {
324 setSendPppEchoPackets(data.contains("lcp-echo-interval") || data.contains("lcp-echo-failure"));
325 }
326 DEFINE_UPDATE_SETTER(sendPppEchoPackets, SendPppEchoPackets, bool)
327
328 PptpConnection& p;
329
330 Data m_data;
331};
332
333PptpConnection::PptpConnection() :
334 d(new Priv(*this))
335{
336}
337
338PptpConnection::~PptpConnection()
339{
340}
341
342void PptpConnection::updateData(const QStringMap& data)
343{
344 // Basic properties
345
346 d->updateGateway(data);
347 d->updateUser(data);
348 d->updateDomain(data);
349
350 // Advanced properties
351
352 d->updateAllowPap(data);
353 d->updateAllowChap(data);
354 d->updateAllowMschap(data);
355 d->updateAllowMschapv2(data);
356 d->updateAllowEap(data);
357 d->updateMppe(data);
358 d->updateBsdCompression(data);
359 d->updateDeflateCompression(data);
360 d->updateTcpHeaderCompression(data);
361 d->updateSendPppEchoPackets(data);
362
363}
364
365void PptpConnection::updateSecrets(const QStringMap& secrets)
366{
367 d->updatePassword(secrets);
368}
369
370// Basic properties
371
372DEFINE_PROPERTY_GETTER(gateway, QString)
373DEFINE_PROPERTY_GETTER(user, QString)
374DEFINE_PROPERTY_GETTER(password, QString)
375DEFINE_PROPERTY_GETTER(domain, QString)
376
377// Advanced properties
378
379DEFINE_PROPERTY_GETTER(allowPap, bool)
380DEFINE_PROPERTY_GETTER(allowChap, bool)
381DEFINE_PROPERTY_GETTER(allowMschap, bool)
382DEFINE_PROPERTY_GETTER(allowMschapv2, bool)
383DEFINE_PROPERTY_GETTER(allowEap, bool)
384DEFINE_PROPERTY_GETTER(requireMppe, bool)
385DEFINE_PROPERTY_GETTER(mppeType, PptpConnection::MppeType)
386DEFINE_PROPERTY_GETTER(mppeStateful, bool)
387DEFINE_PROPERTY_GETTER(bsdCompression, bool)
388DEFINE_PROPERTY_GETTER(deflateCompression, bool)
389DEFINE_PROPERTY_GETTER(tcpHeaderCompression, bool)
390DEFINE_PROPERTY_GETTER(sendPppEchoPackets, bool)
391
392
393
394// Basic properties
395
396DEFINE_PROPERTY_SETTER(gateway, Gateway, const QString &)
397DEFINE_PROPERTY_SETTER(user, User, const QString &)
398DEFINE_SECRET_PROPERTY_SETTER(password, Password, const QString &)
399DEFINE_PROPERTY_SETTER(domain, Domain, const QString &)
400
401// Advanced properties
402
403DEFINE_PROPERTY_SETTER(allowPap, AllowPap, bool)
404DEFINE_PROPERTY_SETTER(allowChap, AllowChap, bool)
405DEFINE_PROPERTY_SETTER(allowMschap, AllowMschap, bool)
406DEFINE_PROPERTY_SETTER(allowMschapv2, AllowMschapv2, bool)
407DEFINE_PROPERTY_SETTER(allowEap, AllowEap, bool)
408DEFINE_PROPERTY_SETTER(requireMppe, RequireMppe, bool)
409DEFINE_PROPERTY_SETTER(mppeType, MppeType, MppeType)
410DEFINE_PROPERTY_SETTER(mppeStateful, MppeStateful, bool)
411DEFINE_PROPERTY_SETTER(bsdCompression, BsdCompression, bool)
412DEFINE_PROPERTY_SETTER(deflateCompression, DeflateCompression, bool)
413DEFINE_PROPERTY_SETTER(tcpHeaderCompression, TcpHeaderCompression, bool)
414DEFINE_PROPERTY_SETTER(sendPppEchoPackets, SendPppEchoPackets, bool)
415
416}
417}
0418
=== added file 'src/indicator/nmofono/vpn/pptp-connection.h'
--- src/indicator/nmofono/vpn/pptp-connection.h 1970-01-01 00:00:00 +0000
+++ src/indicator/nmofono/vpn/pptp-connection.h 2016-02-15 09:40:45 +0000
@@ -0,0 +1,192 @@
1/*
2 * Copyright (C) 2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Pete Woods <pete.woods@canonical.com>
18 */
19
20#pragma once
21
22#include <QObject>
23#include <QVariantMap>
24
25#include <unity/util/DefinesPtrs.h>
26
27class OrgFreedesktopNetworkManagerSettingsConnectionInterface;
28
29namespace nmofono
30{
31namespace vpn
32{
33
34class PptpConnection : public QObject
35{
36 Q_OBJECT
37
38public:
39 UNITY_DEFINES_PTRS(PptpConnection);
40
41 enum class MppeType
42 {
43 MPPE_ALL,
44 MPPE_128,
45 MPPE_40
46 };
47
48 PptpConnection();
49
50 ~PptpConnection();
51
52 // Basic properties
53
54 Q_PROPERTY(QString gateway READ gateway WRITE setGateway NOTIFY gatewayChanged)
55 QString gateway() const;
56
57 Q_PROPERTY(QString user READ user WRITE setUser NOTIFY userChanged)
58 QString user() const;
59
60 Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
61 QString password() const;
62
63 Q_PROPERTY(QString domain READ domain WRITE setDomain NOTIFY domainChanged)
64 QString domain() const;
65
66 // Advanced properties
67
68 Q_PROPERTY(bool allowPap READ allowPap WRITE setAllowPap NOTIFY allowPapChanged)
69 bool allowPap() const;
70
71 Q_PROPERTY(bool allowChap READ allowChap WRITE setAllowChap NOTIFY allowChapChanged)
72 bool allowChap() const;
73
74 Q_PROPERTY(bool allowMschap READ allowMschap WRITE setAllowMschap NOTIFY allowMschapChanged)
75 bool allowMschap() const;
76
77 Q_PROPERTY(bool allowMschapv2 READ allowMschapv2 WRITE setAllowMschapv2 NOTIFY allowMschapv2Changed)
78 bool allowMschapv2() const;
79
80 Q_PROPERTY(bool allowEap READ allowEap WRITE setAllowEap NOTIFY allowEapChanged)
81 bool allowEap() const;
82
83 Q_PROPERTY(bool requireMppe READ requireMppe WRITE setRequireMppe NOTIFY requireMppeChanged)
84 bool requireMppe() const;
85
86 Q_PROPERTY(MppeType mppeType READ mppeType WRITE setMppeType NOTIFY mppeTypeChanged)
87 MppeType mppeType() const;
88
89 Q_PROPERTY(bool mppeStateful READ mppeStateful WRITE setMppeStateful NOTIFY mppeStatefulChanged)
90 bool mppeStateful() const;
91
92 Q_PROPERTY(bool bsdCompression READ bsdCompression WRITE setBsdCompression NOTIFY bsdCompressionChanged)
93 bool bsdCompression() const;
94
95 Q_PROPERTY(bool deflateCompression READ deflateCompression WRITE setDeflateCompression NOTIFY deflateCompressionChanged)
96 bool deflateCompression() const;
97
98 Q_PROPERTY(bool tcpHeaderCompression READ tcpHeaderCompression WRITE setTcpHeaderCompression NOTIFY tcpHeaderCompressionChanged)
99 bool tcpHeaderCompression() const;
100
101 Q_PROPERTY(bool sendPppEchoPackets READ sendPppEchoPackets WRITE setSendPppEchoPackets NOTIFY sendPppEchoPacketsChanged)
102 bool sendPppEchoPackets() const;
103
104public Q_SLOTS:
105 void updateData(const QMap<QString, QString>& data);
106
107 void updateSecrets(const QMap<QString, QString>& data);
108
109 // Basic properties
110
111 void setGateway(const QString &value);
112
113 void setUser(const QString &value);
114
115 void setPassword(const QString &value);
116
117 void setDomain(const QString &value);
118
119 // Advanced properties
120
121 void setAllowPap(bool value);
122
123 void setAllowChap(bool value);
124
125 void setAllowMschap(bool value);
126
127 void setAllowMschapv2(bool value);
128
129 void setAllowEap(bool value);
130
131 void setRequireMppe(bool value);
132
133 void setMppeType(MppeType value);
134
135 void setMppeStateful(bool value);
136
137 void setBsdCompression(bool value);
138
139 void setDeflateCompression(bool value);
140
141 void setTcpHeaderCompression(bool value);
142
143 void setSendPppEchoPackets(bool value);
144
145Q_SIGNALS:
146 void updateVpnData(const QMap<QString, QString>& vpnData);
147
148 void updateVpnSecrets(const QMap<QString, QString>& vpnSecrets);
149
150 // Basic properties
151
152 void gatewayChanged(const QString &value);
153
154 void userChanged(const QString &value);
155
156 void passwordChanged(const QString &value);
157
158 void domainChanged(const QString &value);
159
160 // Advanced properties
161
162 void allowPapChanged(bool value);
163
164 void allowChapChanged(bool value);
165
166 void allowMschapChanged(bool value);
167
168 void allowMschapv2Changed(bool value);
169
170 void allowEapChanged(bool value);
171
172 void requireMppeChanged(bool value);
173
174 void mppeTypeChanged(MppeType value);
175
176 void mppeStatefulChanged(bool value);
177
178 void bsdCompressionChanged(bool value);
179
180 void deflateCompressionChanged(bool value);
181
182 void tcpHeaderCompressionChanged(bool value);
183
184 void sendPppEchoPacketsChanged(bool value);
185
186protected:
187 class Priv;
188 std::shared_ptr<Priv> d;
189};
190
191}
192}
0193
=== modified file 'src/indicator/nmofono/vpn/vpn-connection.cpp'
--- src/indicator/nmofono/vpn/vpn-connection.cpp 2015-12-15 11:18:55 +0000
+++ src/indicator/nmofono/vpn/vpn-connection.cpp 2016-02-15 09:40:45 +0000
@@ -342,6 +342,8 @@
342 QDBusObjectPath m_otherActiveConnectionPath;342 QDBusObjectPath m_otherActiveConnectionPath;
343343
344 OpenvpnConnection::SPtr m_openvpnConnection;344 OpenvpnConnection::SPtr m_openvpnConnection;
345
346 PptpConnection::SPtr m_pptpConnection;
345};347};
346348
347VpnConnection::VpnConnection(349VpnConnection::VpnConnection(
@@ -381,7 +383,14 @@
381 connect(d->m_openvpnConnection.get(), &OpenvpnConnection::updateVpnData, d.get(), &Priv::updateVpnData);383 connect(d->m_openvpnConnection.get(), &OpenvpnConnection::updateVpnData, d.get(), &Priv::updateVpnData);
382 connect(d->m_openvpnConnection.get(), &OpenvpnConnection::updateVpnSecrets, d.get(), &Priv::updateVpnSecrets);384 connect(d->m_openvpnConnection.get(), &OpenvpnConnection::updateVpnSecrets, d.get(), &Priv::updateVpnSecrets);
383 break;385 break;
384 //TODO pptp, etc386 case Type::pptp:
387 d->m_pptpConnection = make_shared<PptpConnection>();
388 d->m_pptpConnection->updateData(d->m_settings["vpn"]["data"].value<QStringMap>());
389 connect(d.get(), &Priv::updateData, d->m_pptpConnection.get(), &PptpConnection::updateData);
390 connect(d.get(), &Priv::updateSecrets, d->m_pptpConnection.get(), &PptpConnection::updateSecrets);
391 connect(d->m_pptpConnection.get(), &PptpConnection::updateVpnData, d.get(), &Priv::updateVpnData);
392 connect(d->m_pptpConnection.get(), &PptpConnection::updateVpnSecrets, d.get(), &Priv::updateVpnSecrets);
393 break;
385 default:394 default:
386 break;395 break;
387 }396 }
@@ -485,6 +494,11 @@
485 return d->m_openvpnConnection;494 return d->m_openvpnConnection;
486}495}
487496
497PptpConnection::SPtr VpnConnection::pptpConnection() const
498{
499 return d->m_pptpConnection;
500}
501
488}502}
489}503}
490504
491505
=== modified file 'src/indicator/nmofono/vpn/vpn-connection.h'
--- src/indicator/nmofono/vpn/vpn-connection.h 2015-12-04 13:18:04 +0000
+++ src/indicator/nmofono/vpn/vpn-connection.h 2016-02-15 09:40:45 +0000
@@ -27,6 +27,7 @@
2727
28#include <nmofono/connection/active-connection-manager.h>28#include <nmofono/connection/active-connection-manager.h>
29#include <nmofono/vpn/openvpn-connection.h>29#include <nmofono/vpn/openvpn-connection.h>
30#include <nmofono/vpn/pptp-connection.h>
3031
31#include <unity/util/DefinesPtrs.h>32#include <unity/util/DefinesPtrs.h>
3233
@@ -70,6 +71,8 @@
7071
71 OpenvpnConnection::SPtr openvpnConnection() const;72 OpenvpnConnection::SPtr openvpnConnection() const;
7273
74 PptpConnection::SPtr pptpConnection() const;
75
73public Q_SLOTS:76public Q_SLOTS:
74 void setActive(bool active);77 void setActive(bool active);
7578
7679
=== modified file 'src/indicator/nmofono/vpn/vpn-manager.cpp'
--- src/indicator/nmofono/vpn/vpn-manager.cpp 2015-12-11 14:58:11 +0000
+++ src/indicator/nmofono/vpn/vpn-manager.cpp 2016-02-15 09:40:45 +0000
@@ -233,7 +233,6 @@
233233
234 QString uuid = QUuid::createUuid().toString().mid(1,36);234 QString uuid = QUuid::createUuid().toString().mid(1,36);
235235
236
237 QStringMap vpnData;236 QStringMap vpnData;
238 switch (type)237 switch (type)
239 {238 {
@@ -241,7 +240,7 @@
241 vpnData["connection-type"] = "tls";240 vpnData["connection-type"] = "tls";
242 break;241 break;
243 case VpnConnection::Type::pptp:242 case VpnConnection::Type::pptp:
244 // TODO PPTP243 vpnData["password-flags"] = "1";
245 break;244 break;
246 };245 };
247246
@@ -251,13 +250,23 @@
251 {250 {
252 {"type", "vpn"},251 {"type", "vpn"},
253 {"id", d->newConnectionName()},252 {"id", d->newConnectionName()},
254 {"uuid", uuid}253 {"uuid", uuid},
254 {"autoconnect", "false"}
255
255 };256 };
256 connection["vpn"] = QVariantMap257 connection["vpn"] = QVariantMap
257 {258 {
258 {"service-type", typeMap[type]},259 {"service-type", typeMap[type]},
259 {"data", QVariant::fromValue(vpnData)}260 {"data", QVariant::fromValue(vpnData)}
260 };261 };
262 connection["ipv4"] = QVariantMap
263 {
264 {"method", "auto"}
265 };
266 connection["ipv6"] = QVariantMap
267 {
268 {"method", "auto"}
269 };
261270
262 auto reply = d->m_settingsInterface->AddConnection(connection);271 auto reply = d->m_settingsInterface->AddConnection(connection);
263 reply.waitForFinished();272 reply.waitForFinished();
264273
=== added directory 'src/vpn-editor/DialogFile'
=== renamed file 'src/vpn-editor/DialogFile.qml' => 'src/vpn-editor/DialogFile/DialogFile.qml'
=== renamed file 'src/vpn-editor/DialogFileProperties.qml' => 'src/vpn-editor/DialogFile/DialogFileProperties.qml'
=== renamed file 'src/vpn-editor/Openvpn/FileSelector.qml' => 'src/vpn-editor/DialogFile/FileSelector.qml'
=== renamed file 'src/vpn-editor/qmldir' => 'src/vpn-editor/DialogFile/qmldir'
=== modified file 'src/vpn-editor/Main.qml'
--- src/vpn-editor/Main.qml 2016-01-06 16:38:31 +0000
+++ src/vpn-editor/Main.qml 2016-02-15 09:40:45 +0000
@@ -17,6 +17,7 @@
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.3
19import Ubuntu.Connectivity 1.019import Ubuntu.Connectivity 1.0
20import "DialogFile"
2021
21MainView {22MainView {
22 id: root23 id: root
2324
=== modified file 'src/vpn-editor/Openvpn/AdvancedGeneral.qml'
--- src/vpn-editor/Openvpn/AdvancedGeneral.qml 2015-12-11 15:28:29 +0000
+++ src/vpn-editor/Openvpn/AdvancedGeneral.qml 2016-02-15 09:40:45 +0000
@@ -69,7 +69,8 @@
6969
70 ListItems.Standard {70 ListItems.Standard {
71 control: CheckBox {71 control: CheckBox {
72 checked: connection.compLzo72 id: compLzoCheckbox
73 Binding {target: compLzoCheckbox; property: "checked"; value: connection.compLzo}
73 onCheckedChanged: connection.compLzo = checked74 onCheckedChanged: connection.compLzo = checked
74 }75 }
75 text: i18n.tr("Use LZO data compression")76 text: i18n.tr("Use LZO data compression")
@@ -77,7 +78,8 @@
7778
78 ListItems.Standard {79 ListItems.Standard {
79 control: CheckBox {80 control: CheckBox {
80 checked: connection.protoTcp81 id: protoTcpCheckbox
82 Binding {target: protoTcpCheckbox; property: "checked"; value: connection.protoTcp}
81 onCheckedChanged: connection.protoTcp = checked83 onCheckedChanged: connection.protoTcp = checked
82 }84 }
83 text: i18n.tr("Use a TCP connection")85 text: i18n.tr("Use a TCP connection")
@@ -85,8 +87,8 @@
8587
86 OptionalValue {88 OptionalValue {
87 text: i18n.tr("Use custom virtual device type:")89 text: i18n.tr("Use custom virtual device type:")
8890 id: devTypeSetCheckbox
89 checked: connection.devTypeSet91 Binding {target: devTypeSetCheckbox; property: "checked"; value: connection.devTypeSet}
90 onCheckedChanged: connection.devTypeSet = checked92 onCheckedChanged: connection.devTypeSet = checked
91 }93 }
92 ListItems.ItemSelector {94 ListItems.ItemSelector {
@@ -113,7 +115,8 @@
113 OptionalValue {115 OptionalValue {
114 text: i18n.tr("Use custom tunnel MTU:")116 text: i18n.tr("Use custom tunnel MTU:")
115117
116 checked: connection.tunnelMtuSet118 id: tunnelMtuSetCheckbox
119 Binding {target: tunnelMtuSetCheckbox; property: "checked"; value: connection.tunnelMtuSet}
117 onCheckedChanged: connection.tunnelMtuSet = checked120 onCheckedChanged: connection.tunnelMtuSet = checked
118121
119 control: TextField {122 control: TextField {
@@ -129,7 +132,8 @@
129 OptionalValue {132 OptionalValue {
130 text: i18n.tr("Use UDP fragment size:")133 text: i18n.tr("Use UDP fragment size:")
131134
132 checked: connection.fragmentSizeSet135 id: fragmentSizeSetCheckbox
136 Binding {target: fragmentSizeSetCheckbox; property: "checked"; value: connection.fragmentSizeSet}
133 onCheckedChanged: connection.fragmentSizeSet = checked137 onCheckedChanged: connection.fragmentSizeSet = checked
134138
135 control: TextField {139 control: TextField {
@@ -144,7 +148,8 @@
144148
145 ListItems.Standard {149 ListItems.Standard {
146 control: CheckBox {150 control: CheckBox {
147 checked: connection.mssFix151 id: mssFixCheckbox
152 Binding {target: mssFixCheckbox; property: "checked"; value: connection.mssFix}
148 onCheckedChanged: connection.mssFix = checked153 onCheckedChanged: connection.mssFix = checked
149 }154 }
150 text: i18n.tr("Restrict tunnel TCP MSS")155 text: i18n.tr("Restrict tunnel TCP MSS")
@@ -152,7 +157,8 @@
152157
153 ListItems.Standard {158 ListItems.Standard {
154 control: CheckBox {159 control: CheckBox {
155 checked: connection.remoteRandom160 id: remoteRandomCheckbox
161 Binding {target: remoteRandomCheckbox; property: "checked"; value: connection.remoteRandom}
156 onCheckedChanged: connection.remoteRandom = checked162 onCheckedChanged: connection.remoteRandom = checked
157 }163 }
158 text: i18n.tr("Randomize remote hosts")164 text: i18n.tr("Randomize remote hosts")
159165
=== modified file 'src/vpn-editor/Openvpn/AdvancedProxies.qml'
--- src/vpn-editor/Openvpn/AdvancedProxies.qml 2015-12-11 15:28:29 +0000
+++ src/vpn-editor/Openvpn/AdvancedProxies.qml 2016-02-15 09:40:45 +0000
@@ -76,7 +76,8 @@
76 ListItems.Standard {76 ListItems.Standard {
77 text: i18n.tr("Retry indefinitely:")77 text: i18n.tr("Retry indefinitely:")
78 control: CheckBox {78 control: CheckBox {
79 checked: connection.proxyRetry79 id: proxyRetryCheckbox
80 Binding {target: proxyRetryCheckbox; property: "checked"; value: connection.proxyRetry}
80 onCheckedChanged: connection.proxyRetry = checked81 onCheckedChanged: connection.proxyRetry = checked
81 }82 }
82 enabled: usesProxy83 enabled: usesProxy
8384
=== modified file 'src/vpn-editor/Openvpn/AdvancedSecurity.qml'
--- src/vpn-editor/Openvpn/AdvancedSecurity.qml 2016-01-06 21:33:36 +0000
+++ src/vpn-editor/Openvpn/AdvancedSecurity.qml 2016-02-15 09:40:45 +0000
@@ -63,7 +63,8 @@
63 OptionalValue {63 OptionalValue {
64 text: i18n.tr("Use cipher key size:")64 text: i18n.tr("Use cipher key size:")
6565
66 checked: connection.keysizeSet66 id: keysizeSetCheckbox
67 Binding {target: keysizeSetCheckbox; property: "checked"; value: connection.keysizeSet}
67 onCheckedChanged: connection.keysizeSet = checked68 onCheckedChanged: connection.keysizeSet = checked
6869
69 control: TextField {70 control: TextField {
7071
=== modified file 'src/vpn-editor/Openvpn/AdvancedTls.qml'
--- src/vpn-editor/Openvpn/AdvancedTls.qml 2016-01-06 16:38:31 +0000
+++ src/vpn-editor/Openvpn/AdvancedTls.qml 2016-02-15 09:40:45 +0000
@@ -17,6 +17,7 @@
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.3
19import Ubuntu.Components.ListItems 1.3 as ListItems19import Ubuntu.Components.ListItems 1.3 as ListItems
20import "../DialogFile"
2021
21Page {22Page {
22 property var connection23 property var connection
@@ -48,7 +49,8 @@
48 OptionalValue {49 OptionalValue {
49 text: i18n.tr("Verify peer certificate:")50 text: i18n.tr("Verify peer certificate:")
5051
51 checked: connection.remoteCertTlsSet52 id: remoteCertTlsSetCheckbox
53 Binding {target: remoteCertTlsSetCheckbox; property: "checked"; value: connection.remoteCertTlsSet}
52 onCheckedChanged: connection.remoteCertTlsSet = checked54 onCheckedChanged: connection.remoteCertTlsSet = checked
53 }55 }
54 ListItems.ValueSelector {56 ListItems.ValueSelector {
@@ -65,7 +67,8 @@
65 OptionalValue {67 OptionalValue {
66 text: i18n.tr("Use additional TLS authentication:")68 text: i18n.tr("Use additional TLS authentication:")
6769
68 checked: connection.taSet70 id: taSetCheckbox
71 Binding {target: taSetCheckbox; property: "checked"; value: connection.taSet}
69 onCheckedChanged: connection.taSet = checked72 onCheckedChanged: connection.taSet = checked
70 }73 }
71 ListItems.Standard {74 ListItems.Standard {
7275
=== modified file 'src/vpn-editor/Openvpn/Password.qml'
--- src/vpn-editor/Openvpn/Password.qml 2015-12-11 14:56:59 +0000
+++ src/vpn-editor/Openvpn/Password.qml 2016-02-15 09:40:45 +0000
@@ -17,6 +17,7 @@
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.3
19import Ubuntu.Components.ListItems 1.3 as ListItems19import Ubuntu.Components.ListItems 1.3 as ListItems
20import "../DialogFile"
2021
21Column {22Column {
22 property var connection23 property var connection
@@ -42,11 +43,10 @@
42 }43 }
4344
44 ListItems.Standard {45 ListItems.Standard {
45 control: TextField {46 control: FileSelector {
46 text: connection.ca47 path: connection.ca
47 onTextChanged: connection.ca = text48 onPathChanged: connection.ca = path
48 width: units.gu(20)49 width: units.gu(20)
49 inputMethodHints: Qt.ImhNoPredictiveText
50 }50 }
51 text: i18n.tr("CA certificate:")51 text: i18n.tr("CA certificate:")
52 }52 }
5353
=== modified file 'src/vpn-editor/Openvpn/PasswordTls.qml'
--- src/vpn-editor/Openvpn/PasswordTls.qml 2016-01-06 16:38:31 +0000
+++ src/vpn-editor/Openvpn/PasswordTls.qml 2016-02-15 09:40:45 +0000
@@ -17,6 +17,7 @@
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.3
19import Ubuntu.Components.ListItems 1.3 as ListItems19import Ubuntu.Components.ListItems 1.3 as ListItems
20import "../DialogFile"
2021
21Column {22Column {
22 property var connection23 property var connection
2324
=== removed file 'src/vpn-editor/Openvpn/SettingTitle.qml'
--- src/vpn-editor/Openvpn/SettingTitle.qml 2015-12-11 14:56:59 +0000
+++ src/vpn-editor/Openvpn/SettingTitle.qml 1970-01-01 00:00:00 +0000
@@ -1,23 +0,0 @@
1/*
2 * Copyright (C) 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.3
19import Ubuntu.Components.ListItems 1.3 as ListItems
20
21ListItems.Standard {
22 highlightWhenPressed: false
23}
240
=== modified file 'src/vpn-editor/Openvpn/StaticKey.qml'
--- src/vpn-editor/Openvpn/StaticKey.qml 2016-01-06 16:38:31 +0000
+++ src/vpn-editor/Openvpn/StaticKey.qml 2016-02-15 09:40:45 +0000
@@ -17,6 +17,7 @@
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.3
19import Ubuntu.Components.ListItems 1.3 as ListItems19import Ubuntu.Components.ListItems 1.3 as ListItems
20import "../DialogFile"
2021
21Column {22Column {
22 property var connection23 property var connection
@@ -24,7 +25,7 @@
24 ListItems.Standard {25 ListItems.Standard {
25 control: FileSelector {26 control: FileSelector {
26 path: connection.staticKey27 path: connection.staticKey
27 onPathChanged: connection.staticKey = text28 onPathChanged: connection.staticKey = path
28 width: units.gu(20)29 width: units.gu(20)
29 }30 }
30 text: i18n.tr("Static key:")31 text: i18n.tr("Static key:")
3132
=== modified file 'src/vpn-editor/Openvpn/Tls.qml'
--- src/vpn-editor/Openvpn/Tls.qml 2016-01-06 16:38:31 +0000
+++ src/vpn-editor/Openvpn/Tls.qml 2016-02-15 09:40:45 +0000
@@ -17,6 +17,7 @@
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.3
19import Ubuntu.Components.ListItems 1.3 as ListItems19import Ubuntu.Components.ListItems 1.3 as ListItems
20import "../DialogFile"
2021
21Column {22Column {
22 property var connection23 property var connection
2324
=== added directory 'src/vpn-editor/Pptp'
=== added file 'src/vpn-editor/Pptp/Advanced.qml'
--- src/vpn-editor/Pptp/Advanced.qml 1970-01-01 00:00:00 +0000
+++ src/vpn-editor/Pptp/Advanced.qml 2016-02-15 09:40:45 +0000
@@ -0,0 +1,160 @@
1/*
2 * Copyright (C) 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.3
19import Ubuntu.Components.ListItems 1.3 as ListItems
20
21Page {
22 property var connection
23
24 title: i18n.tr("Advanced")
25
26 Flickable {
27 anchors.fill: parent
28 contentHeight: contentItem.childrenRect.height
29 boundsBehavior: (contentHeight > root.height) ?
30 Flickable.DragAndOvershootBounds :
31 Flickable.StopAtBounds
32 flickableDirection: Flickable.VerticalFlick
33
34 Column {
35 anchors.left: parent.left
36 anchors.right: parent.right
37
38 ListItems.Header {text: i18n.tr("Authentication methods")}
39
40 ListItems.Standard {
41 control: CheckBox {
42 id: allowPapCheckbox
43 Binding {target: allowPapCheckbox; property: "checked"; value: connection.allowPap}
44 onCheckedChanged: connection.allowPap = checked
45 }
46 text: i18n.tr("PAP")
47 enabled: !connection.requireMppe
48 }
49
50 ListItems.Standard {
51 control: CheckBox {
52 id: allowChapCheckbox
53 Binding {target: allowChapCheckbox; property: "checked"; value: connection.allowChap}
54 onCheckedChanged: connection.allowChap = checked
55 }
56 text: i18n.tr("CHAP")
57 enabled: !connection.requireMppe
58 }
59
60 ListItems.Standard {
61 control: CheckBox {
62 id: allowMschapCheckbox
63 Binding {target: allowMschapCheckbox; property: "checked"; value: connection.allowMschap}
64 onCheckedChanged: connection.allowMschap = checked
65 }
66 text: i18n.tr("MSCHAP")
67 }
68
69 ListItems.Standard {
70 control: CheckBox {
71 id: allowMschapv2Checkbox
72 Binding {target: allowMschapv2Checkbox; property: "checked"; value: connection.allowMschapv2}
73 onCheckedChanged: connection.allowMschapv2 = checked
74 }
75 text: i18n.tr("MSCHAPv2")
76 }
77
78 ListItems.Standard {
79 control: CheckBox {
80 id: allowEapCheckbox
81 Binding {target: allowEapCheckbox; property: "checked"; value: connection.allowEap}
82 onCheckedChanged: connection.allowEap = checked
83 }
84 text: i18n.tr("EAP")
85 enabled: !connection.requireMppe
86 }
87
88 ListItems.Header {text: i18n.tr("Security")}
89
90 ListItems.Standard {
91 control: CheckBox {
92 id: requireMppeCheckbox
93 Binding {target: requireMppeCheckbox; property: "checked"; value: connection.requireMppe}
94 onCheckedChanged: connection.requireMppe = checked
95 }
96 text: i18n.tr("Use Point-to-Point encryption")
97 }
98
99 ListItems.ItemSelector {
100 model: [
101 i18n.tr("All Availale (Default)"),
102 i18n.tr("128-bit (most secure)"),
103 i18n.tr("40-bit (less secure)")
104 ]
105 selectedIndex: connection.mppeType
106 onSelectedIndexChanged: connection.mppeType = selectedIndex
107 enabled: connection.requireMppe
108 }
109
110 ListItems.Standard {
111 control: CheckBox {
112 id: mppeStatefulCheckbox
113 Binding {target: mppeStatefulCheckbox; property: "checked"; value: connection.mppeStateful}
114 onCheckedChanged: connection.mppeStateful = checked
115 }
116 text: i18n.tr("Allow stateful encryption")
117 }
118
119 ListItems.Header {text: i18n.tr("Compression")}
120
121 ListItems.Standard {
122 control: CheckBox {
123 id: bsdCompressionCheckbox
124 Binding {target: bsdCompressionCheckbox; property: "checked"; value: connection.bsdCompression}
125 onCheckedChanged: connection.bsdCompression = checked
126 }
127 text: i18n.tr("Allow BSD data compression")
128 }
129
130 ListItems.Standard {
131 control: CheckBox {
132 id: deflateCompressionCheckbox
133 Binding {target: deflateCompressionCheckbox; property: "checked"; value: connection.deflateCompression}
134 onCheckedChanged: connection.deflateCompression = checked
135 }
136 text: i18n.tr("Allow Deflate data compression")
137 }
138
139 ListItems.Standard {
140 control: CheckBox {
141 id: tcpHeaderCompressionCheckbox
142 Binding {target: tcpHeaderCompressionCheckbox; property: "checked"; value: connection.tcpHeaderCompression}
143 onCheckedChanged: connection.tcpHeaderCompression = checked
144 }
145 text: i18n.tr("Use TCP header compression")
146 }
147
148 ListItems.Header {text: i18n.tr("Echo")}
149
150 ListItems.Standard {
151 control: CheckBox {
152 id: sendPppEchoPacketsCheckbox
153 Binding {target: sendPppEchoPacketsCheckbox; property: "checked"; value: connection.sendPppEchoPackets}
154 onCheckedChanged: connection.sendPppEchoPackets = checked
155 }
156 text: i18n.tr("Send PPP echo packets")
157 }
158 }
159 }
160}
0161
=== added file 'src/vpn-editor/Pptp/Editor.qml'
--- src/vpn-editor/Pptp/Editor.qml 1970-01-01 00:00:00 +0000
+++ src/vpn-editor/Pptp/Editor.qml 2016-02-15 09:40:45 +0000
@@ -0,0 +1,97 @@
1/*
2 * Copyright (C) 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.3
20import Ubuntu.Components.ListItems 1.3 as ListItems
21import Ubuntu.Connectivity 1.0
22import "../DialogFile"
23
24Item {
25 property var connection
26
27 id: root
28
29 Column {
30 id: topPart
31 anchors.left: parent.left
32 anchors.right: parent.right
33
34
35 ListItems.Header {text: i18n.tr("General")}
36
37 ListItems.Standard {
38 control: TextField {
39 text: connection.id
40 onTextChanged: connection.id = text
41 width: units.gu(20)
42 inputMethodHints: Qt.ImhNoPredictiveText
43 }
44 text: i18n.tr("ID:")
45 }
46
47 ListItems.Standard {
48 control: TextField {
49 text: connection.gateway
50 onTextChanged: connection.gateway = text
51 width: units.gu(20)
52 inputMethodHints: Qt.ImhNoPredictiveText
53 }
54 text: i18n.tr("Gateway:")
55 }
56
57 ListItems.Header {text: i18n.tr("Optional")}
58
59 ListItems.Standard {
60 control: TextField {
61 text: connection.user
62 onTextChanged: connection.user = text
63 width: units.gu(20)
64 inputMethodHints: Qt.ImhNoPredictiveText
65 }
66 text: i18n.tr("User name:")
67 }
68
69 ListItems.Standard {
70 control: TextField {
71 text: connection.password
72 onTextChanged: connection.password = text
73 width: units.gu(20)
74 echoMode:TextInput.Password
75 }
76 text: i18n.tr("Password:")
77 }
78
79 ListItems.Standard {
80 control: TextField {
81 text: connection.domain
82 onTextChanged: password.domain = text
83 width: units.gu(20)
84 inputMethodHints: Qt.ImhNoPredictiveText
85 }
86 text: i18n.tr("NT Domain:")
87 }
88
89 ListItems.Divider {}
90
91 ListItems.Standard {
92 text: i18n.tr("Advanced")
93 progression: true
94 onClicked: pageStack.push(Qt.resolvedUrl("Advanced.qml"), {connection: root.connection})
95 }
96 }
97}
098
=== modified file 'src/vpn-editor/VpnList.qml'
--- src/vpn-editor/VpnList.qml 2015-12-15 11:19:25 +0000
+++ src/vpn-editor/VpnList.qml 2016-02-15 09:40:45 +0000
@@ -26,11 +26,23 @@
26 title: i18n.tr("VPN configurations")26 title: i18n.tr("VPN configurations")
2727
28 head.actions: [28 head.actions: [
29 // There has to be a better way to force all the actions
30 // into the menu
31 Action {
32 enabled: false
33 },
34 Action {
35 enabled: false
36 },
29 Action {37 Action {
30 iconName: "add"38 iconName: "add"
31 text: i18n.tr("New configuration")
32 // TODO Pick from OpenVPN or PPTP when supported
33 onTriggered: model.add(VpnConnection.OPENVPN)39 onTriggered: model.add(VpnConnection.OPENVPN)
40 text: i18n.tr("OpenVPN")
41 },
42 Action {
43 iconName: "add"
44 onTriggered: model.add(VpnConnection.PPTP)
45 text: i18n.tr("PPTP")
34 }46 }
35 ]47 ]
3648
@@ -46,6 +58,7 @@
46 ListView {58 ListView {
47 id: listView59 id: listView
48 anchors.fill: parent60 anchors.fill: parent
61 visible: (listView.count !== 0)
49 model: root.model62 model: root.model
5063
51 delegate: ListItem {64 delegate: ListItem {
@@ -77,4 +90,16 @@
77 }90 }
78 }91 }
79 }92 }
93
94 Rectangle {
95 visible: (listView.count === 0)
96 color: "lightgrey"
97 anchors.fill: parent
98
99 Label {
100 text: i18n.tr("No VPN connections")
101 fontSize: "x-large"
102 anchors.centerIn: parent
103 }
104 }
80}105}
81106
=== modified file 'src/vpn-editor/manifest.json'
--- src/vpn-editor/manifest.json 2016-01-06 16:38:31 +0000
+++ src/vpn-editor/manifest.json 2016-02-15 09:40:45 +0000
@@ -10,5 +10,5 @@
10 "maintainer": "Pete Woods <pete.woods@canonical.com>",10 "maintainer": "Pete Woods <pete.woods@canonical.com>",
11 "name": "com.ubuntu.developer.pete-woods.vpn-editor",11 "name": "com.ubuntu.developer.pete-woods.vpn-editor",
12 "title": "VPN editor",12 "title": "VPN editor",
13 "version": "0.2.0"13 "version": "0.3.0"
14}14}

Subscribers

People subscribed via source and target branches