Merge lp:~mikemc/ubuntuone-credentials/fix-tabloop into lp:ubuntuone-credentials

Proposed by Mike McCracken
Status: Merged
Approved by: dobey
Approved revision: 61
Merged at revision: 61
Proposed branch: lp:~mikemc/ubuntuone-credentials/fix-tabloop
Merge into: lp:ubuntuone-credentials
Diff against target: 138 lines (+25/-5)
4 files modified
online-accounts-provider/LoginForm.qml (+8/-1)
online-accounts-provider/Main.qml (+1/-2)
online-accounts-provider/NewAccount.qml (+6/-2)
online-accounts-provider/RegisterForm.qml (+10/-0)
To merge this branch: bzr merge lp:~mikemc/ubuntuone-credentials/fix-tabloop
Reviewer Review Type Date Requested Status
dobey (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+185566@code.launchpad.net

Commit message

- Fix key focus handling.

Description of the change

- Fix key focus handling.

Fixes initial key focus on email text field
Fixes tab loop between text fields
Fixes focus switching when changing between login/register modes.

NOTE: this just always sets the focus to the first field below the switch when you change the switch.
that might be annoying if you haven't finished typing your email yet, but I think if you've hit the switch you're probably done with the email.
I'm open to dissenting opinions...

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'online-accounts-provider/LoginForm.qml'
--- online-accounts-provider/LoginForm.qml 2013-09-06 16:55:47 +0000
+++ online-accounts-provider/LoginForm.qml 2013-09-13 18:34:16 +0000
@@ -5,6 +5,10 @@
5 id: loginFormColumn5 id: loginFormColumn
6 spacing: units.gu(2)6 spacing: units.gu(2)
77
8 /* export two aliases for KeyNavigation access*/
9 property alias passwordTextField: passwordTextField
10 property alias twoFactorTextField: twoFactorTextField
11
8 property alias password: passwordTextField.text12 property alias password: passwordTextField.text
9 property alias twoFactorVisible: twoFactorUI.visible13 property alias twoFactorVisible: twoFactorUI.visible
10 property alias twoFactorCode: twoFactorTextField.text14 property alias twoFactorCode: twoFactorTextField.text
@@ -21,6 +25,8 @@
21 width: main.width - (2 * main.anchors.margins)25 width: main.width - (2 * main.anchors.margins)
2226
23 Keys.onReturnPressed: main.processForm();27 Keys.onReturnPressed: main.processForm();
28 KeyNavigation.tab: twoFactorUI.visible ? twoFactorTextField : emailTextField /* from main */
29 KeyNavigation.backtab: emailTextField /* from main */
24 }30 }
2531
26 Label {32 Label {
@@ -50,11 +56,12 @@
50 id: twoFactorTextField56 id: twoFactorTextField
51 placeholderText: "2-factor device code"57 placeholderText: "2-factor device code"
52 echoMode: TextInput.Password58 echoMode: TextInput.Password
53 focus: true
54 width: main.width - (2 * main.anchors.margins)59 width: main.width - (2 * main.anchors.margins)
55 Keys.onReturnPressed: {60 Keys.onReturnPressed: {
56 main.processForm();61 main.processForm();
57 }62 }
63 KeyNavigation.tab: emailTextField
64 KeyNavigation.backtab: passwordTextField
58 }65 }
5966
60 Label {67 Label {
6168
=== modified file 'online-accounts-provider/Main.qml'
--- online-accounts-provider/Main.qml 2013-09-12 14:59:06 +0000
+++ online-accounts-provider/Main.qml 2013-09-13 18:34:16 +0000
@@ -50,13 +50,12 @@
50 This will not be necessary once Bug #1221845 is fixed.50 This will not be necessary once Bug #1221845 is fixed.
51 */51 */
52 rootFlickable.parent.parent.flickable = rootFlickable;52 rootFlickable.parent.parent.flickable = rootFlickable;
53
54 }53 }
5554
56 Connections {55 Connections {
57 target: account56 target: account
58 onSynced: {57 onSynced: {
59 console.debug("Account id " + account.accountId + "synced. account.displayName: " + account.displayName)58 console.debug("Account id " + account.accountId + " synced. account.displayName: " + account.displayName)
60 }59 }
61 }60 }
62 61
6362
=== modified file 'online-accounts-provider/NewAccount.qml'
--- online-accounts-provider/NewAccount.qml 2013-09-12 14:59:06 +0000
+++ online-accounts-provider/NewAccount.qml 2013-09-13 18:34:16 +0000
@@ -76,12 +76,13 @@
76 TextField {76 TextField {
77 id: emailTextField77 id: emailTextField
78 placeholderText: "Your email"78 placeholderText: "Your email"
79 focus: true;
80
81 width: main.width - (2 * main.anchors.margins)79 width: main.width - (2 * main.anchors.margins)
82 anchors.left: parent.left80 anchors.left: parent.left
83 anchors.margins: parent.anchors.margins81 anchors.margins: parent.anchors.margins
84 validator: RegExpValidator { regExp: /.+@.+/ }82 validator: RegExpValidator { regExp: /.+@.+/ }
83 focus: true
84 KeyNavigation.tab: loginForm.visible ? loginForm.passwordTextField : registerForm.nameTextField
85 KeyNavigation.backtab: loginForm.visible ? ( loginForm.twoFactorVisible ? loginForm.twoFactorTextField : loginForm.passwordTextField) : registerForm.confirmPasswordTextField
85 }86 }
8687
87 Row {88 Row {
@@ -154,6 +155,7 @@
154 state = "login";155 state = "login";
155 switchTo(loginForm);156 switchTo(loginForm);
156 formValid = false;157 formValid = false;
158 emailTextField.forceActiveFocus();
157 }159 }
158160
159 function showError(message) {161 function showError(message) {
@@ -172,9 +174,11 @@
172 if(state == "login") {174 if(state == "login") {
173 switchTo(registerForm)175 switchTo(registerForm)
174 state = "register";176 state = "register";
177 registerForm.nameTextField.focus = true;
175 } else if(state == "register") {178 } else if(state == "register") {
176 switchTo(loginForm)179 switchTo(loginForm)
177 state = "login";180 state = "login";
181 loginForm.passwordTextField.focus = true;
178 } else {182 } else {
179 console.debug("unexpected state" + state + "in toggleNewUser");183 console.debug("unexpected state" + state + "in toggleNewUser");
180 }184 }
181185
=== modified file 'online-accounts-provider/RegisterForm.qml'
--- online-accounts-provider/RegisterForm.qml 2013-09-06 16:55:47 +0000
+++ online-accounts-provider/RegisterForm.qml 2013-09-13 18:34:16 +0000
@@ -5,6 +5,10 @@
5 id: registerFormColumn5 id: registerFormColumn
6 spacing: units.gu(2)6 spacing: units.gu(2)
77
8 /* export two aliases for KeyNavigation access*/
9 property alias nameTextField: nameTextField
10 property alias confirmPasswordTextField: confirmPasswordTextField
11
8 property alias password: passwordTextField.text12 property alias password: passwordTextField.text
9 property alias display_name: nameTextField.text13 property alias display_name: nameTextField.text
1014
@@ -17,6 +21,8 @@
17 id: nameTextField21 id: nameTextField
18 placeholderText: "Your name"22 placeholderText: "Your name"
19 width: main.width - (2 * main.anchors.margins)23 width: main.width - (2 * main.anchors.margins)
24 KeyNavigation.tab: passwordTextField
25 KeyNavigation.backtab: emailTextField /* from main */
20 }26 }
2127
22 TextField {28 TextField {
@@ -24,6 +30,8 @@
24 placeholderText: "Password with at least 8 characters"30 placeholderText: "Password with at least 8 characters"
25 echoMode: TextInput.Password31 echoMode: TextInput.Password
26 width: main.width - (2 * main.anchors.margins)32 width: main.width - (2 * main.anchors.margins)
33 KeyNavigation.tab: confirmPasswordTextField
34 KeyNavigation.backtab: nameTextField
27 }35 }
2836
29 TextField {37 TextField {
@@ -31,6 +39,8 @@
31 placeholderText: "Re-type password"39 placeholderText: "Re-type password"
32 echoMode: TextInput.Password40 echoMode: TextInput.Password
33 width: main.width - (2 * main.anchors.margins)41 width: main.width - (2 * main.anchors.margins)
42 KeyNavigation.tab: emailTextField /* from main */
43 KeyNavigation.backtab: passwordTextField
34 }44 }
3545
36 Row {46 Row {

Subscribers

People subscribed via source and target branches

to all changes: