Fix: Fixed password icon and added states.

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

View File

@ -217,73 +217,79 @@ Column {
width: parent.width / 2 width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
Button { Button {
id: secretCheckBox
width: parent.height
height: parent.height
anchors.left: parent.left
z: 2
background: Rectangle {
color: "transparent"
border.color: "transparent"
}
CheckBox {
id: revealSecret id: revealSecret
width: parent.width z: 2
height: parent.height width: selectUser.height * 1
hoverEnabled: true
indicator: Button {
id: passwordIcon
width: selectUser.height * 1
height: parent.height height: parent.height
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: selectUser.height * 0 anchors.leftMargin: selectUser.height * 0
icon.height: parent.height * 0.25 icon.height: parent.height * 0.25
icon.width: parent.height * 0.25 icon.width: parent.height * 0.25
enabled: false
icon.color: root.palette.text icon.color: root.palette.text
icon.source: Qt.resolvedUrl("../Assets/Password.svg") icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
background: Rectangle { background: Rectangle {
color: "transparent" color: "transparent"
border.color: "transparent" border.color: "transparent"
}
} }
states: [ states: [
State { State {
name: "unchecked" name: "visiblePasswordFocused"
when: revealSecret.checked && revealSecret.activeFocus
PropertyChanges {
target: revealSecret
icon.source: Qt.resolvedUrl("../Assets/Password.svg")
icon.color: root.palette.highlight
}
},
State {
name: "visiblePasswordHovered"
when: revealSecret.checked && revealSecret.hovered
PropertyChanges {
target: revealSecret
icon.source: Qt.resolvedUrl("../Assets/Password.svg")
icon.color: root.palette.highlight
}
},
State {
name: "visiblePassword"
when: revealSecret.checked when: revealSecret.checked
PropertyChanges { PropertyChanges {
target: passwordIcon target: revealSecret
icon.source: Qt.resolvedUrl("../Assets/Password.svg") icon.source: Qt.resolvedUrl("../Assets/Password.svg")
} }
}, },
State { State {
name: "checked" name: "hiddenPasswordFocused"
when: revealSecret.enabled when: revealSecret.enabled && revealSecret.activeFocus
PropertyChanges { PropertyChanges {
target: passwordIcon target: revealSecret
icon.source: Qt.resolvedUrl("../Assets/Password2.svg") icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
icon.color: root.palette.highlight
}
},
State {
name: "hiddenPasswordHovered"
when: revealSecret.hovered
PropertyChanges {
target: revealSecret
icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
icon.color: root.palette.highlight
} }
} }
] ]
onClicked: toggle()
Keys.onReturnPressed: toggle() Keys.onReturnPressed: toggle()
Keys.onEnterPressed: toggle() Keys.onEnterPressed: toggle()
KeyNavigation.down: loginButton KeyNavigation.down: loginButton
} }
}
TextField { TextField {
id: password id: password
anchors.centerIn: parent anchors.centerIn: parent
@ -471,7 +477,6 @@ Column {
} }
} }
] ]
onClicked: config.AllowBadUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession) onClicked: config.AllowBadUsernames == "false" ? sddm.login(username.text.toLowerCase(), password.text, sessionSelect.selectedSession) : sddm.login(username.text, password.text, sessionSelect.selectedSession)
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
Keys.onEnterPressed: clicked() Keys.onEnterPressed: clicked()