Merge lp:~jonas-drange/ubuntu-system-settings/call-fwd-wait-dual-sim into lp:ubuntu-system-settings

Proposed by Jonas G. Drange
Status: Superseded
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/call-fwd-wait-dual-sim
Merge into: lp:ubuntu-system-settings
Prerequisite: lp:~jonas-drange/ubuntu-system-settings/1219793-reset
Diff against target: 946 lines (+647/-65)
11 files modified
plugins/phone/CMakeLists.txt (+3/-0)
plugins/phone/CallForwarding.qml (+17/-13)
plugins/phone/CallWaiting.qml (+10/-9)
plugins/phone/DualSim.qml (+146/-0)
plugins/phone/Ofono.qml (+55/-0)
plugins/phone/PageComponent.qml (+53/-39)
plugins/phone/Services.qml (+4/-1)
plugins/phone/SingleSim.qml (+64/-0)
tests/autopilot/ubuntu_system_settings/__init__.py (+145/-0)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+39/-3)
tests/autopilot/ubuntu_system_settings/tests/test_phone.py (+111/-0)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/call-fwd-wait-dual-sim
Reviewer Review Type Date Requested Status
Ken VanDine Needs Fixing
Sebastien Bacher (community) Approve
PS Jenkins bot continuous-integration Approve
Leo Arias (community) autopilot code review Approve
Review via email: mp+229774@code.launchpad.net

This proposal has been superseded by a proposal from 2014-08-19.

Commit message

[phone] adding dual sim functionality to phone panel

Description of the change

Hi,

the phone panel does not yet support dual SIM setups and is hardcoded to do SIM services, call wait/forward for one SIM.

This branch adds code that lazily and dynamically creates ofono qml objects based on how many SIMs there are. The ofono objects created are only the ones needed for this UI to work.

The UI has been changed for dual SIM setups and mimics the cellular where no designs exist.

Thanks

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

FAILED: Continuous integration, rev:866
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~jonas-drange/ubuntu-system-settings/call-fwd-wait-dual-sim/+merge/229774/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1160/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3104
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2438
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/352
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/352
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/352/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/352
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3141
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4348
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4348/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11089
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2019
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2708
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2708/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1160/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

Thanks for merging my branch.
Many of the tests have failed on Jenkins because the app wasn't launched. That's weird.

439 + :param sim: TODO I'm not sure what this is for.
465 + :param sim: TODO I'm not sure what this is for.
478 + :param sim: TODO I'm not sure what this is for.

Please fill the docstring here. I didn't know what to put in there.

tests/autopilot/ubuntu_system_settings/tests/__init__.py

There are some conflicts here ^

624 + def test_call_fwd(self):

That test just opens the page. It still needs to do an action and check its result.

And I thought you were going to add tests for the two other pages.

review: Needs Fixing
Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

19:47 < elopio> jgdx: we have helpers for switches, so you won't have to check if they are checked before clicking them.
19:48 < elopio> http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk/view/head:/tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_checkbox.py
19:49 < elopio> you use them like this: self.wait_select_single(ubuntuuitoolkit.Checkbox,
19:49 < elopio> objectName="callWaitingSwitch")
19:52 < elopio> also one for textfields: http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk/view/head:/tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py
19:52 < elopio> jgdx: you could do
19:52 < elopio> text_field = self.wait_select_single(ubuntuuitoolkit.TextField, objectName='destNumberField')
19:52 < elopio> text_field.write('...')
19:52 < elopio> it will take care of focusing the field, of using the right input device and of checking that it was written.
19:57 <

Revision history for this message
Leo Arias (elopio) wrote :

<elopio> jgdx: we have helpers for switches, so you won't have to check if they are checked before clicking them.
<elopio> http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk/view/head:/tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_checkbox.py
--> mehow_ (~Adium@90.197.64.5) has joined #ubuntu-app-devel
<elopio> you use them like this: self.wait_select_single(ubuntuuitoolkit.Checkbox,
<elopio> objectName="callWaitingSwitch")
<elopio> also one for textfields: http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk/view/head:/tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py
<elopio> jgdx: you could do
<elopio> text_field = self.wait_select_single(ubuntuuitoolkit.TextField, objectName='destNumberField')
<elopio> text_field.write('...')
<elopio> it will take care of focusing the field, of using the right input device and of checking that it was written.
<jgdx> elopio, thanks!
<elopio> jgdx: I think you are not asserting the calls to the mocks anywhere.
<elopio> I got to go for a while. I'll leave this and a couple of other comments on the branch.
<elopio> thanks again jgdx. Nice work with this.

Using the helpers from the toolkit it's important because if they change the behaviour or the design, the change will be transparent for your tests.

Revision history for this message
Leo Arias (elopio) wrote :

590 + @property
591 + def get_forwarding(self):

Properties and attributes should be named as sustantives, and methods as verbs.
So you can either remove the @property here, or remove the "get_" part of the name. I would find it more readable with a name like get_forwarding_number.

And, please remember to use single quotes for consistency on strings. There are some places where you use " and some where you use '.

