Merge lp:~jonas-drange/ubuntu-system-settings/libqofono-0.70-ready into lp:ubuntu-system-settings

Proposed by Jonas G. Drange on 2015-01-14
Status: Merged
Approved by: Ken VanDine on 2015-01-14
Approved revision: 1255
Merged at revision: 1256
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/libqofono-0.70-ready
Merge into: lp:ubuntu-system-settings
Diff against target: 310 lines (+109/-55)
9 files modified
debian/control (+1/-1)
plugins/about/PageComponent.qml (+11/-6)
plugins/cellular/PageComponent.qml (+4/-14)
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/libqofono-0.70-ready
Reviewer Review Type Date Requested Status
Ken VanDine 2015-01-14 Approve on 2015-01-14
PS Jenkins bot continuous-integration Needs Fixing on 2015-01-14
Review via email: mp+246371@code.launchpad.net

Commit Message

Change the way we use OfonoManager.modems, since it is no longer populated at creation time (in u-s-s)—use events instead. libqofono bindings also require that the modem emits InterfacesChanged with their name it it, to work at all. All modem mocks has been updated.

Description of the Change

* Change from just relying on manager.modems to be correct at binding creation, use event Manager.onModemsChanged
* Create QML when said event is seen
* Bindings now require the modem to broadcast if a binding is in the list of interfaces or not. E.g. OfonoConnMan using '/ril_0' is not working until 'org.ofono.Modem.Interfaces' includes 'org.ofono.ConnectionManager' and 'org.ofono.Modem' has sent an 'InterfaceChanged' event including ''org.ofono.ConnectionManager'.

To post a comment you must log in.
Ken VanDine (ken-vandine) wrote :

