Merge lp:~pete-woods/indicator-network/add-never-default-lp1546573 into lp:indicator-network

Proposed by Pete Woods
Status: Merged
Approved by: Pete Woods
Approved revision: 571
Merged at revision: 570
Proposed branch: lp:~pete-woods/indicator-network/add-never-default-lp1546573
Merge into: lp:indicator-network
Diff against target: 313 lines (+104/-1)
9 files modified
data/com.ubuntu.connectivity1.vpn.VpnConnection.xml (+2/-0)
src/connectivity-api/connectivity-qt/connectivityqt/vpn-connection.cpp (+14/-0)
src/connectivity-api/connectivity-qt/connectivityqt/vpn-connection.h (+7/-0)
src/indicator/connectivity-service/dbus-vpn-connection.cpp (+12/-0)
src/indicator/connectivity-service/dbus-vpn-connection.h (+7/-0)
src/indicator/nmofono/vpn/vpn-connection.cpp (+38/-1)
src/indicator/nmofono/vpn/vpn-connection.h (+6/-0)
src/vpn-editor/Openvpn/AdvancedGeneral.qml (+9/-0)
src/vpn-editor/Pptp/Advanced.qml (+9/-0)
To merge this branch: bzr merge lp:~pete-woods/indicator-network/add-never-default-lp1546573
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Indicator Applet Developers Pending
Review via email: mp+287830@code.launchpad.net

Commit message

Add never default property

Description of the change