804 + call_fwd_page.set_forward("41444424")
809 + Eventually(Equals('41444424')))

pura vida.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, the changes look mostly fine, I've some small style comments inline, the pre-require branch needs to be approved first as well

review: Needs Fixing
Revision history for this message
Sebastien Bacher (seb128) wrote :

the CI shows the changes make the pep8 error, that needs to be fixed as well

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
875. By Jonas G. Drange

merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

The autopilot code looks awesome, thanks. A new jenkins run is about to finish.

review: Approve (autopilot code review)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:875
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1206/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3358
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2630
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/399
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/395
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/395/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/398
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3293
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4604
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4604/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11289
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2132
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2906
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2906/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1206/rebuild

review: Approve (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

All green!

Revision history for this message
Sebastien Bacher (seb128) wrote :

looks fine to me but I don't have a dual sim to test, comment approving only, could somebody having access to the right config do a runtime test before changing the status?

review: Approve
Revision history for this message
Ken VanDine (ken-vandine) wrote :

I tried this on my dual sim device, it's only showing me the first SIM under Phone.

review: Needs Fixing
876. By Jonas G. Drange

merge trunk

877. By Jonas G. Drange

refactor phone panel

878. By Jonas G. Drange

merge prereq

879. By Jonas G. Drange

merge prereq

880. By Jonas G. Drange

merge trunk

881. By Jonas G. Drange

merge prereq

882. By Jonas G. Drange

merge trunk

883. By Jonas G. Drange

be a bit more precise when using the callsettings

884. By Jonas G. Drange

merge trunk

885. By Jonas G. Drange

bad ref

886. By Jonas G. Drange

create the binding locally

887. By Jonas G. Drange

removing debug

888. By Jonas G. Drange

fix bad sim1/sim2 reference

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/phone/CMakeLists.txt'
2--- plugins/phone/CMakeLists.txt 2014-07-09 13:17:47 +0000
3+++ plugins/phone/CMakeLists.txt 2014-08-08 11:33:08 +0000
4@@ -1,9 +1,12 @@
5 set(QML_SOURCES
6 CallForwarding.qml
7 CallWaiting.qml
8+ DualSim.qml
9+ Ofono.qml
10 PageComponent.qml
11 ServiceInfo.qml
12 Services.qml
13+ SingleSim.qml
14 dateUtils.js
15 )
16
17
18=== modified file 'plugins/phone/CallForwarding.qml'
19--- plugins/phone/CallForwarding.qml 2014-07-22 20:10:26 +0000
20+++ plugins/phone/CallForwarding.qml 2014-08-08 11:33:08 +0000
21@@ -22,22 +22,22 @@
22 import SystemSettings 1.0
23 import Ubuntu.Components 0.1
24 import Ubuntu.Components.ListItems 0.1 as ListItem
25-import MeeGo.QOfono 0.2
26
27 ItemPage {
28- title: i18n.tr("Call forwarding")
29
30- property bool forwarding: callForwarding.voiceUnconditional !== ""
31- property string modem
32+ objectName: "callForwardingPage"
33+ title: headerTitle
34+ property var sim
35+ property bool forwarding: sim.callForwarding.voiceUnconditional !== ""
36+ property string headerTitle: i18n.tr("Call forwarding")
37
38 onForwardingChanged: {
39 if (callForwardingSwitch.checked !== forwarding)
40 callForwardingSwitch.checked = forwarding;
41 }
42
43- OfonoCallForwarding {
44- id: callForwarding
45- modemPath: modem
46+ Connections {
47+ target: sim.callForwarding
48 onVoiceUnconditionalChanged: {
49 destNumberField.text = voiceUnconditional;
50 }
51@@ -50,13 +50,14 @@
52
53 Switch {
54 id: callForwardingSwitch
55+ objectName: "callForwardingSwitch"
56 checked: forwarding
57 enabled: (forwarding === checked)
58 visible: callForwardingItem.control === callForwardingSwitch
59 onCheckedChanged: {
60 if (!checked && forwarding) {
61 callForwardingIndicator.running = true;
62- callForwarding.voiceUnconditional = "";
63+ sim.callForwarding.voiceUnconditional = "";
64 }
65 }
66 }
67@@ -101,17 +102,18 @@
68 visible: callForwardingSwitch.checked
69 control: TextInput {
70 id: destNumberField
71+ objectName: "destNumberField"
72 horizontalAlignment: TextInput.AlignRight
73 width: forwardToItem.width/2
74 inputMethodHints: Qt.ImhDialableCharactersOnly
75- text: callForwarding.voiceUnconditional
76+ text: sim.callForwarding.voiceUnconditional
77 font.pixelSize: units.dp(18)
78 font.weight: Font.Light
79 font.family: "Ubuntu"
80 color: "#AAAAAA"
81 maximumLength: 20
82 focus: true
83- cursorVisible: text !== callForwarding.voiceUnconditional ||
84+ cursorVisible: text !== sim.callForwarding.voiceUnconditional ||
85 text === ""
86 clip: true
87 opacity: 0.9
88@@ -133,30 +135,32 @@
89 spacing: units.gu(2)
90
91 Button {
92+ objectName: "cancel"
93 text: i18n.tr("Cancel")
94 width: (buttonsRowId.width-units.gu(2)*4)/3
95 enabled: !callForwardingIndicator.running
96 onClicked: {
97 destNumberField.text =
98- callForwarding.voiceUnconditional;
99+ sim.callForwarding.voiceUnconditional;
100 if (forwarding !== callForwardingSwitch.checked)
101 callForwardingSwitch.checked = forwarding;
102 }
103 }
104
105 Button {
106+ objectName: "set"
107 text: i18n.tr("Set")
108 width: (buttonsRowId.width-units.gu(2)*4)/3
109 enabled: !callForwardingIndicator.running
110 onClicked: {
111 callForwardingIndicator.running = true;
112- callForwarding.voiceUnconditional = destNumberField.text;
113+ sim.callForwarding.voiceUnconditional = destNumberField.text;
114 }
115 }
116 }
117 visible: callForwardingSwitch.checked &&
118 (destNumberField.text !==
119- callForwarding.voiceUnconditional)
120+ sim.callForwarding.voiceUnconditional)
121 }
122 }
123 }
124
125=== modified file 'plugins/phone/CallWaiting.qml'
126--- plugins/phone/CallWaiting.qml 2014-07-16 16:45:25 +0000
127+++ plugins/phone/CallWaiting.qml 2014-08-08 11:33:08 +0000
128@@ -22,15 +22,15 @@
129 import SystemSettings 1.0
130 import Ubuntu.Components 0.1
131 import Ubuntu.Components.ListItems 0.1 as ListItem
132-import MeeGo.QOfono 0.2
133
134 ItemPage {
135- title: i18n.tr("Call waiting")
136- property string modem
137+ objectName: "callWaitingPage"
138+ title: headerTitle
139+ property var sim
140+ property string headerTitle: i18n.tr("Call waiting")
141
142- OfonoCallSettings {
143- id: callSettings
144- modemPath: modem
145+ Connections {
146+ target: sim.callSettings
147 onVoiceCallWaitingChanged: {
148 callWaitingIndicator.running = false;
149 }
150@@ -44,14 +44,15 @@
151
152 Switch {
153 id: callWaitingSwitch
154+ objectName: "callWaitingSwitch"
155 visible: !callWaitingIndicator.running
156- checked: callSettings.voiceCallWaiting !== "disabled"
157+ checked: sim.callSettings.voiceCallWaiting !== "disabled"
158 onClicked: {
159 callWaitingIndicator.running = true;
160 if (checked)
161- callSettings.voiceCallWaiting = "enabled";
162+ sim.callSettings.voiceCallWaiting = "enabled";
163 else
164- callSettings.voiceCallWaiting = "disabled";
165+ sim.callSettings.voiceCallWaiting = "disabled";
166 }
167 }
168
169
170=== added file 'plugins/phone/DualSim.qml'
171--- plugins/phone/DualSim.qml 1970-01-01 00:00:00 +0000
172+++ plugins/phone/DualSim.qml 2014-08-08 11:33:08 +0000
173@@ -0,0 +1,146 @@
174+/*
175+ * Copyright (C) 2014 Canonical Ltd
176+ *
177+ * This program is free software: you can redistribute it and/or modify
178+ * it under the terms of the GNU General Public License version 3 as
179+ * published by the Free Software Foundation.
180+ *
181+ * This program is distributed in the hope that it will be useful,
182+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
183+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
184+ * GNU General Public License for more details.
185+ *
186+ * You should have received a copy of the GNU General Public License
187+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
188+ *
189+ * Authors:
190+ * Ken Vandine <ken.vandine@canonical.com>
191+ * Jonas G. Drange <jonas.drange@canonical.com>
192+ *
193+*/
194+import QtQuick 2.0
195+import GSettings 1.0
196+import Ubuntu.Components 1.1
197+import Ubuntu.Components.ListItems 0.1 as ListItem
198+
199+Column {
200+
201+ anchors.left: parent.left
202+ anchors.right: parent.right
203+
204+ Ofono {
205+ id: sim1
206+ path: modemsSorted[0]
207+ }
208+
209+ Ofono {
210+ id: sim2
211+ path: modemsSorted[1]
212+ }
213+
214+ ListItem.Standard {
215+ text: sim1.title
216+ }
217+
218+ ListItem.Standard {
219+ objectName: "callFwdSim1"
220+ text: i18n.tr("Call forwarding")
221+ progression: true
222+ onClicked: pageStack.push(Qt.resolvedUrl("CallForwarding.qml"), {
223+ sim: sim1,
224+ headerTitle: sim1.title
225+ })
226+ }
227+
228+ ListItem.Standard {
229+ objectName: "callWaitSim1"
230+ text: i18n.tr("Call waiting")
231+ progression: true
232+ onClicked: pageStack.push(Qt.resolvedUrl("CallWaiting.qml"), {
233+ sim: sim1,
234+ headerTitle: sim1.title
235+ })
236+ }
237+
238+ ListItem.Standard {
239+ objectName: "simServicesSim1"
240+ text: i18n.tr("Services")
241+ progression: true
242+ enabled: sim1.simMng.present
243+ onClicked: pageStack.push(Qt.resolvedUrl("Services.qml"), {
244+ carrierString: sim1.netReg.name,
245+ sim: sim1.simMng,
246+ headerTitle: sim1.title
247+ })
248+ }
249+
250+ ListItem.Divider {}
251+
252+ ListItem.Standard {
253+ text: sim2.title
254+ }
255+
256+ ListItem.Standard {
257+ objectName: "callFwdSim2"
258+ text: i18n.tr("Call forwarding")
259+ progression: true
260+ onClicked: pageStack.push(Qt.resolvedUrl("CallForwarding.qml"), {
261+ sim: sim2,
262+ headerTitle: sim2.title
263+ })
264+ }
265+
266+ ListItem.Standard {
267+ objectName: "callWaitSim2"
268+ text: i18n.tr("Call waiting")
269+ progression: true
270+ onClicked: pageStack.push(Qt.resolvedUrl("CallWaiting.qml"), {
271+ sim: sim2,
272+ headerTitle: sim2.title
273+ })
274+ }
275+
276+ ListItem.Standard {
277+ objectName: "simServicesSim2"
278+ text: i18n.tr("Services")
279+ progression: true
280+ enabled: sim2.simMng.present
281+ onClicked: pageStack.push(Qt.resolvedUrl("Services.qml"), {
282+ carrierString: sim2.netReg.name,
283+ sim: sim2.simMng,
284+ headerTitle: sim2.title
285+ })
286+ }
287+
288+
289+ GSettings {
290+ id: phoneSettings
291+ schema.id: "com.ubuntu.phone"
292+ Component.onCompleted: {
293+ // set default names
294+ var simNames = phoneSettings.simNames;
295+ var m0 = sim1.path
296+ var m1 = sim2.path
297+ if (!simNames[m0]) {
298+ simNames[m0] = "SIM 1";
299+ }
300+ if (!simNames[m1]) {
301+ simNames[m1] = "SIM 2";
302+ }
303+ phoneSettings.simNames = simNames;
304+ }
305+ }
306+
307+ Binding {
308+ target: sim1
309+ property: "name"
310+ value: phoneSettings.simNames[modemsSorted[0]]
311+ }
312+
313+ Binding {
314+ target: sim2
315+ property: "name"
316+ value: phoneSettings.simNames[modemsSorted[1]]
317+ }
318+
319+}
320
321=== added file 'plugins/phone/Ofono.qml'
322--- plugins/phone/Ofono.qml 1970-01-01 00:00:00 +0000
323+++ plugins/phone/Ofono.qml 2014-08-08 11:33:08 +0000
324@@ -0,0 +1,55 @@
325+/*
326+ * Copyright (C) 2014 Canonical Ltd
327+ *
328+ * This program is free software: you can redistribute it and/or modify
329+ * it under the terms of the GNU General Public License version 3 as
330+ * published by the Free Software Foundation.
331+ *
332+ * This program is distributed in the hope that it will be useful,
333+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
334+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
335+ * GNU General Public License for more details.
336+ *
337+ * You should have received a copy of the GNU General Public License
338+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
339+ *
340+ * Authors:
341+ * Jonas G. Drange <jonas.drange@canonical.com>
342+ *
343+*/
344+import QtQuick 2.0
345+import MeeGo.QOfono 0.2
346+
347+Item {
348+ property alias callForwarding: callForwarding
349+ property alias callSettings: callSettings
350+ property alias netReg: netReg
351+ property alias simMng: simMng
352+
353+ property string path
354+ property string name
355+ property string title: {
356+ var number = simMng.subscriberNumbers[0] || simMng.subscriberIdentity;
357+ return name + (number ? " (" + number + ")" : "");
358+ }
359+
360+ OfonoCallSettings {
361+ id: callSettings
362+ modemPath: path
363+ }
364+
365+ OfonoCallForwarding {
366+ id: callForwarding
367+ modemPath: path
368+ }
369+
370+ OfonoNetworkRegistration {
371+ id: netReg
372+ modemPath: path
373+ }
374+
375+ OfonoSimManager {
376+ id: simMng
377+ modemPath: path
378+ }
379+}
380
381=== modified file 'plugins/phone/PageComponent.qml'
382--- plugins/phone/PageComponent.qml 2014-07-18 13:00:36 +0000
383+++ plugins/phone/PageComponent.qml 2014-08-08 11:33:08 +0000
384@@ -25,50 +25,64 @@
385 import MeeGo.QOfono 0.2
386
387 ItemPage {
388+ id: root
389+ objectName: "phonePage"
390 title: i18n.tr("Phone")
391- property string carrierName: netop.name
392- property string carrierString: carrierName ? carrierName : i18n.tr("SIM")
393+ flickable: flick
394+
395+ property var modemsSorted: manager.modems.slice(0).sort()
396+
397+ states: [
398+ State {
399+ name: "singleSim"
400+ PropertyChanges {
401+ target: singleSim
402+ source: "SingleSim.qml"
403+ }
404+ },
405+ State {
406+ name: "dualSim"
407+ PropertyChanges {
408+ target: dualSim
409+ source: "DualSim.qml"
410+ }
411+ }
412+ ]
413
414 OfonoManager {
415 id: manager
416- }
417-
418- OfonoNetworkRegistration {
419- id: netop;
420- modemPath: manager.modems[0]
421- onNameChanged: carrierName = netop.name
422- }
423-
424- OfonoSimManager {
425- id: sim
426- modemPath: manager.modems[0]
427- }
428-
429- Column {
430+ Component.onCompleted: {
431+ if (modems.length === 1) {
432+ root.state = "singleSim";
433+ } else if (modems.length === 2) {
434+ root.state = "dualSim";
435+ }
436+ }
437+ }
438+
439+ Flickable {
440+ id: flick
441 anchors.fill: parent
442-
443- ListItem.Standard {
444- text: i18n.tr("Call forwarding")
445- progression: true
446- onClicked: pageStack.push(Qt.resolvedUrl("CallForwarding.qml"), {modem: manager.modems[0]})
447- }
448-
449- ListItem.Standard {
450- text: i18n.tr("Call waiting")
451- progression: true
452- onClicked: pageStack.push(Qt.resolvedUrl("CallWaiting.qml"), {modem: manager.modems[0]})
453- showDivider: false
454- }
455-
456- ListItem.Divider {}
457-
458- ListItem.Standard {
459- // TRANSLATORS: %1 is the name of the (network) carrier
460- text: i18n.tr("%1 Services").arg(carrierString)
461- progression: true
462- enabled: sim.present
463- onClicked: pageStack.push(Qt.resolvedUrl("Services.qml"),
464- {carrierString: carrierString, sim: sim})
465+ contentWidth: parent.width
466+ contentHeight: contentItem.childrenRect.height
467+ boundsBehavior: (contentHeight > root.height) ?
468+ Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
469+
470+ Column {
471+ anchors.left: parent.left
472+ anchors.right: parent.right
473+
474+ Loader {
475+ id: singleSim
476+ anchors.left: parent.left
477+ anchors.right: parent.right
478+ }
479+
480+ Loader {
481+ id: dualSim
482+ anchors.left: parent.left
483+ anchors.right: parent.right
484+ }
485 }
486 }
487 }
488
489=== modified file 'plugins/phone/Services.qml'
490--- plugins/phone/Services.qml 2014-06-19 03:54:01 +0000
491+++ plugins/phone/Services.qml 2014-08-08 11:33:08 +0000
492@@ -24,12 +24,15 @@
493 import Ubuntu.Components.ListItems 0.1 as ListItem
494
495 ItemPage {
496+ objectName: "servicesPage"
497+ title: headerTitle
498 property string carrierString
499 property variant sim
500 property var names: []
501
502 // TRANSLATORS: %1 is the name of the (network) carrier
503- title: i18n.tr("%1 Services").arg(carrierString)
504+ property string headerTitle: i18n.tr("%1 Services").arg(carrierString)
505+
506
507 Component.onCompleted: {
508 var keys = [];
509
510=== added file 'plugins/phone/SingleSim.qml'
511--- plugins/phone/SingleSim.qml 1970-01-01 00:00:00 +0000
512+++ plugins/phone/SingleSim.qml 2014-08-08 11:33:08 +0000
513@@ -0,0 +1,64 @@
514+/*
515+ * Copyright (C) 2014 Canonical Ltd
516+ *
517+ * This program is free software: you can redistribute it and/or modify
518+ * it under the terms of the GNU General Public License version 3 as
519+ * published by the Free Software Foundation.
520+ *
521+ * This program is distributed in the hope that it will be useful,
522+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
523+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
524+ * GNU General Public License for more details.
525+ *
526+ * You should have received a copy of the GNU General Public License
527+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
528+ *
529+ * Authors:
530+ * Ken Vandine <ken.vandine@canonical.com>
531+ * Jonas G. Drange <jonas.drange@canonical.com>
532+ *
533+*/
534+import QtQuick 2.0
535+import Ubuntu.Components 1.1
536+import Ubuntu.Components.ListItems 0.1 as ListItem
537+
538+Column {
539+
540+ anchors.left: parent.left
541+ anchors.right: parent.right
542+
543+ property string carrierName: sim.netReg.name
544+ property string carrierString: carrierName ? carrierName : i18n.tr("SIM")
545+
546+ Ofono {
547+ id: sim
548+ path: modemsSorted[0]
549+ }
550+
551+ ListItem.Standard {
552+ objectName: "callFwd"
553+ text: i18n.tr("Call forwarding")
554+ progression: true
555+ onClicked: pageStack.push(Qt.resolvedUrl("CallForwarding.qml"), {sim: sim})
556+ }
557+
558+ ListItem.Standard {
559+ objectName: "callWait"
560+ text: i18n.tr("Call waiting")
561+ progression: true
562+ onClicked: pageStack.push(Qt.resolvedUrl("CallWaiting.qml"), {sim: sim})
563+ showDivider: false
564+ }
565+
566+ ListItem.Divider {}
567+
568+ ListItem.Standard {
569+ objectName: "simServices"
570+ // TRANSLATORS: %1 is the name of the (network) carrier
571+ text: i18n.tr("%1 Services").arg(carrierString)
572+ progression: true
573+ enabled: sim.simMng.present
574+ onClicked: pageStack.push(Qt.resolvedUrl("Services.qml"),
575+ {carrierString: carrierString, sim: sim.simMng})
576+ }
577+}
578
579=== modified file 'tests/autopilot/ubuntu_system_settings/__init__.py'
580--- tests/autopilot/ubuntu_system_settings/__init__.py 2014-08-01 00:24:24 +0000
581+++ tests/autopilot/ubuntu_system_settings/__init__.py 2014-08-08 11:33:08 +0000
582@@ -23,6 +23,7 @@
583
584 from time import sleep
585
586+from autopilot.input import Keyboard
587 import autopilot.logging
588 import ubuntuuitoolkit
589 from autopilot import introspection, platform
590@@ -102,6 +103,10 @@
591 self.pointing_device.click_object(item)
592
593 @autopilot.logging.log_action(logger.debug)
594+ def go_to_phone_page(self):
595+ return self._go_to_page('entryComponent-phone', 'phonePage')
596+
597+ @autopilot.logging.log_action(logger.debug)
598 def go_to_reset_phone(self):
599 return self._go_to_page('entryComponent-reset', 'resetPage')
600
601@@ -299,6 +304,146 @@
602 return False
603
604
605+class PhonePage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
606+
607+ """Autopilot helper for the Phone page."""
608+
609+ @classmethod
610+ def validate_dbus_object(cls, path, state):
611+ name = introspection.get_classname_from_path(path)
612+ if name == b'PageComponent':
613+ if state['objectName'][1] == 'phonePage':
614+ return True
615+ return False
616+
617+ @autopilot.logging.log_action(logger.info)
618+ def go_to_call_forwarding(self, sim=None):
619+ """Open the Call Forwarding settings page.
620+
621+ :param sim: Number of what SIM to use, either 1 or 2.
622+ Required parameter in dual SIM setups
623+ :returns: The Call Forwarding settings page.
624+
625+ """
626+ find = "callFwd"
627+ if sim:
628+ find = "callFwdSim%d" % sim
629+
630+ return self._go_to_page(find, 'callForwardingPage')
631+
632+ def _go_to_page(self, item_object_name, page_object_name):
633+ self._click_item(item_object_name)
634+ page = self.get_root_instance().wait_select_single(
635+ objectName=page_object_name)
636+ page.active.wait_for(True)
637+ return page
638+
639+ def _click_item(self, object_name):
640+ item = self.select_single(objectName=object_name)
641+ item.swipe_into_view()
642+ self.pointing_device.click_object(item)
643+
644+ @autopilot.logging.log_action(logger.info)
645+ def go_to_call_waiting(self, sim=None):
646+ """Open the Call Waiting settings page.
647+
648+ :param sim: Number of what SIM to use, either 1 or 2.
649+ Required parameter in dual SIM setups
650+ :returns: The Call Waiting settings page.
651+
652+ """
653+ find = "callWait"
654+ if sim:
655+ find = "callWaitSim%d" % sim
656+ return self._go_to_page(find, 'callWaitingPage')
657+
658+ @autopilot.logging.log_action(logger.info)
659+ def go_to_sim_services(self, sim=None):
660+ """Open the SIM Services settings page.
661+
662+ :param sim: Number of what SIM to use, either 1 or 2.
663+ Required parameter in dual SIM setups
664+ :returns: The SIM Services settings page.
665+
666+ """
667+ find = "simServices"
668+ if sim:
669+ find = "simServicesSim%d" % sim
670+
671+ return self._go_to_page(find, 'servicesPage')
672+
673+
674+class CallWaiting(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
675+
676+ """Autopilot helper for the Call waiting page."""
677+
678+ @property
679+ def _switch(self):
680+ return self.wait_select_single(
681+ ubuntuuitoolkit.CheckBox,
682+ objectName='callWaitingSwitch')
683+
684+ def enable_call_waiting(self):
685+ self._switch.check()
686+
687+ def disable_call_waiting(self):
688+ self._switch.uncheck()
689+
690+
691+class CallForwarding(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
692+
693+ """Autopilot helper for the Call forwarding page."""
694+
695+ @property
696+ def _switch(self):
697+ return self.wait_select_single(
698+ ubuntuuitoolkit.CheckBox,
699+ objectName='callForwardingSwitch')
700+
701+ @property
702+ def _number_field(self):
703+ return self.wait_select_single(
704+ objectName='destNumberField')
705+
706+ def _click_set(self):
707+ button = self.wait_select_single(
708+ objectName='set')
709+ self.pointing_device.click_object(button)
710+
711+ def _click_cancel(self):
712+ button = self.wait_select_single(
713+ objectName='cancel')
714+ self.pointing_device.click_object(button)
715+
716+ @property
717+ def current_forwarding(self):
718+ return self.wait_select_single(
719+ objectName='destNumberField').text
720+
721+ def enable_call_forwarding(self):
722+ self._switch.check()
723+
724+ def disable_call_forwarding(self):
725+ self._switch.uncheck()
726+
727+ def set_forward(self, number):
728+ input_method = Keyboard.create()
729+ self.enable_call_forwarding()
730+ self.pointing_device.click_object(self._number_field)
731+ input_method.type(number)
732+ self._click_set()
733+
734+
735+class Services(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
736+
737+ """Autopilot helper for the Call waiting page."""
738+
739+ # TODO: add pages for each relevant sim services page
740+ def open_sim_service(self, service):
741+ """Return a sim service page"""
742+ pass
743+
744+
745 class ResetPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
746
747 """Autopilot helper for the Reset page."""
748
749=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
750--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-08-07 09:52:19 +0000
751+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-08-08 11:33:08 +0000
752@@ -34,6 +34,8 @@
753 RDO_IFACE = 'org.ofono.RadioSettings'
754 SIM_IFACE = 'org.ofono.SimManager'
755 NETREG_IFACE = 'org.ofono.NetworkRegistration'
756+CALL_FWD_IFACE = 'org.ofono.CallForwarding'
757+CALL_SETTINGS_IFACE = 'org.ofono.CallSettings'
758 SYSTEM_IFACE = 'com.canonical.SystemImage'
759 SYSTEM_SERVICE_OBJ = '/Service'
760
761@@ -202,18 +204,43 @@
762 "PropertyChanged", "sv", [args[0], args[1]])'
763 .replace('IFACE', SIM_IFACE)), ])
764
765+ def mock_call_forwarding(self, modem):
766+ modem.AddProperty(
767+ CALL_FWD_IFACE, 'VoiceUnconditional', '')
768+ modem.AddMethods(
769+ CALL_FWD_IFACE,
770+ [('GetProperties', '', 'a{sv}',
771+ 'ret = self.GetAll("%s")' % CALL_FWD_IFACE),
772+ ('SetProperty', 'sv', '',
773+ 'self.Set("IFACE", args[0], args[1]); '
774+ 'self.EmitSignal("IFACE",\
775+ "PropertyChanged", "sv", [args[0], args[1]])'
776+ .replace('IFACE', CALL_FWD_IFACE)), ])
777+
778+ def mock_call_settings(self, modem):
779+ modem.AddProperty(
780+ CALL_SETTINGS_IFACE, 'VoiceCallWaiting', 'disabled')
781+ modem.AddMethods(
782+ CALL_SETTINGS_IFACE,
783+ [('GetProperties', '', 'a{sv}',
784+ 'ret = self.GetAll("%s")' % CALL_SETTINGS_IFACE),
785+ ('SetProperty', 'sv', '',
786+ 'self.Set("IFACE", args[0], args[1]); '
787+ 'self.EmitSignal("IFACE",\
788+ "PropertyChanged", "sv", [args[0], args[1]])'
789+ .replace('IFACE', CALL_SETTINGS_IFACE)), ])
790+
791 def add_sim1(self):
792 # create modem_0 proxy
793 self.modem_0 = self.dbus_con.get_object('org.ofono', '/ril_0')
794
795 # Add an available carrier
796 self.mock_carriers('ril_0')
797-
798 self.mock_radio_settings(self.modem_0)
799-
800 self.mock_connection_manager(self.modem_0)
801-
802 self.mock_sim_manager(self.modem_0)
803+ self.mock_call_forwarding(self.modem_0)
804+ self.mock_call_settings(self.modem_0)
805
806 self.modem_0.AddMethods('org.ofono.NetworkRegistration', [
807 ('GetProperties', '', 'a{sv}',
808@@ -242,6 +269,8 @@
809 self.mock_carriers(second_modem)
810 self.mock_radio_settings(self.modem_1)
811 self.mock_connection_manager(self.modem_1)
812+ self.mock_call_forwarding(self.modem_1)
813+ self.mock_call_settings(self.modem_1)
814
815 self.mock_sim_manager(self.modem_1, {
816 'SubscriberNumbers': ['08123', '938762783']
817@@ -272,6 +301,13 @@
818 super(CellularBaseTestCase, self).setUp('cellular')
819
820
821+class PhoneOfonoBaseTestCase(UbuntuSystemSettingsOfonoTestCase):
822+ def setUp(self):
823+ """ Go to Phone page """
824+ super(PhoneOfonoBaseTestCase, self).setUp()
825+ self.phone_page = self.system_settings.main_view.go_to_phone_page()
826+
827+
828 class AboutBaseTestCase(UbuntuSystemSettingsTestCase):
829 def setUp(self):
830 """Go to About page."""
831
832=== added file 'tests/autopilot/ubuntu_system_settings/tests/test_phone.py'
833--- tests/autopilot/ubuntu_system_settings/tests/test_phone.py 1970-01-01 00:00:00 +0000
834+++ tests/autopilot/ubuntu_system_settings/tests/test_phone.py 2014-08-08 11:33:08 +0000
835@@ -0,0 +1,111 @@
836+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
837+# Copyright 2014 Canonical
838+#
839+# This program is free software: you can redistribute it and/or modify it
840+# under the terms of the GNU General Public License version 3, as published
841+# by the Free Software Foundation.
842+
843+from __future__ import absolute_import
844+
845+from autopilot.matchers import Eventually
846+from testtools.matchers import Contains, Equals
847+
848+from ubuntu_system_settings.tests import (
849+ PhoneOfonoBaseTestCase, CALL_FWD_IFACE, CALL_SETTINGS_IFACE)
850+
851+
852+class PhoneTestCase(PhoneOfonoBaseTestCase):
853+ """Tests for Phone Page"""
854+
855+ def test_call_fwd(self):
856+ call_fwd_page = self.phone_page.go_to_call_forwarding()
857+ call_fwd_page.set_forward("41444424")
858+
859+ # Check that the forward has been set
860+ self.assertThat(
861+ call_fwd_page.current_forwarding,
862+ Eventually(Equals('41444424')))
863+
864+ # Check that dbus properties have been updated
865+ self.assertThat(
866+ lambda: str(self.modem_0.Get(CALL_FWD_IFACE,
867+ 'VoiceUnconditional')),
868+ Eventually(Contains('41444424')))
869+
870+ def test_call_waiting(self):
871+ call_wait = self.phone_page.go_to_call_waiting()
872+ # we have to help our test here, this normally takes quite a while
873+ self.modem_0.EmitSignal(
874+ CALL_SETTINGS_IFACE, 'PropertyChanged', 'sv',
875+ ['VoiceCallWaiting', 'disabled'])
876+ call_wait.enable_call_waiting()
877+
878+ # Check that dbus properties have been updated
879+ self.assertThat(
880+ lambda: str(self.modem_0.Get(CALL_SETTINGS_IFACE,
881+ 'VoiceCallWaiting')),
882+ Eventually(Contains('enabled')))
883+
884+
885+class PhoneDualSimTestCase(PhoneOfonoBaseTestCase):
886+ """Tests for Phone Page"""
887+
888+ use_sims = 2
889+
890+ def test_call_fwd_sim_1(self):
891+ call_fwd_page = self.phone_page.go_to_call_forwarding(sim=1)
892+ call_fwd_page.set_forward("41444424")
893+
894+ # Check that the forward has been set
895+ self.assertThat(
896+ call_fwd_page.current_forwarding,
897+ Eventually(Equals('41444424')))
898+
899+ # Check that dbus properties have been updated
900+ self.assertThat(
901+ lambda: str(self.modem_0.Get(CALL_FWD_IFACE,
902+ 'VoiceUnconditional')),
903+ Eventually(Contains('41444424')))
904+
905+ def test_call_fwd_sim_2(self):
906+ call_fwd_page = self.phone_page.go_to_call_forwarding(sim=2)
907+ call_fwd_page.set_forward("41444424")
908+
909+ # Check that the forward has been set
910+ self.assertThat(
911+ call_fwd_page.current_forwarding,
912+ Eventually(Equals('41444424')))
913+
914+ # Check that dbus properties have been updated
915+ self.assertThat(
916+ lambda: str(self.modem_1.Get(CALL_FWD_IFACE,
917+ 'VoiceUnconditional')),
918+ Eventually(Contains('41444424')))
919+
920+ def test_call_waiting_sim_1(self):
921+ call_wait = self.phone_page.go_to_call_waiting(sim=1)
922+ # we have to help our test here, this normally takes quite a while
923+ self.modem_0.EmitSignal(
924+ CALL_SETTINGS_IFACE, 'PropertyChanged', 'sv',
925+ ['VoiceCallWaiting', 'disabled'])
926+ call_wait.enable_call_waiting()
927+
928+ # Check that dbus properties have been updated
929+ self.assertThat(
930+ lambda: str(self.modem_0.Get(CALL_SETTINGS_IFACE,
931+ 'VoiceCallWaiting')),
932+ Eventually(Contains('enabled')))
933+
934+ def test_call_waiting_sim_2(self):
935+ call_wait = self.phone_page.go_to_call_waiting(sim=2)
936+ # we have to help our test here, this normally takes quite a while
937+ self.modem_1.EmitSignal(
938+ CALL_SETTINGS_IFACE, 'PropertyChanged', 'sv',
939+ ['VoiceCallWaiting', 'disabled'])
940+ call_wait.enable_call_waiting()
941+
942+ # Check that dbus properties have been updated
943+ self.assertThat(
944+ lambda: str(self.modem_1.Get(CALL_SETTINGS_IFACE,
945+ 'VoiceCallWaiting')),
946+ Eventually(Contains('enabled')))

Subscribers

People subscribed via source and target branches