Merge lp:~jonas-drange/ubuntu-system-settings/default-sims into lp:ubuntu-system-settings

Proposed by Jonas G. Drange
Status: Merged
Approved by: Ken VanDine
Approved revision: 817
Merged at revision: 893
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/default-sims
Merge into: lp:ubuntu-system-settings
Diff against target: 196 lines (+139/-1)
5 files modified
plugins/cellular/Components/CMakeLists.txt (+2/-1)
plugins/cellular/Components/DefaultSim.qml (+69/-0)
plugins/cellular/PageComponent.qml (+11/-0)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+20/-0)
tests/autopilot/ubuntu_system_settings/tests/test_cellular.py (+37/-0)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/default-sims
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+230227@code.launchpad.net

Commit message

[cellular] uis for default SIM settings

Description of the change

Hi,

new UI bits for selecting default SIM for calls and messages.

Thanks

To post a comment you must log in.
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:817
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1202/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3346
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2618
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/395
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/391
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/391/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/394
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3283
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4592
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4592/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11278
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2124
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2893
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2893/artifact/work/output/*zip*/output.zip

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

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

Looks good and works well on a dual SIM device

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/cellular/Components/CMakeLists.txt'
2--- plugins/cellular/Components/CMakeLists.txt 2014-07-24 16:04:51 +0000
3+++ plugins/cellular/Components/CMakeLists.txt 2014-08-11 12:04:48 +0000
4@@ -1,7 +1,8 @@
5 set(QML_SOURCES
6 CellularSingleSim.qml
7+ CellularDualSim.qml
8 data-helpers.js
9- CellularDualSim.qml
10+ DefaultSim.qml
11 Sim.qml
12 SimEditor.qml
13 )
14
15=== added file 'plugins/cellular/Components/DefaultSim.qml'
16--- plugins/cellular/Components/DefaultSim.qml 1970-01-01 00:00:00 +0000
17+++ plugins/cellular/Components/DefaultSim.qml 2014-08-11 12:04:48 +0000
18@@ -0,0 +1,69 @@
19+/*
20+ * Copyright (C) 2014 Canonical Ltd
21+ *
22+ * This program is free software: you can redistribute it and/or modify
23+ * it under the terms of the GNU General Public License version 3 as
24+ * published by the Free Software Foundation.
25+ *
26+ * This program is distributed in the hope that it will be useful,
27+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
28+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+ * GNU General Public License for more details.
30+ *
31+ * You should have received a copy of the GNU General Public License
32+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
33+ *
34+ * Authors:
35+ * Jonas G. Drange <jonas.drange@canonical.com>
36+ *
37+*/
38+import QtQuick 2.0
39+import Ubuntu.Components 0.1
40+import Ubuntu.Components.ListItems 0.1 as ListItem
41+
42+Column {
43+
44+ property var m: ["ask", sim1.path, sim2.path]
45+
46+ function getNameFromIndex (index) {
47+ return [i18n.tr("Ask me each time"), sim1.title, sim2.title][index];
48+ }
49+
50+ ListItem.ItemSelector {
51+ id: callsDefaultSim
52+ text: i18n.tr("For outgoing calls, use:")
53+ expanded: true
54+ model: m
55+ delegate: OptionSelectorDelegate {
56+ objectName: "defaultForCalls" + modelData
57+ text: getNameFromIndex(index);
58+ }
59+ selectedIndex: m.indexOf(phoneSettings.defaultSimForCalls)
60+ onDelegateClicked: {
61+ phoneSettings.defaultSimForCalls = m[index];
62+ }
63+ }
64+
65+ ListItem.Caption {
66+ text: i18n.tr("You can change the SIM for individual calls, or for contacts in the address book.")
67+ }
68+
69+ ListItem.Divider {}
70+
71+ ListItem.ItemSelector {
72+ id: messagesDefaultSim
73+ text: i18n.tr("For messages, use:")
74+ expanded: true
75+ model: m
76+ delegate: OptionSelectorDelegate {
77+ objectName: "defaultForMessages" + modelData
78+ text: getNameFromIndex(index);
79+ }
80+ selectedIndex: m.indexOf(phoneSettings.defaultSimForMessages)
81+ onDelegateClicked: {
82+ phoneSettings.defaultSimForMessages = m[index];
83+
84+ }
85+ }
86+}
87+
88
89=== modified file 'plugins/cellular/PageComponent.qml'
90--- plugins/cellular/PageComponent.qml 2014-07-31 15:35:41 +0000
91+++ plugins/cellular/PageComponent.qml 2014-08-11 12:04:48 +0000
92@@ -60,6 +60,7 @@
93 simTwoLoader.setSource("Components/Sim.qml", {
94 path: p
95 });
96+ defaultSimLoader.source = "Components/DefaultSim.qml";
97 }
98 }
99 }
100@@ -182,10 +183,20 @@
101 visible: showAllUI
102 }
103
104+ ListItem.Divider {}
105+
106 SimEditor {
107 visible: root.state === "dualSim"
108 objectName: "simEditor"
109 }
110+
111+ ListItem.Divider {}
112+
113+ Loader {
114+ id: defaultSimLoader
115+ anchors.left: parent.left
116+ anchors.right: parent.right
117+ }
118 }
119 }
120
121
122=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
123--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-08-07 09:52:19 +0000
124+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-08-11 12:04:48 +0000
125@@ -265,6 +265,26 @@
126
127 super(UbuntuSystemSettingsOfonoTestCase, self).setUp(panel)
128
129+ def set_default_for_calls(self, gsettings, default):
130+ gsettings.set_value('default-sim-for-calls', default)
131+ # wait for gsettings
132+ sleep(1)
133+
134+ def set_default_for_messages(self, gsettings, default):
135+ gsettings.set_value('default-sim-for-messages', default)
136+ # wait for gsettings
137+ sleep(1)
138+
139+ def get_default_sim_for_calls_selector(self, text):
140+ return self.system_settings.main_view.cellular_page.select_single(
141+ objectName="defaultForCalls" + text
142+ )
143+
144+ def get_default_sim_for_messages_selector(self, text):
145+ return self.system_settings.main_view.cellular_page.select_single(
146+ objectName="defaultForMessages" + text
147+ )
148+
149
150 class CellularBaseTestCase(UbuntuSystemSettingsOfonoTestCase):
151 def setUp(self):
152
153=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_cellular.py'
154--- tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2014-07-31 14:16:23 +0000
155+++ tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2014-08-11 12:04:48 +0000
156@@ -562,3 +562,40 @@
157 gsettings.set_value('sim-names', old_names)
158 # wait for gsettings
159 sleep(1)
160+
161+ def test_changing_default_sim_for_calls(self):
162+ gsettings = Gio.Settings.new('com.ubuntu.phone')
163+ default = gsettings.get_value('default-sim-for-calls')
164+
165+ self.addCleanup(
166+ self.set_default_for_calls, gsettings, default)
167+
168+ # click ask
169+ self.system_settings.main_view.scroll_to_and_click(
170+ self.get_default_sim_for_calls_selector('ask'))
171+ # click first sim
172+ self.system_settings.main_view.scroll_to_and_click(
173+ self.get_default_sim_for_calls_selector('/ril_0'))
174+ # wait for gsettings
175+ sleep(1)
176+ self.assertEqual(
177+ gsettings.get_value('default-sim-for-calls').get_string(),
178+ '/ril_0')
179+
180+ def test_changing_default_sim_for_messages(self):
181+ gsettings = Gio.Settings.new('com.ubuntu.phone')
182+ default = gsettings.get_value('default-sim-for-messages')
183+ self.addCleanup(
184+ self.set_default_for_messages, gsettings, default)
185+
186+ # click ask
187+ self.system_settings.main_view.scroll_to_and_click(
188+ self.get_default_sim_for_messages_selector('ask'))
189+ # click second sim
190+ self.system_settings.main_view.scroll_to_and_click(
191+ self.get_default_sim_for_messages_selector('/ril_1'))
192+ # wait for gsettings
193+ sleep(1)
194+ self.assertEqual(
195+ gsettings.get_value('default-sim-for-messages').get_string(),
196+ '/ril_1')

Subscribers

People subscribed via source and target branches