Skip to content

Commit

Permalink
Fix textfield layout on basic auth credentials page
Browse files Browse the repository at this point in the history
Fixes: #11913
  • Loading branch information
erikjv committed Oct 16, 2024
1 parent eaede7d commit 39e7b60
Showing 1 changed file with 43 additions and 35 deletions.
78 changes: 43 additions & 35 deletions src/gui/qml/credentials/BasicAuthCredentials.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,51 @@ Credentials {
text: credentials.isReadOnlyName ? qsTr("Please enter your password to log in.") : qsTr("Please enter %1 and password to log in.").arg(credentials.userNameLabel)
}

Label {
text: credentials.userNameLabel
}
TextField {
id: userNameField
placeholderText: qsTr("Enter %1").arg(credentials.userNameLabel)
horizontalAlignment: TextField.AlignHCenter
text: credentials.userName
enabled: !credentials.isReadOnlyName
onTextChanged: {
credentials.userName = text;
}
Pane {
// Treat the user name and password fields (and labels) as one single group, so they are
// always placed and layed out together.
Layout.alignment: Qt.AlignHCenter

Keys.onBacktabPressed: {
widget.parentFocusWidget.focusPrevious();
}
}
ColumnLayout {
Label {
text: credentials.userNameLabel
}
TextField {
id: userNameField
placeholderText: qsTr("Enter %1").arg(credentials.userNameLabel)
horizontalAlignment: TextField.AlignHCenter
text: credentials.userName
enabled: !credentials.isReadOnlyName
onTextChanged: {
credentials.userName = text;
}

Label {
text: qsTr("Password")
}
TextField {
id: passwordField
horizontalAlignment: TextField.AlignHCenter
placeholderText: qsTr("Enter Password")
text: credentials.password
echoMode: TextField.PasswordEchoOnEdit
onTextChanged: {
credentials.password = text;
}
Keys.onTabPressed: event => {
// there is no lougout button
if (!credentials.isRefresh) {
widget.parentFocusWidget.focusNext();
event.accepted = true;
} else {
event.accepted = false;
Keys.onBacktabPressed: {
widget.parentFocusWidget.focusPrevious();
}
}

Label {
text: qsTr("Password")
}
TextField {
id: passwordField
horizontalAlignment: TextField.AlignHCenter
placeholderText: qsTr("Enter Password")
text: credentials.password
echoMode: TextField.PasswordEchoOnEdit
onTextChanged: {
credentials.password = text;
}
Keys.onTabPressed: event => {
// there is no lougout button
if (!credentials.isRefresh) {
widget.parentFocusWidget.focusNext();
event.accepted = true;
} else {
event.accepted = false;
}
}
}
}
}
Expand Down

0 comments on commit 39e7b60

Please sign in to comment.