Merge lp:~joergberroth/ubuntu-system-settings/wifi-802-1x-configurations into lp:ubuntu-system-settings
- wifi-802-1x-configurations
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~joergberroth/ubuntu-system-settings/wifi-802-1x-configurations |
Merge into: | lp:ubuntu-system-settings |
Diff against target: |
931 lines (+626/-169) 3 files modified
plugins/wifi/OtherNetwork.qml (+495/-163) plugins/wifi/wifidbushelper.cpp (+129/-5) plugins/wifi/wifidbushelper.h (+2/-1) |
To merge this branch: | bzr merge lp:~joergberroth/ubuntu-system-settings/wifi-802-1x-configurations |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marcus Tomlinson (community) | Needs Fixing | ||
Matthew Paul Thomas (community) | design | Abstain | |
Jonas G. Drange | Pending | ||
Review via email: mp+257472@code.launchpad.net |
This proposal supersedes a proposal from 2015-04-18.
This proposal has been superseded by a proposal from 2015-04-27.
Commit message
Description of the change
Added support for 802-1x wireless network configurations.
Jonas G. Drange (jonas-drange) wrote : Posted in a previous version of this proposal | # |
JkB (joergberroth) wrote : Posted in a previous version of this proposal | # |
> This is really great. Thanks for proposing this.
>
> I've added some comments, but they're mostly about your decision to make the
> Dialog an ItemPage. If this is not crucial to the implementation of support
> for 802-1x, we need to revert it.
>
> Also, if cert picking is not implemented, please remove all components that
> are unused. Please leave the UI bits in, but hide it with "visible:
> showAllUI". This way we can get strings translated.
>
> Thanks again.
Hey, thanks a lot for for reviewing.
First I had the concerns about pushing it to an ItemPage, too. Then, after dealing with the variety of different configurations, I found there would be an advantage if one changes to ItemPage. There is no need for the ItemPage from implementation point of view but there are configurations for which the user has to be asked up to two different certificates and an additional private key (TLS) and there can be different types of path2 authentication types for the different WPA Enterprise configurations.
So if we want the user to be able two choose all the different types of configurations, it seems to me that a dialog would get quite overloaded with ui inputs. And correct me if I'm wrong but scrolling, which certainly would be needed, seems not to be provided for the dialogs.
At the moment there are some pages in the cellular settings (e.g. APN) where one switched to ItemPages, too. So from design point of view it would keep consistent.
Maybe, based on these points, we can quickly discuss this again before I revert the change.
All other comments are clear. I will consider for the next commit.
I think the file picker would make selecting certificates even more comfortable but I will remove it as proposed, so one can work on that later.
Thanks again.
Joerg
Matthew Paul Thomas (mpt) wrote : | # |
Thanks so much for working on this, Joerg!
Jonas is right, though, that the authentication UI does need to remain a dialog. The reason is that System Settings is just one of three -- and will eventually be just one of six -- different places that might launch the UI for entering Wi-Fi details. The first-run setup "Connect to Wi-Fi" screen, and the network indicator menu, should let you connect to all the same Wi-Fi networks that System Settings does, by putting up the same dialog. <https:/
When dialog contents are bigger than the available screen space, the body is supposed to scroll automatically, and apparently this has been implemented already (bug 1376763). If it's not working, please report a bug.
JkB (joergberroth) wrote : | # |
Thanks for the review and the hints.
It was not clear from documentation for me. But the bug post made it.
I just reverted the page back to dialog.
Am 2015-04-27 um 13:04 schrieb Matthew Paul Thomas:
> Review: Needs Fixing design
>
> Thanks so much for working on this, Joerg!
>
> Jonas is right, though, that the authentication UI does need to remain a dialog. The reason is that System Settings is just one of three -- and will eventually be just one of six -- different places that might launch the UI for entering Wi-Fi details. The first-run setup "Connect to Wi-Fi" screen, and the network indicator menu, should let you connect to all the same Wi-Fi networks that System Settings does, by putting up the same dialog. <https:/
>
> When dialog contents are bigger than the available screen space, the body is supposed to scroll automatically, and apparently this has been implemented already (bug 1376763). If it's not working, please report a bug.
>
Matthew Paul Thomas (mpt) wrote : | # |
Thank you.
Marcus Tomlinson (marcustomlinson) wrote : | # |
Your code isn't compiling. There are some weird "!==" occurrences in 2 of your .cpp files. Rather hard to test your changes work when the project doesn't compile no? :P
- 1392. By JkB
-
Fixed weird "!==". Added basic FilePicker functionality.
- 1393. By JkB
-
Added CertificateHandling to list installed and add new certificates from OtherNetwork
Now uses ItemSelectors and dataModels. Certs can be added by calling ContentHub.ToDos:
*improve list update for ItemSelectors
*Add handling for private keys and pac files.
*add password-flags
*add pac-Provisioning
*change? from blob to path scheme for nm configurations no that certs can be stored in a central place.--- in wifi settings:
*Page (from PageComponents) to manage all installed certs and keys. - 1394. By JkB
-
Improved certificate and key handling. List installed and add new certificates from OtherNetwork Dialog.
Uses ItemSelectors and dataModels to select certs and keys. Certs and keys can be added by calling ContentHub.ToDos:
*improve list update for ItemSelectors
*Improve handling pac files.
*change? from blob to path scheme for nm configurations no that certs can be stored in a central place.--- in wifi settings:
*Page (from PageComponents) to manage all "installed" certs and keys. - 1395. By JkB
-
Merge with trunk
- 1396. By JkB
-
merge with trunk.
Fixed bugs. - 1397. By JkB
-
removed some bugs,
finally tested on my BQ Aquaris. At least for WPA and a WPA Enterprise TTLS/MCHAP2 connection.
Had no other networks around.final changes:
*changed to path scheme for cert handling with networkmanager
*removed some further small bugs that made it finally work.----
ToDos:
*Improve handling of pac Files.
*As suggested, cert and key managment for "installed" ones will be needed.
*Improve CertDialog not to show raw content of cert.
*Implement network encryption detection to use dialog for visible networks as well. - 1398. By JkB
-
merge with trunk
----
*added checks against bad cert/key content
*improved data update. - 1399. By JkB
-
OtherNetwork extensions mature now.
---
*improved Pac fIle handling. - 1400. By JkB
-
*
- 1401. By JkB
-
formatting
- 1402. By JkB
-
* ItemSelectors: select back to "None" as standard for cases when filePicker is canceled.
* formatting
----
ToDo (later on):
- change selectedIndex to Item that has been added via ContentHub. - 1403. By JkB
-
merge with trunk
- 1404. By JkB
-
* improve config handling
* fixed bug: added missing nul termination to successfully store certs with path scheme. - 1405. By JkB
-
* added QStandardPaths for cert handling
* improved getting secrets in Previous network to get wpa-eap passwords as well.
* restored .bzrignore - 1406. By JkB
-
merge with trunk
- 1407. By JkB
-
merged with jgdx merge proposal. Thanks a lot Jonas for the extensive format fixes!
+Also, considered some quickly managable FIXMEs from Jonas. Some stay. - 1408. By JkB
-
* fixed wpa-eap/peap configurations.
* added "certificates recommended" security hint. - 1409. By JkB
-
*merged with trunk
- 1410. By JkB
-
merge jonas branch
- 1411. By JkB
-
merge with trunk
- 1412. By JkB
-
* set feedback back to original implementation
- 1413. By JkB
-
merge Jonas fixmes
- 1414. By JkB
-
clear spaces
- 1415. By JkB
-
merge with trunk
- 1416. By JkB
-
* multiple %1 args in i18n.tr all fall back to the first arg() provided.
Is this an individuell problem of my build?
If not we should consider this last commit. - 1417. By JkB
-
* only show "using certificate.." hint if selected one == "None"
Unmerged revisions
Preview Diff
1 | === modified file 'plugins/wifi/OtherNetwork.qml' |
2 | --- plugins/wifi/OtherNetwork.qml 2015-01-09 08:47:53 +0000 |
3 | +++ plugins/wifi/OtherNetwork.qml 2015-04-27 21:24:48 +0000 |
4 | @@ -38,14 +38,16 @@ |
5 | if(securityList.selectedIndex == 0) { |
6 | return true |
7 | } |
8 | - if(securityList.selectedIndex == 1) { |
9 | - return password.length >= 8 |
10 | - } |
11 | + if(securityList.selectedIndex == 3) { |
12 | + |
13 | // WEP |
14 | return password.length === 5 || |
15 | password.length === 10 || |
16 | password.length === 13 || |
17 | password.length === 26; |
18 | + } |
19 | + //WPA |
20 | + return password.length >= 8 |
21 | } |
22 | |
23 | title: i18n.tr("Connect to Hidden Network") |
24 | @@ -56,76 +58,109 @@ |
25 | } |
26 | |
27 | states: [ |
28 | - State { |
29 | - name: "CONNECTING" |
30 | - PropertyChanges { |
31 | - target: connectAction |
32 | - enabled: false |
33 | - } |
34 | - PropertyChanges { |
35 | - target: connectButtonIndicator |
36 | - running: true |
37 | - } |
38 | - PropertyChanges { |
39 | - target: passwordVisibleSwitch |
40 | - enabled: false |
41 | - } |
42 | - PropertyChanges { |
43 | - target: passwordVisibleLabel |
44 | - opacity: 0.5 |
45 | - } |
46 | - PropertyChanges { |
47 | - target: password |
48 | - enabled: false |
49 | - } |
50 | - PropertyChanges { |
51 | - target: passwordListLabel |
52 | - opacity: 0.5 |
53 | - } |
54 | - PropertyChanges { |
55 | - target: securityList |
56 | - enabled: false |
57 | - opacity: 0.5 |
58 | - } |
59 | - PropertyChanges { |
60 | - target: securityListLabel |
61 | - opacity: 0.5 |
62 | - } |
63 | - PropertyChanges { |
64 | - target: networkname |
65 | - enabled: false |
66 | - } |
67 | - PropertyChanges { |
68 | - target: networknameLabel |
69 | - opacity: 0.5 |
70 | - } |
71 | - PropertyChanges { |
72 | - target: feedback |
73 | - enabled: true |
74 | - } |
75 | - }, |
76 | - State { |
77 | - name: "FAILED" |
78 | - PropertyChanges { |
79 | - target: feedback |
80 | - enabled: true |
81 | - } |
82 | - }, |
83 | - State { |
84 | - name: "SUCCEEDED" |
85 | - PropertyChanges { |
86 | - target: successIndicator |
87 | - running: true |
88 | - } |
89 | - PropertyChanges { |
90 | - target: cancelButton |
91 | - enabled: false |
92 | - } |
93 | - PropertyChanges { |
94 | - target: connectAction |
95 | - enabled: false |
96 | - } |
97 | - } |
98 | + State { |
99 | + name: "CONNECTING" |
100 | + PropertyChanges { |
101 | + target: connectAction |
102 | + enabled: false |
103 | + } |
104 | + PropertyChanges { |
105 | + target: connectButtonIndicator |
106 | + running: true |
107 | + } |
108 | + |
109 | + PropertyChanges { |
110 | + target: p2authList |
111 | + enabled: false |
112 | + } |
113 | + PropertyChanges { |
114 | + target: p2authListLabel |
115 | + opacity: 0.5 |
116 | + } |
117 | + PropertyChanges { |
118 | + target: cacert |
119 | + enabled: false |
120 | + } |
121 | + PropertyChanges { |
122 | + target: cacertLabel |
123 | + opacity: 0.5 |
124 | + } |
125 | + PropertyChanges { |
126 | + target: passwordVisibleSwitch |
127 | + enabled: false |
128 | + } |
129 | + PropertyChanges { |
130 | + target: passwordVisibleLabel |
131 | + opacity: 0.5 |
132 | + } |
133 | + PropertyChanges { |
134 | + target: password |
135 | + enabled: false |
136 | + } |
137 | + PropertyChanges { |
138 | + target: passwordLabel |
139 | + opacity: 0.5 |
140 | + } |
141 | + PropertyChanges { |
142 | + target: username |
143 | + enabled: false |
144 | + } |
145 | + PropertyChanges { |
146 | + target: usernameLabel |
147 | + opacity: 0.5 |
148 | + } |
149 | + PropertyChanges { |
150 | + target: authList |
151 | + enabled: false |
152 | + opacity: 0.5 |
153 | + } |
154 | + PropertyChanges { |
155 | + target: authListLabel |
156 | + opacity: 0.5 |
157 | + } |
158 | + PropertyChanges { |
159 | + target: securityList |
160 | + enabled: false |
161 | + opacity: 0.5 |
162 | + } |
163 | + PropertyChanges { |
164 | + target: securityListLabel |
165 | + opacity: 0.5 |
166 | + } |
167 | + PropertyChanges { |
168 | + target: networkname |
169 | + enabled: false |
170 | + } |
171 | + PropertyChanges { |
172 | + target: networknameLabel |
173 | + opacity: 0.5 |
174 | + } |
175 | + PropertyChanges { |
176 | + target: feedback |
177 | + enabled: true |
178 | + visible: true |
179 | + } |
180 | + }, |
181 | + State { |
182 | + name: "FAILED" |
183 | + PropertyChanges { |
184 | + target: feedback |
185 | + enabled: true |
186 | + visible: true |
187 | + } |
188 | + }, |
189 | + State { |
190 | + name: "SUCCEEDED" |
191 | + PropertyChanges { |
192 | + target: successIndicator |
193 | + running: true |
194 | + } |
195 | + |
196 | + PropertyChanges { |
197 | + target: connectAction |
198 | + enabled: false |
199 | + } |
200 | + } |
201 | ] |
202 | |
203 | Label { |
204 | @@ -138,95 +173,388 @@ |
205 | } |
206 | |
207 | Label { |
208 | - id: networknameLabel |
209 | - text : i18n.tr("Network name") |
210 | - objectName: "networknameLabel" |
211 | - fontSize: "medium" |
212 | - font.bold: true |
213 | - color: Theme.palette.selected.backgroundText |
214 | - elide: Text.ElideRight |
215 | - } |
216 | - |
217 | - TextField { |
218 | - id : networkname |
219 | - objectName: "networkname" |
220 | - inputMethodHints: Qt.ImhNoPredictiveText |
221 | - Component.onCompleted: forceActiveFocus() |
222 | - } |
223 | - |
224 | - Label { |
225 | - id: securityListLabel |
226 | - text : i18n.tr("Security") |
227 | - objectName: "securityListLabel" |
228 | - fontSize: "medium" |
229 | - font.bold: true |
230 | - color: Theme.palette.selected.backgroundText |
231 | - elide: Text.ElideRight |
232 | - } |
233 | - |
234 | - ListItem.ItemSelector { |
235 | - id: securityList |
236 | - objectName: "securityList" |
237 | - model: [i18n.tr("None"), // index: 0 |
238 | - i18n.tr("WPA & WPA2 Personal"), // index: 1 |
239 | - i18n.tr("WEP"), // index: 2 |
240 | - ] |
241 | - } |
242 | - |
243 | - Label { |
244 | - id: passwordListLabel |
245 | - text : i18n.tr("Password") |
246 | - objectName: "passwordListLabel" |
247 | - fontSize: "medium" |
248 | - font.bold: true |
249 | - color: Theme.palette.selected.backgroundText |
250 | - elide: Text.ElideRight |
251 | - visible: securityList.selectedIndex !== 0 |
252 | - } |
253 | - |
254 | - TextField { |
255 | - id : password |
256 | - objectName: "password" |
257 | - visible: securityList.selectedIndex !== 0 |
258 | - echoMode: passwordVisibleSwitch.checked ? |
259 | - TextInput.Normal : TextInput.Password |
260 | - inputMethodHints: Qt.ImhNoPredictiveText |
261 | - onAccepted: { |
262 | - connectAction.trigger(); |
263 | - } |
264 | - } |
265 | - |
266 | - RowĀ { |
267 | - id: passwordVisiblityRow |
268 | - layoutDirection: Qt.LeftToRight |
269 | - spacing: units.gu(2) |
270 | - visible: securityList.selectedIndex !== 0 |
271 | - |
272 | - CheckBox { |
273 | - id: passwordVisibleSwitch |
274 | - activeFocusOnPress: false |
275 | - } |
276 | - |
277 | - Label { |
278 | - id: passwordVisibleLabel |
279 | - text : i18n.tr("Show password") |
280 | - objectName: "passwordVisibleLabel" |
281 | - fontSize: "medium" |
282 | - color: Theme.palette.selected.backgroundText |
283 | - elide: Text.ElideRight |
284 | - height: passwordVisibleSwitch.height |
285 | - verticalAlignment: Text.AlignVCenter |
286 | - MouseArea { |
287 | - anchors { |
288 | - fill: parent |
289 | - } |
290 | - onClicked: { |
291 | - passwordVisibleSwitch.checked = |
292 | - !passwordVisibleSwitch.checked |
293 | - } |
294 | - } |
295 | - } |
296 | - } |
297 | + id: networknameLabel |
298 | + text : i18n.tr("Network name") |
299 | + objectName: "networknameLabel" |
300 | + fontSize: "medium" |
301 | + font.bold: false |
302 | + color: Theme.palette.selected.backgroundText |
303 | + elide: Text.ElideRight |
304 | + } |
305 | + |
306 | + TextField { |
307 | + id : networkname |
308 | + objectName: "networkname" |
309 | + width: parent.width |
310 | + placeholderText: i18n.tr("SSID") |
311 | + inputMethodHints: Qt.ImhNoPredictiveText |
312 | + Component.onCompleted: forceActiveFocus() |
313 | + } |
314 | + |
315 | + ListItem.ThinDivider {} |
316 | + |
317 | + Label { |
318 | + id: securityListLabel |
319 | + text : i18n.tr("Security") |
320 | + objectName: "securityListLabel" |
321 | + fontSize: "medium" |
322 | + font.bold: false |
323 | + color: Theme.palette.selected.backgroundText |
324 | + elide: Text.ElideRight |
325 | + } |
326 | + |
327 | + ListItem.ItemSelector { |
328 | + id: securityList |
329 | + objectName: "securityList" |
330 | + model: [i18n.tr("None"), // index: 0 |
331 | + i18n.tr("WPA & WPA2 Personal"), // index: 1 |
332 | + i18n.tr("WPA & WPA2 Enterprise"),// index: 2 |
333 | + i18n.tr("WEP"), // index: 3 |
334 | + i18n.tr("Dynamic WEP (802.1x)"), // index: 4 |
335 | + ] |
336 | + } |
337 | + |
338 | + Label { |
339 | + id: authListLabel |
340 | + text : i18n.tr("Authentication") |
341 | + objectName: "authListLabel" |
342 | + fontSize: "medium" |
343 | + font.bold: false |
344 | + color: Theme.palette.selected.backgroundText |
345 | + elide: Text.ElideRight |
346 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
347 | + } |
348 | + |
349 | + ListItem.ItemSelector { |
350 | + id: authList |
351 | + objectName: "authList" |
352 | + model: [i18n.tr("TLS"), // index: 0 |
353 | + i18n.tr("TTLS"), // index: 1 |
354 | + i18n.tr("LEAP"), // index: 2 |
355 | + i18n.tr("FAST"), // index: 3 |
356 | + i18n.tr("PEAP"), // index: 4 |
357 | + ] |
358 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
359 | + } |
360 | + |
361 | + Label { |
362 | + id: p2authListLabel |
363 | + text : i18n.tr("Phase-2-Authentication") |
364 | + objectName: "p2authLabel" |
365 | + fontSize: "medium" |
366 | + font.bold: false |
367 | + color: Theme.palette.selected.backgroundText |
368 | + elide: Text.ElideRight |
369 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) // WPA or D-WEP |
370 | + && ( authList.selectedIndex == 1 || |
371 | + authList.selectedIndex == 3 || |
372 | + authList.selectedIndex == 4 ) |
373 | + } |
374 | + |
375 | + ListItem.ItemSelector { |
376 | + id: p2authList |
377 | + objectName: "p2authList" |
378 | + width: parent.width |
379 | + model: [i18n.tr("PAP"), // index: 0 |
380 | + i18n.tr("MSCHAPv2"), // index: 1 |
381 | + i18n.tr("MSCHAP"), // index: 2 |
382 | + i18n.tr("CHAP"), // index: 3 |
383 | + i18n.tr("GTC"), // index: 4 |
384 | + i18n.tr("MD5") // index: 5 |
385 | + ] |
386 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) // WPA or D-WEP |
387 | + && ( authList.selectedIndex == 1 || |
388 | + authList.selectedIndex == 3 || |
389 | + authList.selectedIndex == 4 ) |
390 | + } |
391 | + |
392 | + Column{ // ca-cert |
393 | + id: cacertColumn |
394 | + anchors { |
395 | + left: parent.left |
396 | + right: parent.right |
397 | + } |
398 | + spacing: parent.spacing |
399 | + |
400 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
401 | + && ( authList.selectedIndex == 0 || |
402 | + authList.selectedIndex == 1 || |
403 | + authList.selectedIndex == 4 ) |
404 | + |
405 | + RowLayout{ |
406 | + spacing: units.gu(4) |
407 | + anchors { |
408 | + left: parent.left |
409 | + right: parent.right |
410 | + } |
411 | + |
412 | + Label { |
413 | + id: cacertLabel |
414 | + text : i18n.tr("CA-Certificate") |
415 | + objectName: "cacertListLabel" |
416 | + fontSize: "medium" |
417 | + font.bold: false |
418 | + color: Theme.palette.selected.backgroundText |
419 | + //anchors.bottom: addcacertButton.bottom // while button is disabled |
420 | + } |
421 | + |
422 | + Button { |
423 | + id: addcacertButton |
424 | + //action: selectPeer |
425 | + visible: false //showAllUI // Button action not implemented yet. |
426 | + objectName: "addcacertButton" |
427 | + anchors.right: parent.right |
428 | + text: i18n.tr("Add fileā¦") |
429 | + } |
430 | + } |
431 | + |
432 | + |
433 | + TextArea { |
434 | + id : cacert |
435 | + objectName: "cacert" |
436 | + width: parent.width |
437 | + autoSize: true |
438 | + maximumLineCount: 4 |
439 | + placeholderText: i18n.tr("Absolute path to cert file or clipboard content") |
440 | + |
441 | + } |
442 | + |
443 | + RowLayout{ |
444 | + spacing: units.gu(4) |
445 | + anchors { |
446 | + left: parent.left |
447 | + right: parent.right |
448 | + } |
449 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
450 | + && ( authList.selectedIndex == 0 ) // only for TLS |
451 | + |
452 | + Label { |
453 | + id: usercertLabel |
454 | + text : i18n.tr("User Certificate") |
455 | + objectName: "usercertListLabel" |
456 | + fontSize: "medium" |
457 | + font.bold: false |
458 | + color: Theme.palette.selected.backgroundText |
459 | + //anchors.bottom: addusercertButton.bottom |
460 | + } |
461 | + |
462 | + Button { |
463 | + id: addusercertButton |
464 | + //action: selectPeer |
465 | + visible: false // Button action not implemented yet. |
466 | + objectName: "addusercertButton" |
467 | + anchors.right: parent.right |
468 | + text: i18n.tr("Add fileā¦") |
469 | + } |
470 | + } |
471 | + |
472 | + TextArea{ |
473 | + id : usercert |
474 | + objectName: "usercert" |
475 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
476 | + && ( authList.selectedIndex == 0 ) |
477 | + width: parent.width |
478 | + autoSize: true |
479 | + maximumLineCount: 4 |
480 | + placeholderText: i18n.tr("Absolute path to cert file or clipboard content") |
481 | + } |
482 | + |
483 | + |
484 | + RowLayout{ |
485 | + spacing: units.gu(4) |
486 | + anchors { |
487 | + left: parent.left |
488 | + right: parent.right |
489 | + } |
490 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
491 | + && ( authList.selectedIndex == 0 ) // only for TLS |
492 | + |
493 | + Label { |
494 | + id: userprivatekeyLabel |
495 | + text : i18n.tr("User Private Key") |
496 | + objectName: "userprivatekeyLabel" |
497 | + fontSize: "medium" |
498 | + font.bold: false |
499 | + color: Theme.palette.selected.backgroundText |
500 | + //anchors.bottom: adduserprivatekeyButton.bottom |
501 | + } |
502 | + |
503 | + Button { |
504 | + id: adduserprivatekeyButton |
505 | + //action: selectPeer |
506 | + visible: false // Button action not implemented yet |
507 | + objectName: "adduserprivatekeyButton" |
508 | + anchors.right: parent.right |
509 | + text: i18n.tr("Add fileā¦") |
510 | + } |
511 | + } |
512 | + |
513 | + TextArea { |
514 | + id : userprivatekey |
515 | + objectName: "userprivatekey" |
516 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
517 | + && ( authList.selectedIndex == 0 ) |
518 | + width: parent.width |
519 | + autoSize: true |
520 | + maximumLineCount: 4 |
521 | + placeholderText: i18n.tr("Absolute path to key or clipboard content") |
522 | + } |
523 | + |
524 | + ListItem.ThinDivider {} |
525 | + |
526 | + } |
527 | + |
528 | + Column{ // pacFile |
529 | + id: pacFileColumn |
530 | + anchors { |
531 | + left: parent.left |
532 | + right: parent.right |
533 | + } |
534 | + spacing: parent.spacing |
535 | + |
536 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
537 | + && ( authList.selectedIndex == 3 ) |
538 | + |
539 | + RowLayout{ |
540 | + spacing: units.gu(4) |
541 | + anchors { |
542 | + left: parent.left |
543 | + right: parent.right |
544 | + } |
545 | + |
546 | + Label { |
547 | + id: pacFileLabel |
548 | + text : i18n.tr("Pac File") |
549 | + objectName: "pacFileLabel" |
550 | + fontSize: "medium" |
551 | + font.bold: false |
552 | + color: Theme.palette.selected.backgroundText |
553 | + //anchors.bottom: adduserprivatekeyButton.bottom |
554 | + } |
555 | + |
556 | + Button { |
557 | + id: addpacFileButton |
558 | + //action: selectPeer |
559 | + visible: false // Button action not implemented yet |
560 | + objectName: "addpacFileButton" |
561 | + anchors.right: parent.right |
562 | + text: i18n.tr("Add fileā¦") |
563 | + } |
564 | + } |
565 | + |
566 | + TextArea { |
567 | + id : pacFile |
568 | + objectName: "pacFile" |
569 | + width: parent.width |
570 | + autoSize: true |
571 | + maximumLineCount: 4 |
572 | + placeholderText: i18n.tr("Absolute path to Pac File or clipboard content") |
573 | + } |
574 | + |
575 | + ListItem.ThinDivider {} |
576 | + |
577 | + } |
578 | + |
579 | + Label { |
580 | + id: usernameLabel |
581 | + text : { |
582 | + if ( ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
583 | + && ( authList.selectedIndex == 0 )) { |
584 | + i18n.tr("Identity") |
585 | + } |
586 | + else { |
587 | + i18n.tr("Username") |
588 | + } |
589 | + } |
590 | + |
591 | + objectName: "usernameLabel" |
592 | + fontSize: "medium" |
593 | + font.bold: false |
594 | + color: Theme.palette.selected.backgroundText |
595 | + elide: Text.ElideRight |
596 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
597 | + } |
598 | + |
599 | + TextField { |
600 | + id : username |
601 | + objectName: "username" |
602 | + width: parent.width |
603 | + visible: ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
604 | + inputMethodHints: Qt.ImhNoPredictiveText |
605 | + Component.onCompleted: forceActiveFocus() |
606 | + onAccepted: { |
607 | + connectAction.trigger() |
608 | + } |
609 | + } |
610 | + |
611 | + Label { |
612 | + id: passwordLabel |
613 | + text: { |
614 | + if ( ( securityList.selectedIndex == 2 || securityList.selectedIndex == 4) |
615 | + && ( authList.selectedIndex == 0 )) { |
616 | + i18n.tr("Private Key Password") |
617 | + } else { |
618 | + i18n.tr("Password") |
619 | + } |
620 | + } |
621 | + |
622 | + objectName: "passwordListLabel" |
623 | + fontSize: "medium" |
624 | + font.bold: false |
625 | + color: Theme.palette.selected.backgroundText |
626 | + elide: Text.ElideRight |
627 | + visible: securityList.selectedIndex !== 0 |
628 | + } |
629 | + |
630 | + TextField { |
631 | + id : password |
632 | + objectName: "password" |
633 | + width: parent.width |
634 | + visible: securityList.selectedIndex !== 0 |
635 | + echoMode: passwordVisibleSwitch.checked ? |
636 | + TextInput.Normal : TextInput.Password |
637 | + inputMethodHints: Qt.ImhNoPredictiveText |
638 | + onAccepted: { |
639 | + connectAction.trigger(); |
640 | + } |
641 | + } |
642 | + |
643 | + Row { |
644 | + id: passwordVisiblityRow |
645 | + layoutDirection: Qt.LeftToRight |
646 | + spacing: units.gu(2) |
647 | + visible: securityList.selectedIndex !== 0 |
648 | + |
649 | + CheckBox { |
650 | + id: passwordVisibleSwitch |
651 | + //activeFocusOnPress: false |
652 | + } |
653 | + |
654 | + Label { |
655 | + id: passwordVisibleLabel |
656 | + text : i18n.tr("Show password") |
657 | + objectName: "passwordVisibleLabel" |
658 | + fontSize: "medium" |
659 | + color: Theme.palette.selected.backgroundText |
660 | + elide: Text.ElideRight |
661 | + height: passwordVisibleSwitch.height |
662 | + verticalAlignment: Text.AlignVCenter |
663 | + MouseArea { |
664 | + anchors { |
665 | + fill: parent |
666 | + } |
667 | + onClicked: { |
668 | + passwordVisibleSwitch.checked = |
669 | + !passwordVisibleSwitch.checked |
670 | + } |
671 | + } |
672 | + } |
673 | + |
674 | + } |
675 | + |
676 | + |
677 | + ListItem.ThinDivider {visible: securityList.selectedIndex != 0} |
678 | + |
679 | |
680 | RowLayout { |
681 | id: buttonRow |
682 | @@ -289,7 +617,11 @@ |
683 | DbusHelper.connect( |
684 | networkname.text, |
685 | securityList.selectedIndex, |
686 | - password.text); |
687 | + authList.selectedIndex, |
688 | + username.text, |
689 | + password.text, |
690 | + [cacert.text, usercert.text, userprivatekey.text, pacFile.text] , |
691 | + p2authList.selectedIndex); |
692 | otherNetworkDialog.state = "CONNECTING"; |
693 | } |
694 | } |
695 | |
696 | === modified file 'plugins/wifi/wifidbushelper.cpp' |
697 | --- plugins/wifi/wifidbushelper.cpp 2014-10-10 14:10:52 +0000 |
698 | +++ plugins/wifi/wifidbushelper.cpp 2015-04-27 21:24:48 +0000 |
699 | @@ -37,15 +37,29 @@ |
700 | typedef QMap<QString,QVariantMap> ConfigurationData; |
701 | Q_DECLARE_METATYPE(ConfigurationData) |
702 | |
703 | + |
704 | WifiDbusHelper::WifiDbusHelper(QObject *parent) : QObject(parent), |
705 | m_systemBusConnection(QDBusConnection::systemBus()) |
706 | { |
707 | qDBusRegisterMetaType<ConfigurationData>(); |
708 | } |
709 | |
710 | -void WifiDbusHelper::connect(QString ssid, int security, QString password) |
711 | + |
712 | +QByteArray WifiDbusHelper::getCertContent(QString filename){ |
713 | + QFile file(filename); |
714 | + if (!file.open(QIODevice::ReadOnly)) { |
715 | + qWarning() << "Could not resolve Cert-File (" << filename << "): File does not exist or is empty." ; |
716 | + return QByteArray(); |
717 | + } |
718 | + else { |
719 | + return file.readAll(); |
720 | + } |
721 | +} |
722 | + |
723 | + |
724 | +void WifiDbusHelper::connect(QString ssid, int security, int auth, QString username, QString password, QStringList certs, int p2auth) |
725 | { |
726 | - if(security<0 || security>2) { |
727 | + if((security<0 || security>4) || (auth<0 || auth>4) || (p2auth<0 || p2auth>5)) { |
728 | qWarning() << "Qml and C++ have gotten out of sync. Can't connect.\n"; |
729 | return; |
730 | } |
731 | @@ -66,8 +80,10 @@ |
732 | // security: |
733 | // 0: None |
734 | // 1: WPA & WPA2 Personal |
735 | - // 2: WEP |
736 | - if (security != 0) { |
737 | + // 2: WPA Enterprise |
738 | + // 3: WEP |
739 | + // 4: Dynamic WEP |
740 | + if (!(security == 0)) { // WPA Enterprise or Dynamic WEP |
741 | wireless["security"] = QStringLiteral("802-11-wireless-security"); |
742 | |
743 | QVariantMap wireless_security; |
744 | @@ -75,17 +91,119 @@ |
745 | if (security == 1) { |
746 | wireless_security["key-mgmt"] = QStringLiteral("wpa-psk"); |
747 | wireless_security["psk"] = password; |
748 | - } else if (security == 2) { |
749 | + } else if (security == 3) { |
750 | wireless_security["key-mgmt"] = QStringLiteral("none"); |
751 | wireless_security["auth-alg"] = QStringLiteral("open"); |
752 | wireless_security["wep-key0"] = password; |
753 | wireless_security["wep-key-type"] = QVariant(uint(1)); |
754 | + } else if (security == 2) { |
755 | + wireless_security["key-mgmt"] = QStringLiteral("wpa-eap"); |
756 | + } else if (security == 4) { |
757 | + wireless_security["key-mgmt"] = QStringLiteral("ieee8021x"); |
758 | + |
759 | + /* leave disabled as hopefully not needed: |
760 | + QStringList wep_pairwise, wep_group; |
761 | + wep_pairwise[0] ="wep40"; wep_pairwise[1] ="wep104"; |
762 | + wep_group[0] ="wep40"; wep_group[1] ="wep104"; |
763 | + wireless_security["pairwise"] = wep_pairwise; |
764 | + wireless_security["group"] = wep_group; */ |
765 | } |
766 | configuration["802-11-wireless-security"] = wireless_security; |
767 | } |
768 | |
769 | configuration["802-11-wireless"] = wireless; |
770 | |
771 | + if (security == 2 || security == 4){ |
772 | + |
773 | + QVariantMap wireless_802_1x; |
774 | + // [802-1x] |
775 | + /*TLS // index: 0 |
776 | + TTLS // index: 1 |
777 | + LEAP // index: 2 |
778 | + FAST // index: 3 |
779 | + PEAP // index: 4 */ |
780 | + |
781 | + wireless_802_1x["identity"] = username; |
782 | + if (!(auth == 0)) { |
783 | + wireless_802_1x["password"] = password; |
784 | + } |
785 | + |
786 | + QByteArray cacert_a, clientcert, privatekey, pacFile; |
787 | + |
788 | + if (certs[0].left(1) == "/"){ |
789 | + cacert_a = getCertContent(certs[0]); |
790 | + } |
791 | + else { |
792 | + cacert_a.append(certs[0]); |
793 | + } |
794 | + |
795 | + if (auth == 0) { // TLS |
796 | + wireless_802_1x["eap"] = QStringList("tls"); |
797 | + wireless_802_1x["ca-cert"] = cacert_a; |
798 | + |
799 | + if (certs[1].left(1) == "/"){ |
800 | + clientcert = getCertContent(certs[1]); |
801 | + } |
802 | + else { |
803 | + clientcert.append(certs[1]); |
804 | + } |
805 | + wireless_802_1x["client-cert"] = clientcert; |
806 | + if (certs[2].left(1) == "/"){ |
807 | + privatekey = getCertContent(certs[2]); |
808 | + } |
809 | + else { |
810 | + privatekey.append(certs[2]); |
811 | + } |
812 | + wireless_802_1x["private-key"] = privatekey; |
813 | + wireless_802_1x["private-key-password"] = password; |
814 | + } else if (auth == 1) { // TTLS |
815 | + wireless_802_1x["eap"] = QStringList("ttls"); |
816 | + wireless_802_1x["ca-cert"] = cacert_a; |
817 | + } else if (auth == 2) { // LEAP |
818 | + wireless_802_1x["eap"] = QStringList("leap"); |
819 | + } else if (auth == 3) { // FAST |
820 | + wireless_802_1x["eap"] = QStringList("fast"); |
821 | + wireless_802_1x["ca-cert"] = cacert_a; |
822 | + |
823 | + if (certs[3].left(1) == "/"){ |
824 | + pacFile = getCertContent(certs[3]); |
825 | + } |
826 | + else { |
827 | + pacFile.append(certs[3]); |
828 | + } |
829 | + wireless_802_1x["pac-file"] = pacFile; |
830 | + |
831 | + // wireless_802_1x["phase1-fast-provisioning"] = QString("0"); |
832 | + } else if (auth == 4) { // PEAP |
833 | + wireless_802_1x["eap"] = QStringList("peap"); |
834 | + wireless_802_1x["phase1-peaplabel"] = QString("1"); |
835 | + //wireless_802_1x["phase1-peapver"] = QString("0"); #jkb:let us unset this until problems are reported. |
836 | + } |
837 | + |
838 | + if (auth == 1 || auth == 3 || auth == 4 ){ // only for TTLS, FAST and PEAP |
839 | + /* PAP // index: 0 |
840 | + MSCHAPv2 // index: 1 |
841 | + MSCHAP // index: 2 |
842 | + CHAP // index: 3 |
843 | + GTC // index: 4 |
844 | + MD5 // index: 5 */ |
845 | + if (p2auth == 0) { |
846 | + wireless_802_1x["phase2-auth"] = QStringLiteral("pap"); |
847 | + } else if (p2auth == 1) { |
848 | + wireless_802_1x["phase2-auth"] = QStringLiteral("mschapv2"); |
849 | + } else if (p2auth == 2) { |
850 | + wireless_802_1x["phase2-auth"] = QStringLiteral("mschap"); |
851 | + } else if (p2auth == 3) { |
852 | + wireless_802_1x["phase2-auth"] = QStringLiteral("chap"); |
853 | + } else if (p2auth == 4) { |
854 | + wireless_802_1x["phase2-auth"] = QStringLiteral("gtc"); |
855 | + } else if (p2auth == 5) { |
856 | + wireless_802_1x["phase2-auth"] = QStringLiteral("md5"); |
857 | + } |
858 | + |
859 | + } |
860 | + configuration["802-1x"] = wireless_802_1x; |
861 | + } |
862 | |
863 | // find the first wlan adapter for now |
864 | auto reply1 = mgr.GetDevices(); |
865 | @@ -142,6 +260,7 @@ |
866 | } |
867 | } |
868 | |
869 | + |
870 | void WifiDbusHelper::nmDeviceStateChanged(uint newState, |
871 | uint oldState, |
872 | uint reason) |
873 | @@ -150,6 +269,7 @@ |
874 | Q_EMIT (deviceStateChanged(newState, reason)); |
875 | } |
876 | |
877 | + |
878 | QString WifiDbusHelper::getWifiIpAddress() |
879 | { |
880 | OrgFreedesktopNetworkManagerInterface mgr(NM_SERVICE, |
881 | @@ -193,6 +313,7 @@ |
882 | return QString(inet_ntoa(ip_addr)); |
883 | } |
884 | |
885 | + |
886 | struct Network : public QObject |
887 | { |
888 | struct DontCare : public std::exception {}; |
889 | @@ -345,6 +466,7 @@ |
890 | QMap<QString, QVariantMap> settings; |
891 | }; |
892 | |
893 | + |
894 | QList<QStringList> WifiDbusHelper::getPreviouslyConnectedWifiNetworks() { |
895 | QList<QStringList> networks; |
896 | |
897 | @@ -383,6 +505,7 @@ |
898 | return networks; |
899 | } |
900 | |
901 | + |
902 | void WifiDbusHelper::forgetConnection(const QString dbus_path) { |
903 | OrgFreedesktopNetworkManagerSettingsConnectionInterface bar |
904 | (NM_SERVICE, |
905 | @@ -395,6 +518,7 @@ |
906 | } |
907 | } |
908 | |
909 | + |
910 | bool WifiDbusHelper::forgetActiveDevice() { |
911 | OrgFreedesktopNetworkManagerInterface mgr(NM_SERVICE, |
912 | NM_PATH, |
913 | |
914 | === modified file 'plugins/wifi/wifidbushelper.h' |
915 | --- plugins/wifi/wifidbushelper.h 2014-10-10 14:10:52 +0000 |
916 | +++ plugins/wifi/wifidbushelper.h 2015-04-27 21:24:48 +0000 |
917 | @@ -37,7 +37,7 @@ |
918 | explicit WifiDbusHelper(QObject *parent = nullptr); |
919 | ~WifiDbusHelper() {}; |
920 | |
921 | - Q_INVOKABLE void connect(QString ssid, int security, QString password); |
922 | + Q_INVOKABLE void connect(QString ssid, int security, int auth, QString username, QString password, QStringList certs, int p2auth); |
923 | Q_INVOKABLE QList<QStringList> getPreviouslyConnectedWifiNetworks(); |
924 | Q_INVOKABLE void forgetConnection(const QString dbus_path); |
925 | Q_INVOKABLE bool forgetActiveDevice(); |
926 | @@ -52,6 +52,7 @@ |
927 | private: |
928 | QDBusConnection m_systemBusConnection; |
929 | QString getWifiIpAddress(); |
930 | + QByteArray getCertContent(QString filename); |
931 | }; |
932 | |
933 |
This is really great. Thanks for proposing this.
I've added some comments, but they're mostly about your decision to make the Dialog an ItemPage. If this is not crucial to the implementation of support for 802-1x, we need to revert it.
Also, if cert picking is not implemented, please remove all components that are unused. Please leave the UI bits in, but hide it with "visible: showAllUI". This way we can get strings translated.
Thanks again.