mirror of
https://github.com/redstrate/Astra.git
synced 2025-05-19 15:37:46 +00:00
Initially focus a more relevant login field
This was only done during account change, but the same logic is now used on start-up. Also, if the password doesn't need to be entered by the user (e.g. they have "Remember Password" checked) then the OTP/Login button is focused instead.
This commit is contained in:
parent
eebd827982
commit
a4e9343b12
1 changed files with 19 additions and 14 deletions
|
@ -73,22 +73,28 @@ QQC2.Control {
|
||||||
|
|
||||||
function onAccountChanged(): void {
|
function onAccountChanged(): void {
|
||||||
page.updateFields();
|
page.updateFields();
|
||||||
|
page.updateFocus();
|
||||||
if (LauncherCore.currentProfile.account.needsPassword) {
|
|
||||||
passwordField.forceActiveFocus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LauncherCore.currentProfile.account.config.useOTP) {
|
|
||||||
otpField.forceActiveFocus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
loginButton.forceActiveFocus();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: updateFields()
|
function updateFocus(): void {
|
||||||
|
if (LauncherCore.currentProfile.account.needsPassword && !LauncherCore.currentProfile.account.config.rememberPassword) {
|
||||||
|
passwordField.forceActiveFocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LauncherCore.currentProfile.account.config.useOTP) {
|
||||||
|
otpField.forceActiveFocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loginButton.forceActiveFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
updateFields();
|
||||||
|
updateFocus();
|
||||||
|
}
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -227,7 +233,6 @@ QQC2.Control {
|
||||||
FormCard.FormPasswordFieldDelegate {
|
FormCard.FormPasswordFieldDelegate {
|
||||||
id: passwordField
|
id: passwordField
|
||||||
label: i18n("Square Enix Password")
|
label: i18n("Square Enix Password")
|
||||||
focus: true
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if (otpField.visible) {
|
if (otpField.visible) {
|
||||||
otpField.clicked();
|
otpField.clicked();
|
||||||
|
|
Loading…
Add table
Reference in a new issue