File fix-sddm-theme-logic.diff of Package plasma5-workspace

From 70fc5cc70281abad8e50ae17a9d0d90817488813 Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <larrosa@kde.org>
Date: Fri, 21 Oct 2016 14:33:04 +0200
Subject: [PATCH] Directly show the username/password textboxes when user list
 is empty

Summary:
If the user list is empty (for example, because regular users are hidden
or sddm's configuration includes something like MinimumUid=2000)
show directly the username/password textboxes instead of an empty
user list.

Test Plan:
I edited /etc/sddm.conf and added MinimumUid=2000 to the [Users] group,
then restarted sddm.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D3128
---
 sddm-theme/Main.qml | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sddm-theme/Main.qml b/sddm-theme/Main.qml
index 4230cbe..9078743 100644
--- a/sddm-theme/Main.qml
+++ b/sddm-theme/Main.qml
@@ -90,7 +90,15 @@ PlasmaCore.ColorScope {
             id: userListComponent
             userListModel: userModel
             userListCurrentIndex: userModel.lastIndex >= 0 ? userModel.lastIndex : 0
-            showUserList: (userListModel.count && userListModel.disableAvatarsThreshold) ? userListModel.count <= userListModel.disableAvatarsThreshold : true
+            showUserList: {
+                 if ( !userListModel.hasOwnProperty("count")
+                   || !userListModel.hasOwnProperty("disableAvatarsThreshold"))
+                     return true
+
+                 if ( userListModel.count == 0 ) return false
+
+                 return userListModel.count <= userListModel.disableAvatarsThreshold
+            }
 
             notificationMessage: {
                 var text = ""
-- 
2.10.1

openSUSE Build Service is sponsored by