File fix-breeze-sddm-theme-with-many-users.patch of Package plasma5-workspace.openSUSE_Leap_42.1_Update

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,9 +27,13 @@
     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 delegate: usersList.delegate
     property alias notification: notificationLabel.text
+    property bool  showUserList: (usersList.model.count && usersList.model.usersThresholdToDisableAvatars) ? usersList.model.count <= usersList.model.usersThresholdToDisableAvatars : true
+    property alias pwFieldEnabled: userPasswordPrompt.pwFieldEnabled
 
     activeFocusOnTab: true
 
@@ -41,6 +45,10 @@
         usersList.decrementCurrentIndex()
     }
 
+    function reenablePasswordInput() {
+        userPasswordPrompt.reenablePasswordInput();
+    }
+
     InfoPane {
         id: infoPane
         anchors {
@@ -54,6 +62,7 @@
         id: usersList
 
         focus: true
+        visible: root.showUserList
 
         Rectangle {//debug
             visible: debug
@@ -84,6 +93,21 @@
         }
     }
 
+    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
@@ -71,6 +71,9 @@
 
         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
@@ -126,13 +129,14 @@
                             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
@@ -218,9 +222,13 @@
                     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;
                     }
                 }
@@ -229,11 +237,12 @@
 
             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 {
openSUSE Build Service is sponsored by