Merge lp:~jonas-drange/ubuntu-system-settings/rtm-techswitch into lp:ubuntu-system-settings/rtm-14.09
- rtm-techswitch
- Merge into rtm-14.09
Status: | Merged |
---|---|
Approved by: | Ken VanDine |
Approved revision: | 987 |
Merged at revision: | 989 |
Proposed branch: | lp:~jonas-drange/ubuntu-system-settings/rtm-techswitch |
Merge into: | lp:ubuntu-system-settings/rtm-14.09 |
Diff against target: |
871 lines (+413/-98) 18 files modified
debian/control (+1/-1) plugins/about/PageComponent.qml (+11/-6) plugins/cellular/CMakeLists.txt (+2/-0) plugins/cellular/Components/DataMultiSim.qml (+10/-2) plugins/cellular/Components/MultiSim.qml (+48/-23) plugins/cellular/Components/RadioSingleSim.qml (+43/-13) plugins/cellular/Components/Sim.qml (+26/-3) plugins/cellular/Components/SingleSim.qml (+4/-0) plugins/cellular/PageComponent.qml (+80/-16) plugins/cellular/connectivity.cpp (+49/-0) plugins/cellular/connectivity.h (+35/-0) plugins/cellular/plugin.cpp (+11/-0) plugins/cellular/sims.js (+21/-0) plugins/phone/PageComponent.qml (+4/-14) plugins/phone/sims.js (+21/-0) plugins/security-privacy/PageComponent.qml (+8/-19) plugins/security-privacy/sims.js (+25/-0) tests/autopilot/ubuntu_system_settings/tests/__init__.py (+14/-1) |
To merge this branch: | bzr merge lp:~jonas-drange/ubuntu-system-settings/rtm-techswitch |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ken VanDine | Approve | ||
PS Jenkins bot | continuous-integration | Needs Fixing | |
Review via email: mp+248811@code.launchpad.net |
Commit message
[cellular] using libqofono-0.7 and including functionality for enabling users to change what modem has 3G
Description of the change
(included https:/
[cellular] using libqofono-0.7 and including functionality for enabling users to change what modem has 3G
PS Jenkins bot (ps-jenkins) wrote : | # |
- 986. By Jonas G. Drange
-
fix dep
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:986
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 987. By Jonas G. Drange
-
need u-s-s module for title
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:987
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ken VanDine (ken-vandine) wrote : | # |
Thanks, looks good.
Preview Diff
1 | === modified file 'debian/control' |
2 | --- debian/control 2015-01-30 18:36:21 +0000 |
3 | +++ debian/control 2015-02-09 14:18:57 +0000 |
4 | @@ -68,7 +68,7 @@ |
5 | qml-module-qtmultimedia | qml-module-qtmultimedia-gles, |
6 | qml-module-ubuntu-connectivity, |
7 | qtdeclarative5-gsettings1.0 (>=0.1+14.10.20140801.1), |
8 | - qtdeclarative5-ofono0.2 (>=0.53), |
9 | + qtdeclarative5-ofono0.2 (>=0.70~), |
10 | qtdeclarative5-systeminfo-plugin, |
11 | qtdeclarative5-ubuntu-content1, |
12 | qtdeclarative5-ubuntu-settings-components (>> 0.2), |
13 | |
14 | === modified file 'plugins/about/PageComponent.qml' |
15 | --- plugins/about/PageComponent.qml 2015-01-16 15:27:56 +0000 |
16 | +++ plugins/about/PageComponent.qml 2015-02-09 14:18:57 +0000 |
17 | @@ -33,7 +33,7 @@ |
18 | |
19 | title: i18n.tr("About this phone") |
20 | flickable: scrollWidget |
21 | - property var modemsSorted: manager.modems.slice(0).sort() |
22 | + property var modemsSorted: [] |
23 | |
24 | UbuntuStorageAboutPanel { |
25 | id: backendInfos |
26 | @@ -49,11 +49,16 @@ |
27 | |
28 | OfonoManager { |
29 | id: manager |
30 | - Component.onCompleted: { |
31 | - if (manager.modems.length === 1) { |
32 | - phoneNumbers.setSource("PhoneNumber.qml", {path: manager.modems[0]}) |
33 | - } else if (manager.modems.length > 1) { |
34 | - phoneNumbers.setSource("PhoneNumbers.qml", {paths: modemsSorted}) |
35 | + onModemsChanged: { |
36 | + root.modemsSorted = modems.slice(0).sort(); |
37 | + if (modems.length === 1) { |
38 | + phoneNumbers.setSource("PhoneNumber.qml", { |
39 | + path: manager.modems[0] |
40 | + }); |
41 | + } else if (modems.length > 1) { |
42 | + phoneNumbers.setSource("PhoneNumbers.qml", { |
43 | + paths: root.modemsSorted |
44 | + }); |
45 | } |
46 | } |
47 | } |
48 | |
49 | === modified file 'plugins/cellular/CMakeLists.txt' |
50 | --- plugins/cellular/CMakeLists.txt 2014-12-16 16:22:29 +0000 |
51 | +++ plugins/cellular/CMakeLists.txt 2015-02-09 14:18:57 +0000 |
52 | @@ -24,6 +24,8 @@ |
53 | hotspotmanager.h |
54 | ofonoactivator.cpp |
55 | ofonoactivator.h |
56 | + connectivity.cpp |
57 | + connectivity.h |
58 | nm_manager_proxy.h |
59 | nm_settings_proxy.h |
60 | nm_settings_connection_proxy.h |
61 | |
62 | === modified file 'plugins/cellular/Components/DataMultiSim.qml' |
63 | --- plugins/cellular/Components/DataMultiSim.qml 2014-11-18 20:13:35 +0000 |
64 | +++ plugins/cellular/Components/DataMultiSim.qml 2015-02-09 14:18:57 +0000 |
65 | @@ -23,6 +23,8 @@ |
66 | |
67 | Column { |
68 | |
69 | + property string prevOnlineModem: parent.prevOnlineModem |
70 | + |
71 | function getNameFromIndex (index) { |
72 | if (index === 0) { |
73 | return i18n.tr("Off"); |
74 | @@ -50,8 +52,14 @@ |
75 | objectName: "use" + modelData |
76 | text: getNameFromIndex(index) |
77 | } |
78 | - selectedIndex: [true, sims[0].connMan.powered, sims[1].connMan.powered] |
79 | - .lastIndexOf(true) |
80 | + selectedIndex: { |
81 | + if (prevOnlineModem) { |
82 | + return model.indexOf(prevOnlineModem); |
83 | + } else { |
84 | + return [true, sims[0].connMan.powered, sims[1].connMan.powered] |
85 | + .lastIndexOf(true); |
86 | + } |
87 | + } |
88 | |
89 | onDelegateClicked: { |
90 | // power all sims on or off |
91 | |
92 | === modified file 'plugins/cellular/Components/MultiSim.qml' |
93 | --- plugins/cellular/Components/MultiSim.qml 2014-12-16 16:22:29 +0000 |
94 | +++ plugins/cellular/Components/MultiSim.qml 2015-02-09 14:18:57 +0000 |
95 | @@ -19,6 +19,7 @@ |
96 | */ |
97 | import QtQuick 2.0 |
98 | import GSettings 1.0 |
99 | +import SystemSettings 1.0 |
100 | import Ubuntu.Components 0.1 |
101 | import Ubuntu.Components.ListItems 0.1 as ListItem |
102 | |
103 | @@ -36,14 +37,17 @@ |
104 | return s; |
105 | } |
106 | property var modems |
107 | - // make settings available to all children of root |
108 | property var settings: phoneSettings |
109 | + property string prevOnlineModem: "" |
110 | + |
111 | + /* @sim a Sim.qml component containing libqofono bindings |
112 | + @prevOnlineModem path to modem that was online before modem reset */ |
113 | + signal umtsModemChanged (var sim, string prevOnlineModem); |
114 | |
115 | DataMultiSim { |
116 | anchors { left: parent.left; right: parent.right } |
117 | } |
118 | |
119 | - |
120 | ListItem.SingleValue { |
121 | text : i18n.tr("Hotspot disabled because Wi-Fi is off.") |
122 | visible: showAllUI && !hotspotItem.visible |
123 | @@ -95,13 +99,7 @@ |
124 | |
125 | ListItem.Divider {} |
126 | |
127 | - function techToString (tech) { |
128 | - return { |
129 | - 'gsm': i18n.tr("2G only (saves battery)"), |
130 | - 'umts': i18n.tr("2G/3G (faster)"), |
131 | - 'lte': i18n.tr("2G/3G/4G (faster)") |
132 | - }[tech] |
133 | - } |
134 | + SettingsItemTitle { text: i18n.tr("Connection type:") } |
135 | |
136 | Repeater { |
137 | model: sims |
138 | @@ -109,27 +107,54 @@ |
139 | ListItem.ItemSelector { |
140 | id: radio |
141 | property var sim: modelData |
142 | - property var rSettings: sim.radioSettings |
143 | - property string techPref: rSettings.technologyPreference |
144 | - property var modemTechs: rSettings.modemTechnologies |
145 | + |
146 | expanded: true |
147 | - text: i18n.tr("Connection type:") |
148 | - model: modemTechs || [] |
149 | + text: sim.title |
150 | + model: sim.radioSettings.modemTechnologies |
151 | delegate: OptionSelectorDelegate { |
152 | objectName: sim.path + "_radio_" + modelData |
153 | - text: techToString(modelData) |
154 | - } |
155 | - enabled: techPref !== "" |
156 | - visible: sim.connMan.powered |
157 | - selectedIndex: techPref !== "" ? model.indexOf(techPref) : -1 |
158 | - onDelegateClicked: rSettings.technologyPreference = model[index]; |
159 | + text: sim.techToString(modelData) |
160 | + } |
161 | + enabled: sim.radioSettings.technologyPreference !== "" |
162 | + selectedIndex: sim.radioSettings.technologyPreference !== "" ? |
163 | + model.indexOf(sim.radioSettings.technologyPreference) : -1 |
164 | + |
165 | + onDelegateClicked: { |
166 | + if (model[index] === 'umts_enable') { |
167 | + sim.radioSettings.technologyPreference = 'umts'; |
168 | + umtsModemChanged(sim, poweredSim ? poweredSim.path : ""); |
169 | + sim.mtkSettings.has3G = true; |
170 | + } else { |
171 | + sim.radioSettings.technologyPreference = model[index]; |
172 | + } |
173 | + } |
174 | + |
175 | Connections { |
176 | - target: rSettings |
177 | - onTechnologyPreferenceChanged: { |
178 | - radio.selectedIndex = modemTechs.indexOf(preference) |
179 | + target: sim.radioSettings |
180 | + onTechnologyPreferenceChanged: radio.selectedIndex = |
181 | + sim.radioSettings.modemTechnologies.indexOf(preference) |
182 | + |
183 | + onModemTechnologiesChanged: { |
184 | + if ((technologies.indexOf('umts') === -1) |
185 | + && (sim.mtkSettings.has3G === false)) { |
186 | + radio.model = sim.addUmtsEnableToModel(technologies); |
187 | + } else { |
188 | + radio.model = technologies; |
189 | + } |
190 | + radio.selectedIndex = sim.radioSettings.technologyPreference !== "" ? |
191 | + model.indexOf(sim.radioSettings.technologyPreference) : -1 |
192 | } |
193 | ignoreUnknownSignals: true |
194 | } |
195 | + |
196 | + Component.onCompleted: { |
197 | + if ((sim.radioSettings.modemTechnologies.indexOf('umts') === -1) |
198 | + && (sim.mtkSettings.has3G === false)) { |
199 | + radio.model = sim.addUmtsEnableToModel(sim.radioSettings.modemTechnologies); |
200 | + } else { |
201 | + radio.model = sim.radioSettings.modemTechnologies; |
202 | + } |
203 | + } |
204 | } |
205 | } |
206 | |
207 | |
208 | === modified file 'plugins/cellular/Components/RadioSingleSim.qml' |
209 | --- plugins/cellular/Components/RadioSingleSim.qml 2014-12-16 16:22:29 +0000 |
210 | +++ plugins/cellular/Components/RadioSingleSim.qml 2015-02-09 14:18:57 +0000 |
211 | @@ -22,36 +22,66 @@ |
212 | import Ubuntu.Components.ListItems 0.1 as ListItem |
213 | |
214 | Column { |
215 | + id: radioSingleSim |
216 | height: childrenRect.height |
217 | |
218 | property bool enabled: sim.radioSettings.technologyPreference !== "" |
219 | |
220 | ListItem.ItemSelector { |
221 | id: selector |
222 | - text: i18n.tr("Connection type:") |
223 | showDivider: false |
224 | expanded: true |
225 | |
226 | // an empty string is not a valid preference, which means |
227 | // we disregard the interace and disable the selector |
228 | enabled: parent.enabled |
229 | - model: sim.radioSettings.modemTechnologies || [] |
230 | - |
231 | + model: sim.radioSettings.modemTechnologies |
232 | delegate: OptionSelectorDelegate { |
233 | objectName: sim.path + "_radio_" + modelData |
234 | - text: { |
235 | - return { |
236 | - 'gsm': i18n.tr("2G only (saves battery)"), |
237 | - 'umts': i18n.tr("2G/3G (faster)"), |
238 | - 'lte': i18n.tr("2G/3G/4G (faster)") |
239 | - }[modelData] |
240 | - } |
241 | + text: sim.techToString(modelData) |
242 | showDivider: false |
243 | } |
244 | - selectedIndex: model.length ? |
245 | - model.indexOf(sim.radioSettings.technologyPreference) : -1 |
246 | + selectedIndex: |
247 | + sim.radioSettings.technologyPreference !== "" ? |
248 | + model.indexOf(sim.radioSettings.technologyPreference) : -1 |
249 | + |
250 | onDelegateClicked: { |
251 | - sim.radioSettings.technologyPreference = model[index]; |
252 | + if (model[index] === 'umts_enable') { |
253 | + sim.radioSettings.technologyPreference = 'umts'; |
254 | + radioSingleSim.parent.umtsModemChanged(sim, sim.connMan.powered ? sim.path : ""); |
255 | + sim.mtkSettings.has3G = true; |
256 | + } else { |
257 | + sim.radioSettings.technologyPreference = model[index]; |
258 | + } |
259 | + } |
260 | + |
261 | + Connections { |
262 | + target: sim.radioSettings |
263 | + |
264 | + onTechnologyPreferenceChanged: selector.selectedIndex = |
265 | + sim.radioSettings.modemTechnologies.indexOf(preference) |
266 | + |
267 | + onModemTechnologiesChanged: { |
268 | + if ((technologies.indexOf('umts') === -1) |
269 | + && (sim.mtkSettings.has3G === false)) { |
270 | + selector.model = sim.addUmtsEnableToModel(technologies); |
271 | + } else { |
272 | + selector.model = technologies; |
273 | + } |
274 | + selector.selectedIndex = sim.radioSettings.technologyPreference !== "" ? |
275 | + selector.model.indexOf(sim.radioSettings.technologyPreference) : -1 |
276 | + } |
277 | + ignoreUnknownSignals: true |
278 | + } |
279 | + |
280 | + Component.onCompleted: { |
281 | + if ((sim.radioSettings.modemTechnologies.indexOf('umts') === -1) |
282 | + && (sim.mtkSettings.has3G === false)) { |
283 | + selector.model = sim.addUmtsEnableToModel( |
284 | + sim.radioSettings.modemTechnologies); |
285 | + } else { |
286 | + selector.model = sim.radioSettings.modemTechnologies; |
287 | + } |
288 | } |
289 | } |
290 | } |
291 | |
292 | === modified file 'plugins/cellular/Components/Sim.qml' |
293 | --- plugins/cellular/Components/Sim.qml 2014-10-07 15:41:44 +0000 |
294 | +++ plugins/cellular/Components/Sim.qml 2015-02-09 14:18:57 +0000 |
295 | @@ -27,6 +27,7 @@ |
296 | property alias radioSettings: radioSettings |
297 | property alias simMng: simMng |
298 | property alias connMan: connMan |
299 | + property alias mtkSettings: mtkSettings |
300 | |
301 | property alias present: simMng.present |
302 | property string path |
303 | @@ -36,14 +37,31 @@ |
304 | return name + (number ? " (" + number + ")" : ""); |
305 | } |
306 | |
307 | + function techToString (tech) { |
308 | + var strings = { |
309 | + 'gsm': i18n.tr("2G only (saves battery)"), |
310 | + 'umts': i18n.tr("2G/3G (faster)"), |
311 | + 'lte': i18n.tr("2G/3G/4G (faster)") |
312 | + }; |
313 | + strings['umts_enable'] = strings['umts']; |
314 | + return strings[tech]; |
315 | + } |
316 | + |
317 | + // adds umts_enable to an copy of model |
318 | + function addUmtsEnableToModel (model) { |
319 | + var newModel = model.slice(0); |
320 | + newModel.push('umts_enable'); |
321 | + return newModel; |
322 | + } |
323 | + |
324 | OfonoModem { |
325 | id: modem |
326 | modemPath: path |
327 | onInterfacesChanged: { |
328 | - if (interfaces.indexOf('org.ofono.ConnectionManager') >= 0) { |
329 | - connMan._valid = true; |
330 | + if (interfaces.indexOf('org.ofono.MtkSettings') >= 0) { |
331 | + mtkSettings._valid = true; |
332 | } else { |
333 | - connMan._valid = false; |
334 | + mtkSettings._valid = false; |
335 | } |
336 | } |
337 | } |
338 | @@ -65,6 +83,11 @@ |
339 | |
340 | OfonoConnMan { |
341 | id: connMan |
342 | + modemPath: path |
343 | + } |
344 | + |
345 | + OfonoMtkSettings { |
346 | + id: mtkSettings |
347 | property bool _valid: true |
348 | modemPath: path |
349 | on_ValidChanged: { |
350 | |
351 | === modified file 'plugins/cellular/Components/SingleSim.qml' |
352 | --- plugins/cellular/Components/SingleSim.qml 2014-12-16 16:22:29 +0000 |
353 | +++ plugins/cellular/Components/SingleSim.qml 2015-02-09 14:18:57 +0000 |
354 | @@ -28,6 +28,10 @@ |
355 | |
356 | property var sim |
357 | |
358 | + /* @sim a Sim.qml component containing libqofono bindings |
359 | + @prevOnlineModem path to modem that was online before this event */ |
360 | + signal umtsModemChanged (var sim, string prevOnlineModem); |
361 | + |
362 | ListItem.Standard { |
363 | id: selector |
364 | text: i18n.tr("Cellular data:") |
365 | |
366 | === modified file 'plugins/cellular/PageComponent.qml' |
367 | --- plugins/cellular/PageComponent.qml 2014-11-18 20:13:35 +0000 |
368 | +++ plugins/cellular/PageComponent.qml 2015-02-09 14:18:57 +0000 |
369 | @@ -20,6 +20,7 @@ |
370 | |
371 | import QtQuick 2.0 |
372 | import SystemSettings 1.0 |
373 | +import Ubuntu.SystemSettings.Cellular 1.0 |
374 | import Ubuntu.Components 0.1 |
375 | import Ubuntu.Components.ListItems 0.1 as ListItem |
376 | import MeeGo.QOfono 0.2 |
377 | @@ -32,11 +33,31 @@ |
378 | title: i18n.tr("Cellular") |
379 | objectName: "cellularPage" |
380 | |
381 | - property var modemsSorted: manager.modems.slice(0).sort() |
382 | + property var modemsSorted: [] |
383 | property int simsLoaded: 0 |
384 | |
385 | + // waiting during modem reboots or for modems to come online |
386 | + property bool waiting: true |
387 | + |
388 | + QtObject { |
389 | + id: priv |
390 | + property string prevOnlineModem: "" |
391 | + } |
392 | + |
393 | states: [ |
394 | State { |
395 | + name: "waiting" |
396 | + when: waiting |
397 | + PropertyChanges { |
398 | + target: waitIndicator |
399 | + opacity: 1 |
400 | + } |
401 | + PropertyChanges { |
402 | + target: flick |
403 | + opacity: 0 |
404 | + } |
405 | + }, |
406 | + State { |
407 | name: "noSim" |
408 | when: (simsLoaded === 0) || (Sims.getPresentCount() === 0) |
409 | StateChangeScript { |
410 | @@ -47,7 +68,8 @@ |
411 | name: "singleSim" |
412 | StateChangeScript { |
413 | script: loader.setSource("Components/SingleSim.qml", { |
414 | - sim: Sims.getFirstPresent() |
415 | + sim: Sims.getFirstPresent(), |
416 | + prevOnlineModem: priv.prevOnlineModem |
417 | }) |
418 | } |
419 | when: simsLoaded && (Sims.getPresentCount() === 1) |
420 | @@ -57,7 +79,8 @@ |
421 | StateChangeScript { |
422 | script: loader.setSource("Components/MultiSim.qml", { |
423 | sims: Sims.getAll(), |
424 | - modems: modemsSorted |
425 | + modems: modemsSorted, |
426 | + prevOnlineModem: priv.prevOnlineModem |
427 | }) |
428 | } |
429 | when: simsLoaded && (Sims.getPresentCount() > 1) |
430 | @@ -66,19 +89,10 @@ |
431 | |
432 | OfonoManager { |
433 | id: manager |
434 | - Component.onCompleted: { |
435 | - var component = Qt.createComponent("Components/Sim.qml"); |
436 | - modemsSorted.forEach(function (path) { |
437 | - var sim = component.createObject(root, { |
438 | - path: path |
439 | - }); |
440 | - if (sim === null) { |
441 | - console.warn('Failed to create Sim qml:', |
442 | - component.errorString()); |
443 | - } else { |
444 | - Sims.add(sim); |
445 | - } |
446 | - }); |
447 | + onModemsChanged: { |
448 | + root.modemsSorted = modems.slice(0).sort(); |
449 | + Sims.createQML(); |
450 | + root.waiting = false; |
451 | } |
452 | } |
453 | |
454 | @@ -95,12 +109,30 @@ |
455 | } |
456 | } |
457 | |
458 | + Item { |
459 | + id: waitIndicator |
460 | + anchors.fill: parent |
461 | + opacity: 0 |
462 | + |
463 | + ActivityIndicator { |
464 | + anchors.centerIn: parent |
465 | + running: true |
466 | + } |
467 | + |
468 | + Behavior on opacity { |
469 | + PropertyAnimation { |
470 | + duration: UbuntuAnimation.SleepyDuration |
471 | + } |
472 | + } |
473 | + } |
474 | + |
475 | Flickable { |
476 | id: flick |
477 | anchors.fill: parent |
478 | contentWidth: parent.width |
479 | contentHeight: contentItem.childrenRect.height |
480 | boundsBehavior: (contentHeight > root.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds |
481 | + |
482 | Column { |
483 | anchors { left: parent.left; right: parent.right } |
484 | Loader { |
485 | @@ -108,5 +140,37 @@ |
486 | anchors { left: parent.left; right: parent.right } |
487 | } |
488 | } |
489 | + |
490 | + Behavior on opacity { |
491 | + PropertyAnimation { |
492 | + duration: UbuntuAnimation.SleepyDuration |
493 | + } |
494 | + } |
495 | + |
496 | + Connections { |
497 | + target: loader.item |
498 | + |
499 | + onUmtsModemChanged: { |
500 | + var path = sim.path; |
501 | + var e = sim.simMng.presenceChanged; |
502 | + |
503 | + function presenceHandler (ispresent) { |
504 | + if (ispresent) { |
505 | + root.waiting = false; |
506 | + Connectivity.unlockAllModems(); |
507 | + e.disconnect(presenceHandler); |
508 | + } |
509 | + } |
510 | + |
511 | + priv.prevOnlineModem = prevOnlineModem ? |
512 | + prevOnlineModem : ""; |
513 | + root.waiting = true; |
514 | + |
515 | + /* When the SIM comes back online, set waiting to false: |
516 | + the modem reboot is done.*/ |
517 | + sim.simMng.presenceChanged.connect(presenceHandler); |
518 | + } |
519 | + ignoreUnknownSignals: true |
520 | + } |
521 | } |
522 | } |
523 | |
524 | === added file 'plugins/cellular/connectivity.cpp' |
525 | --- plugins/cellular/connectivity.cpp 1970-01-01 00:00:00 +0000 |
526 | +++ plugins/cellular/connectivity.cpp 2015-02-09 14:18:57 +0000 |
527 | @@ -0,0 +1,49 @@ |
528 | +/* |
529 | + * Copyright (C) 2014 Canonical, Ltd. |
530 | + * |
531 | + * Authors: |
532 | + * Jonas G. Drange <jonas.drange@canonical.com> |
533 | + * |
534 | + * This program is free software: you can redistribute it and/or modify it |
535 | + * under the terms of the GNU General Public License version 3, as published |
536 | + * by the Free Software Foundation. |
537 | + * |
538 | + * This library is distributed in the hope that it will be useful, but WITHOUT |
539 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
540 | + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
541 | + * details. |
542 | + * |
543 | + * You should have received a copy of the GNU General Public License |
544 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
545 | + */ |
546 | + |
547 | +#include <QDBusReply> |
548 | +#include <QtDebug> |
549 | +#include <QDBusInterface> |
550 | +#include "connectivity.h" |
551 | + |
552 | +namespace { |
553 | + const QString conn_service("com.ubuntu.connectivity1"); |
554 | + const QString conn_object("/com/ubuntu/connectivity1/Private"); |
555 | + const QString conn_interface("com.ubuntu.connectivity1.Private"); |
556 | + const QString conn_unlockall_method("UnlockAllModems"); |
557 | +} |
558 | + |
559 | +Connectivity::Connectivity(QObject *parent) : QObject(parent) |
560 | +{ |
561 | +} |
562 | + |
563 | +void Connectivity::unlockAllModems() { |
564 | + |
565 | + QDBusInterface connectivityIface ( |
566 | + conn_service, |
567 | + conn_object, |
568 | + conn_interface, |
569 | + QDBusConnection::sessionBus(), |
570 | + this); |
571 | + |
572 | + auto reply = connectivityIface.call(conn_unlockall_method); |
573 | + if (reply.type() == QDBusMessage::ErrorMessage) { |
574 | + qWarning() << "Failed to unlock modems" << reply.errorMessage(); |
575 | + } |
576 | +} |
577 | |
578 | === added file 'plugins/cellular/connectivity.h' |
579 | --- plugins/cellular/connectivity.h 1970-01-01 00:00:00 +0000 |
580 | +++ plugins/cellular/connectivity.h 2015-02-09 14:18:57 +0000 |
581 | @@ -0,0 +1,35 @@ |
582 | +/* |
583 | + * Copyright (C) 2014 Canonical, Ltd. |
584 | + * |
585 | + * Authors: |
586 | + * Jonas G. Drange <jonas.drange@canonical.com> |
587 | + * |
588 | + * This program is free software: you can redistribute it and/or modify it |
589 | + * under the terms of the GNU General Public License version 3, as published |
590 | + * by the Free Software Foundation. |
591 | + * |
592 | + * This library is distributed in the hope that it will be useful, but WITHOUT |
593 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
594 | + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
595 | + * details. |
596 | + * |
597 | + * You should have received a copy of the GNU General Public License |
598 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
599 | + */ |
600 | + |
601 | +#ifndef CELLULAR_CONNECTIVITY_HELPER |
602 | +#define CELLULAR_CONNECTIVITY_HELPER |
603 | + |
604 | +#include <QObject> |
605 | + |
606 | +class Connectivity : public QObject { |
607 | + Q_OBJECT |
608 | + |
609 | +public: |
610 | + explicit Connectivity(QObject *parent = nullptr); |
611 | + ~Connectivity() {}; |
612 | + |
613 | + Q_INVOKABLE void unlockAllModems(); |
614 | +}; |
615 | + |
616 | +#endif |
617 | |
618 | === modified file 'plugins/cellular/plugin.cpp' |
619 | --- plugins/cellular/plugin.cpp 2014-08-29 14:32:28 +0000 |
620 | +++ plugins/cellular/plugin.cpp 2015-02-09 14:18:57 +0000 |
621 | @@ -19,12 +19,23 @@ |
622 | |
623 | #include <QtQml> |
624 | #include <QtQml/QQmlContext> |
625 | +#include "connectivity.h" |
626 | #include "hotspotmanager.h" |
627 | #include "ofonoactivator.h" |
628 | |
629 | +static QObject *connectivitySingeltonProvider(QQmlEngine *engine, QJSEngine *scriptEngine) |
630 | +{ |
631 | + Q_UNUSED(engine) |
632 | + Q_UNUSED(scriptEngine) |
633 | + |
634 | + Connectivity *connectivity = new Connectivity(); |
635 | + return connectivity; |
636 | +} |
637 | + |
638 | void BackendPlugin::registerTypes(const char *uri) |
639 | { |
640 | Q_ASSERT(uri == QLatin1String("Ubuntu.SystemSettings.Cellular")); |
641 | + qmlRegisterSingletonType<Connectivity>(uri, 1, 0, "Connectivity", connectivitySingeltonProvider); |
642 | qmlRegisterType<HotspotManager>(uri, 1, 0, "HotspotManager"); |
643 | qmlRegisterType<OfonoActivator>(uri, 1, 0, "OfonoActivator"); |
644 | } |
645 | |
646 | === modified file 'plugins/cellular/sims.js' |
647 | --- plugins/cellular/sims.js 2014-11-18 20:13:35 +0000 |
648 | +++ plugins/cellular/sims.js 2015-02-09 14:18:57 +0000 |
649 | @@ -46,3 +46,24 @@ |
650 | function getPresentCount () { |
651 | return getPresent().length; |
652 | } |
653 | + |
654 | +function createQML () { |
655 | + var component = Qt.createComponent("Components/Sim.qml"); |
656 | + |
657 | + sims.forEach(function (sim) { |
658 | + sim.destroy(); |
659 | + }); |
660 | + sims = []; |
661 | + |
662 | + root.modemsSorted.forEach(function (path) { |
663 | + var sim = component.createObject(root, { |
664 | + path: path |
665 | + }); |
666 | + if (sim === null) { |
667 | + console.warn('Failed to create Sim qml:', |
668 | + component.errorString()); |
669 | + } else { |
670 | + Sims.add(sim); |
671 | + } |
672 | + }); |
673 | +} |
674 | |
675 | === modified file 'plugins/phone/PageComponent.qml' |
676 | --- plugins/phone/PageComponent.qml 2014-11-10 17:59:34 +0000 |
677 | +++ plugins/phone/PageComponent.qml 2015-02-09 14:18:57 +0000 |
678 | @@ -32,7 +32,7 @@ |
679 | title: i18n.tr("Phone") |
680 | flickable: flick |
681 | |
682 | - property var modemsSorted: manager.modems.slice(0).sort() |
683 | + property var modemsSorted: [] |
684 | property var simsLoaded: 0 |
685 | |
686 | states: [ |
687 | @@ -65,19 +65,9 @@ |
688 | |
689 | OfonoManager { |
690 | id: manager |
691 | - Component.onCompleted: { |
692 | - // create ofono bindings for all modem paths |
693 | - var component = Qt.createComponent("Ofono.qml"); |
694 | - modemsSorted.forEach(function (path) { |
695 | - var sim = component.createObject(root, { |
696 | - path: path |
697 | - }); |
698 | - if (sim === null) { |
699 | - console.warn('failed to create sim object'); |
700 | - } else { |
701 | - Sims.add(sim); |
702 | - } |
703 | - }); |
704 | + onModemsChanged: { |
705 | + root.modemsSorted = modems.slice(0).sort(); |
706 | + Sims.createQML(); |
707 | } |
708 | } |
709 | |
710 | |
711 | === modified file 'plugins/phone/sims.js' |
712 | --- plugins/phone/sims.js 2014-10-03 14:08:08 +0000 |
713 | +++ plugins/phone/sims.js 2015-02-09 14:18:57 +0000 |
714 | @@ -36,3 +36,24 @@ |
715 | function getPresentCount () { |
716 | return getPresent().length; |
717 | } |
718 | + |
719 | +function createQML () { |
720 | + var component = Qt.createComponent("Ofono.qml"); |
721 | + |
722 | + sims.forEach(function (sim) { |
723 | + sim.destroy(); |
724 | + }); |
725 | + sims = []; |
726 | + |
727 | + root.modemsSorted.forEach(function (path) { |
728 | + var sim = component.createObject(root, { |
729 | + path: path |
730 | + }); |
731 | + if (sim === null) { |
732 | + console.warn('Failed to create Sim qml:', |
733 | + component.errorString()); |
734 | + } else { |
735 | + Sims.add(sim); |
736 | + } |
737 | + }); |
738 | +} |
739 | |
740 | === modified file 'plugins/security-privacy/PageComponent.qml' |
741 | --- plugins/security-privacy/PageComponent.qml 2014-11-12 16:28:12 +0000 |
742 | +++ plugins/security-privacy/PageComponent.qml 2015-02-09 14:18:57 +0000 |
743 | @@ -39,9 +39,11 @@ |
744 | |
745 | property alias usePowerd: batteryBackend.powerdRunning |
746 | property bool lockOnSuspend |
747 | - property var modemsSorted: manager.modems.slice(0).sort() |
748 | - property var sims |
749 | - property int simsPresent: 0 |
750 | + property var modemsSorted: [] |
751 | + property var sims: [] |
752 | + /* glue to something that will emit change events |
753 | + TODO: fix this so that the present count emits events of its own */ |
754 | + property int simsPresent: simsLoaded ? Sims.getPresentCount() : 0 |
755 | property int simsLoaded: 0 |
756 | property int simsLocked: { |
757 | var t = 0; |
758 | @@ -66,23 +68,10 @@ |
759 | |
760 | OfonoManager { |
761 | id: manager |
762 | - Component.onCompleted: { |
763 | - // create ofono bindings for all modem paths |
764 | - var component = Qt.createComponent("Ofono.qml"); |
765 | - modemsSorted.forEach(function (path, index) { |
766 | - var sim = component.createObject(root, { |
767 | - path: path, |
768 | - name: phoneSettings.simNames[path] ? |
769 | - phoneSettings.simNames[path] : |
770 | - "SIM " + (index + 1) |
771 | - }); |
772 | - if (sim === null) |
773 | - console.warn('failed to create sim object'); |
774 | - else |
775 | - Sims.add(sim); |
776 | - }); |
777 | + onModemsChanged: { |
778 | + root.modemsSorted = modems.slice(0).sort(); |
779 | + Sims.createQML(); |
780 | root.sims = Sims.getAll(); |
781 | - root.simsPresent = Sims.getPresentCount(); |
782 | } |
783 | } |
784 | |
785 | |
786 | === modified file 'plugins/security-privacy/sims.js' |
787 | --- plugins/security-privacy/sims.js 2014-08-27 05:19:24 +0000 |
788 | +++ plugins/security-privacy/sims.js 2015-02-09 14:18:57 +0000 |
789 | @@ -32,3 +32,28 @@ |
790 | function getPresentCount () { |
791 | return getPresent().length; |
792 | } |
793 | + |
794 | +function createQML () { |
795 | + var component = Qt.createComponent("Ofono.qml"); |
796 | + |
797 | + sims.forEach(function (sim) { |
798 | + sim.destroy(); |
799 | + }); |
800 | + sims = []; |
801 | + |
802 | + root.modemsSorted.forEach(function (path, index) { |
803 | + var sim = component.createObject(root, { |
804 | + path: path, |
805 | + name: phoneSettings.simNames[path] ? |
806 | + phoneSettings.simNames[path] : |
807 | + "SIM " + (index + 1) |
808 | + }); |
809 | + if (sim === null) { |
810 | + console.warn('Failed to create Sim qml:', |
811 | + component.errorString()); |
812 | + } else { |
813 | + Sims.add(sim); |
814 | + } |
815 | + }); |
816 | +} |
817 | + |
818 | |
819 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py' |
820 | --- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-01-29 19:50:34 +0000 |
821 | +++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-02-09 14:18:57 +0000 |
822 | @@ -143,7 +143,7 @@ |
823 | |
824 | def mock_connection_manager(self, modem): |
825 | modem.AddProperty(CONNMAN_IFACE, 'Powered', dbus.Boolean(1)) |
826 | - modem.AddProperty(CONNMAN_IFACE, 'RoamingAllowed', False) |
827 | + modem.AddProperty(CONNMAN_IFACE, 'RoamingAllowed', dbus.Boolean(0)) |
828 | modem.AddMethods( |
829 | CONNMAN_IFACE, |
830 | [ |
831 | @@ -156,6 +156,9 @@ |
832 | 'self.EmitSignal("IFACE", "PropertyChanged", "sv",\ |
833 | [args[0], args[1]])'.replace("IFACE", CONNMAN_IFACE)), |
834 | ]) |
835 | + interfaces = modem.GetProperties()['Interfaces'] |
836 | + interfaces.append(CONNMAN_IFACE) |
837 | + modem.SetProperty('Interfaces', interfaces) |
838 | |
839 | def mock_carriers(self, name): |
840 | self.dbusmock.AddObject( |
841 | @@ -208,6 +211,10 @@ |
842 | "PropertyChanged", "sv", [args[0], args[1]])' |
843 | .replace('IFACE', RDO_IFACE)), ]) |
844 | |
845 | + interfaces = modem.GetProperties()['Interfaces'] |
846 | + interfaces.append(RDO_IFACE) |
847 | + modem.SetProperty('Interfaces', interfaces) |
848 | + |
849 | def mock_call_forwarding(self, modem): |
850 | modem.AddProperty( |
851 | CALL_FWD_IFACE, 'VoiceUnconditional', '') |
852 | @@ -220,6 +227,9 @@ |
853 | 'self.EmitSignal("IFACE",\ |
854 | "PropertyChanged", "sv", [args[0], args[1]])' |
855 | .replace('IFACE', CALL_FWD_IFACE)), ]) |
856 | + interfaces = modem.GetProperties()['Interfaces'] |
857 | + interfaces.append(CALL_FWD_IFACE) |
858 | + modem.SetProperty('Interfaces', interfaces) |
859 | |
860 | def mock_call_settings(self, modem): |
861 | modem.AddProperty( |
862 | @@ -233,6 +243,9 @@ |
863 | 'self.EmitSignal("IFACE",\ |
864 | "PropertyChanged", "sv", [args[0], args[1]])' |
865 | .replace('IFACE', CALL_SETTINGS_IFACE)), ]) |
866 | + interfaces = modem.GetProperties()['Interfaces'] |
867 | + interfaces.append(CALL_SETTINGS_IFACE) |
868 | + modem.SetProperty('Interfaces', interfaces) |
869 | |
870 | def add_sim1(self): |
871 | # create modem_0 proxy |
FAILED: Continuous integration, rev:985 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- rtm-14. 09-ci/57/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- 14.09-touch/ 36/console jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- rtm-14. 09-14.09- armhf-ci/ 58 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- rtm-14. 09-14.09- armhf-ci/ 58/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- 14.09-mako/ 37/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- 14.09-armhf/ 36 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- 14.09-armhf/ 36/artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 17821
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- system- settings- rtm-14. 09-ci/57/ rebuild
http://