on xenial help sign in
Simplify and correctify focus for GreeterPrompt
commit6ecd8b8a37e785f0d72261432d1972ce06293bae authorMichael Terry <michael.terry@canonical.com> dateMon 6 Jun 2016, 14:21 (10 years ago) parent7f67138
1 file changed+3−11
qml/Greeter/GreeterPrompt.qml+3−11
qml/Greeter/GreeterPrompt.qml+3−11
@@ -20,6 +20,7 @@ import Ubuntu.Components 1.3
2020FocusScope {
2121 id: root
2222 implicitHeight: units.gu(5)
23+ focus: true
2324
2425 property bool isPrompt
2526 property bool isAlphanumeric
@@ -32,7 +33,6 @@ FocusScope {
3233
3334 function reset() {
3435 passwordInput.text = "";
35− focus = false;
3636 d.enabled = true;
3737 }
3838
@@ -63,6 +63,7 @@ FocusScope {
6363 anchors.fill: parent
6464 visible: !root.isPrompt
6565 enabled: d.enabled
66+ focus: visible
6667
6768 onClicked: root.clicked()
6869
@@ -79,6 +80,7 @@ FocusScope {
7980 anchors.fill: parent
8081 visible: root.isPrompt
8182 enabled: d.enabled
83+ focus: visible
8284
8385 inputMethodHints: root.isAlphanumeric ? Qt.ImhNone : Qt.ImhDigitsOnly
8486 echoMode: root.isSecret ? TextInput.Password : TextInput.Normal
@@ -111,22 +113,12 @@ FocusScope {
111113 onAccepted: {
112114 if (!enabled)
113115 return;
114− root.focus = true; // so that it can handle Escape presses for us
115116 d.enabled = false;
116117 root.responded(text);
117118 }
118119
119120 Keys.onEscapePressed: root.canceled()
120121
121− Connections {
122− target: Qt.inputMethod
123− onVisibleChanged: {
124− if (passwordInput.visible && !Qt.inputMethod.visible) {
125− passwordInput.focus = false;
126− }
127− }
128− }
129−
130122 // We use our own custom placeholder label instead of the standard
131123 // TextField one because the standard one hardcodes baseText as the
132124 // palette color, whereas we want raisedSecondaryText.