Hello community,

here is the log from the commit of package sddm for openSUSE:Factory checked in 
at 2015-11-24 22:28:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/sddm (Old)
 and      /work/SRC/openSUSE:Factory/.sddm.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "sddm"

Changes:
--------
--- /work/SRC/openSUSE:Factory/sddm/sddm.changes        2015-11-12 
19:39:32.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.sddm.new/sddm.changes   2015-11-24 
22:28:46.000000000 +0100
@@ -1,0 +2,20 @@
+Fri Nov 20 15:00:22 UTC 2015 - [email protected]
+
+- Renamed config option and property from UsersThresholdToDisableAvatars
+  to DisableAvatarsThreshold as proposed by upstream before accepting
+  the patches.
+
+-------------------------------------------------------------------
+Wed Nov 11 14:34:21 UTC 2015 - [email protected]
+
+- Add patch add-count-property-to-UserModel.patch: Adds a property so
+  sddm themes can access the number of users in the system
+- Add patch specify-default-config-entries.patch: Stores which config
+  values have been read from the config file or are just default values.
+- Add patch add-threshold-to-disable-avatars.patch: Adds a config option
+  and property named UsersThresholdToDisableAvatars, if the number of
+  users in the system is greater than the threshold, use a default avatar
+  for all users and disable avatar loading.
+- These patches together with patches in plasma5-workspace fix bnc#953778
+
+-------------------------------------------------------------------

New:
----
  add-count-property-to-UserModel.patch
  add-threshold-to-disable-avatars.patch
  specify-default-config-entries.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ sddm.spec ++++++
--- /var/tmp/diff_new_pack.4TZF8w/_old  2015-11-24 22:28:47.000000000 +0100
+++ /var/tmp/diff_new_pack.4TZF8w/_new  2015-11-24 22:28:47.000000000 +0100
@@ -51,6 +51,12 @@
 Patch6:         0001-Add-a-config-option-to-enable-avatars.patch
 # PATCH-FIX-UPSTREAM 
0002-Use-.face.icon-instead-of-default.face.icon-and-rena.patch -- Use new face 
icons
 Patch7:         0002-Use-.face.icon-instead-of-default.face.icon-and-rena.patch
+# PATCH-FIX-UPSTREAM add-count-property-to-UserModel.patch -- Adds a new 
property so themes can use it
+Patch8:         add-count-property-to-UserModel.patch
+# PATCH-FIX-UPSTREAM specify-default-config-entries.patch -- Specify which 
config entries are a default and which come from the config file
+Patch9:         specify-default-config-entries.patch
+# PATCH-FIX-UPSTREAM add-threshold-to-disable-avatars.patch -- Add a config 
option/property to define a thershold above which avatars are disabled 
automatically
+Patch10:        add-threshold-to-disable-avatars.patch
 BuildRequires:  cmake
 BuildRequires:  fdupes
 BuildRequires:  kf5-filesystem
@@ -115,6 +121,9 @@
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
 cp %{SOURCE3} data/faces/default.face.icon.png
 cp %{SOURCE4} data/faces/root.face.icon.png
 

