Fix: fixed array out of range in system buttons, added ability to bypass checks.

This commit is contained in:
Keyitdev
2024-12-23 16:10:54 +01:00
parent 8ac616a827
commit 7123e3870b
2 changed files with 4 additions and 23 deletions
-1
View File
@@ -386,7 +386,6 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: config.HideLoginButton == "true" ? false : true visible: config.HideLoginButton == "true" ? false : true
Button { Button {
id: loginButton id: loginButton
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
+3 -21
View File
@@ -32,24 +32,21 @@ RowLayout {
icon.width: 2 * Math.round((root.font.pointSize * 3) / 2) icon.width: 2 * Math.round((root.font.pointSize * 3) / 2)
icon.color: config.SystemButtonsIconsColor icon.color: config.SystemButtonsIconsColor
display: AbstractButton.TextUnderIcon display: AbstractButton.TextUnderIcon
visible: config.HideSystemButtons != "true" && modelData[2] visible: config.HideSystemButtons != "true" && (config.BypassSystemButtonsChecks == "true" ? 1 : modelData[2])
hoverEnabled: true hoverEnabled: true
palette.buttonText: config.SystemButtonsIconsColor palette.buttonText: config.SystemButtonsIconsColor
background: Rectangle { background: Rectangle {
height: 2 height: 2
color: "transparent" color: "transparent"
width: parent.width width: parent.width
border.width: parent.activeFocus ? 1 : 0
border.color: "transparent"
anchors.top: parent.bottom
} }
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
onClicked: { onClicked: {
parent.forceActiveFocus() parent.forceActiveFocus()
index == 0 ? sddm.powerOff() : index == 1 ? sddm.reboot() : index == 2 ? sddm.suspend() : sddm.hibernate() index == 0 ? sddm.powerOff() : index == 1 ? sddm.reboot() : index == 2 ? sddm.suspend() : sddm.hibernate()
} }
KeyNavigation.up: exposedSession KeyNavigation.left: index > 0 ? parent.children[index-1] : null
KeyNavigation.left: parent.children[index-1]
states: [ states: [
State { State {
@@ -60,11 +57,6 @@ RowLayout {
icon.color: root.palette.buttonText icon.color: root.palette.buttonText
palette.buttonText: Qt.darker(root.palette.buttonText, 1.1) palette.buttonText: Qt.darker(root.palette.buttonText, 1.1)
} }
PropertyChanges {
target: parent.children[index].background
icon.color: root.palette.buttonText
border.color: Qt.darker(root.palette.buttonText, 1.1)
}
}, },
State { State {
name: "hovered" name: "hovered"
@@ -74,11 +66,6 @@ RowLayout {
icon.color: root.palette.buttonText icon.color: root.palette.buttonText
palette.buttonText: Qt.lighter(root.palette.buttonText, 1.1) palette.buttonText: Qt.lighter(root.palette.buttonText, 1.1)
} }
PropertyChanges {
target: parent.children[index].background
icon.color: root.palette.buttonText
border.color: Qt.lighter(root.palette.buttonText, 1.1)
}
}, },
State { State {
name: "focused" name: "focused"
@@ -88,11 +75,6 @@ RowLayout {
icon.color: root.palette.buttonText icon.color: root.palette.buttonText
palette.buttonText: root.palette.buttonText palette.buttonText: root.palette.buttonText
} }
PropertyChanges {
target: parent.children[index].background
icon.color: root.palette.buttonText
border.color: root.palette.buttonText
}
} }
] ]