Add never default property

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

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.xml'
2--- data/com.ubuntu.connectivity1.vpn.VpnConnection.xml 2015-12-14 11:56:23 +0000
3+++ data/com.ubuntu.connectivity1.vpn.VpnConnection.xml 2016-03-03 15:12:56 +0000
4@@ -10,6 +10,8 @@
5
6 <property name="id" type="s" access="readwrite"/>
7
8+ <property name="neverDefault" type="b" access="readwrite"/>
9+
10 <property name="active" type="b" access="readwrite"/>
11
12 <property name="activatable" type="b" access="read"/>
13
14=== modified file 'src/connectivity-api/connectivity-qt/connectivityqt/vpn-connection.cpp'
15--- src/connectivity-api/connectivity-qt/connectivityqt/vpn-connection.cpp 2015-12-14 11:56:23 +0000
16+++ src/connectivity-api/connectivity-qt/connectivityqt/vpn-connection.cpp 2016-03-03 15:12:56 +0000
17@@ -45,6 +45,10 @@
18 {
19 Q_EMIT p.idChanged(value.toString());
20 }
21+ else if (name == "neverDefault")
22+ {
23+ Q_EMIT p.neverDefaultChanged(value.toBool());
24+ }
25 else if (name == "active")
26 {
27 Q_EMIT p.activeChanged(value.toBool());
28@@ -95,6 +99,11 @@
29 return d->m_propertyCache->get("id").toString();
30 }
31
32+bool VpnConnection::neverDefault() const
33+{
34+ return d->m_propertyCache->get("neverDefault").toBool();
35+}
36+
37 bool VpnConnection::active() const
38 {
39 return d->m_propertyCache->get("active").toBool();
40@@ -110,6 +119,11 @@
41 d->m_propertyCache->set("id", id);
42 }
43
44+void VpnConnection::setNeverDefault(bool neverDefault) const
45+{
46+ d->m_propertyCache->set("neverDefault", neverDefault);
47+}
48+
49 void VpnConnection::setActive(bool active) const
50 {
51 d->m_propertyCache->set("active", active);
52
53=== modified file 'src/connectivity-api/connectivity-qt/connectivityqt/vpn-connection.h'
54--- src/connectivity-api/connectivity-qt/connectivityqt/vpn-connection.h 2015-12-14 11:56:23 +0000
55+++ src/connectivity-api/connectivity-qt/connectivityqt/vpn-connection.h 2016-03-03 15:12:56 +0000
56@@ -53,6 +53,9 @@
57 Q_PROPERTY(QString id READ id WRITE setId NOTIFY idChanged)
58 QString id() const;
59
60+ Q_PROPERTY(bool neverDefault READ neverDefault WRITE setNeverDefault NOTIFY neverDefaultChanged)
61+ bool neverDefault() const;
62+
63 Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
64 bool active() const;
65
66@@ -65,6 +68,8 @@
67 public Q_SLOTS:
68 void setId(const QString& id) const;
69
70+ void setNeverDefault(bool neverDefault) const;
71+
72 void setActive(bool active) const;
73
74 void updateSecrets() const;
75@@ -72,6 +77,8 @@
76 Q_SIGNALS:
77 void idChanged(const QString& id);
78
79+ void neverDefaultChanged(bool neverDefault);
80+
81 void activeChanged(bool active);
82
83 void activatableChanged(bool active);
84
85=== modified file 'src/indicator/connectivity-service/dbus-vpn-connection.cpp'
86--- src/indicator/connectivity-service/dbus-vpn-connection.cpp 2015-12-14 11:56:23 +0000
87+++ src/indicator/connectivity-service/dbus-vpn-connection.cpp 2016-03-03 15:12:56 +0000
88@@ -37,11 +37,13 @@
89 new VpnConnectionAdaptor(this);
90
91 connect(m_vpnConnection.get(), &VpnConnection::idChanged, this, &DBusVpnConnection::idUpdated);
92+ connect(m_vpnConnection.get(), &VpnConnection::neverDefaultChanged, this, &DBusVpnConnection::neverDefaultUpdated);
93 connect(m_vpnConnection.get(), &VpnConnection::activeChanged, this, &DBusVpnConnection::activeUpdated);
94 connect(m_vpnConnection.get(), &VpnConnection::activatableChanged, this, &DBusVpnConnection::activatableUpdated);
95
96 connect(this, &DBusVpnConnection::setActive, m_vpnConnection.get(), &VpnConnection::setActive);
97 connect(this, &DBusVpnConnection::setId, m_vpnConnection.get(), &VpnConnection::setId);
98+ connect(this, &DBusVpnConnection::setNeverDefault, m_vpnConnection.get(), &VpnConnection::setNeverDefault);
99 connect(this, &DBusVpnConnection::UpdateSecrets, m_vpnConnection.get(), &VpnConnection::updateSecrets);
100 }
101
102@@ -62,6 +64,11 @@
103 notifyProperties({"id"});
104 }
105
106+void DBusVpnConnection::neverDefaultUpdated(bool)
107+{
108+ notifyProperties({"neverDefault"});
109+}
110+
111 void DBusVpnConnection::activeUpdated(bool)
112 {
113 notifyProperties({"active"});
114@@ -90,6 +97,11 @@
115 return m_vpnConnection->id();
116 }
117
118+bool DBusVpnConnection::neverDefault() const
119+{
120+ return m_vpnConnection->neverDefault();
121+}
122+
123 bool DBusVpnConnection::active() const
124 {
125 return m_vpnConnection->isActive();
126
127=== modified file 'src/indicator/connectivity-service/dbus-vpn-connection.h'
128--- src/indicator/connectivity-service/dbus-vpn-connection.h 2015-12-14 11:56:23 +0000
129+++ src/indicator/connectivity-service/dbus-vpn-connection.h 2016-03-03 15:12:56 +0000
130@@ -50,6 +50,9 @@
131 Q_PROPERTY(QString id READ id WRITE setId)
132 QString id() const;
133
134+ Q_PROPERTY(bool neverDefault READ neverDefault WRITE setNeverDefault)
135+ bool neverDefault() const;
136+
137 virtual nmofono::vpn::VpnConnection::Type type() const = 0;
138
139 Q_PROPERTY(bool active READ active WRITE setActive)
140@@ -67,6 +70,8 @@
141
142 void setId(const QString& id);
143
144+ void setNeverDefault(bool neverDefault);
145+
146 void UpdateSecrets();
147
148 protected Q_SLOTS:
149@@ -76,6 +81,8 @@
150
151 void idUpdated(const QString& id);
152
153+ void neverDefaultUpdated(bool neverDefault);
154+
155 private:
156 void notifyProperties(const QStringList& propertyNames);
157
158
159=== modified file 'src/indicator/nmofono/vpn/vpn-connection.cpp'
160--- src/indicator/nmofono/vpn/vpn-connection.cpp 2016-01-14 11:40:59 +0000
161+++ src/indicator/nmofono/vpn/vpn-connection.cpp 2016-03-03 15:12:56 +0000
162@@ -133,6 +133,23 @@
163 Q_EMIT p.validChanged(m_valid);
164 }
165
166+ void updateNeverDefault()
167+ {
168+ auto ipv4 = m_settings.value("ipv4");
169+ bool neverDefault = false;
170+ if (ipv4.contains("never-default") && ipv4.value("never-default").toBool()) {
171+ neverDefault = true;
172+ }
173+
174+ if (neverDefault == m_neverDefault)
175+ {
176+ return;
177+ }
178+
179+ m_neverDefault = neverDefault;
180+ Q_EMIT p.neverDefaultChanged(m_neverDefault);
181+ }
182+
183 void updateType()
184 {
185 static const QMap<QString, Type> typeMap
186@@ -188,7 +205,7 @@
187 reply.waitForFinished();
188 if (reply.isError())
189 {
190- qWarning() << __PRETTY_FUNCTION__ << reply.error().message();
191+ qWarning() << __PRETTY_FUNCTION__ << reply.error().message() << m_pendingSettings;
192 }
193
194 m_dirty = false;
195@@ -258,6 +275,7 @@
196 }
197
198 updateId();
199+ updateNeverDefault();
200 updateValid();
201 updateType();
202
203@@ -325,6 +343,8 @@
204
205 QString m_id;
206
207+ bool m_neverDefault = false;
208+
209 bool m_valid = false;
210
211 Type m_type;
212@@ -406,6 +426,11 @@
213 return d->m_id;
214 }
215
216+bool VpnConnection::neverDefault() const
217+{
218+ return d->m_neverDefault;
219+}
220+
221 QDBusObjectPath VpnConnection::path() const
222 {
223 return QDBusObjectPath(d->m_connection->path());
224@@ -442,6 +467,18 @@
225 d->m_pendingSettings["connection"]["id"] = id;
226 }
227
228+void VpnConnection::setNeverDefault(bool neverDefault)
229+{
230+ if (d->m_neverDefault == neverDefault)
231+ {
232+ return;
233+ }
234+
235+ d->setDirty();
236+ d->m_pendingSettings["ipv4"]["never-default"] = neverDefault;
237+ d->m_pendingSettings["ipv6"]["never-default"] = neverDefault;
238+}
239+
240 void VpnConnection::setOtherConnectionIsBusy(bool otherConnectionIsBusy)
241 {
242 d->m_otherConnectionIsBusy = otherConnectionIsBusy;
243
244=== modified file 'src/indicator/nmofono/vpn/vpn-connection.h'
245--- src/indicator/nmofono/vpn/vpn-connection.h 2016-01-14 11:40:59 +0000
246+++ src/indicator/nmofono/vpn/vpn-connection.h 2016-03-03 15:12:56 +0000
247@@ -57,6 +57,8 @@
248
249 QString id() const;
250
251+ bool neverDefault() const;
252+
253 QDBusObjectPath path() const;
254
255 bool isActive() const;
256@@ -78,6 +80,8 @@
257
258 void setId(const QString& id);
259
260+ void setNeverDefault(bool neverDefault);
261+
262 void setOtherConnectionIsBusy(bool otherConnectionIsBusy);
263
264 void setActiveConnectionPath(const QDBusObjectPath& path);
265@@ -89,6 +93,8 @@
266 Q_SIGNALS:
267 void idChanged(const QString& id);
268
269+ void neverDefaultChanged(bool neverDefault);
270+
271 void activeChanged(bool active);
272
273 void validChanged(bool valid);
274
275=== modified file 'src/vpn-editor/Openvpn/AdvancedGeneral.qml'
276--- src/vpn-editor/Openvpn/AdvancedGeneral.qml 2016-01-14 11:40:59 +0000
277+++ src/vpn-editor/Openvpn/AdvancedGeneral.qml 2016-03-03 15:12:56 +0000
278@@ -34,6 +34,15 @@
279 Column {
280 anchors.left: parent.left
281 anchors.right: parent.right
282+
283+ ListItems.Standard {
284+ control: CheckBox {
285+ id: neverDefaultCheckbox
286+ Binding {target: neverDefaultCheckbox; property: "checked"; value: connection.neverDefault}
287+ onCheckedChanged: connection.neverDefault = checked
288+ }
289+ text: i18n.tr("Only use connection for VPN resources")
290+ }
291
292 OptionalValue {
293 text: i18n.tr("Use custom gateway port:")
294
295=== modified file 'src/vpn-editor/Pptp/Advanced.qml'
296--- src/vpn-editor/Pptp/Advanced.qml 2016-01-14 11:40:59 +0000
297+++ src/vpn-editor/Pptp/Advanced.qml 2016-03-03 15:12:56 +0000
298@@ -35,6 +35,15 @@
299 anchors.left: parent.left
300 anchors.right: parent.right
301
302+ ListItems.Standard {
303+ control: CheckBox {
304+ id: neverDefaultCheckbox
305+ Binding {target: neverDefaultCheckbox; property: "checked"; value: connection.neverDefault}
306+ onCheckedChanged: connection.neverDefault = checked
307+ }
308+ text: i18n.tr("Only use connection for VPN resources")
309+ }
310+
311 ListItems.Header {text: i18n.tr("Authentication methods")}
312
313 ListItems.Standard {

Subscribers

People subscribed via source and target branches