Merge lp:~mcintire-evan/ubuntu-terminal-app/auto-focus-auth into lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot

Proposed by Evan McIntire
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 160
Merged at revision: 178
Proposed branch: lp:~mcintire-evan/ubuntu-terminal-app/auto-focus-auth
Merge into: lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot
Diff against target: 26 lines (+9/-1)
1 file modified
src/app/qml/AuthenticationDialog.qml (+9/-1)
To merge this branch: bzr merge lp:~mcintire-evan/ubuntu-terminal-app/auto-focus-auth
Reviewer Review Type Date Requested Status
Stefano Verzegnassi Approve
Jenkins Bot continuous-integration Approve
Niklas Wenzel Pending
Ubuntu Terminal Developers Pending
Review via email: mp+284502@code.launchpad.net

Commit message

Autofocus the authentication popup at app launch. In addition, only load the terminal page after auth is complete/not required so that it doesnt not steal focus, which allowed users to use a bluetooth keyboard to bypass authentication

Description of the change

Autofocus the authentication popup at app launch

To post a comment you must log in.
Revision history for this message
Evan McIntire (mcintire-evan) wrote :

I haven't been able to test this quite yet - running on an emulator/sandbox has been hard, as the auth dialog only comes up on unity 8

Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

Hi Evan!
As long as you only need to test the TextField focus, you can force the auth dialog to appear on desktop too. In AuthenticationService.qml, line 33, you can remove the 'if' condition, so that the dialog will be always shown on any platform.

http://bazaar.launchpad.net/~ubuntu-terminal-dev/ubuntu-terminal-app/reboot/view/head:/src/app/qml/AuthenticationService.qml#L33

As a side note, the auth dialog does not get the focus because of the multiple requests of 'forceActiveFocus()' during initialization, therefore the focus stays on the terminal widget. By fixing this, you will probably fix also the bug at:
  https://bugs.launchpad.net/ubuntu-terminal-app/+bug/1488481/comments/3

Revision history for this message
Evan McIntire (mcintire-evan) wrote :

Cool, thanks for the advice! That other bug you linked is pretty nasty so I'll see if I can rework things a little to get them both done :)

Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

The bug about the bluetooth keyboard should be easily reproducible on desktop too: just ensure to make the auth dialog visible and type some text with your USB/PS2/... keyboard.

Currently the keyboard focus is owned by the terminal widget, that's the reason why it can be typed some command in the console. Once you properly give the focus to the dialog, there's no one to move the focus to another component (UITK Dialog itself has some internal that prevents this).

If you need some test on a Ubuntu device, feel free to ping me

Keep up the good work! :)

Revision history for this message
Evan McIntire (mcintire-evan) wrote :

Yup - I've been able to reproduce it, I almost have a fix ready, just have to fine tune a little bit and we'll be golden! Thanks for the help!

Revision history for this message
Evan McIntire (mcintire-evan) wrote :

It seems a bunch of stuff snuck into the POT file, but I suppose it needs to be updated eventually?

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

I've tested it on my BQ and it works fine! Good work!

However, giving a look at the code I saw there may be some complication in keeping this change working in future.

Mine just wants to be a suggestion on how to prevent this from happening, but I understand there may be some urgency in getting this patch landed and release a new version of terminal-app in the store. For that reason I'll abstain from doing a review.

Anyway, it's great to see new people joining the Core Apps team, so thank you! :)

P.S. I'd wait for Alan, David or Niklas to provide a review before doing any of the changes I suggested.

review: Abstain
Revision history for this message
Evan McIntire (mcintire-evan) wrote :

Thanks! I wasn't entirely sold by the way I fixed it, thanks for the ideas! We'll wait until someone else reviews to see where to go :)

Revision history for this message
Evan McIntire (mcintire-evan) wrote :

Thanks again Stefano, the timer idea works great in keeping everything working smoothly with the least change, so Im going with that - the new diff will be here in a moment, and _hopefully_ I will have done all the branch stuff correctly

I feel the timer is a tad hacky, but this fixes some important stuff, and we can always take another look at the auth stuff when looking at things like #1416886 and #1493786

Thanks again for the help :)

Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

Yes, it's more a workaround than a "rock-solid" solution, but it does the job well and don't require to change things where it's not strictly required.

Below the Timer {}, I see that you left the Component.onCompleted handler. It isn't necessary anymore.

Anyway, LGTM, so there's no reason why I shouldn't approve it. Great work! :)

review: Approve
Revision history for this message
Niklas Wenzel (nikwen) wrote :

@Stefano: If you think that this can be merged, feel free to do so. I don't think that we need approvals from everyone all the time. ;)

(To be clear: I haven't had a chance to look into it or test it yet.)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/qml/AuthenticationDialog.qml'
2--- src/app/qml/AuthenticationDialog.qml 2016-01-22 17:50:33 +0000
3+++ src/app/qml/AuthenticationDialog.qml 2016-02-13 04:00:46 +0000
4@@ -29,6 +29,15 @@
5 signal passwordEntered(string password)
6 signal dialogCanceled
7
8+ // Due to several different things forcing focus
9+ // on creation, we simply create this timer to
10+ // work around that (see bugs #1488481 and #1499994)
11+ Timer {
12+ interval: 1
13+ running: true
14+ onTriggered: passwordField.forceActiveFocus()
15+ }
16+
17 Component.onCompleted: {
18 passwordField.forceActiveFocus();
19 }
20@@ -36,7 +45,6 @@
21 TextField {
22 id: passwordField
23 objectName: "inputField"
24-
25 placeholderText: i18n.tr("passcode or passphrase")
26 echoMode: TextInput.Password
27

Subscribers

People subscribed via source and target branches