++++++ add-count-property-to-UserModel.patch ++++++
Index: sddm-0.13.0/src/greeter/UserModel.h
===================================================================
--- sddm-0.13.0.orig/src/greeter/UserModel.h
+++ sddm-0.13.0/src/greeter/UserModel.h
@@ -32,6 +32,7 @@ namespace SDDM {
         Q_DISABLE_COPY(UserModel)
         Q_PROPERTY(int lastIndex READ lastIndex CONSTANT)
         Q_PROPERTY(QString lastUser READ lastUser CONSTANT)
+        Q_PROPERTY(int count READ rowCount CONSTANT)
     public:
         enum UserRoles {
             NameRole = Qt::UserRole + 1,
++++++ add-threshold-to-disable-avatars.patch ++++++
Index: sddm-0.13.0/src/greeter/UserModel.cpp
===================================================================
--- sddm-0.13.0.orig/src/greeter/UserModel.cpp
+++ sddm-0.13.0/src/greeter/UserModel.cpp
@@ -51,6 +51,9 @@ namespace SDDM {
     };
 
     UserModel::UserModel(QObject *parent) : QAbstractListModel(parent), d(new 
UserModelPrivate()) {
+        const QString facesDir = mainConfig.Theme.FacesDir.get();
+        const QString defaultFace = 
QStringLiteral("%1/.face.icon").arg(facesDir);
+
         struct passwd *current_pw;
         while ((current_pw = getpwent()) != nullptr) {
 
@@ -81,23 +84,7 @@ namespace SDDM {
             user->needsPassword = strcmp(current_pw->pw_passwd, "") != 0;
 
             // search for face icon
-            QString facesDir = mainConfig.Theme.FacesDir.get();
-            QString defaultFace = 
QStringLiteral("%1/.face.icon").arg(facesDir);
-            bool avatarsEnabled = mainConfig.Theme.EnableAvatars.get();
-
-            if (avatarsEnabled) {
-                QString userFace = 
QStringLiteral("%1/.face.icon").arg(user->homeDir);
-                QString systemFace = 
QStringLiteral("%1/%2.face.icon").arg(facesDir).arg(user->name);
-
-                if (QFile::exists(userFace))
-                    user->icon = userFace;
-                else if (QFile::exists(systemFace))
-                    user->icon = systemFace;
-                else
-                    user->icon = defaultFace;
-            } else {
-                user->icon = defaultFace;
-            }
+            user->icon = defaultFace;
 
             // add user
             d->users << user;
@@ -108,10 +95,26 @@ namespace SDDM {
         // sort users by username
         std::sort(d->users.begin(), d->users.end(), [&](const UserPtr &u1, 
const UserPtr &u2) { return u1->name < u2->name; });
 
+        bool avatarsEnabled = mainConfig.Theme.EnableAvatars.get();
+        if (avatarsEnabled && mainConfig.Theme.EnableAvatars.isDefault()) {
+            if (d->users.count() > 
mainConfig.Theme.DisableAvatarsThreshold.get()) avatarsEnabled=false;
+        }
+
         // find out index of the last user
         for (int i = 0; i < d->users.size(); ++i) {
-            if (d->users.at(i)->name == stateConfig.Last.User.get())
+            UserPtr user { d->users.at(i) };
+            if (user->name == stateConfig.Last.User.get())
                 d->lastIndex = i;
+
+            if (avatarsEnabled) {
+                const QString userFace = 
QStringLiteral("%1/.face.icon").arg(user->homeDir);
+                const QString systemFace = 
QStringLiteral("%1/%2.face.icon").arg(facesDir).arg(user->name);
+
+                if (QFile::exists(userFace))
+                    user->icon = userFace;
+                else if (QFile::exists(systemFace))
+                    user->icon = systemFace;
+            }
         }
     }
 
@@ -165,4 +168,8 @@ namespace SDDM {
         // return empty value
         return QVariant();
     }
+
+    int UserModel::disableAvatarsThreshold() const {
+        return mainConfig.Theme.DisableAvatarsThreshold.get();
+    }
 }
Index: sddm-0.13.0/src/common/Configuration.h
===================================================================
--- sddm-0.13.0.orig/src/common/Configuration.h
+++ sddm-0.13.0/src/common/Configuration.h
@@ -50,6 +50,9 @@ namespace SDDM {
                                                                                
                    "The files should be in username.face.icon format"));
             Entry(CursorTheme,         QString,     QString(),                 
                 _S("Cursor theme"));
             Entry(EnableAvatars,       bool,        true,                      
                 _S("Enable display of custom user avatars"));
+            Entry(DisableAvatarsThreshold,int,      7,                         
                 _S("Number of users to use as threshold\n"
+                                                                               
                    "above which avatars are disabled\n"
+                                                                               
                    "unless explicitly enabled with EnableAvatars"));
         );
         // TODO: Not absolutely sure if everything belongs here. Xsessions, VT 
and probably some more seem universal
         Section(XDisplay,
Index: sddm-0.13.0/src/greeter/UserModel.h
===================================================================
--- sddm-0.13.0.orig/src/greeter/UserModel.h
+++ sddm-0.13.0/src/greeter/UserModel.h
@@ -33,6 +33,7 @@ namespace SDDM {
         Q_PROPERTY(int lastIndex READ lastIndex CONSTANT)
         Q_PROPERTY(QString lastUser READ lastUser CONSTANT)
         Q_PROPERTY(int count READ rowCount CONSTANT)
+        Q_PROPERTY(int disableAvatarsThreshold READ disableAvatarsThreshold 
CONSTANT)
     public:
         enum UserRoles {
             NameRole = Qt::UserRole + 1,
@@ -53,6 +54,7 @@ namespace SDDM {
         int rowCount(const QModelIndex &parent = QModelIndex()) const override;
         QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) 
const override;
 
+        int disableAvatarsThreshold() const;
     private:
         UserModelPrivate *d { nullptr };
     };


++++++ specify-default-config-entries.patch ++++++
Index: sddm-0.13.0/src/common/ConfigReader.cpp
===================================================================
--- sddm-0.13.0.orig/src/common/ConfigReader.cpp
+++ sddm-0.13.0/src/common/ConfigReader.cpp
@@ -186,17 +186,17 @@ namespace SDDM {
          * Initialization of the map of nondefault values to be saved
          */
         if (section) {
-            if (entry && !entry->isDefault())
+            if (entry && !entry->matchesDefault())
                 remainingEntries.insert(section, entry);
             else
                 for (const ConfigEntryBase *b : section->entries().values())
-                    if (!b->isDefault())
+                    if (!b->matchesDefault())
                         remainingEntries.insert(section, b);
         }
         else {
             for (const ConfigSection *s : m_sections)
                 for (const ConfigEntryBase *b : s->entries().values())
-                    if (!b->isDefault())
+                    if (!b->matchesDefault())
                         remainingEntries.insert(s, b);
         }
 
Index: sddm-0.13.0/src/common/ConfigReader.h
===================================================================
--- sddm-0.13.0.orig/src/common/ConfigReader.h
+++ sddm-0.13.0/src/common/ConfigReader.h
@@ -77,6 +77,7 @@ namespace SDDM {
         virtual void setValue(const QString &str) = 0;
         virtual QString toConfigShort() const = 0;
         virtual QString toConfigFull() const = 0;
+        virtual bool matchesDefault() const = 0;
         virtual bool isDefault() const = 0;
     };
 
@@ -107,6 +108,7 @@ namespace SDDM {
             m_description(description),
             m_default(value),
             m_value(value),
+            m_isDefault(true),
             m_parent(parent) {
             m_parent->m_entries[name] = this;
         }
@@ -117,13 +119,19 @@ namespace SDDM {
 
         void set(const T val) {
             m_value = val;
+            m_isDefault = false;
         }
 
-        bool isDefault() const {
+        bool matchesDefault() const {
             return m_value == m_default;
         }
 
+        bool isDefault() const {
+            return m_isDefault;
+        }
+
         bool setDefault() {
+            m_isDefault = true;
             if (m_value == m_default)
                 return false;
             m_value = m_default;
@@ -147,6 +155,7 @@ namespace SDDM {
 
         // specialised for QString
         void setValue(const QString &str) {
+            m_isDefault = false;
             QTextStream in(qPrintable(str));
             in >> m_value;
         }
@@ -167,6 +176,7 @@ namespace SDDM {
         const QString m_description;
         T m_default;
         T m_value;
+        bool m_isDefault;
         ConfigSection *m_parent;
     };
 

Reply via email to