Merge lp:~pete-woods/indicator-network/wapi-lp1597681 into lp:indicator-network

Proposed by Pete Woods
Status: Approved
Approved by: Pete Woods
Approved revision: 609
Proposed branch: lp:~pete-woods/indicator-network/wapi-lp1597681
Merge into: lp:indicator-network
Diff against target: 531 lines (+187/-139)
12 files modified
po/indicator-network.pot (+126/-122)
src/agent/SecretAgent.h (+1/-0)
src/agent/SecretRequest.cpp (+5/-2)
src/indicator/menuitems/access-point-item.cpp (+1/-1)
src/indicator/nmofono/wifi/access-point-impl.cpp (+18/-2)
src/indicator/nmofono/wifi/access-point-impl.h (+1/-1)
src/indicator/nmofono/wifi/access-point.h (+10/-1)
src/indicator/nmofono/wifi/grouped-access-point.cpp (+3/-3)
src/indicator/nmofono/wifi/grouped-access-point.h (+1/-1)
src/indicator/nmofono/wifi/wifi-link-impl.cpp (+18/-4)
tests/integration/test-indicator.cpp (+1/-1)
tests/unit/indicator/menuitems/test-access-point-item.cpp (+2/-1)
To merge this branch: bzr merge lp:~pete-woods/indicator-network/wapi-lp1597681
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+299577@code.launchpad.net

Commit message

Add support for new WAPI settings keys

Description of the change

Add support for new WAPI settings keys

To post a comment you must log in.
610. By Pete Woods

Log which URLs are dispatched to USS

Unmerged revisions

610. By Pete Woods

Log which URLs are dispatched to USS

609. By Pete Woods

