Merge lp:~tiagosh/dialer-app/rtm-14.09-fix-1410961 into lp:dialer-app/rtm-14.09
- rtm-14.09-fix-1410961
- Merge into rtm-14.09
Proposed by
Tiago Salem Herrmann
Status: | Superseded |
---|---|
Proposed branch: | lp:~tiagosh/dialer-app/rtm-14.09-fix-1410961 |
Merge into: | lp:dialer-app/rtm-14.09 |
Diff against target: |
465 lines (+147/-63) 6 files modified
src/qml/ContactsPage/ContactsPage.qml (+1/-1) src/qml/DialerPage/DialerPage.qml (+14/-14) src/qml/HistoryPage/HistoryDetailsPage.qml (+1/-1) src/qml/HistoryPage/HistoryPage.qml (+2/-2) src/qml/LiveCallPage/LiveCall.qml (+23/-9) src/qml/dialer-app.qml (+106/-36) |
To merge this branch: | bzr merge lp:~tiagosh/dialer-app/rtm-14.09-fix-1410961 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phablet Team | Pending | ||
Review via email: mp+246801@code.launchpad.net |
This proposal has been superseded by a proposal from 2015-01-17.
Commit message
Give some time to finish the greeter animation before removing the LiveCall view.
Description of the change
Give some time to finish the greeter animation before removing the LiveCall view.
To post a comment you must log in.
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/qml/ContactsPage/ContactsPage.qml' |
2 | --- src/qml/ContactsPage/ContactsPage.qml 2014-09-03 17:07:44 +0000 |
3 | +++ src/qml/ContactsPage/ContactsPage.qml 2015-01-17 02:38:49 +0000 |
4 | @@ -208,7 +208,7 @@ |
5 | Qt.openUrlExternally("message:///" + encodeURIComponent(detail.number)) |
6 | return |
7 | } |
8 | - pageStack.pop() |
9 | + pageStackNormalMode.pop() |
10 | if (callManager.hasCalls) { |
11 | mainView.call(detail.number, mainView.account.accountId); |
12 | } else { |
13 | |
14 | === modified file 'src/qml/DialerPage/DialerPage.qml' |
15 | --- src/qml/DialerPage/DialerPage.qml 2014-12-04 12:52:57 +0000 |
16 | +++ src/qml/DialerPage/DialerPage.qml 2015-01-17 02:38:49 +0000 |
17 | @@ -32,32 +32,37 @@ |
18 | property alias dialNumber: keypadEntry.value |
19 | property alias input: keypadEntry.input |
20 | property alias callAnimationRunning: callAnimation.running |
21 | + property bool greeterMode: false |
22 | property var mmiPlugins: [] |
23 | property list<Action> actionsGreeter |
24 | property list<Action> actionsNormal: [ |
25 | Action { |
26 | iconName: "contact" |
27 | text: i18n.tr("Contacts") |
28 | - onTriggered: pageStack.push(Qt.resolvedUrl("../ContactsPage/ContactsPage.qml")) |
29 | + onTriggered: pageStackNormalMode.push(Qt.resolvedUrl("../ContactsPage/ContactsPage.qml")) |
30 | }, |
31 | Action { |
32 | iconName: "settings" |
33 | text: i18n.tr("Settings") |
34 | onTriggered: Qt.openUrlExternally("settings:///system/phone") |
35 | } |
36 | + |
37 | ] |
38 | - head.actions: greeter.greeterActive ? actionsGreeter : actionsNormal |
39 | + head.actions: mainView.greeterMode ? actionsGreeter : actionsNormal |
40 | head.backAction: Action { |
41 | iconName: "back" |
42 | text: i18n.tr("Close") |
43 | - visible: greeter.greeterActive |
44 | - onTriggered: greeter.showGreeter() |
45 | + visible: mainView.greeterMode |
46 | + onTriggered: { |
47 | + greeter.showGreeter() |
48 | + dialNumber = ""; |
49 | + } |
50 | } |
51 | |
52 | objectName: "dialerPage" |
53 | |
54 | title: { |
55 | - if (greeter.greeterActive) { |
56 | + if (mainView.greeterMode) { |
57 | return i18n.tr("Emergency Calls") |
58 | } else if (telepathyHelper.flightMode) { |
59 | return i18n.tr("Flight mode") |
60 | @@ -73,7 +78,7 @@ |
61 | return i18n.tr("No network") |
62 | } |
63 | |
64 | - state: greeter.greeterActive ? "greeterMode" : "normalMode" |
65 | + state: mainView.state |
66 | // -------- Greeter mode ---------- |
67 | states: [ |
68 | State { |
69 | @@ -86,10 +91,6 @@ |
70 | target: addContact |
71 | visible: false |
72 | } |
73 | - PropertyChanges { |
74 | - target: keypadEntry |
75 | - value: "" |
76 | - } |
77 | }, |
78 | State { |
79 | name: "normalMode" |
80 | @@ -101,12 +102,11 @@ |
81 | target: addContact |
82 | visible: true |
83 | } |
84 | - |
85 | } |
86 | ] |
87 | |
88 | // -------- Bottom Edge Setup ----- |
89 | - bottomEdgeEnabled: !greeter.greeterActive |
90 | + bottomEdgeEnabled: !mainView.greeterMode |
91 | bottomEdgePageSource: Qt.resolvedUrl("../HistoryPage/HistoryPage.qml") |
92 | // NOTE: uncomment the next line to re-enable progressive bottom edge swiping. |
93 | //bottomEdgeExpandThreshold: bottomEdgePage ? bottomEdgePage.delegateHeight * 3 : 0 |
94 | @@ -181,7 +181,7 @@ |
95 | |
96 | head.sections.model: { |
97 | // does not show dual sim switch if there is only one sim |
98 | - if (!multipleAccounts || greeter.greeterActive) { |
99 | + if (!multipleAccounts || mainView.greeterMode) { |
100 | return undefined |
101 | } |
102 | |
103 | @@ -388,7 +388,7 @@ |
104 | return false; |
105 | } |
106 | |
107 | - if (greeter.greeterActive) { |
108 | + if (mainView.greeterMode) { |
109 | return mainView.isEmergencyNumber(dialNumber); |
110 | } |
111 | |
112 | |
113 | === modified file 'src/qml/HistoryPage/HistoryDetailsPage.qml' |
114 | --- src/qml/HistoryPage/HistoryDetailsPage.qml 2015-01-09 11:54:33 +0000 |
115 | +++ src/qml/HistoryPage/HistoryDetailsPage.qml 2015-01-17 02:38:49 +0000 |
116 | @@ -74,7 +74,7 @@ |
117 | text: i18n.tr("Delete") |
118 | onTriggered: { |
119 | eventModel.removeEvents(events); |
120 | - pageStack.pop(); |
121 | + pageStackNormalMode.pop(); |
122 | } |
123 | } |
124 | |
125 | |
126 | === modified file 'src/qml/HistoryPage/HistoryPage.qml' |
127 | --- src/qml/HistoryPage/HistoryPage.qml 2015-01-09 11:54:33 +0000 |
128 | +++ src/qml/HistoryPage/HistoryPage.qml 2015-01-17 02:38:49 +0000 |
129 | @@ -112,7 +112,7 @@ |
130 | onSelectedIndexChanged: { |
131 | // NOTE: be careful on changing the way filters are assigned, if we create a |
132 | // binding on head.sections, we might get weird results when the page moves to the bottom |
133 | - if (pageStack.depth > 1) { |
134 | + if (pageStackNormalMode.depth > 1) { |
135 | if (head.sections.selectedIndex == 0) { |
136 | historyEventModel.filter = emptyFilter; |
137 | } else { |
138 | @@ -323,7 +323,7 @@ |
139 | iconName: "info" |
140 | text: i18n.tr("Details") |
141 | onTriggered: { |
142 | - pageStack.push(Qt.resolvedUrl("HistoryDetailsPage.qml"), |
143 | + pageStackNormalMode.push(Qt.resolvedUrl("HistoryDetailsPage.qml"), |
144 | { phoneNumber: participants[0].phoneNumber, |
145 | events: model.events, |
146 | eventModel: historyEventModel}) |
147 | |
148 | === modified file 'src/qml/LiveCallPage/LiveCall.qml' |
149 | --- src/qml/LiveCallPage/LiveCall.qml 2014-12-16 01:11:54 +0000 |
150 | +++ src/qml/LiveCallPage/LiveCall.qml 2015-01-17 02:38:49 +0000 |
151 | @@ -60,10 +60,10 @@ |
152 | objectName: "backButton" |
153 | iconName: "back" |
154 | onTriggered: { |
155 | - if (greeter.greeterActive) { |
156 | + if (mainView.greeterMode) { |
157 | greeter.showGreeter(); |
158 | } else { |
159 | - pageStack.pop(); |
160 | + pageStackNormalMode.pop(); |
161 | } |
162 | } |
163 | } |
164 | @@ -192,7 +192,7 @@ |
165 | |
166 | State { |
167 | name: "closing" |
168 | - when: closeTimer.running |
169 | + when: closeTimer.running || greeterAnimationTimer.running |
170 | |
171 | PropertyChanges { |
172 | target: buttonsArea |
173 | @@ -255,16 +255,30 @@ |
174 | } |
175 | |
176 | Timer { |
177 | + id: greeterAnimationTimer |
178 | + interval: 1000 |
179 | + repeat: false |
180 | + running: false |
181 | + onTriggered: mainView.removeLiveCallView() |
182 | + } |
183 | + |
184 | + Timer { |
185 | id: closeTimer |
186 | - interval: 3000 |
187 | + interval: mainView.greeterMode ? 2000 : 3000 |
188 | repeat: false |
189 | running: false |
190 | onTriggered: { |
191 | if (!callManager.hasCalls) { |
192 | - mainView.switchToKeypadView(); |
193 | - pageStack.currentPage.dialNumber = pendingNumberToDial; |
194 | - if (greeter.greeterActive) { |
195 | + if (!mainView.greeterMode) { |
196 | + mainView.removeLiveCallView(); |
197 | + } |
198 | + // TODO: we can't be sure that the currentPage is a DialerPage instance |
199 | + if (pageStackNormalMode.currentPage.dialNumber) { |
200 | + pageStackNormalMode.currentPage.dialNumber = pendingNumberToDial; |
201 | + } |
202 | + if (mainView.greeterMode) { |
203 | greeter.showGreeter(); |
204 | + greeterAnimationTimer.running = true |
205 | } |
206 | } |
207 | } |
208 | @@ -568,8 +582,8 @@ |
209 | iconSource: "add" |
210 | iconWidth: units.gu(3) |
211 | iconHeight: units.gu(3) |
212 | - enabled: !greeter.greeterActive |
213 | - onClicked: pageStack.push(Qt.resolvedUrl("../ContactsPage/ContactsPage.qml")) |
214 | + enabled: !mainView.greeterMode |
215 | + onClicked: pageStackNormalMode.push(Qt.resolvedUrl("../ContactsPage/ContactsPage.qml")) |
216 | } |
217 | |
218 | LiveCallKeypadButton { |
219 | |
220 | === modified file 'src/qml/dialer-app.qml' |
221 | --- src/qml/dialer-app.qml 2014-12-04 13:24:23 +0000 |
222 | +++ src/qml/dialer-app.qml 2015-01-17 02:38:49 +0000 |
223 | @@ -32,6 +32,8 @@ |
224 | property string ussdResponseText: "" |
225 | property bool multipleAccounts: telepathyHelper.activeAccounts.length > 1 |
226 | property QtObject account: defaultAccount() |
227 | + property bool greeterMode: (state == "greeterMode") |
228 | + property bool lastHasCalls: callManager.hasCalls |
229 | |
230 | function defaultAccount() { |
231 | // we only use the default account property if we have more |
232 | @@ -58,8 +60,20 @@ |
233 | onApplicationActiveChanged: { |
234 | if (applicationActive) { |
235 | telepathyHelper.registerChannelObserver() |
236 | - if (pageStack.currentPage.objectName == "pageLiveCall" && !callManager.hasCalls) { |
237 | - pageStack.pop(); |
238 | + |
239 | + if (!callManager.hasCalls) { |
240 | + // if on contacts page in a live call and no calls are found, pop it out |
241 | + if (pageStackNormalMode.depth > 2 && pageStackNormalMode.currentPage.objectName == "contactsPage") { |
242 | + pageStackNormalMode.pop(); |
243 | + } |
244 | + |
245 | + // pop live call views from both stacks if we have no calls. |
246 | + if (pageStackNormalMode.depth > 1 && pageStackNormalMode.currentPage.objectName == "pageLiveCall") { |
247 | + pageStackNormalMode.pop(); |
248 | + } |
249 | + if (pageStackGreeterMode.depth > 1 && pageStackGreeterMode.currentPage.objectName == "pageLiveCall") { |
250 | + pageStackGreeterMode.pop(); |
251 | + } |
252 | } |
253 | } else { |
254 | telepathyHelper.unregisterChannelObserver() |
255 | @@ -70,7 +84,7 @@ |
256 | target: telepathyHelper |
257 | onSetupReady: { |
258 | if (multipleAccounts && !telepathyHelper.defaultCallAccount && |
259 | - settings.mainViewDontAskCount < 3 && pageStack.depth === 1) { |
260 | + settings.mainViewDontAskCount < 3 && pageStackNormalMode.depth === 1 && !mainView.greeterMode) { |
261 | PopupUtils.open(Qt.createComponent("Dialogs/NoDefaultSIMCardDialog.qml").createObject(mainView)) |
262 | } |
263 | } |
264 | @@ -104,21 +118,39 @@ |
265 | Binding { |
266 | target: application |
267 | property: "fullScreen" |
268 | - value: greeter.greeterActive |
269 | + value: mainView.greeterMode |
270 | } |
271 | |
272 | + state: greeter.greeterActive ? "greeterMode" : "normalMode" |
273 | states: [ |
274 | State { |
275 | name: "greeterMode" |
276 | - when: greeter.greeterActive |
277 | - |
278 | - StateChangeScript { |
279 | - script: { |
280 | - // make sure to reset the view so that the contacts page is not loaded |
281 | - if (callManager.hasCalls) { |
282 | - switchToLiveCall(); |
283 | - } else { |
284 | - switchToKeypadView(); |
285 | + |
286 | + StateChangeScript { |
287 | + script: { |
288 | + // preload greeter stack if not done yet |
289 | + if (pageStackGreeterMode.depth == 0) { |
290 | + pageStackGreeterMode.push(Qt.resolvedUrl("DialerPage/DialerPage.qml")) |
291 | + } |
292 | + // make sure to reset the view so that the contacts page is not loaded |
293 | + if (callManager.hasCalls) { |
294 | + switchToLiveCall(); |
295 | + } else { |
296 | + removeLiveCallView(); |
297 | + } |
298 | + } |
299 | + } |
300 | + }, |
301 | + State { |
302 | + name: "normalMode" |
303 | + |
304 | + StateChangeScript { |
305 | + script: { |
306 | + // make sure to reset the view so that the contacts page is not loaded |
307 | + if (callManager.hasCalls) { |
308 | + switchToLiveCall(); |
309 | + } else { |
310 | + removeLiveCallView(); |
311 | } |
312 | } |
313 | } |
314 | @@ -160,7 +192,7 @@ |
315 | } |
316 | |
317 | function callVoicemail() { |
318 | - if (greeter.greeterActive) { |
319 | + if (mainView.greeterMode) { |
320 | return; |
321 | } |
322 | call(mainView.account.voicemailNumber); |
323 | @@ -265,7 +297,7 @@ |
324 | return |
325 | } |
326 | |
327 | - if (mainView.account && !greeter.greeterActive && mainView.account.simLocked) { |
328 | + if (mainView.account && !mainView.greeterMode && mainView.account.simLocked) { |
329 | var properties = {} |
330 | properties["accountId"] = mainView.account.accountId |
331 | PopupUtils.open(Qt.createComponent("Dialogs/SimLockedDialog.qml").createObject(mainView), mainView, properties) |
332 | @@ -301,49 +333,72 @@ |
333 | // FIXME: check what to do when not in the dialpad view |
334 | |
335 | // if not on the livecall view, go back to the dialpad |
336 | - while (pageStack.depth > 1 && pageStack.currentPage.objectName != "pageLiveCall") { |
337 | - pageStack.pop(); |
338 | - } |
339 | - |
340 | - if (pageStack.currentPage && typeof(pageStack.currentPage.dialNumber) != 'undefined') { |
341 | - pageStack.currentPage.dialNumber = number; |
342 | + while (pageStackNormalMode.depth > 1) { |
343 | + pageStackNormalMode.pop(); |
344 | + } |
345 | + |
346 | + if (pageStackNormalMode.currentPage && typeof(pageStackNormalMode.currentPage.dialNumber) != 'undefined') { |
347 | + pageStackNormalMode.currentPage.dialNumber = number; |
348 | + } |
349 | + } |
350 | + |
351 | + function removeLiveCallView() { |
352 | + // if on contacts page in a live call and no calls are found, pop it out |
353 | + if (pageStackNormalMode.depth > 2 && pageStackNormalMode.currentPage.objectName == "contactsPage") { |
354 | + pageStackNormalMode.pop(); |
355 | + } |
356 | + |
357 | + if (pageStackNormalMode.depth > 1 && pageStackNormalMode.currentPage.objectName == "pageLiveCall") { |
358 | + pageStackNormalMode.pop(); |
359 | + } |
360 | + |
361 | + while (pageStackGreeterMode.depth > 1) { |
362 | + pageStackGreeterMode.pop(); |
363 | } |
364 | } |
365 | |
366 | function switchToKeypadView() { |
367 | - while (pageStack.depth > 1) { |
368 | - pageStack.pop(); |
369 | + while (pageStackNormalMode.depth > 1) { |
370 | + pageStackNormalMode.pop(); |
371 | + } |
372 | + while (pageStackGreeterMode.depth > 1) { |
373 | + pageStackGreeterMode.pop(); |
374 | } |
375 | } |
376 | |
377 | function animateLiveCall() { |
378 | - if (pageStack.currentPage && pageStack.currentPage.triggerCallAnimation) { |
379 | - pageStack.currentPage.triggerCallAnimation(); |
380 | + var stack = mainView.greeterMode ? pageStackGreeterMode : pageStackNormalMode |
381 | + if (stack.currentPage && stack.currentPage.triggerCallAnimation) { |
382 | + stack.currentPage.triggerCallAnimation(); |
383 | } else { |
384 | switchToLiveCall(); |
385 | } |
386 | } |
387 | |
388 | function switchToLiveCall() { |
389 | - // pop the stack if the live call is not the visible view |
390 | - // FIXME: using the objectName here is not pretty, change by something less prone to errors |
391 | - while (pageStack.depth > 1 && pageStack.currentPage.objectName != "pageLiveCall") { |
392 | - pageStack.pop(); |
393 | + var stack = mainView.greeterMode ? pageStackGreeterMode : pageStackNormalMode |
394 | + |
395 | + if (pageStackNormalMode.depth > 2 && pageStackNormalMode.currentPage.objectName == "contactsPage") { |
396 | + // pop contacts Page |
397 | + stack.pop(); |
398 | } |
399 | + |
400 | var properties = {} |
401 | if (isEmergencyNumber(pendingNumberToDial)) { |
402 | properties["defaultTimeout"] = 30000 |
403 | } |
404 | |
405 | - if (pageStack.depth === 1) { |
406 | - pageStack.push(Qt.resolvedUrl("LiveCallPage/LiveCall.qml"), properties) |
407 | + if (stack.currentPage.objectName == "pageLiveCall") { |
408 | + return; |
409 | } |
410 | + |
411 | + stack.push(Qt.resolvedUrl("LiveCallPage/LiveCall.qml"), properties) |
412 | } |
413 | |
414 | Component.onCompleted: { |
415 | i18n.domain = "dialer-app" |
416 | i18n.bindtextdomain("dialer-app", i18nDirectory) |
417 | - pageStack.push(Qt.createComponent("DialerPage/DialerPage.qml")) |
418 | + pageStackNormalMode.push(Qt.createComponent("DialerPage/DialerPage.qml")) |
419 | |
420 | // if there are calls, even if we don't have info about them yet, push the livecall view |
421 | if (callManager.hasCalls) { |
422 | @@ -484,16 +539,22 @@ |
423 | target: callManager |
424 | onHasCallsChanged: { |
425 | if (!callManager.hasCalls) { |
426 | + mainView.lastHasCalls = callManager.hasCalls |
427 | return; |
428 | } |
429 | |
430 | + var stack = mainView.greeterMode ? pageStackGreeterMode : pageStackNormalMode |
431 | // if we are animating the dialpad view, do not switch to livecall directly |
432 | - if (pageStack.currentPage && pageStack.currentPage.callAnimationRunning) { |
433 | + if (stack.currentPage && stack.currentPage.callAnimationRunning) { |
434 | + mainView.lastHasCalls = callManager.hasCalls |
435 | return; |
436 | } |
437 | |
438 | // if not, just open the live call |
439 | - switchToLiveCall(); |
440 | + if (mainView.lastHasCalls != callManager.hasCalls) { |
441 | + mainView.lastHasCalls = callManager.hasCalls |
442 | + switchToLiveCall(); |
443 | + } |
444 | } |
445 | } |
446 | |
447 | @@ -575,7 +636,16 @@ |
448 | } |
449 | |
450 | PageStack { |
451 | - id: pageStack |
452 | - anchors.fill: parent |
453 | + id: pageStackNormalMode |
454 | + anchors.fill: parent |
455 | + active: mainView.state == "normalMode" |
456 | + visible: active |
457 | + } |
458 | + |
459 | + PageStack { |
460 | + id: pageStackGreeterMode |
461 | + anchors.fill: parent |
462 | + active: mainView.state == "greeterMode" |
463 | + visible: active |
464 | } |
465 | } |