Fix: Changed how enter works on password field, minor improvements.

This commit is contained in:
Keyitdev 2024-04-06 14:49:33 +02:00
parent cad1ddd956
commit ba0dd8f377
No known key found for this signature in database
GPG Key ID: B1EB177BC594D8B0

View File

@ -190,7 +190,7 @@ Column {
radius: config.RoundCorners || 0 radius: config.RoundCorners || 0
} }
onAccepted: loginButton.clicked() onAccepted: loginButton.clicked()
KeyNavigation.down: password KeyNavigation.down: showPassword
z: 1 z: 1
states: [ states: [
@ -219,7 +219,7 @@ Column {
Button { Button {
id: revealSecret id: showPassword
z: 2 z: 2
width: selectUser.height * 1 width: selectUser.height * 1
height: parent.height height: parent.height
@ -239,44 +239,44 @@ Column {
states: [ states: [
State { State {
name: "visiblePasswordFocused" name: "visiblePasswordFocused"
when: revealSecret.checked && revealSecret.activeFocus when: showPassword.checked && showPassword.activeFocus
PropertyChanges { PropertyChanges {
target: revealSecret target: showPassword
icon.source: Qt.resolvedUrl("../Assets/Password.svg") icon.source: Qt.resolvedUrl("../Assets/Password.svg")
icon.color: root.palette.highlight icon.color: root.palette.highlight
} }
}, },
State { State {
name: "visiblePasswordHovered" name: "visiblePasswordHovered"
when: revealSecret.checked && revealSecret.hovered when: showPassword.checked && showPassword.hovered
PropertyChanges { PropertyChanges {
target: revealSecret target: showPassword
icon.source: Qt.resolvedUrl("../Assets/Password.svg") icon.source: Qt.resolvedUrl("../Assets/Password.svg")
icon.color: root.palette.highlight icon.color: root.palette.highlight
} }
}, },
State { State {
name: "visiblePassword" name: "visiblePassword"
when: revealSecret.checked when: showPassword.checked
PropertyChanges { PropertyChanges {
target: revealSecret target: showPassword
icon.source: Qt.resolvedUrl("../Assets/Password.svg") icon.source: Qt.resolvedUrl("../Assets/Password.svg")
} }
}, },
State { State {
name: "hiddenPasswordFocused" name: "hiddenPasswordFocused"
when: revealSecret.enabled && revealSecret.activeFocus when: showPassword.enabled && showPassword.activeFocus
PropertyChanges { PropertyChanges {
target: revealSecret target: showPassword
icon.source: Qt.resolvedUrl("../Assets/Password2.svg") icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
icon.color: root.palette.highlight icon.color: root.palette.highlight
} }
}, },
State { State {
name: "hiddenPasswordHovered" name: "hiddenPasswordHovered"
when: revealSecret.hovered when: showPassword.hovered
PropertyChanges { PropertyChanges {
target: revealSecret target: showPassword
icon.source: Qt.resolvedUrl("../Assets/Password2.svg") icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
icon.color: root.palette.highlight icon.color: root.palette.highlight
} }
@ -286,7 +286,7 @@ Column {
onClicked: toggle() onClicked: toggle()
Keys.onReturnPressed: toggle() Keys.onReturnPressed: toggle()
Keys.onEnterPressed: toggle() Keys.onEnterPressed: toggle()
KeyNavigation.down: loginButton KeyNavigation.down: password
} }
@ -298,7 +298,7 @@ Column {
font.bold: true font.bold: true
focus: config.ForcePasswordFocus == "true" ? true : false focus: config.ForcePasswordFocus == "true" ? true : false
selectByMouse: true selectByMouse: true
echoMode: revealSecret.checked ? TextInput.Normal : TextInput.Password echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password
placeholderText: config.TranslatePlaceholderPassword || textConstants.password placeholderText: config.TranslatePlaceholderPassword || textConstants.password
placeholderTextColor: config.placeholderColor placeholderTextColor: config.placeholderColor
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
@ -312,8 +312,8 @@ Column {
border.width: parent.activeFocus ? 2 : 1 border.width: parent.activeFocus ? 2 : 1
radius: config.RoundCorners || 0 radius: config.RoundCorners || 0
} }
onAccepted: loginButton.clicked() onAccepted: config.AllowBadUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession)
KeyNavigation.down: revealSecret KeyNavigation.down: loginButton
} }
states: [ states: [