Add support for new WAPI settings keys

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/indicator-network.pot'
2--- po/indicator-network.pot 2016-04-29 14:08:19 +0000
3+++ po/indicator-network.pot 2016-07-14 10:02:10 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: PACKAGE VERSION\n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2016-04-29 12:38+0300\n"
9+"POT-Creation-Date: 2016-07-11 09:50+0100\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -30,72 +30,63 @@
14 msgid "WEP"
15 msgstr ""
16
17-#: ../src/agent/SecretRequest.cpp:74
18+#: ../src/agent/SecretRequest.cpp:70
19+msgid "WAPI"
20+msgstr ""
21+
22+#: ../src/agent/SecretRequest.cpp:76
23 msgid "Connect"
24 msgstr ""
25
26-#: ../src/agent/SecretRequest.cpp:75
27+#: ../src/agent/SecretRequest.cpp:77
28 msgid "Cancel"
29 msgstr ""
30
31-#: ../src/indicator/menuitems/wifi-link-item.cpp:109
32-msgid "Other network…"
33-msgstr ""
34-
35-#: ../src/indicator/menuitems/wwan-link-item.cpp:90
36-msgid "No SIM"
37-msgstr ""
38-
39-#: ../src/indicator/menuitems/wwan-link-item.cpp:97
40-msgid "SIM Error"
41-msgstr ""
42-
43-#: ../src/indicator/menuitems/wwan-link-item.cpp:105
44-msgid "SIM Locked"
45-msgstr ""
46-
47-#: ../src/indicator/menuitems/wwan-link-item.cpp:118
48-msgid "Unregistered"
49-msgstr ""
50-
51-#: ../src/indicator/menuitems/wwan-link-item.cpp:123
52-msgid "Unknown"
53-msgstr ""
54-
55-#: ../src/indicator/menuitems/wwan-link-item.cpp:128
56-msgid "Denied"
57-msgstr ""
58-
59-#: ../src/indicator/menuitems/wwan-link-item.cpp:133
60-msgid "Searching"
61-msgstr ""
62-
63-#: ../src/indicator/menuitems/wwan-link-item.cpp:145
64-msgid "No Signal"
65-msgstr ""
66-
67-#: ../src/indicator/menuitems/wwan-link-item.cpp:157
68-#: ../src/indicator/menuitems/wwan-link-item.cpp:164
69-msgid "Offline"
70-msgstr ""
71-
72-#. TODO Move this into a new class
73-#: ../src/indicator/factory.cpp:187
74-msgid "Wi-Fi"
75-msgstr ""
76-
77-#. TODO Move this into a new class
78-#: ../src/indicator/factory.cpp:198
79-msgid "Flight Mode"
80-msgstr ""
81-
82-#: ../src/indicator/factory.cpp:208
83-msgid "Cellular data"
84-msgstr ""
85-
86-#. TODO Move this into a new class
87-#: ../src/indicator/factory.cpp:219
88-msgid "Hotspot"
89+#: ../src/indicator/vpn-status-notifier.cpp:48
90+msgid "The VPN connection '%1' failed."
91+msgstr ""
92+
93+#: ../src/indicator/vpn-status-notifier.cpp:50
94+msgid ""
95+"The VPN connection '%1' failed because the network connection was "
96+"interrupted."
97+msgstr ""
98+
99+#: ../src/indicator/vpn-status-notifier.cpp:51
100+msgid ""
101+"The VPN connection '%1' failed because the VPN service stopped unexpectedly."
102+msgstr ""
103+
104+#: ../src/indicator/vpn-status-notifier.cpp:52
105+msgid ""
106+"The VPN connection '%1' failed because the VPN service returned invalid "
107+"configuration."
108+msgstr ""
109+
110+#: ../src/indicator/vpn-status-notifier.cpp:53
111+msgid ""
112+"The VPN connection '%1' failed because the connection attempt timed out."
113+msgstr ""
114+
115+#: ../src/indicator/vpn-status-notifier.cpp:54
116+msgid ""
117+"The VPN connection '%1' failed because the VPN service did not start in time."
118+msgstr ""
119+
120+#: ../src/indicator/vpn-status-notifier.cpp:55
121+msgid "The VPN connection '%1' failed because the VPN service failed to start."
122+msgstr ""
123+
124+#: ../src/indicator/vpn-status-notifier.cpp:56
125+msgid "The VPN connection '%1' failed because there were no valid VPN secrets."
126+msgstr ""
127+
128+#: ../src/indicator/vpn-status-notifier.cpp:57
129+msgid "The VPN connection '%1' failed because of invalid VPN secrets."
130+msgstr ""
131+
132+#: ../src/indicator/vpn-status-notifier.cpp:68
133+msgid "VPN Connection Failed"
134 msgstr ""
135
136 #: ../src/indicator/sim-unlock-dialog.cpp:144
137@@ -186,70 +177,83 @@
138 msgid "PIN codes did not match."
139 msgstr ""
140
141-#: ../src/indicator/vpn-status-notifier.cpp:48
142-msgid "The VPN connection '%1' failed."
143-msgstr ""
144-
145-#: ../src/indicator/vpn-status-notifier.cpp:50
146-msgid ""
147-"The VPN connection '%1' failed because the network connection was "
148-"interrupted."
149-msgstr ""
150-
151-#: ../src/indicator/vpn-status-notifier.cpp:51
152-msgid ""
153-"The VPN connection '%1' failed because the VPN service stopped unexpectedly."
154-msgstr ""
155-
156-#: ../src/indicator/vpn-status-notifier.cpp:52
157-msgid ""
158-"The VPN connection '%1' failed because the VPN service returned invalid "
159-"configuration."
160-msgstr ""
161-
162-#: ../src/indicator/vpn-status-notifier.cpp:53
163-msgid ""
164-"The VPN connection '%1' failed because the connection attempt timed out."
165-msgstr ""
166-
167-#: ../src/indicator/vpn-status-notifier.cpp:54
168-msgid ""
169-"The VPN connection '%1' failed because the VPN service did not start in time."
170-msgstr ""
171-
172-#: ../src/indicator/vpn-status-notifier.cpp:55
173-msgid "The VPN connection '%1' failed because the VPN service failed to start."
174-msgstr ""
175-
176-#: ../src/indicator/vpn-status-notifier.cpp:56
177-msgid "The VPN connection '%1' failed because there were no valid VPN secrets."
178-msgstr ""
179-
180-#: ../src/indicator/vpn-status-notifier.cpp:57
181-msgid "The VPN connection '%1' failed because of invalid VPN secrets."
182-msgstr ""
183-
184-#: ../src/indicator/vpn-status-notifier.cpp:68
185-msgid "VPN Connection Failed"
186-msgstr ""
187-
188-#: ../src/indicator/sections/wwan-section.cpp:99
189+#: ../src/indicator/nmofono/vpn/vpn-manager.cpp:81
190+msgid "VPN connection %1"
191+msgstr ""
192+
193+#: ../src/indicator/menuitems/wifi-link-item.cpp:109
194+msgid "Other network…"
195+msgstr ""
196+
197+#: ../src/indicator/menuitems/wwan-link-item.cpp:90
198+msgid "No SIM"
199+msgstr ""
200+
201+#: ../src/indicator/menuitems/wwan-link-item.cpp:97
202+msgid "SIM Error"
203+msgstr ""
204+
205+#: ../src/indicator/menuitems/wwan-link-item.cpp:105
206+msgid "SIM Locked"
207+msgstr ""
208+
209+#: ../src/indicator/menuitems/wwan-link-item.cpp:118
210+msgid "Unregistered"
211+msgstr ""
212+
213+#: ../src/indicator/menuitems/wwan-link-item.cpp:123
214+msgid "Unknown"
215+msgstr ""
216+
217+#: ../src/indicator/menuitems/wwan-link-item.cpp:128
218+msgid "Denied"
219+msgstr ""
220+
221+#: ../src/indicator/menuitems/wwan-link-item.cpp:133
222+msgid "Searching"
223+msgstr ""
224+
225+#: ../src/indicator/menuitems/wwan-link-item.cpp:145
226+msgid "No Signal"
227+msgstr ""
228+
229+#: ../src/indicator/menuitems/wwan-link-item.cpp:157
230+#: ../src/indicator/menuitems/wwan-link-item.cpp:164
231+msgid "Offline"
232+msgstr ""
233+
234+#. TRANSLATORS: this is the indicator title shown on the top header of the indicator area
235+#: ../src/indicator/root-state.cpp:306
236+msgid "Network"
237+msgstr ""
238+
239+#. TODO Move this into a new class
240+#: ../src/indicator/factory.cpp:187
241+msgid "Wi-Fi"
242+msgstr ""
243+
244+#. TODO Move this into a new class
245+#: ../src/indicator/factory.cpp:198
246+msgid "Flight Mode"
247+msgstr ""
248+
249+#: ../src/indicator/factory.cpp:208
250+msgid "Cellular data"
251+msgstr ""
252+
253+#. TODO Move this into a new class
254+#: ../src/indicator/factory.cpp:221
255+msgid "Hotspot"
256+msgstr ""
257+
258+#: ../src/indicator/sections/wwan-section.cpp:102
259 msgid "Cellular settings…"
260 msgstr ""
261
262+#: ../src/indicator/sections/wifi-section.cpp:65
263+msgid "Wi-Fi settings…"
264+msgstr ""
265+
266 #: ../src/indicator/sections/vpn-section.cpp:140
267 msgid "VPN settings…"
268 msgstr ""
269-
270-#: ../src/indicator/sections/wifi-section.cpp:65
271-msgid "Wi-Fi settings…"
272-msgstr ""
273-
274-#. TRANSLATORS: this is the indicator title shown on the top header of the indicator area
275-#: ../src/indicator/root-state.cpp:306
276-msgid "Network"
277-msgstr ""
278-
279-#: ../src/indicator/nmofono/vpn/vpn-manager.cpp:81
280-msgid "VPN connection %1"
281-msgstr ""
282
283=== modified file 'src/agent/SecretAgent.h'
284--- src/agent/SecretAgent.h 2016-02-15 09:31:38 +0000
285+++ src/agent/SecretAgent.h 2016-07-14 10:02:10 +0000
286@@ -90,6 +90,7 @@
287 static constexpr char const* NM_KEY_MGMT_WPA_NONE = "wpa-none";
288 static constexpr char const* NM_KEY_MGMT_WPA_PSK = "wpa-psk";
289 static constexpr char const* NM_KEY_MGMT_NONE = "none";
290+ static constexpr char const* NM_KEY_MGMT_WAPI_PSK = "wapi-psk";
291
292 explicit SecretAgent(std::shared_ptr<notify::NotificationManager> notificationManager,
293 CredentialStore::SPtr credentialStore,
294
295=== modified file 'src/agent/SecretRequest.cpp'
296--- src/agent/SecretRequest.cpp 2016-02-15 09:31:38 +0000
297+++ src/agent/SecretRequest.cpp 2016-07-14 10:02:10 +0000
298@@ -66,7 +66,9 @@
299 subject = _("WPA");
300 } else if (keyMgmt == SecretAgent::NM_KEY_MGMT_NONE) {
301 subject = _("WEP");
302- }
303+ } else if (keyMgmt == SecretAgent::NM_KEY_MGMT_WAPI_PSK) {
304+ subject = _("WAPI");
305+ }
306
307 m_notification = m_secretAgent.notifications()->notify(
308 title.arg(conn[SecretAgent::NM_CONNECTION_ID].toString()), subject,
309@@ -104,7 +106,8 @@
310 wirelessSecurity->value(SecretAgent::NM_WIRELESS_SECURITY_KEY_MGMT).toString());
311
312 if (keyMgmt == SecretAgent::NM_KEY_MGMT_WPA_NONE
313- || keyMgmt == SecretAgent::NM_KEY_MGMT_WPA_PSK) {
314+ || keyMgmt == SecretAgent::NM_KEY_MGMT_WPA_PSK
315+ || keyMgmt == SecretAgent::NM_KEY_MGMT_WAPI_PSK) {
316 wirelessSecurity->insert(SecretAgent::NM_WIRELESS_SECURITY_PSK, key);
317 } else if (keyMgmt == SecretAgent::NM_KEY_MGMT_NONE) {
318 wirelessSecurity->insert(SecretAgent::NM_WIRELESS_SECURITY_WEP_KEY0, key);
319
320=== modified file 'src/indicator/menuitems/access-point-item.cpp'
321--- src/indicator/menuitems/access-point-item.cpp 2015-10-06 10:14:57 +0000
322+++ src/indicator/menuitems/access-point-item.cpp 2016-07-14 10:02:10 +0000
323@@ -61,7 +61,7 @@
324 m_item->setAttribute("x-canonical-type", TypedVariant<std::string>("unity.widgets.systemsettings.tablet.accesspoint"));
325 m_item->setAttribute("x-canonical-wifi-ap-is-adhoc", TypedVariant<bool>(m_accessPoint->adhoc()));
326 m_item->setAttribute("x-canonical-wifi-ap-is-secure", TypedVariant<bool>(m_accessPoint->secured()));
327- m_item->setAttribute("x-canonical-wifi-ap-is-enterprise", TypedVariant<bool>(m_accessPoint->enterprise()));
328+ m_item->setAttribute("x-canonical-wifi-ap-is-enterprise", TypedVariant<bool>(m_accessPoint->keyManagementType() != wifi::AccessPoint::KeyManagementType::psk));
329 m_item->setAttribute("x-canonical-wifi-ap-strength-action", TypedVariant<std::string>(("indicator." + strengthActionId).toStdString()));
330
331 m_actionStrength = std::make_shared<Action>(strengthActionId,
332
333=== modified file 'src/indicator/nmofono/wifi/access-point-impl.cpp'
334--- src/indicator/nmofono/wifi/access-point-impl.cpp 2015-07-06 12:59:21 +0000
335+++ src/indicator/nmofono/wifi/access-point-impl.cpp 2016-07-14 10:02:10 +0000
336@@ -22,6 +22,10 @@
337 #include <QTextCodec>
338 #include <NetworkManager.h>
339
340+#ifndef NM_802_11_AP_SEC_KEY_MGMT_WAPI_CERT
341+#define NM_802_11_AP_SEC_KEY_MGMT_WAPI_CERT 0x00002000
342+#endif
343+
344 namespace nmofono {
345 namespace wifi {
346
347@@ -116,9 +120,21 @@
348 return m_raw_ssid;
349 }
350
351-bool AccessPointImpl::enterprise() const
352+AccessPoint::KeyManagementType AccessPointImpl::keyManagementType() const
353 {
354- return (m_secflags & NM_802_11_AP_SEC_KEY_MGMT_802_1X) > 0;
355+ if ((m_secflags & NM_802_11_AP_SEC_KEY_MGMT_802_1X) > 0)
356+ {
357+ return KeyManagementType::ieee8021x;
358+ }
359+ else if ((m_secflags & NM_802_11_AP_SEC_KEY_MGMT_802_1X) > 0)
360+ {
361+ return KeyManagementType::wpa_eap;
362+ }
363+ else if ((m_secflags & NM_802_11_AP_SEC_KEY_MGMT_WAPI_CERT) > 0)
364+ {
365+ return KeyManagementType::wapi_cert;
366+ }
367+ return KeyManagementType::psk;
368 }
369
370 bool AccessPointImpl::secured() const
371
372=== modified file 'src/indicator/nmofono/wifi/access-point-impl.h'
373--- src/indicator/nmofono/wifi/access-point-impl.h 2015-07-06 12:59:21 +0000
374+++ src/indicator/nmofono/wifi/access-point-impl.h 2016-07-14 10:02:10 +0000
375@@ -90,7 +90,7 @@
376 std::uint32_t mode() const;
377
378 bool secured() const override;
379- bool enterprise() const override;
380+ KeyManagementType keyManagementType() const override;
381 bool adhoc() const override;
382
383 QDBusObjectPath object_path() const override;
384
385=== modified file 'src/indicator/nmofono/wifi/access-point.h'
386--- src/indicator/nmofono/wifi/access-point.h 2015-07-06 12:59:21 +0000
387+++ src/indicator/nmofono/wifi/access-point.h 2016-07-14 10:02:10 +0000
388@@ -37,8 +37,17 @@
389 AccessPoint: public QObject
390 {
391 Q_OBJECT
392+ Q_ENUMS(EnterpriseType)
393
394 public:
395+ enum KeyManagementType
396+ {
397+ psk,
398+ ieee8021x,
399+ wpa_eap,
400+ wapi_cert
401+ };
402+
403 typedef std::shared_ptr<AccessPoint> Ptr;
404 AccessPoint();
405 virtual ~AccessPoint();
406@@ -54,7 +63,7 @@
407 virtual QByteArray raw_ssid() const = 0;
408 virtual QDBusObjectPath object_path() const = 0;
409 virtual bool secured() const = 0;
410- virtual bool enterprise() const = 0;
411+ virtual KeyManagementType keyManagementType() const = 0;
412 virtual bool adhoc() const = 0;
413
414 Q_SIGNALS:
415
416=== modified file 'src/indicator/nmofono/wifi/grouped-access-point.cpp'
417--- src/indicator/nmofono/wifi/grouped-access-point.cpp 2015-07-06 12:59:21 +0000
418+++ src/indicator/nmofono/wifi/grouped-access-point.cpp 2016-07-14 10:02:10 +0000
419@@ -199,14 +199,14 @@
420 return p->aplist.at(0)->secured();
421 }
422
423-bool GroupedAccessPoint::enterprise() const
424+AccessPoint::KeyManagementType GroupedAccessPoint::keyManagementType() const
425 {
426 if (p->aplist.empty())
427 {
428- return false;
429+ return KeyManagementType::psk;
430 }
431
432- return p->aplist.at(0)->enterprise();
433+ return p->aplist.at(0)->keyManagementType();
434 }
435
436 bool GroupedAccessPoint::adhoc() const
437
438=== modified file 'src/indicator/nmofono/wifi/grouped-access-point.h'
439--- src/indicator/nmofono/wifi/grouped-access-point.h 2015-07-06 12:59:21 +0000
440+++ src/indicator/nmofono/wifi/grouped-access-point.h 2016-07-14 10:02:10 +0000
441@@ -54,7 +54,7 @@
442 QByteArray raw_ssid() const override;
443
444 bool secured() const override;
445- bool enterprise() const override;
446+ KeyManagementType keyManagementType() const override;
447 bool adhoc() const override;
448
449 QDBusObjectPath object_path() const override;
450
451=== modified file 'src/indicator/nmofono/wifi/wifi-link-impl.cpp'
452--- src/indicator/nmofono/wifi/wifi-link-impl.cpp 2016-05-26 13:51:39 +0000
453+++ src/indicator/nmofono/wifi/wifi-link-impl.cpp 2016-07-14 10:02:10 +0000
454@@ -486,17 +486,31 @@
455 QDBusObjectPath(d->m_dev->path()),
456 accessPoint->object_path());
457 } else {
458- if (accessPoint->enterprise()) {
459+ auto keyManagementType = accessPoint->keyManagementType();
460+ if (keyManagementType != AccessPoint::KeyManagementType::psk) {
461 qDebug() << "New connection to enterprise access point";
462+
463+ const static QMap<AccessPoint::KeyManagementType, QString> typeMap {
464+ {AccessPoint::KeyManagementType::ieee8021x, "ieee8021x"},
465+ {AccessPoint::KeyManagementType::wpa_eap, "wpa-eap"},
466+ {AccessPoint::KeyManagementType::wapi_cert, "wapi-cert"},
467+ };
468+
469 // activate system settings URI
470 QUrlQuery q;
471 q.addQueryItem("ssid", accessPoint->raw_ssid());
472 q.addQueryItem("bssid", accessPoint->bssid());
473+ q.addQueryItem("key-mgmt", typeMap[keyManagementType]);
474 QString url = "settings:///system/wifi?" + q.query(QUrl::FullyEncoded);
475
476 UrlDispatcher::send(url.toStdString(), [](string url, bool success) {
477- if (!success) {
478- cerr << "URL Dispatcher failed on " << url << endl;
479+ if (success)
480+ {
481+ qDebug() << "Activated URL for USS" << QString::fromStdString(url);
482+ }
483+ else
484+ {
485+ qDebug() << "URL Dispatcher failed on" << QString::fromStdString(url);
486 }
487 });
488 } else {
489@@ -516,7 +530,7 @@
490 }
491 }
492 // For enterprise access points, the system settings app will perform the connection
493- if (!accessPoint->enterprise()) {
494+ if (accessPoint->keyManagementType() == AccessPoint::KeyManagementType::psk) {
495 d->updateActiveConnection(ac);
496 }
497 d->m_connecting = false;
498
499=== modified file 'tests/integration/test-indicator.cpp'
500--- tests/integration/test-indicator.cpp 2016-06-13 10:57:46 +0000
501+++ tests/integration/test-indicator.cpp 2016-07-14 10:02:10 +0000
502@@ -2006,7 +2006,7 @@
503 << QVariant("DispatchURL")
504 << QVariant(
505 QVariantList()
506- << QVariant("settings:///system/wifi?ssid=ABC&bssid=11:22:33:44:55:66")
507+ << QVariant("settings:///system/wifi?ssid=ABC&bssid=11:22:33:44:55:66&key-mgmt=wpa-eap")
508 << QVariant("")
509 )
510 );
511
512=== modified file 'tests/unit/indicator/menuitems/test-access-point-item.cpp'
513--- tests/unit/indicator/menuitems/test-access-point-item.cpp 2015-10-06 10:14:57 +0000
514+++ tests/unit/indicator/menuitems/test-access-point-item.cpp 2016-07-14 10:02:10 +0000
515@@ -48,7 +48,7 @@
516
517 MOCK_CONST_METHOD0(secured, bool());
518
519- MOCK_CONST_METHOD0(enterprise, bool());
520+ MOCK_CONST_METHOD0(keyManagementType, KeyManagementType());
521
522 MOCK_CONST_METHOD0(adhoc, bool());
523
524@@ -68,6 +68,7 @@
525 ON_CALL(*accessPoint, ssid()).WillByDefault(Return(QString("the ssid")));
526 ON_CALL(*accessPoint, secured()).WillByDefault(Return(true));
527 ON_CALL(*accessPoint, adhoc()).WillByDefault(Return(false));
528+ ON_CALL(*accessPoint, keyManagementType()).WillByDefault(Return(wifi::AccessPoint::KeyManagementType::psk));
529 ON_CALL(*accessPoint, strength()).WillByDefault(Return(70.0));
530
531 auto accessPointItem = make_shared<AccessPointItem>(accessPoint);

Subscribers

People subscribed via source and target branches