Merge lp:~jonas-drange/ubuntu-system-settings/security-focus-correct-entry into lp:ubuntu-system-settings

Proposed by Jonas G. Drange
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 1385
Merged at revision: 1410
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/security-focus-correct-entry
Merge into: lp:ubuntu-system-settings
Diff against target: 149 lines (+67/-1)
3 files modified
plugins/security-privacy/LockSecurity.qml (+25/-1)
plugins/security-privacy/PhoneLocking.qml (+1/-0)
tests/autopilot/ubuntu_system_settings/tests/test_security.py (+41/-0)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/security-focus-correct-entry
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Sebastien Bacher (community) Approve
Review via email: mp+256345@code.launchpad.net

Commit message

[security-privacy] give the focus to the right entry, if the current
unlock method is swipe then there is no "current password" so the new
input line should be the focussed one

Description of the change

[security-privacy] give the focus to the right entry, if the current
unlock method is swipe then there is no "current password" so the new
input line should be the focussed one

To post a comment you must log in.
1384. By Jonas G. Drange

use assertTrue

1385. By Jonas G. Drange

handle the case where security is swipe

Revision history for this message
Sebastien Bacher (seb128) wrote :

looks fine to me, thanks

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/security-privacy/LockSecurity.qml'
--- plugins/security-privacy/LockSecurity.qml 2015-02-09 15:46:27 +0000
+++ plugins/security-privacy/LockSecurity.qml 2015-04-15 16:40:34 +0000
@@ -29,6 +29,7 @@
2929
30ItemPage {30ItemPage {
31 id: page31 id: page
32 objectName: "lockSecurityPage"
32 title: i18n.tr("Lock security")33 title: i18n.tr("Lock security")
3334
34 // The user can still press the main "back" button or other buttons on the35 // The user can still press the main "back" button or other buttons on the
@@ -94,6 +95,7 @@
9495
95 Dialog {96 Dialog {
96 id: changeSecurityDialog97 id: changeSecurityDialog
98 objectName: "changeSecurityDialog"
9799
98 function displayMismatchWarning() {100 function displayMismatchWarning() {
99 /* If the entry have the same length and different content,101 /* If the entry have the same length and different content,
@@ -159,6 +161,7 @@
159161
160 TextField {162 TextField {
161 id: currentInput163 id: currentInput
164 objectName: "currentInput"
162 echoMode: TextInput.Password165 echoMode: TextInput.Password
163 inputMethodHints: {166 inputMethodHints: {
164 if (changeSecurityDialog.oldMethod ===167 if (changeSecurityDialog.oldMethod ===
@@ -181,7 +184,10 @@
181 UbuntuSecurityPrivacyPanel.Swipe)184 UbuntuSecurityPrivacyPanel.Swipe)
182 confirmButton.enabled = text.length > 0185 confirmButton.enabled = text.length > 0
183 }186 }
184 Component.onCompleted: forceActiveFocus()187 Component.onCompleted: {
188 if (securityPrivacy.securityType !== UbuntuSecurityPrivacyPanel.Swipe)
189 forceActiveFocus()
190 }
185 }191 }
186192
187 /* Using bindings since it is, according to documentation,193 /* Using bindings since it is, according to documentation,
@@ -226,6 +232,7 @@
226232
227 TextField {233 TextField {
228 id: newInput234 id: newInput
235 objectName: "newInput"
229 echoMode: TextInput.Password236 echoMode: TextInput.Password
230 inputMethodHints: {237 inputMethodHints: {
231 if (changeSecurityDialog.newMethod ===238 if (changeSecurityDialog.newMethod ===
@@ -244,6 +251,10 @@
244 changeSecurityDialog.newMethod ===251 changeSecurityDialog.newMethod ===
245 UbuntuSecurityPrivacyPanel.Passphrase252 UbuntuSecurityPrivacyPanel.Passphrase
246 onTextChanged: { displayMismatchWarning() }253 onTextChanged: { displayMismatchWarning() }
254 Component.onCompleted: {
255 if (securityPrivacy.securityType === UbuntuSecurityPrivacyPanel.Swipe)
256 forceActiveFocus()
257 }
247 }258 }
248259
249 /* Using bindings since it is, according to documentation,260 /* Using bindings since it is, according to documentation,
@@ -434,6 +445,18 @@
434 id: unlockMethod445 id: unlockMethod
435 model: 3446 model: 3
436 delegate: OptionSelectorDelegate {447 delegate: OptionSelectorDelegate {
448 objectName: {
449 switch (index) {
450 case 0:
451 return "method_swipe";
452 case 1:
453 return "method_code";
454 case 2:
455 return "method_phrase";
456 default:
457 return "method_unknown";
458 }
459 }
437 text: index == 0 ? (unlockMethod.selectedIndex == 0 ? unlockMethod.swipe : unlockMethod.swipeAlt) :460 text: index == 0 ? (unlockMethod.selectedIndex == 0 ? unlockMethod.swipe : unlockMethod.swipeAlt) :
438 (index == 1 ? (unlockMethod.selectedIndex == 1 ? unlockMethod.passcode : unlockMethod.passcodeAlt) :461 (index == 1 ? (unlockMethod.selectedIndex == 1 ? unlockMethod.passcode : unlockMethod.passcodeAlt) :
439 (unlockMethod.selectedIndex == 2 ? unlockMethod.passphrase : unlockMethod.passphraseAlt))462 (unlockMethod.selectedIndex == 2 ? unlockMethod.passphrase : unlockMethod.passphraseAlt))
@@ -466,6 +489,7 @@
466 property bool passcode: securityPrivacy.securityType ===489 property bool passcode: securityPrivacy.securityType ===
467 UbuntuSecurityPrivacyPanel.Passcode490 UbuntuSecurityPrivacyPanel.Passcode
468491
492 objectName: "changePass"
469 enabled: parent.visible493 enabled: parent.visible
470494
471 text: passcode ? changePasscode : changePassphrase495 text: passcode ? changePasscode : changePassphrase
472496
=== modified file 'plugins/security-privacy/PhoneLocking.qml'
--- plugins/security-privacy/PhoneLocking.qml 2015-02-09 15:42:47 +0000
+++ plugins/security-privacy/PhoneLocking.qml 2015-04-15 16:40:34 +0000
@@ -46,6 +46,7 @@
46 property string passcode: i18n.tr("Passcode")46 property string passcode: i18n.tr("Passcode")
47 property string passphrase: i18n.tr("Passphrase")47 property string passphrase: i18n.tr("Passphrase")
4848
49 objectName: "lockSecurity"
49 text: i18n.tr("Lock security")50 text: i18n.tr("Lock security")
50 value: {51 value: {
51 switch (securityPrivacy.securityType) {52 switch (securityPrivacy.securityType) {
5253
=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_security.py'
--- tests/autopilot/ubuntu_system_settings/tests/test_security.py 2015-02-19 15:18:09 +0000
+++ tests/autopilot/ubuntu_system_settings/tests/test_security.py 2015-04-15 16:40:34 +0000
@@ -139,6 +139,47 @@
139 Equals(_('Phone locking'))139 Equals(_('Phone locking'))
140 )140 )
141141
142 def test_lock_security_focus_on_entry(self):
143 self._go_to_phone_lock()
144
145 phone_lock_page = self.main_view.select_single(
146 objectName='phoneLockingPage')
147 selector = phone_lock_page.select_single(objectName='lockSecurity')
148 self.main_view.scroll_to_and_click(selector)
149
150 lock_security_page = self.main_view.wait_select_single(
151 objectName='lockSecurityPage')
152
153 # Find the selected security method.
154 unlock_methods = ['method_swipe', 'method_code', 'method_phrase']
155 selected_method = None
156 for m in unlock_methods:
157 if lock_security_page.select_single(objectName=m).selected:
158 selected_method = m
159
160 # If swipe is the selected security, we trigger the dialog by
161 # changing the security to method_code
162 if selected_method == 'method_swipe':
163 dialog_trigger = lock_security_page.select_single(
164 objectName='method_code')
165 input_selector = 'newInput'
166 else:
167 # If the security is anything besides swipe, we trigger the dialog
168 # by changing the code/phrase.
169 dialog_trigger = lock_security_page.select_single(
170 objectName='changePass')
171 input_selector = 'currentInput'
172
173 # Trigger dialog.
174 self.main_view.scroll_to_and_click(dialog_trigger)
175
176 # Find the text input.
177 dialog = self.main_view.wait_select_single(
178 objectName='changeSecurityDialog')
179 text_input = dialog.wait_select_single(
180 objectName=input_selector)
181 self.assertTrue(text_input.focus)
182
142 def test_phone_lock_value(self):183 def test_phone_lock_value(self):
143 self._go_to_phone_lock()184 self._go_to_phone_lock()
144 phone_lock_page = self.main_view.select_single(185 phone_lock_page = self.main_view.select_single(

Subscribers

People subscribed via source and target branches