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
=== modified file 'plugins/phone/CMakeLists.txt'
--- plugins/phone/CMakeLists.txt 2014-07-09 13:17:47 +0000
+++ plugins/phone/CMakeLists.txt 2014-08-08 11:33:08 +0000
@@ -1,9 +1,12 @@
1set(QML_SOURCES1set(QML_SOURCES
2 CallForwarding.qml2 CallForwarding.qml
3 CallWaiting.qml3 CallWaiting.qml
4 DualSim.qml
5 Ofono.qml
4 PageComponent.qml6 PageComponent.qml
5 ServiceInfo.qml7 ServiceInfo.qml
6 Services.qml8 Services.qml
9 SingleSim.qml
7 dateUtils.js10 dateUtils.js
8)11)
912
1013
=== modified file 'plugins/phone/CallForwarding.qml'
--- plugins/phone/CallForwarding.qml 2014-07-22 20:10:26 +0000
+++ plugins/phone/CallForwarding.qml 2014-08-08 11:33:08 +0000
@@ -22,22 +22,22 @@
22import SystemSettings 1.022import SystemSettings 1.0
23import Ubuntu.Components 0.123import Ubuntu.Components 0.1
24import Ubuntu.Components.ListItems 0.1 as ListItem24import Ubuntu.Components.ListItems 0.1 as ListItem
25import MeeGo.QOfono 0.2
2625
27ItemPage {26ItemPage {
28 title: i18n.tr("Call forwarding")
2927
30 property bool forwarding: callForwarding.voiceUnconditional !== ""28 objectName: "callForwardingPage"
31 property string modem29 title: headerTitle
30 property var sim
31 property bool forwarding: sim.callForwarding.voiceUnconditional !== ""
32 property string headerTitle: i18n.tr("Call forwarding")
3233
33 onForwardingChanged: {34 onForwardingChanged: {
34 if (callForwardingSwitch.checked !== forwarding)35 if (callForwardingSwitch.checked !== forwarding)
35 callForwardingSwitch.checked = forwarding;36 callForwardingSwitch.checked = forwarding;
36 }37 }
3738
38 OfonoCallForwarding {39 Connections {
39 id: callForwarding40 target: sim.callForwarding
40 modemPath: modem
41 onVoiceUnconditionalChanged: {41 onVoiceUnconditionalChanged: {
42 destNumberField.text = voiceUnconditional;42 destNumberField.text = voiceUnconditional;
43 }43 }
@@ -50,13 +50,14 @@
5050
51 Switch {51 Switch {
52 id: callForwardingSwitch52 id: callForwardingSwitch
53 objectName: "callForwardingSwitch"
53 checked: forwarding54 checked: forwarding
54 enabled: (forwarding === checked)55 enabled: (forwarding === checked)
55 visible: callForwardingItem.control === callForwardingSwitch56 visible: callForwardingItem.control === callForwardingSwitch
56 onCheckedChanged: {57 onCheckedChanged: {
57 if (!checked && forwarding) {58 if (!checked && forwarding) {
58 callForwardingIndicator.running = true;59 callForwardingIndicator.running = true;
59 callForwarding.voiceUnconditional = "";60 sim.callForwarding.voiceUnconditional = "";
60 }61 }
61 }62 }
62 }63 }
@@ -101,17 +102,18 @@
101 visible: callForwardingSwitch.checked102 visible: callForwardingSwitch.checked
102 control: TextInput {103 control: TextInput {
103 id: destNumberField104 id: destNumberField
105 objectName: "destNumberField"
104 horizontalAlignment: TextInput.AlignRight106 horizontalAlignment: TextInput.AlignRight
105 width: forwardToItem.width/2107 width: forwardToItem.width/2
106 inputMethodHints: Qt.ImhDialableCharactersOnly108 inputMethodHints: Qt.ImhDialableCharactersOnly
107 text: callForwarding.voiceUnconditional109 text: sim.callForwarding.voiceUnconditional
108 font.pixelSize: units.dp(18)110 font.pixelSize: units.dp(18)
109 font.weight: Font.Light111 font.weight: Font.Light
110 font.family: "Ubuntu"112 font.family: "Ubuntu"
111 color: "#AAAAAA"113 color: "#AAAAAA"
112 maximumLength: 20114 maximumLength: 20
113 focus: true115 focus: true
114 cursorVisible: text !== callForwarding.voiceUnconditional ||116 cursorVisible: text !== sim.callForwarding.voiceUnconditional ||
115 text === ""117 text === ""
116 clip: true118 clip: true
117 opacity: 0.9119 opacity: 0.9
@@ -133,30 +135,32 @@
133 spacing: units.gu(2)135 spacing: units.gu(2)
134136
135 Button {137 Button {
138 objectName: "cancel"
136 text: i18n.tr("Cancel")139 text: i18n.tr("Cancel")
137 width: (buttonsRowId.width-units.gu(2)*4)/3140 width: (buttonsRowId.width-units.gu(2)*4)/3
138 enabled: !callForwardingIndicator.running141 enabled: !callForwardingIndicator.running
139 onClicked: {142 onClicked: {
140 destNumberField.text =143 destNumberField.text =
141 callForwarding.voiceUnconditional;144 sim.callForwarding.voiceUnconditional;
142 if (forwarding !== callForwardingSwitch.checked)145 if (forwarding !== callForwardingSwitch.checked)
143 callForwardingSwitch.checked = forwarding;146 callForwardingSwitch.checked = forwarding;
144 }147 }
145 }148 }
146149
147 Button {150 Button {
151 objectName: "set"
148 text: i18n.tr("Set")152 text: i18n.tr("Set")
149 width: (buttonsRowId.width-units.gu(2)*4)/3153 width: (buttonsRowId.width-units.gu(2)*4)/3
150 enabled: !callForwardingIndicator.running154 enabled: !callForwardingIndicator.running
151 onClicked: {155 onClicked: {
152 callForwardingIndicator.running = true;156 callForwardingIndicator.running = true;
153 callForwarding.voiceUnconditional = destNumberField.text;157 sim.callForwarding.voiceUnconditional = destNumberField.text;
154 }158 }
155 }159 }
156 }160 }
157 visible: callForwardingSwitch.checked &&161 visible: callForwardingSwitch.checked &&
158 (destNumberField.text !==162 (destNumberField.text !==
159 callForwarding.voiceUnconditional)163 sim.callForwarding.voiceUnconditional)
160 }164 }
161 }165 }
162}166}
163167
=== modified file 'plugins/phone/CallWaiting.qml'
--- plugins/phone/CallWaiting.qml 2014-07-16 16:45:25 +0000
+++ plugins/phone/CallWaiting.qml 2014-08-08 11:33:08 +0000
@@ -22,15 +22,15 @@
22import SystemSettings 1.022import SystemSettings 1.0
23import Ubuntu.Components 0.123import Ubuntu.Components 0.1
24import Ubuntu.Components.ListItems 0.1 as ListItem24import Ubuntu.Components.ListItems 0.1 as ListItem
25import MeeGo.QOfono 0.2
2625
27ItemPage {26ItemPage {
28 title: i18n.tr("Call waiting")27 objectName: "callWaitingPage"
29 property string modem28 title: headerTitle
29 property var sim
30 property string headerTitle: i18n.tr("Call waiting")
3031
31 OfonoCallSettings {32 Connections {
32 id: callSettings33 target: sim.callSettings
33 modemPath: modem
34 onVoiceCallWaitingChanged: {34 onVoiceCallWaitingChanged: {
35 callWaitingIndicator.running = false;35 callWaitingIndicator.running = false;
36 }36 }
@@ -44,14 +44,15 @@
4444
45 Switch {45 Switch {
46 id: callWaitingSwitch46 id: callWaitingSwitch
47 objectName: "callWaitingSwitch"
47 visible: !callWaitingIndicator.running48 visible: !callWaitingIndicator.running
48 checked: callSettings.voiceCallWaiting !== "disabled"49 checked: sim.callSettings.voiceCallWaiting !== "disabled"
49 onClicked: {50 onClicked: {
50 callWaitingIndicator.running = true;51 callWaitingIndicator.running = true;
51 if (checked)52 if (checked)
52 callSettings.voiceCallWaiting = "enabled";53 sim.callSettings.voiceCallWaiting = "enabled";
53 else54 else
54 callSettings.voiceCallWaiting = "disabled";55 sim.callSettings.voiceCallWaiting = "disabled";
55 }56 }
56 }57 }
5758
5859
=== added file 'plugins/phone/DualSim.qml'
--- plugins/phone/DualSim.qml 1970-01-01 00:00:00 +0000
+++ plugins/phone/DualSim.qml 2014-08-08 11:33:08 +0000
@@ -0,0 +1,146 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Ken Vandine <ken.vandine@canonical.com>
18 * Jonas G. Drange <jonas.drange@canonical.com>
19 *
20*/
21import QtQuick 2.0
22import GSettings 1.0
23import Ubuntu.Components 1.1
24import Ubuntu.Components.ListItems 0.1 as ListItem
25
26Column {
27
28 anchors.left: parent.left
29 anchors.right: parent.right
30
31 Ofono {
32 id: sim1
33 path: modemsSorted[0]
34 }
35
36 Ofono {
37 id: sim2
38 path: modemsSorted[1]
39 }
40
41 ListItem.Standard {
42 text: sim1.title
43 }
44
45 ListItem.Standard {
46 objectName: "callFwdSim1"
47 text: i18n.tr("Call forwarding")
48 progression: true
49 onClicked: pageStack.push(Qt.resolvedUrl("CallForwarding.qml"), {
50 sim: sim1,
51 headerTitle: sim1.title
52 })
53 }
54
55 ListItem.Standard {
56 objectName: "callWaitSim1"
57 text: i18n.tr("Call waiting")
58 progression: true
59 onClicked: pageStack.push(Qt.resolvedUrl("CallWaiting.qml"), {
60 sim: sim1,
61 headerTitle: sim1.title
62 })
63 }
64
65 ListItem.Standard {
66 objectName: "simServicesSim1"
67 text: i18n.tr("Services")
68 progression: true
69 enabled: sim1.simMng.present
70 onClicked: pageStack.push(Qt.resolvedUrl("Services.qml"), {
71 carrierString: sim1.netReg.name,
72 sim: sim1.simMng,
73 headerTitle: sim1.title
74 })
75 }
76
77 ListItem.Divider {}
78
79 ListItem.Standard {
80 text: sim2.title
81 }
82
83 ListItem.Standard {
84 objectName: "callFwdSim2"
85 text: i18n.tr("Call forwarding")
86 progression: true
87 onClicked: pageStack.push(Qt.resolvedUrl("CallForwarding.qml"), {
88 sim: sim2,
89 headerTitle: sim2.title
90 })
91 }
92
93 ListItem.Standard {
94 objectName: "callWaitSim2"
95 text: i18n.tr("Call waiting")
96 progression: true
97 onClicked: pageStack.push(Qt.resolvedUrl("CallWaiting.qml"), {
98 sim: sim2,
99 headerTitle: sim2.title
100 })
101 }
102
103 ListItem.Standard {
104 objectName: "simServicesSim2"
105 text: i18n.tr("Services")
106 progression: true
107 enabled: sim2.simMng.present
108 onClicked: pageStack.push(Qt.resolvedUrl("Services.qml"), {
109 carrierString: sim2.netReg.name,
110 sim: sim2.simMng,
111 headerTitle: sim2.title
112 })
113 }
114
115
116 GSettings {
117 id: phoneSettings
118 schema.id: "com.ubuntu.phone"
119 Component.onCompleted: {
120 // set default names
121 var simNames = phoneSettings.simNames;
122 var m0 = sim1.path
123 var m1 = sim2.path
124 if (!simNames[m0]) {
125 simNames[m0] = "SIM 1";
126 }
127 if (!simNames[m1]) {
128 simNames[m1] = "SIM 2";
129 }
130 phoneSettings.simNames = simNames;
131 }
132 }
133
134 Binding {
135 target: sim1
136 property: "name"
137 value: phoneSettings.simNames[modemsSorted[0]]
138 }
139
140 Binding {
141 target: sim2
142 property: "name"
143 value: phoneSettings.simNames[modemsSorted[1]]
144 }
145
146}
0147
=== added file 'plugins/phone/Ofono.qml'
--- plugins/phone/Ofono.qml 1970-01-01 00:00:00 +0000
+++ plugins/phone/Ofono.qml 2014-08-08 11:33:08 +0000
@@ -0,0 +1,55 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Jonas G. Drange <jonas.drange@canonical.com>
18 *
19*/
20import QtQuick 2.0
21import MeeGo.QOfono 0.2
22
23Item {
24 property alias callForwarding: callForwarding
25 property alias callSettings: callSettings
26 property alias netReg: netReg
27 property alias simMng: simMng
28
29 property string path
30 property string name
31 property string title: {
32 var number = simMng.subscriberNumbers[0] || simMng.subscriberIdentity;
33 return name + (number ? " (" + number + ")" : "");
34 }
35
36 OfonoCallSettings {
37 id: callSettings
38 modemPath: path
39 }
40
41 OfonoCallForwarding {
42 id: callForwarding
43 modemPath: path
44 }
45
46 OfonoNetworkRegistration {
47 id: netReg
48 modemPath: path
49 }
50
51 OfonoSimManager {
52 id: simMng
53 modemPath: path
54 }
55}
056
=== modified file 'plugins/phone/PageComponent.qml'
--- plugins/phone/PageComponent.qml 2014-07-18 13:00:36 +0000
+++ plugins/phone/PageComponent.qml 2014-08-08 11:33:08 +0000
@@ -25,50 +25,64 @@
25import MeeGo.QOfono 0.225import MeeGo.QOfono 0.2
2626
27ItemPage {27ItemPage {
28 id: root
29 objectName: "phonePage"
28 title: i18n.tr("Phone")30 title: i18n.tr("Phone")
29 property string carrierName: netop.name31 flickable: flick
30 property string carrierString: carrierName ? carrierName : i18n.tr("SIM")32
33 property var modemsSorted: manager.modems.slice(0).sort()
34
35 states: [
36 State {
37 name: "singleSim"
38 PropertyChanges {
39 target: singleSim
40 source: "SingleSim.qml"
41 }
42 },
43 State {
44 name: "dualSim"
45 PropertyChanges {
46 target: dualSim
47 source: "DualSim.qml"
48 }
49 }
50 ]
3151
32 OfonoManager {52 OfonoManager {
33 id: manager53 id: manager
34 }54 Component.onCompleted: {
3555 if (modems.length === 1) {
36 OfonoNetworkRegistration {56 root.state = "singleSim";
37 id: netop;57 } else if (modems.length === 2) {
38 modemPath: manager.modems[0]58 root.state = "dualSim";
39 onNameChanged: carrierName = netop.name59 }
40 }60 }
4161 }
42 OfonoSimManager {62
43 id: sim63 Flickable {
44 modemPath: manager.modems[0]64 id: flick
45 }
46
47 Column {
48 anchors.fill: parent65 anchors.fill: parent
4966 contentWidth: parent.width
50 ListItem.Standard {67 contentHeight: contentItem.childrenRect.height
51 text: i18n.tr("Call forwarding")68 boundsBehavior: (contentHeight > root.height) ?
52 progression: true69 Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
53 onClicked: pageStack.push(Qt.resolvedUrl("CallForwarding.qml"), {modem: manager.modems[0]})70
54 }71 Column {
5572 anchors.left: parent.left
56 ListItem.Standard {73 anchors.right: parent.right
57 text: i18n.tr("Call waiting") 74
58 progression: true75 Loader {
59 onClicked: pageStack.push(Qt.resolvedUrl("CallWaiting.qml"), {modem: manager.modems[0]})76 id: singleSim
60 showDivider: false77 anchors.left: parent.left
61 }78 anchors.right: parent.right
6279 }
63 ListItem.Divider {}80
6481 Loader {
65 ListItem.Standard {82 id: dualSim
66 // TRANSLATORS: %1 is the name of the (network) carrier83 anchors.left: parent.left
67 text: i18n.tr("%1 Services").arg(carrierString)84 anchors.right: parent.right
68 progression: true85 }
69 enabled: sim.present
70 onClicked: pageStack.push(Qt.resolvedUrl("Services.qml"),
71 {carrierString: carrierString, sim: sim})
72 }86 }
73 }87 }
74}88}
7589
=== modified file 'plugins/phone/Services.qml'
--- plugins/phone/Services.qml 2014-06-19 03:54:01 +0000
+++ plugins/phone/Services.qml 2014-08-08 11:33:08 +0000
@@ -24,12 +24,15 @@
24import Ubuntu.Components.ListItems 0.1 as ListItem24import Ubuntu.Components.ListItems 0.1 as ListItem
2525
26ItemPage {26ItemPage {
27 objectName: "servicesPage"
28 title: headerTitle
27 property string carrierString29 property string carrierString
28 property variant sim30 property variant sim
29 property var names: []31 property var names: []
3032
31 // TRANSLATORS: %1 is the name of the (network) carrier33 // TRANSLATORS: %1 is the name of the (network) carrier
32 title: i18n.tr("%1 Services").arg(carrierString)34 property string headerTitle: i18n.tr("%1 Services").arg(carrierString)
35
3336
34 Component.onCompleted: {37 Component.onCompleted: {
35 var keys = [];38 var keys = [];
3639
=== added file 'plugins/phone/SingleSim.qml'
--- plugins/phone/SingleSim.qml 1970-01-01 00:00:00 +0000
+++ plugins/phone/SingleSim.qml 2014-08-08 11:33:08 +0000
@@ -0,0 +1,64 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Ken Vandine <ken.vandine@canonical.com>
18 * Jonas G. Drange <jonas.drange@canonical.com>
19 *
20*/
21import QtQuick 2.0
22import Ubuntu.Components 1.1
23import Ubuntu.Components.ListItems 0.1 as ListItem
24
25Column {
26
27 anchors.left: parent.left
28 anchors.right: parent.right
29
30 property string carrierName: sim.netReg.name
31 property string carrierString: carrierName ? carrierName : i18n.tr("SIM")
32
33 Ofono {
34 id: sim
35 path: modemsSorted[0]
36 }
37
38 ListItem.Standard {
39 objectName: "callFwd"
40 text: i18n.tr("Call forwarding")
41 progression: true
42 onClicked: pageStack.push(Qt.resolvedUrl("CallForwarding.qml"), {sim: sim})
43 }
44
45 ListItem.Standard {
46 objectName: "callWait"
47 text: i18n.tr("Call waiting")
48 progression: true
49 onClicked: pageStack.push(Qt.resolvedUrl("CallWaiting.qml"), {sim: sim})
50 showDivider: false
51 }
52
53 ListItem.Divider {}
54
55 ListItem.Standard {
56 objectName: "simServices"
57 // TRANSLATORS: %1 is the name of the (network) carrier
58 text: i18n.tr("%1 Services").arg(carrierString)
59 progression: true
60 enabled: sim.simMng.present
61 onClicked: pageStack.push(Qt.resolvedUrl("Services.qml"),
62 {carrierString: carrierString, sim: sim.simMng})
63 }
64}
065
=== modified file 'tests/autopilot/ubuntu_system_settings/__init__.py'
--- tests/autopilot/ubuntu_system_settings/__init__.py 2014-08-01 00:24:24 +0000
+++ tests/autopilot/ubuntu_system_settings/__init__.py 2014-08-08 11:33:08 +0000
@@ -23,6 +23,7 @@
2323
24from time import sleep24from time import sleep
2525
26from autopilot.input import Keyboard
26import autopilot.logging27import autopilot.logging
27import ubuntuuitoolkit28import ubuntuuitoolkit
28from autopilot import introspection, platform29from autopilot import introspection, platform
@@ -102,6 +103,10 @@
102 self.pointing_device.click_object(item)103 self.pointing_device.click_object(item)
103104
104 @autopilot.logging.log_action(logger.debug)105 @autopilot.logging.log_action(logger.debug)
106 def go_to_phone_page(self):
107 return self._go_to_page('entryComponent-phone', 'phonePage')
108
109 @autopilot.logging.log_action(logger.debug)
105 def go_to_reset_phone(self):110 def go_to_reset_phone(self):
106 return self._go_to_page('entryComponent-reset', 'resetPage')111 return self._go_to_page('entryComponent-reset', 'resetPage')
107112
@@ -299,6 +304,146 @@
299 return False304 return False
300305
301306
307class PhonePage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
308
309 """Autopilot helper for the Phone page."""
310
311 @classmethod
312 def validate_dbus_object(cls, path, state):
313 name = introspection.get_classname_from_path(path)
314 if name == b'PageComponent':
315 if state['objectName'][1] == 'phonePage':
316 return True
317 return False
318
319 @autopilot.logging.log_action(logger.info)
320 def go_to_call_forwarding(self, sim=None):
321 """Open the Call Forwarding settings page.
322
323 :param sim: Number of what SIM to use, either 1 or 2.
324 Required parameter in dual SIM setups
325 :returns: The Call Forwarding settings page.
326
327 """
328 find = "callFwd"
329 if sim:
330 find = "callFwdSim%d" % sim
331
332 return self._go_to_page(find, 'callForwardingPage')
333
334 def _go_to_page(self, item_object_name, page_object_name):
335 self._click_item(item_object_name)
336 page = self.get_root_instance().wait_select_single(
337 objectName=page_object_name)
338 page.active.wait_for(True)
339 return page
340
341 def _click_item(self, object_name):
342 item = self.select_single(objectName=object_name)
343 item.swipe_into_view()
344 self.pointing_device.click_object(item)
345
346 @autopilot.logging.log_action(logger.info)
347 def go_to_call_waiting(self, sim=None):
348 """Open the Call Waiting settings page.
349
350 :param sim: Number of what SIM to use, either 1 or 2.
351 Required parameter in dual SIM setups
352 :returns: The Call Waiting settings page.
353
354 """
355 find = "callWait"
356 if sim:
357 find = "callWaitSim%d" % sim
358 return self._go_to_page(find, 'callWaitingPage')
359
360 @autopilot.logging.log_action(logger.info)
361 def go_to_sim_services(self, sim=None):
362 """Open the SIM Services settings page.
363
364 :param sim: Number of what SIM to use, either 1 or 2.
365 Required parameter in dual SIM setups
366 :returns: The SIM Services settings page.
367
368 """
369 find = "simServices"
370 if sim:
371 find = "simServicesSim%d" % sim
372
373 return self._go_to_page(find, 'servicesPage')
374
375
376class CallWaiting(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
377
378 """Autopilot helper for the Call waiting page."""
379
380 @property
381 def _switch(self):
382 return self.wait_select_single(
383 ubuntuuitoolkit.CheckBox,
384 objectName='callWaitingSwitch')
385
386 def enable_call_waiting(self):
387 self._switch.check()
388
389 def disable_call_waiting(self):
390 self._switch.uncheck()
391
392
393class CallForwarding(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
394
395 """Autopilot helper for the Call forwarding page."""
396
397 @property
398 def _switch(self):
399 return self.wait_select_single(
400 ubuntuuitoolkit.CheckBox,
401 objectName='callForwardingSwitch')
402
403 @property
404 def _number_field(self):
405 return self.wait_select_single(
406 objectName='destNumberField')
407
408 def _click_set(self):
409 button = self.wait_select_single(
410 objectName='set')
411 self.pointing_device.click_object(button)
412
413 def _click_cancel(self):
414 button = self.wait_select_single(
415 objectName='cancel')
416 self.pointing_device.click_object(button)
417
418 @property
419 def current_forwarding(self):
420 return self.wait_select_single(
421 objectName='destNumberField').text
422
423 def enable_call_forwarding(self):
424 self._switch.check()
425
426 def disable_call_forwarding(self):
427 self._switch.uncheck()
428
429 def set_forward(self, number):
430 input_method = Keyboard.create()
431 self.enable_call_forwarding()
432 self.pointing_device.click_object(self._number_field)
433 input_method.type(number)
434 self._click_set()
435
436
437class Services(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
438
439 """Autopilot helper for the Call waiting page."""
440
441 # TODO: add pages for each relevant sim services page
442 def open_sim_service(self, service):
443 """Return a sim service page"""
444 pass
445
446
302class ResetPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):447class ResetPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
303448
304 """Autopilot helper for the Reset page."""449 """Autopilot helper for the Reset page."""
305450
=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-08-07 09:52:19 +0000
+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-08-08 11:33:08 +0000
@@ -34,6 +34,8 @@
34RDO_IFACE = 'org.ofono.RadioSettings'34RDO_IFACE = 'org.ofono.RadioSettings'
35SIM_IFACE = 'org.ofono.SimManager'35SIM_IFACE = 'org.ofono.SimManager'
36NETREG_IFACE = 'org.ofono.NetworkRegistration'36NETREG_IFACE = 'org.ofono.NetworkRegistration'
37CALL_FWD_IFACE = 'org.ofono.CallForwarding'
38CALL_SETTINGS_IFACE = 'org.ofono.CallSettings'
37SYSTEM_IFACE = 'com.canonical.SystemImage'39SYSTEM_IFACE = 'com.canonical.SystemImage'
38SYSTEM_SERVICE_OBJ = '/Service'40SYSTEM_SERVICE_OBJ = '/Service'
3941
@@ -202,18 +204,43 @@
202 "PropertyChanged", "sv", [args[0], args[1]])'204 "PropertyChanged", "sv", [args[0], args[1]])'
203 .replace('IFACE', SIM_IFACE)), ])205 .replace('IFACE', SIM_IFACE)), ])
204206
207 def mock_call_forwarding(self, modem):
208 modem.AddProperty(
209 CALL_FWD_IFACE, 'VoiceUnconditional', '')
210 modem.AddMethods(
211 CALL_FWD_IFACE,
212 [('GetProperties', '', 'a{sv}',
213 'ret = self.GetAll("%s")' % CALL_FWD_IFACE),
214 ('SetProperty', 'sv', '',
215 'self.Set("IFACE", args[0], args[1]); '
216 'self.EmitSignal("IFACE",\
217 "PropertyChanged", "sv", [args[0], args[1]])'
218 .replace('IFACE', CALL_FWD_IFACE)), ])
219
220 def mock_call_settings(self, modem):
221 modem.AddProperty(
222 CALL_SETTINGS_IFACE, 'VoiceCallWaiting', 'disabled')
223 modem.AddMethods(
224 CALL_SETTINGS_IFACE,
225 [('GetProperties', '', 'a{sv}',
226 'ret = self.GetAll("%s")' % CALL_SETTINGS_IFACE),
227 ('SetProperty', 'sv', '',
228 'self.Set("IFACE", args[0], args[1]); '
229 'self.EmitSignal("IFACE",\
230 "PropertyChanged", "sv", [args[0], args[1]])'
231 .replace('IFACE', CALL_SETTINGS_IFACE)), ])
232
205 def add_sim1(self):233 def add_sim1(self):
206 # create modem_0 proxy234 # create modem_0 proxy
207 self.modem_0 = self.dbus_con.get_object('org.ofono', '/ril_0')235 self.modem_0 = self.dbus_con.get_object('org.ofono', '/ril_0')
208236
209 # Add an available carrier237 # Add an available carrier
210 self.mock_carriers('ril_0')238 self.mock_carriers('ril_0')
211
212 self.mock_radio_settings(self.modem_0)239 self.mock_radio_settings(self.modem_0)
213
214 self.mock_connection_manager(self.modem_0)240 self.mock_connection_manager(self.modem_0)
215
216 self.mock_sim_manager(self.modem_0)241 self.mock_sim_manager(self.modem_0)
242 self.mock_call_forwarding(self.modem_0)
243 self.mock_call_settings(self.modem_0)
217244
218 self.modem_0.AddMethods('org.ofono.NetworkRegistration', [245 self.modem_0.AddMethods('org.ofono.NetworkRegistration', [
219 ('GetProperties', '', 'a{sv}',246 ('GetProperties', '', 'a{sv}',
@@ -242,6 +269,8 @@
242 self.mock_carriers(second_modem)269 self.mock_carriers(second_modem)
243 self.mock_radio_settings(self.modem_1)270 self.mock_radio_settings(self.modem_1)
244 self.mock_connection_manager(self.modem_1)271 self.mock_connection_manager(self.modem_1)
272 self.mock_call_forwarding(self.modem_1)
273 self.mock_call_settings(self.modem_1)
245274
246 self.mock_sim_manager(self.modem_1, {275 self.mock_sim_manager(self.modem_1, {
247 'SubscriberNumbers': ['08123', '938762783']276 'SubscriberNumbers': ['08123', '938762783']
@@ -272,6 +301,13 @@
272 super(CellularBaseTestCase, self).setUp('cellular')301 super(CellularBaseTestCase, self).setUp('cellular')
273302
274303
304class PhoneOfonoBaseTestCase(UbuntuSystemSettingsOfonoTestCase):
305 def setUp(self):
306 """ Go to Phone page """
307 super(PhoneOfonoBaseTestCase, self).setUp()
308 self.phone_page = self.system_settings.main_view.go_to_phone_page()
309
310
275class AboutBaseTestCase(UbuntuSystemSettingsTestCase):311class AboutBaseTestCase(UbuntuSystemSettingsTestCase):
276 def setUp(self):312 def setUp(self):
277 """Go to About page."""313 """Go to About page."""
278314
=== added file 'tests/autopilot/ubuntu_system_settings/tests/test_phone.py'
--- tests/autopilot/ubuntu_system_settings/tests/test_phone.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_system_settings/tests/test_phone.py 2014-08-08 11:33:08 +0000
@@ -0,0 +1,111 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# Copyright 2014 Canonical
3#
4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.
7
8from __future__ import absolute_import
9
10from autopilot.matchers import Eventually
11from testtools.matchers import Contains, Equals
12
13from ubuntu_system_settings.tests import (
14 PhoneOfonoBaseTestCase, CALL_FWD_IFACE, CALL_SETTINGS_IFACE)
15
16
17class PhoneTestCase(PhoneOfonoBaseTestCase):
18 """Tests for Phone Page"""
19
20 def test_call_fwd(self):
21 call_fwd_page = self.phone_page.go_to_call_forwarding()
22 call_fwd_page.set_forward("41444424")
23
24 # Check that the forward has been set
25 self.assertThat(
26 call_fwd_page.current_forwarding,
27 Eventually(Equals('41444424')))
28
29 # Check that dbus properties have been updated
30 self.assertThat(
31 lambda: str(self.modem_0.Get(CALL_FWD_IFACE,
32 'VoiceUnconditional')),
33 Eventually(Contains('41444424')))
34
35 def test_call_waiting(self):
36 call_wait = self.phone_page.go_to_call_waiting()
37 # we have to help our test here, this normally takes quite a while
38 self.modem_0.EmitSignal(
39 CALL_SETTINGS_IFACE, 'PropertyChanged', 'sv',
40 ['VoiceCallWaiting', 'disabled'])
41 call_wait.enable_call_waiting()
42
43 # Check that dbus properties have been updated
44 self.assertThat(
45 lambda: str(self.modem_0.Get(CALL_SETTINGS_IFACE,
46 'VoiceCallWaiting')),
47 Eventually(Contains('enabled')))
48
49
50class PhoneDualSimTestCase(PhoneOfonoBaseTestCase):
51 """Tests for Phone Page"""
52
53 use_sims = 2
54
55 def test_call_fwd_sim_1(self):
56 call_fwd_page = self.phone_page.go_to_call_forwarding(sim=1)
57 call_fwd_page.set_forward("41444424")
58
59 # Check that the forward has been set
60 self.assertThat(
61 call_fwd_page.current_forwarding,
62 Eventually(Equals('41444424')))
63
64 # Check that dbus properties have been updated
65 self.assertThat(
66 lambda: str(self.modem_0.Get(CALL_FWD_IFACE,
67 'VoiceUnconditional')),
68 Eventually(Contains('41444424')))
69
70 def test_call_fwd_sim_2(self):
71 call_fwd_page = self.phone_page.go_to_call_forwarding(sim=2)
72 call_fwd_page.set_forward("41444424")
73
74 # Check that the forward has been set
75 self.assertThat(
76 call_fwd_page.current_forwarding,
77 Eventually(Equals('41444424')))
78
79 # Check that dbus properties have been updated
80 self.assertThat(
81 lambda: str(self.modem_1.Get(CALL_FWD_IFACE,
82 'VoiceUnconditional')),
83 Eventually(Contains('41444424')))
84
85 def test_call_waiting_sim_1(self):
86 call_wait = self.phone_page.go_to_call_waiting(sim=1)
87 # we have to help our test here, this normally takes quite a while
88 self.modem_0.EmitSignal(
89 CALL_SETTINGS_IFACE, 'PropertyChanged', 'sv',
90 ['VoiceCallWaiting', 'disabled'])
91 call_wait.enable_call_waiting()
92
93 # Check that dbus properties have been updated
94 self.assertThat(
95 lambda: str(self.modem_0.Get(CALL_SETTINGS_IFACE,
96 'VoiceCallWaiting')),
97 Eventually(Contains('enabled')))
98
99 def test_call_waiting_sim_2(self):
100 call_wait = self.phone_page.go_to_call_waiting(sim=2)
101 # we have to help our test here, this normally takes quite a while
102 self.modem_1.EmitSignal(
103 CALL_SETTINGS_IFACE, 'PropertyChanged', 'sv',
104 ['VoiceCallWaiting', 'disabled'])
105 call_wait.enable_call_waiting()
106
107 # Check that dbus properties have been updated
108 self.assertThat(
109 lambda: str(self.modem_1.Get(CALL_SETTINGS_IFACE,
110 'VoiceCallWaiting')),
111 Eventually(Contains('enabled')))

Subscribers

People subscribed via source and target branches