Merge lp:~tiagosh/dialer-app/fix-dtmf-long-press into lp:dialer-app

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 215
Merged at revision: 220
Proposed branch: lp:~tiagosh/dialer-app/fix-dtmf-long-press
Merge into: lp:dialer-app
Prerequisite: lp:~piiramar/dialer-app/dial-tones
Diff against target: 234 lines (+62/-28)
3 files modified
src/qml/DialerPage/DialerPage.qml (+24/-13)
src/qml/DialerPage/Keypad.qml (+27/-15)
src/qml/DialerPage/KeypadButton.qml (+11/-0)
To merge this branch: bzr merge lp:~tiagosh/dialer-app/fix-dtmf-long-press
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+229811@code.launchpad.net

This proposal supersedes a proposal from 2014-08-06.

Commit message

- move MMI code to onKeyPressed()
- use onPressed() instead of onClicked()

Description of the change

- move MMI code to onKeyPressed()
- use onPressed() instead of onClicked()

-- Checklist --
Are there any related MPs required for this MP to build/function as expected? Please list.
No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/dialer-app) on device or emulator?
Yes

If you changed the UI, was the change specified/approved by design?
N/A

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
215. By Tiago Salem Herrmann

merge dial-tone branch

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

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
No, but not related to the MR

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

Code looks good and works as expected!

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 2014-08-07 14:59:35 +0000
3+++ src/qml/DialerPage/DialerPage.qml 2014-08-07 14:59:35 +0000
4@@ -102,18 +102,6 @@
5 }
6 }
7
8- onDialNumberChanged: {
9- if(checkUSSD(dialNumber)) {
10- // check for custom strings
11- if (dialNumber === "*#06#") {
12- dialNumber = ""
13- mainView.ussdResponseTitle = "IMEI"
14- mainView.ussdResponseText = ussdManager.serial(mainView.account.accountId)
15- PopupUtils.open(ussdResponseDialog)
16- }
17- }
18- }
19-
20 function accountIndex(account) {
21 var index = -1;
22 for (var i in telepathyHelper.accounts) {
23@@ -289,6 +277,7 @@
24
25 Keypad {
26 id: keypad
27+ showVoicemail: true
28
29 anchors {
30 top: divider.bottom
31@@ -297,11 +286,33 @@
32 }
33
34 onKeyPressed: {
35+ callManager.playTone(label);
36 input.insert(input.cursorPosition, label)
37- callManager.playTone(label);
38+ if(checkUSSD(dialNumber)) {
39+ // check for custom strings
40+ if (dialNumber === "*#06#") {
41+ dialNumber = ""
42+ mainView.ussdResponseTitle = "IMEI"
43+ mainView.ussdResponseText = ussdManager.serial(mainView.account.accountId)
44+ PopupUtils.open(ussdResponseDialog)
45+ }
46+ }
47+ }
48+ onKeyPressAndHold: {
49+ // we should only call voicemail if the keypad entry was empty,
50+ // but as we add numbers when onKeyPressed is triggered, the keypad entry will be "1"
51+ if (keycode == Qt.Key_1 && dialNumber == "1") {
52+ dialNumber = ""
53+ mainView.callVoicemail()
54+ } else if (keycode == Qt.Key_0) {
55+ // replace 0 by +
56+ dialNumber = dialNumber.substring(0, dialNumber.length - 1)
57+ dialNumber += i18n.tr("+")
58+ }
59 }
60 }
61 }
62+
63 Item {
64 id: footer
65
66
67=== modified file 'src/qml/DialerPage/Keypad.qml'
68--- src/qml/DialerPage/Keypad.qml 2014-07-23 16:10:36 +0000
69+++ src/qml/DialerPage/Keypad.qml 2014-08-07 14:59:35 +0000
70@@ -25,11 +25,13 @@
71
72 property int keysWidth: units.gu(11)
73 property int keysHeight: units.gu(8)
74+ property bool showVoicemail: false
75
76 width: keys.width
77 height: keys.height
78
79 signal keyPressed(int keycode, string label)
80+ signal keyPressAndHold(int keycode, string label)
81
82 Grid {
83 id: keys
84@@ -46,9 +48,9 @@
85 height: keysHeight
86 label: i18n.tr("1")
87 keycode: Qt.Key_1
88- onClicked: keypad.keyPressed(keycode, label)
89- onPressAndHold: mainView.callVoicemail()
90- iconSource: "voicemail"
91+ onKeyPressed: keypad.keyPressed(keycode, label)
92+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
93+ iconSource: showVoicemail ? "voicemail" : ""
94 }
95
96 KeypadButton {
97@@ -58,7 +60,8 @@
98 label: i18n.tr("2")
99 sublabel: i18n.tr("ABC")
100 keycode: Qt.Key_2
101- onClicked: keypad.keyPressed(keycode, label)
102+ onKeyPressed: keypad.keyPressed(keycode, label)
103+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
104 }
105
106 KeypadButton {
107@@ -68,7 +71,8 @@
108 label: i18n.tr("3")
109 sublabel: i18n.tr("DEF")
110 keycode: Qt.Key_3
111- onClicked: keypad.keyPressed(keycode, label)
112+ onKeyPressed: keypad.keyPressed(keycode, label)
113+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
114 }
115
116 KeypadButton {
117@@ -78,7 +82,8 @@
118 label: i18n.tr("4")
119 sublabel: i18n.tr("GHI")
120 keycode: Qt.Key_4
121- onClicked: keypad.keyPressed(keycode, label)
122+ onKeyPressed: keypad.keyPressed(keycode, label)
123+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
124 }
125
126 KeypadButton {
127@@ -88,7 +93,8 @@
128 label: i18n.tr("5")
129 sublabel: i18n.tr("JKL")
130 keycode: Qt.Key_5
131- onClicked: keypad.keyPressed(keycode, label)
132+ onKeyPressed: keypad.keyPressed(keycode, label)
133+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
134 }
135
136 KeypadButton {
137@@ -98,7 +104,8 @@
138 label: i18n.tr("6")
139 sublabel: i18n.tr("MNO")
140 keycode: Qt.Key_6
141- onClicked: keypad.keyPressed(keycode, label)
142+ onKeyPressed: keypad.keyPressed(keycode, label)
143+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
144 }
145
146 KeypadButton {
147@@ -108,7 +115,8 @@
148 label: i18n.tr("7")
149 sublabel: i18n.tr("PQRS")
150 keycode: Qt.Key_7
151- onClicked: keypad.keyPressed(keycode, label)
152+ onKeyPressed: keypad.keyPressed(keycode, label)
153+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
154 }
155
156 KeypadButton {
157@@ -118,7 +126,8 @@
158 label: i18n.tr("8")
159 sublabel: i18n.tr("TUV")
160 keycode: Qt.Key_8
161- onClicked: keypad.keyPressed(keycode, label)
162+ onKeyPressed: keypad.keyPressed(keycode, label)
163+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
164 }
165
166 KeypadButton {
167@@ -128,7 +137,8 @@
168 label: i18n.tr("9")
169 sublabel: i18n.tr("WXYZ")
170 keycode: Qt.Key_9
171- onClicked: keypad.keyPressed(keycode, label)
172+ onKeyPressed: keypad.keyPressed(keycode, label)
173+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
174 }
175
176 KeypadButton {
177@@ -139,7 +149,8 @@
178 corner: Qt.BottomLeftCorner
179 label: i18n.tr("*")
180 keycode: Qt.Key_Asterisk
181- onClicked: keypad.keyPressed(keycode, label)
182+ onKeyPressed: keypad.keyPressed(keycode, label)
183+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
184 }
185
186 KeypadButton {
187@@ -150,8 +161,8 @@
188 sublabel: i18n.tr("+")
189 sublabelSize: "medium"
190 keycode: Qt.Key_0
191- onClicked: keypad.keyPressed(keycode, label)
192- onPressAndHold: keypad.keyPressed(keycode, sublabel)
193+ onKeyPressed: keypad.keyPressed(keycode, label)
194+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
195 }
196
197 KeypadButton {
198@@ -162,7 +173,8 @@
199 corner: Qt.BottomRightCorner
200 label: i18n.tr("#")
201 keycode: Qt.Key_ssharp
202- onClicked: keypad.keyPressed(keycode, label)
203+ onKeyPressed: keypad.keyPressed(keycode, label)
204+ onPressAndHold: keypad.keyPressAndHold(keycode, label)
205 }
206 }
207 }
208
209=== modified file 'src/qml/DialerPage/KeypadButton.qml'
210--- src/qml/DialerPage/KeypadButton.qml 2014-07-23 16:10:36 +0000
211+++ src/qml/DialerPage/KeypadButton.qml 2014-08-07 14:59:35 +0000
212@@ -32,6 +32,9 @@
213 property int keycode
214 property bool isCorner: false
215 property int corner
216+ property alias pressed: mouseArea.pressed
217+
218+ signal keyPressed()
219
220 UbuntuShape {
221 anchors.fill: parent
222@@ -92,4 +95,12 @@
223 height: units.gu(2)
224 }
225 }
226+
227+ // WORKAROUND: AbstractButton does not provide onPressed()
228+ MouseArea {
229+ id: mouseArea
230+ anchors.fill: parent
231+ onPressed: button.keyPressed()
232+ onPressAndHold: button.pressAndHold()
233+ }
234 }

Subscribers

People subscribed via source and target branches