The CI failures are due to the dependency bump which is still in vivid-proposed. The autopilot tests for about, cellular and phone pass on my device.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-12-11 21:14:43 +0000
3+++ debian/control 2015-01-14 00:09:20 +0000
4@@ -71,7 +71,7 @@
5 qtdeclarative5-folderlistmodel-plugin,
6 qml-module-qtmultimedia | qml-module-qtmultimedia-gles,
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-07 12:04:59 +0000
16+++ plugins/about/PageComponent.qml 2015-01-14 00:09:20 +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/PageComponent.qml'
50--- plugins/cellular/PageComponent.qml 2014-12-11 16:35:55 +0000
51+++ plugins/cellular/PageComponent.qml 2015-01-14 00:09:20 +0000
52@@ -32,7 +32,7 @@
53 title: i18n.tr("Cellular")
54 objectName: "cellularPage"
55
56- property var modemsSorted: manager.modems.slice(0).sort()
57+ property var modemsSorted: []
58 property int simsLoaded: 0
59
60 states: [
61@@ -66,19 +66,9 @@
62
63 OfonoManager {
64 id: manager
65- Component.onCompleted: {
66- var component = Qt.createComponent("Components/Sim.qml");
67- modemsSorted.forEach(function (path) {
68- var sim = component.createObject(root, {
69- path: path
70- });
71- if (sim === null) {
72- console.warn('Failed to create Sim qml:',
73- component.errorString());
74- } else {
75- Sims.add(sim);
76- }
77- });
78+ onModemsChanged: {
79+ root.modemsSorted = modems.slice(0).sort();
80+ Sims.createQML();
81 }
82 }
83
84
85=== modified file 'plugins/cellular/sims.js'
86--- plugins/cellular/sims.js 2014-10-10 15:47:59 +0000
87+++ plugins/cellular/sims.js 2015-01-14 00:09:20 +0000
88@@ -46,3 +46,24 @@
89 function getPresentCount () {
90 return getPresent().length;
91 }
92+
93+function createQML () {
94+ var component = Qt.createComponent("Components/Sim.qml");
95+
96+ sims.forEach(function (sim) {
97+ sim.destroy();
98+ });
99+ sims = [];
100+
101+ root.modemsSorted.forEach(function (path) {
102+ var sim = component.createObject(root, {
103+ path: path
104+ });
105+ if (sim === null) {
106+ console.warn('Failed to create Sim qml:',
107+ component.errorString());
108+ } else {
109+ Sims.add(sim);
110+ }
111+ });
112+}
113
114=== modified file 'plugins/phone/PageComponent.qml'
115--- plugins/phone/PageComponent.qml 2014-11-04 11:57:21 +0000
116+++ plugins/phone/PageComponent.qml 2015-01-14 00:09:20 +0000
117@@ -32,7 +32,7 @@
118 title: i18n.tr("Phone")
119 flickable: flick
120
121- property var modemsSorted: manager.modems.slice(0).sort()
122+ property var modemsSorted: []
123 property var simsLoaded: 0
124
125 states: [
126@@ -65,19 +65,9 @@
127
128 OfonoManager {
129 id: manager
130- Component.onCompleted: {
131- // create ofono bindings for all modem paths
132- var component = Qt.createComponent("Ofono.qml");
133- modemsSorted.forEach(function (path) {
134- var sim = component.createObject(root, {
135- path: path
136- });
137- if (sim === null) {
138- console.warn('failed to create sim object');
139- } else {
140- Sims.add(sim);
141- }
142- });
143+ onModemsChanged: {
144+ root.modemsSorted = modems.slice(0).sort();
145+ Sims.createQML();
146 }
147 }
148
149
150=== modified file 'plugins/phone/sims.js'
151--- plugins/phone/sims.js 2014-10-03 14:08:08 +0000
152+++ plugins/phone/sims.js 2015-01-14 00:09:20 +0000
153@@ -36,3 +36,24 @@
154 function getPresentCount () {
155 return getPresent().length;
156 }
157+
158+function createQML () {
159+ var component = Qt.createComponent("Ofono.qml");
160+
161+ sims.forEach(function (sim) {
162+ sim.destroy();
163+ });
164+ sims = [];
165+
166+ root.modemsSorted.forEach(function (path) {
167+ var sim = component.createObject(root, {
168+ path: path
169+ });
170+ if (sim === null) {
171+ console.warn('Failed to create Sim qml:',
172+ component.errorString());
173+ } else {
174+ Sims.add(sim);
175+ }
176+ });
177+}
178
179=== modified file 'plugins/security-privacy/PageComponent.qml'
180--- plugins/security-privacy/PageComponent.qml 2014-11-04 12:08:12 +0000
181+++ plugins/security-privacy/PageComponent.qml 2015-01-14 00:09:20 +0000
182@@ -39,9 +39,11 @@
183
184 property alias usePowerd: batteryBackend.powerdRunning
185 property bool lockOnSuspend
186- property var modemsSorted: manager.modems.slice(0).sort()
187- property var sims
188- property int simsPresent: 0
189+ property var modemsSorted: []
190+ property var sims: []
191+ /* glue to something that will emit change events
192+ TODO: fix this so that the present count emits events of its own */
193+ property int simsPresent: simsLoaded ? Sims.getPresentCount() : 0
194 property int simsLoaded: 0
195 property int simsLocked: {
196 var t = 0;
197@@ -66,23 +68,10 @@
198
199 OfonoManager {
200 id: manager
201- Component.onCompleted: {
202- // create ofono bindings for all modem paths
203- var component = Qt.createComponent("Ofono.qml");
204- modemsSorted.forEach(function (path, index) {
205- var sim = component.createObject(root, {
206- path: path,
207- name: phoneSettings.simNames[path] ?
208- phoneSettings.simNames[path] :
209- "SIM " + (index + 1)
210- });
211- if (sim === null)
212- console.warn('failed to create sim object');
213- else
214- Sims.add(sim);
215- });
216+ onModemsChanged: {
217+ root.modemsSorted = modems.slice(0).sort();
218+ Sims.createQML();
219 root.sims = Sims.getAll();
220- root.simsPresent = Sims.getPresentCount();
221 }
222 }
223
224
225=== modified file 'plugins/security-privacy/sims.js'
226--- plugins/security-privacy/sims.js 2014-08-27 05:19:24 +0000
227+++ plugins/security-privacy/sims.js 2015-01-14 00:09:20 +0000
228@@ -32,3 +32,28 @@
229 function getPresentCount () {
230 return getPresent().length;
231 }
232+
233+function createQML () {
234+ var component = Qt.createComponent("Ofono.qml");
235+
236+ sims.forEach(function (sim) {
237+ sim.destroy();
238+ });
239+ sims = [];
240+
241+ root.modemsSorted.forEach(function (path, index) {
242+ var sim = component.createObject(root, {
243+ path: path,
244+ name: phoneSettings.simNames[path] ?
245+ phoneSettings.simNames[path] :
246+ "SIM " + (index + 1)
247+ });
248+ if (sim === null) {
249+ console.warn('Failed to create Sim qml:',
250+ component.errorString());
251+ } else {
252+ Sims.add(sim);
253+ }
254+ });
255+}
256+
257
258=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
259--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-01-10 06:50:41 +0000
260+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-01-14 00:09:20 +0000
261@@ -139,7 +139,7 @@
262
263 def mock_connection_manager(self, modem):
264 modem.AddProperty(CONNMAN_IFACE, 'Powered', dbus.Boolean(1))
265- modem.AddProperty(CONNMAN_IFACE, 'RoamingAllowed', False)
266+ modem.AddProperty(CONNMAN_IFACE, 'RoamingAllowed', dbus.Boolean(0))
267 modem.AddMethods(
268 CONNMAN_IFACE,
269 [
270@@ -152,6 +152,9 @@
271 'self.EmitSignal("IFACE", "PropertyChanged", "sv",\
272 [args[0], args[1]])'.replace("IFACE", CONNMAN_IFACE)),
273 ])
274+ interfaces = modem.GetProperties()['Interfaces']
275+ interfaces.append(CONNMAN_IFACE)
276+ modem.SetProperty('Interfaces', interfaces)
277
278 def mock_carriers(self, name):
279 self.dbusmock.AddObject(
280@@ -204,6 +207,10 @@
281 "PropertyChanged", "sv", [args[0], args[1]])'
282 .replace('IFACE', RDO_IFACE)), ])
283
284+ interfaces = modem.GetProperties()['Interfaces']
285+ interfaces.append(RDO_IFACE)
286+ modem.SetProperty('Interfaces', interfaces)
287+
288 def mock_call_forwarding(self, modem):
289 modem.AddProperty(
290 CALL_FWD_IFACE, 'VoiceUnconditional', '')
291@@ -216,6 +223,9 @@
292 'self.EmitSignal("IFACE",\
293 "PropertyChanged", "sv", [args[0], args[1]])'
294 .replace('IFACE', CALL_FWD_IFACE)), ])
295+ interfaces = modem.GetProperties()['Interfaces']
296+ interfaces.append(CALL_FWD_IFACE)
297+ modem.SetProperty('Interfaces', interfaces)
298
299 def mock_call_settings(self, modem):
300 modem.AddProperty(
301@@ -229,6 +239,9 @@
302 'self.EmitSignal("IFACE",\
303 "PropertyChanged", "sv", [args[0], args[1]])'
304 .replace('IFACE', CALL_SETTINGS_IFACE)), ])
305+ interfaces = modem.GetProperties()['Interfaces']
306+ interfaces.append(CALL_SETTINGS_IFACE)
307+ modem.SetProperty('Interfaces', interfaces)
308
309 def add_sim1(self):
310 # create modem_0 proxy

Subscribers

People subscribed via source and target branches