plasma5-workspace/fix-breeze-sddm-theme-with-many-users.patch

181 lines
7.3 KiB
Diff

Index: plasma-workspace-5.4.3/lookandfeel/contents/components/UserSelect.qml
===================================================================
--- plasma-workspace-5.4.3.orig/lookandfeel/contents/components/UserSelect.qml 2015-11-11 16:10:23.021419038 +0100
+++ plasma-workspace-5.4.3/lookandfeel/contents/components/UserSelect.qml 2015-11-11 15:25:12.570242837 +0100
@@ -27,10 +27,14 @@ FocusScope {
id: root
property alias model: usersList.model
property alias selectedUser: usersList.selectedUser
+ property var username: usersList.visible ? usersList.selectedUser : userPasswordPrompt.username
+ property alias password: userPasswordPrompt.password
property alias selectedIndex: usersList.currentIndex
property alias selectedItem: usersList.currentItem
property alias delegate: usersList.delegate
property alias notification: notificationLabel.text
+ property bool showUserList: (usersList.model.count && usersList.model.disableAvatarsThreshold) ? usersList.model.count <= usersList.model.disableAvatarsThreshold : true
+ property alias pwFieldEnabled: userPasswordPrompt.pwFieldEnabled
activeFocusOnTab: true
@@ -42,6 +46,10 @@ FocusScope {
usersList.decrementCurrentIndex()
}
+ function reenablePasswordInput() {
+ userPasswordPrompt.reenablePasswordInput();
+ }
+
InfoPane {
id: infoPane
anchors {
@@ -55,6 +63,7 @@ FocusScope {
id: usersList
focus: true
+ visible: root.showUserList
Rectangle {//debug
visible: debug
@@ -85,6 +94,21 @@ FocusScope {
}
}
+ UserPasswordPrompt {
+ id: userPasswordPrompt
+
+ focus: true
+ visible: !root.showUserList
+
+ anchors {
+ left: parent.horizontalCenter
+ top: parent.top
+ right: parent.right
+
+ topMargin: parent.height*0.2
+ }
+ }
+
BreezeLabel {
id: notificationLabel
anchors {
Index: plasma-workspace-5.4.3/lookandfeel/contents/components/UserPasswordPrompt.qml
===================================================================
--- plasma-workspace-5.4.3.orig/lookandfeel/contents/components/UserPasswordPrompt.qml 2015-11-11 16:14:28.277434982 +0100
+++ plasma-workspace-5.4.3/lookandfeel/contents/components/UserPasswordPrompt.qml 2015-11-11 15:25:12.528242834 +0100
@@ -0,0 +1,54 @@
+import QtQuick 2.2
+import SddmComponents 2.0
+import QtQuick.Layouts 1.1
+import org.kde.plasma.components 2.0 as PlasmaComponents
+
+Rectangle {
+ readonly property string username: usernameInput.text
+ readonly property string password: passwordInput.text
+ property alias pwFieldEnabled: passwordInput.enabled
+ color: "transparent"
+
+ function reenablePasswordInput() {
+ passwordInput.enabled = true
+ passwordInput.selectAll()
+ passwordInput.forceActiveFocus()
+ }
+
+ ColumnLayout {
+ anchors.fill: parent
+ PlasmaComponents.TextField {
+ id: usernameInput
+ placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Username")
+ onAccepted: nextItemInFocusChain().forceActiveFocus();
+ focus: true
+ text: userModel.lastUser
+ }
+
+ PlasmaComponents.TextField {
+ id: passwordInput
+ placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Password")
+ echoMode: TextInput.Password
+ onAccepted: loginPrompt.startLogin()
+ focus: true
+
+ //focus works in qmlscene
+ //but this seems to be needed when loaded from SDDM
+ //I don't understand why, but we have seen this before in the old lock screen
+ Timer {
+ interval: 200
+ running: parent.visible
+ onTriggered: passwordInput.forceActiveFocus()
+ }
+ //end hack
+
+ Keys.onEscapePressed: {
+ //nextItemInFocusChain(false) is previous Item
+ nextItemInFocusChain(false).forceActiveFocus();
+ }
+
+ }
+
+ } // ColumnLayout
+
+}
Index: plasma-workspace-5.4.3/lookandfeel/contents/loginmanager/Main.qml
===================================================================
--- plasma-workspace-5.4.3.orig/lookandfeel/contents/loginmanager/Main.qml 2015-11-05 13:49:30.000000000 +0100
+++ plasma-workspace-5.4.3/lookandfeel/contents/loginmanager/Main.qml 2015-11-11 15:25:12.832242854 +0100
@@ -74,6 +74,9 @@ Image {
initialItem: BreezeBlock {
id: loginPrompt
+ property var showUserList: mainItem.showUserList
+ property var username: mainItem.username
+ property var password: mainItem.showUserList ? controlsItem.password : mainItem.password
//Enable clipping whilst animating, otherwise the items would be shifted to other screens in multiscreen setups
//As there are only 2 items (loginPrompt and logoutScreenComponent), it's sufficient to do it only in this component
@@ -129,13 +132,14 @@ Image {
echoMode: TextInput.Password
onAccepted: loginPrompt.startLogin()
focus: true
+ visible: loginPrompt.mainItem.showUserList
//focus works in qmlscene
//but this seems to be needed when loaded from SDDM
//I don't understand why, but we have seen this before in the old lock screen
Timer {
interval: 200
- running: true
+ running: passwordInput.visible
onTriggered: passwordInput.forceActiveFocus()
}
//end hack
@@ -221,9 +225,13 @@ Image {
target: sddm
onLoginFailed: {
//Re-enable button and textfield
- passwordInput.enabled = true
- passwordInput.selectAll()
- passwordInput.forceActiveFocus()
+ if (loginPrompt.showUserList) {
+ passwordInput.enabled = true
+ passwordInput.selectAll()
+ passwordInput.forceActiveFocus()
+ } else {
+ loginPrompt.mainItem.reenablePasswordInput(true);
+ }
loginButton.enabled = true;
}
}
@@ -232,11 +240,12 @@ Image {
function startLogin () {
//Disable button and textfield while password check is running
+ loginPrompt.mainItem.pwFieldEnabled = false
controlsItem.pwFieldEnabled = false;
controlsItem.buttonEnabled = false;
//Clear notification in case the notificationResetTimer hasn't expired yet
mainItem.notification = ""
- sddm.login(mainItem.selectedUser, controlsItem.password, controlsItem.sessionIndex)
+ sddm.login(loginPrompt.username, loginPrompt.password, controlsItem.sessionIndex)
}
Component {