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

Proposed by Jonas G. Drange
Status: Merged
Approved by: Ken VanDine
Approved revision: 1552
Merged at revision: 1555
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/lp1478049
Merge into: lp:ubuntu-system-settings
Diff against target: 250 lines (+80/-34)
7 files modified
plugins/phone/CallForwardItem.qml (+3/-1)
plugins/phone/CallForwarding.qml (+38/-5)
plugins/phone/MultiSim.qml (+1/-11)
plugins/phone/Ofono.qml (+25/-6)
plugins/phone/SingleSim.qml (+1/-11)
plugins/phone/callForwardingUtils.js (+7/-0)
schema/com.ubuntu.touch.system-settings.gschema.xml (+5/-0)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/lp1478049
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Sebastien Bacher (community) Approve
Review via email: mp+276789@code.launchpad.net

Commit message

* Cache call forwarding summary for each IMSI/ICCID.
* Block UI until the CallForwarding binding is ready.
* Do not assume a failed callforwarding change means it's disabled (could be forced by carrier).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1552. By Jonas G. Drange

nuke the arbitrary time TTL, use IMSI or ICCID.

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

thanks, that looks fine to me

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

I've restarted this MP to work around an issue triggering generic-deb-autopilot-vivid-touch on krillin hardware.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/phone/CallForwardItem.qml'
2--- plugins/phone/CallForwardItem.qml 2015-08-10 13:31:45 +0000
3+++ plugins/phone/CallForwardItem.qml 2015-11-09 12:37:53 +0000
4@@ -72,7 +72,7 @@
5 /**
6 * Server is working.
7 */
8- property bool _pending: false
9+ property bool _pending: !callForwarding.ready
10
11 /**
12 * Server failed to change/fetch setting.
13@@ -233,10 +233,12 @@
14 Component.onCompleted: {
15 item.callForwarding[item.rule + 'Changed'].connect(Utils.ruleChanged);
16 item.callForwarding[item.rule + 'Complete'].connect(Utils.ruleComplete);
17+ item.callForwarding.readyChanged.connect(Utils.ruleReadyChanged);
18 }
19 Component.onDestruction: {
20 item.callForwarding[item.rule + 'Changed'].disconnect(Utils.ruleChanged);
21 item.callForwarding[item.rule + 'Complete'].disconnect(Utils.ruleComplete);
22+ item.callForwarding.readyChanged.disconnect(Utils.ruleReadyChanged);
23 }
24 }
25 }
26
27=== modified file 'plugins/phone/CallForwarding.qml'
28--- plugins/phone/CallForwarding.qml 2015-08-10 13:31:45 +0000
29+++ plugins/phone/CallForwarding.qml 2015-11-09 12:37:53 +0000
30@@ -28,6 +28,7 @@
31
32 import QtQuick 2.4
33 import QtContacts 5.0
34+import MeeGo.QOfono 0.2
35 import SystemSettings 1.0
36 import Ubuntu.Components 1.3
37 import Ubuntu.Components.ListItems 1.3 as ListItem
38@@ -126,7 +127,7 @@
39 id: fwdAll
40 anchors { left: parent.left; right: parent.right }
41 rule: "voiceUnconditional"
42- callForwarding: sim.callForwarding
43+ callForwarding: callForwarding
44 text: i18n.tr("Forward every incoming call")
45 onEnteredEditMode: {page.editing = fwdAll; Utils.show(field)}
46 onLeftEditMode: page.editing = null
47@@ -170,7 +171,7 @@
48 id: fwdBusy
49 objectName: "fwdBusy"
50 anchors { left: parent.left; right: parent.right }
51- callForwarding: sim.callForwarding
52+ callForwarding: callForwarding
53 rule: "voiceBusy"
54 text: i18n.tr("I’m on another call")
55 onEnteredEditMode: {page.editing = fwdBusy; Utils.show(field)}
56@@ -181,7 +182,7 @@
57 id: fwdLost
58 objectName: "fwdLost"
59 anchors { left: parent.left; right: parent.right }
60- callForwarding: sim.callForwarding
61+ callForwarding: callForwarding
62 rule: "voiceNoReply"
63 text: i18n.tr("I don’t answer")
64 onEnteredEditMode: {page.editing = fwdLost; Utils.show(field)}
65@@ -192,7 +193,7 @@
66 id: fwdUnreachable
67 objectName: "fwdUnreachable"
68 anchors { left: parent.left; right: parent.right }
69- callForwarding: sim.callForwarding
70+ callForwarding: callForwarding
71 rule: "voiceNotReachable"
72 text: i18n.tr("My phone is unreachable")
73 onEnteredEditMode: {
74@@ -359,7 +360,39 @@
75 }
76
77 Connections {
78- target: sim.callForwarding
79+ target: callForwarding
80 onGetPropertiesFailed: page.state = "forwardFailed";
81 }
82+
83+ OfonoCallForwarding {
84+ id: callForwarding
85+ modemPath: sim.path
86+ function updateSummary () {
87+ var val;
88+
89+ // Clear the summary and exit if any of the values are unknown.
90+ if (typeof voiceUnconditional === 'undefined' ||
91+ typeof voiceBusy === 'undefined' ||
92+ typeof voiceNoReply === 'undefined' ||
93+ typeof voiceNotReachable === 'undefined') {
94+ sim.setCallForwardingSummary('');
95+ return;
96+ }
97+
98+ if (voiceUnconditional) {
99+ val = i18n.tr('All calls');
100+ } else if (voiceBusy || voiceNoReply || voiceNotReachable) {
101+ val = i18n.tr('Some calls')
102+ } else {
103+ val = i18n.tr('Off')
104+ }
105+ sim.setCallForwardingSummary(val);
106+ }
107+
108+ Component.onCompleted: updateSummary()
109+ onVoiceUnconditionalChanged: updateSummary()
110+ onVoiceBusyChanged: updateSummary()
111+ onVoiceNoReplyChanged: updateSummary()
112+ onVoiceNotReachableChanged: updateSummary()
113+ }
114 }
115
116=== modified file 'plugins/phone/MultiSim.qml'
117--- plugins/phone/MultiSim.qml 2015-08-10 13:31:45 +0000
118+++ plugins/phone/MultiSim.qml 2015-11-09 12:37:53 +0000
119@@ -51,17 +51,7 @@
120 objectName: "callFwdSim" + index
121 text: i18n.tr("Call forwarding")
122 progression: true
123- value: {
124- if (sims[index].callForwarding.voiceUnconditional) {
125- return i18n.tr("All calls");
126- } else if (sims[index].callForwarding.voiceBusy ||
127- sims[index].callForwarding.voiceNoReply ||
128- sims[index].callForwarding.voiceNotReachable) {
129- return i18n.tr("Some calls")
130- } else {
131- return i18n.tr("Off")
132- }
133- }
134+ value: sims[index].getCallForwardingSummary()
135 onClicked: pageStack.push(Qt.resolvedUrl("CallForwarding.qml"), {
136 sim: sims[index],
137 headerTitle: sims[index].title
138
139=== modified file 'plugins/phone/Ofono.qml'
140--- plugins/phone/Ofono.qml 2015-08-10 13:31:45 +0000
141+++ plugins/phone/Ofono.qml 2015-11-09 12:37:53 +0000
142@@ -18,10 +18,10 @@
143 *
144 */
145 import QtQuick 2.4
146+import GSettings 1.0
147 import MeeGo.QOfono 0.2
148
149 Item {
150- property alias callForwarding: callForwarding
151 property alias netReg: netReg
152 property alias simMng: simMng
153 property alias present: simMng.present
154@@ -33,11 +33,6 @@
155 return name + (number ? " (" + number + ")" : "");
156 }
157
158- OfonoCallForwarding {
159- id: callForwarding
160- modemPath: path
161- }
162-
163 OfonoNetworkRegistration {
164 id: netReg
165 modemPath: path
166@@ -47,4 +42,28 @@
167 id: simMng
168 modemPath: path
169 }
170+
171+ function setCallForwardingSummary (val) {
172+ var tmp = {};
173+ var fwdSum = settings.callforwardingSummaries;
174+ for (var k in fwdSum){
175+ if (fwdSum.hasOwnProperty(k)) {
176+ tmp[k] = fwdSum[k];
177+ }
178+ }
179+ // Prefer IMSI to identify the SIM, use ICCID if IMSI is not available.
180+ tmp[simMng.subscriberIdentity || simMng.CardIdentifier] = val;
181+ settings.callforwardingSummaries = tmp;
182+ }
183+
184+ function getCallForwardingSummary () {
185+ // Use either IMSI or ICCID to identify the SIM.
186+ var sid = simMng.subscriberIdentity || simMng.CardIdentifier;
187+ return settings.callforwardingSummaries[sid] || '';
188+ }
189+
190+ GSettings {
191+ id: settings
192+ schema.id: "com.ubuntu.touch.system-settings"
193+ }
194 }
195
196=== modified file 'plugins/phone/SingleSim.qml'
197--- plugins/phone/SingleSim.qml 2015-08-10 13:31:45 +0000
198+++ plugins/phone/SingleSim.qml 2015-11-09 12:37:53 +0000
199@@ -41,17 +41,7 @@
200 text: i18n.tr("Call forwarding")
201 showDivider: false
202 progression: true
203- value: {
204- if (sim.callForwarding.voiceUnconditional) {
205- return i18n.tr("All calls");
206- } else if (sim.callForwarding.voiceBusy ||
207- sim.callForwarding.voiceNoReply ||
208- sim.callForwarding.voiceNotReachable) {
209- return i18n.tr("Some calls")
210- } else {
211- return i18n.tr("Off")
212- }
213- }
214+ value: sim.getCallForwardingSummary()
215 onClicked: pageStack.push(Qt.resolvedUrl("CallForwarding.qml"), {sim: sim})
216 }
217
218
219=== modified file 'plugins/phone/callForwardingUtils.js'
220--- plugins/phone/callForwardingUtils.js 2015-07-02 18:36:39 +0000
221+++ plugins/phone/callForwardingUtils.js 2015-11-09 12:37:53 +0000
222@@ -73,6 +73,13 @@
223 }
224
225 /**
226+ * Handler for when the rule ready changes.
227+ */
228+function ruleReadyChanged () {
229+ d._pending = !callForwarding.ready;
230+}
231+
232+/**
233 * Scroll something into view.
234 *
235 * @param {QtObject} item to scroll to.
236
237=== modified file 'schema/com.ubuntu.touch.system-settings.gschema.xml'
238--- schema/com.ubuntu.touch.system-settings.gschema.xml 2014-07-29 12:27:37 +0000
239+++ schema/com.ubuntu.touch.system-settings.gschema.xml 2015-11-09 12:37:53 +0000
240@@ -27,5 +27,10 @@
241 <summary>Whether the applications should be sorted by name.</summary>
242 <description>If true the applications are sorted by name, otherwise by disk size.</description>
243 </key>
244+ <key name="callforwarding-summaries" type="a{ss}">
245+ <summary>Call forwarding summaries</summary>
246+ <default>{}</default>
247+ <description>Mapping of SIM to a call forwarding summary.</description>
248+ </key>
249 </schema>
250 </schemalist>

Subscribers

People subscribed via source and target branches