on xenial help sign in
fix haptics being out of sync
commit2e2611aeafeecbef8a42ee76e84d322cfc29a7d5 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 13 Apr 2016, 17:19 (11 years ago) parentd25b519
2 files changed+20−11
qml/Components/PinLockscreen.qml+2−10 qml/Components/PinPadButton.qml+18−1
qml/Components/PinLockscreen.qml+2−10
@@ -197,11 +197,7 @@ FocusScope {
197197 pinentryField.text.length < root.maxPinLength ||
198198 pinentryField.incorrectOverride)
199199
200− onPressedChanged: {
201− if (!pressed) {
202− pinentryField.appendNumber(index + 1)
203− }
204− }
200+ onClicked: pinentryField.appendNumber(index + 1)
205201 }
206202 }
207203 Item {
@@ -217,11 +213,7 @@ FocusScope {
217213 pinentryField.text.length < root.maxPinLength ||
218214 pinentryField.incorrectOverride)
219215
220− onPressedChanged: {
221− if (!pressed) {
222− pinentryField.appendNumber(0)
223− }
224− }
216+ onClicked: pinentryField.appendNumber(0)
225217 }
226218 Item {
227219 height: numbersGrid.buttonHeight
qml/Components/PinPadButton.qml+18−1
@@ -17,7 +17,7 @@
1717import QtQuick 2.4
1818import Ubuntu.Components 1.3
1919
20−AbstractButton {
20+Item {
2121 id: root
2222 opacity: enabled ? 1 : 0.6
2323
@@ -25,6 +25,10 @@ AbstractButton {
2525 property string iconName
2626 property color foregroundColor: "#000000"
2727
28+ readonly property alias pressed: mouseArea.pressed
29+
30+ signal clicked();
31+
2832 UbuntuShape {
2933 anchors.fill: parent
3034 opacity: root.pressed ? 1 : 0
@@ -60,4 +64,17 @@ AbstractButton {
6064 UbuntuNumberAnimation { duration: UbuntuAnimation.SlowDuration }
6165 }
6266 }
67+
68+ MouseArea {
69+ id: mouseArea
70+ anchors.fill: parent
71+
72+ // Intentionally using onReleased here to increase the robustness against
73+ // sloppy presses. This often happens when entering a pin very quickly and
74+ // the numbers for the pin are far apart.
75+ onReleased: {
76+ Haptics.play();
77+ root.clicked();
78+ }
79+ }
6380}