Merge lp:~boiko/dialer-app/show_emergency_calls_when_sim_locked into lp:dialer-app

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 526
Merged at revision: 527
Proposed branch: lp:~boiko/dialer-app/show_emergency_calls_when_sim_locked
Merge into: lp:dialer-app
Diff against target: 161 lines (+60/-10)
4 files modified
src/qml/DialerPage/DialerPage.qml (+26/-4)
src/qml/Dialogs/SimLockedDialog.qml (+2/-1)
src/qml/dialer-app.qml (+9/-4)
tests/qml/tst_DialerPage.qml (+23/-1)
To merge this branch: bzr merge lp:~boiko/dialer-app/show_emergency_calls_when_sim_locked
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+293456@code.launchpad.net

Commit message

In order to make it clear that emergency calls are possible in a sim locked situation,
show "Emergency Calls" in the header together with a sim locked icon.

Description of the change

In order to make it clear that emergency calls are possible in a sim locked situation,
show "Emergency Calls" in the header together with a sim locked icon.

To post a comment you must log in.
526. By Gustavo Pichorim Boiko

Update copyright header.

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)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/DialerPage/DialerPage.qml'
2--- src/qml/DialerPage/DialerPage.qml 2016-02-11 17:58:29 +0000
3+++ src/qml/DialerPage/DialerPage.qml 2016-04-29 21:33:35 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright 2012-2013 Canonical Ltd.
7+ * Copyright 2012-2016 Canonical Ltd.
8 *
9 * This file is part of dialer-app.
10 *
11@@ -71,15 +71,34 @@
12
13 ]
14 head.actions: mainView.greeterMode ? actionsGreeter : actionsNormal
15- head.backAction: Action {
16+
17+ Action {
18+ id: backAction
19+ objectName: "backAction"
20 iconName: "back"
21 text: i18n.tr("Close")
22- visible: mainView.greeterMode
23 onTriggered: {
24 greeter.showGreeter()
25 dialNumber = "";
26 }
27 }
28+ Action {
29+ id: simLockedAction
30+ objectName: "simLockedAction"
31+ iconName: "simcard-locked"
32+ onTriggered: {
33+ mainView.showSimLockedDialog()
34+ }
35+ }
36+
37+ head.backAction: {
38+ if (mainView.greeterMode) {
39+ return backAction
40+ } else if (mainView.simLocked) {
41+ return simLockedAction
42+ }
43+ return null
44+ }
45
46 objectName: "dialerPage"
47
48@@ -97,7 +116,10 @@
49 } else if (telepathyHelper.flightMode) {
50 return i18n.tr("Flight Mode")
51 } else if (mainView.account && mainView.account.simLocked) {
52- return i18n.tr("SIM Locked")
53+ // just in case we need it back in the future somewhere, keep the original string
54+ var oldTitle = i18n.tr("SIM Locked")
55+ // show Emergency Calls for sim locked too. There is going to be an icon indicating it is locked
56+ return i18n.tr("Emergency Calls")
57 } else if (mainView.account && mainView.account.networkName != "") {
58 return mainView.account.networkName
59 } else if (multiplePhoneAccounts && !mainView.account) {
60
61=== modified file 'src/qml/Dialogs/SimLockedDialog.qml'
62--- src/qml/Dialogs/SimLockedDialog.qml 2015-09-07 15:40:45 +0000
63+++ src/qml/Dialogs/SimLockedDialog.qml 2016-04-29 21:33:35 +0000
64@@ -1,5 +1,5 @@
65 /*
66- * Copyright 2012-2013 Canonical Ltd.
67+ * Copyright 2012-2016 Canonical Ltd.
68 *
69 * This file is part of dialer-app.
70 *
71@@ -23,6 +23,7 @@
72 Component {
73 Dialog {
74 id: dialogue
75+ objectName: "simLockedDialog"
76 title: i18n.tr("SIM Card is locked")
77 Column {
78 anchors.left: parent.left
79
80=== modified file 'src/qml/dialer-app.qml'
81--- src/qml/dialer-app.qml 2016-03-17 22:01:50 +0000
82+++ src/qml/dialer-app.qml 2016-04-29 21:33:35 +0000
83@@ -1,5 +1,5 @@
84 /*
85- * Copyright 2012-2013 Canonical Ltd.
86+ * Copyright 2012-2016 Canonical Ltd.
87 *
88 * This file is part of dialer-app.
89 *
90@@ -43,6 +43,7 @@
91 }
92
93 property QtObject account: defaultPhoneAccount()
94+ property bool simLocked: account && account.simLocked
95 property bool greeterMode: (state == "greeterMode")
96 property bool lastHasCalls: callManager.hasCalls
97 property bool telepathyReady: false
98@@ -365,9 +366,7 @@
99 }
100
101 if (mainView.account && !mainView.greeterMode && mainView.account.simLocked) {
102- var properties = {}
103- properties["accountId"] = mainView.account.accountId
104- PopupUtils.open(Qt.createComponent("Dialogs/SimLockedDialog.qml").createObject(mainView), mainView, properties)
105+ showSimLockedDialog();
106 return
107 }
108
109@@ -473,6 +472,12 @@
110 PopupUtils.open(Qt.resolvedUrl("Dialogs/NotificationDialog.qml"), mainView, {title: title, text: text});
111 }
112
113+ function showSimLockedDialog() {
114+ var properties = {}
115+ properties["accountId"] = mainView.account.accountId
116+ PopupUtils.open(Qt.createComponent("Dialogs/SimLockedDialog.qml").createObject(mainView), mainView, properties)
117+ }
118+
119 Component.onCompleted: {
120 i18n.domain = "dialer-app"
121 i18n.bindtextdomain("dialer-app", i18nDirectory)
122
123=== modified file 'tests/qml/tst_DialerPage.qml'
124--- tests/qml/tst_DialerPage.qml 2015-10-19 18:02:58 +0000
125+++ tests/qml/tst_DialerPage.qml 2016-04-29 21:33:35 +0000
126@@ -1,5 +1,5 @@
127 /*
128- * Copyright 2014 Canonical Ltd.
129+ * Copyright 2014-2016 Canonical Ltd.
130 *
131 * This file is part of dialer-app.
132 *
133@@ -114,6 +114,28 @@
134
135 mainViewLoader.item.applicationActive = false
136 tryCompare(mainViewLoader.item.currentStack.currentPage, 'title', ' ')
137+ mainViewLoader.item.applicationActive = true
138+ }
139+
140+ function test_dialerPageWhenSimLocked() {
141+ mainViewLoader.item.switchToKeypadView()
142+ tryCompare(mainViewLoader.item, 'applicationActive', true)
143+ tryCompare(mainViewLoader.item.currentStack, 'depth', 1)
144+
145+ mainViewLoader.item.telepathyReady = true
146+ greeter.greeterActive = false
147+ testAccount.simLocked = true
148+
149+ var dialerPage = mainViewLoader.item.currentStack.currentPage
150+ tryCompare(dialerPage, 'title', i18n.tr('Emergency Calls'))
151+ tryCompare(dialerPage.head.backAction, 'objectName', 'simLockedAction')
152+
153+ // click the action to see if the dialog is shown
154+ dialerPage.head.backAction.trigger()
155+ var simLockedDialog = findChild(root, 'simLockedDialog')
156+ tryCompare(simLockedDialog, 'visible', true)
157+ var okButton = findChild(simLockedDialog, 'okSimLockedDialog')
158+ mouseClick(okButton)
159 }
160
161 /*

Subscribers

People subscribed via source and target branches