Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-plasma/user-manager/files/, kde-plasma/user-manager/
Date: Wed, 16 May 2018 16:13:04
Message-Id: 1526487171.5b9b31ac57650d34987d52a2d5768f80aea92eaf.asturm@gentoo
commit:     5b9b31ac57650d34987d52a2d5768f80aea92eaf
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed May 16 16:11:34 2018 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed May 16 16:12:51 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b9b31ac

kde-plasma/user-manager: Fix user account list

See also: https://bugs.kde.org/show_bug.cgi?id=336994

Package-Manager: Portage-2.3.36, Repoman-2.3.9

 ...user-manager-5.12.5-fix-addAccountToCache.patch | 104 +++++++++++++++++++++
 .../user-manager/user-manager-5.12.5-r1.ebuild     |  29 ++++++
 2 files changed, 133 insertions(+)

diff --git a/kde-plasma/user-manager/files/user-manager-5.12.5-fix-addAccountToCache.patch b/kde-plasma/user-manager/files/user-manager-5.12.5-fix-addAccountToCache.patch
new file mode 100644
index 00000000000..bc823adf8c9
--- /dev/null
+++ b/kde-plasma/user-manager/files/user-manager-5.12.5-fix-addAccountToCache.patch
@@ -0,0 +1,104 @@
+From ff88e24e4380a341f70f9b005acbce2ae9afa60a Mon Sep 17 00:00:00 2001
+From: Valeriy Malov <jazzvoid@×××××.com>
+Date: Sat, 12 May 2018 18:13:25 +0300
+Subject: Split replaceAccount from addAccountToCache
+
+Summary:
+We were accidentally overwriting first account in the model with
+currently logged in user after polling AccountsService
+
+BUG: 336994
+
+Test Plan: check if kcmshell5 user_manager lists mutliple users on cold boot
+
+Reviewers: #plasma, davidedmundson
+
+Reviewed By: #plasma, davidedmundson
+
+Subscribers: davidedmundson, ngraham, rdieter, plasma-devel
+
+Tags: #plasma
+
+Differential Revision: https://phabricator.kde.org/D12837
+---
+ src/lib/accountmodel.cpp | 26 ++++++++++++++++----------
+ src/lib/accountmodel.h   |  1 +
+ 2 files changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/src/lib/accountmodel.cpp b/src/lib/accountmodel.cpp
+index 8ebc4ff..8258810 100644
+--- a/src/lib/accountmodel.cpp
++++ b/src/lib/accountmodel.cpp
+@@ -93,8 +93,8 @@ AccountModel::AccountModel(QObject* parent)
+         addAccount(path.path());
+     }
+ 
+-    //Adding fake "new user" directly into cache
+-    addAccountToCache("new-user", 0);
++    // Adding fake "new user" directly into cache
++    addAccountToCache("new-user", nullptr);
+ 
+     m_kEmailSettings.setProfile(m_kEmailSettings.defaultProfileName());
+ 
+@@ -368,11 +368,7 @@ void AccountModel::addAccount(const QString& path)
+ void AccountModel::addAccountToCache(const QString& path, Account* acc, int pos)
+ {
+     if (pos > -1) {
+-        if (m_userPath.count() > 0) {
+-            m_userPath.replace(pos, path);
+-        } else {
+-            m_userPath.insert(pos, path);
+-        }
++        m_userPath.insert(pos, path);
+     } else {
+         m_userPath.append(path);
+     }
+@@ -381,6 +377,16 @@ void AccountModel::addAccountToCache(const QString& path, Account* acc, int pos)
+     m_loggedAccounts[path] = false;
+ }
+ 
++void AccountModel::replaceAccount(const QString &path, OrgFreedesktopAccountsUserInterface *acc, int pos)
++{
++    if (pos >= m_userPath.size() || pos < 0) {
++        return;
++    }
++    m_userPath.replace(pos, path);
++
++    m_users.insert(path, acc);
++    m_loggedAccounts[path] = false;
++}
+ 
+ void AccountModel::removeAccount(const QString& path)
+ {
+@@ -429,13 +435,13 @@ void AccountModel::UserAdded(const QDBusObjectPath& dbusPath)
+     }
+     connect(acc, SIGNAL(Changed()), SLOT(Changed()));
+ 
+-    //First, we modify "new-user" to become the new created user
++    // First, we modify "new-user" to become the new created user
+     int row = rowCount();
+-    addAccountToCache(path, acc, row - 1);
++    replaceAccount(path, acc, row - 1);
+     QModelIndex changedIndex = index(row - 1, 0);
+     emit dataChanged(changedIndex, changedIndex);
+ 
+-    //Then we add new-user again.
++    // Then we add new-user again.
+     beginInsertRows(QModelIndex(), row, row);
+     addAccountToCache("new-user", 0);
+     endInsertRows();
+diff --git a/src/lib/accountmodel.h b/src/lib/accountmodel.h
+index b666239..f515613 100644
+--- a/src/lib/accountmodel.h
++++ b/src/lib/accountmodel.h
+@@ -79,6 +79,7 @@ class AccountModel : public QAbstractListModel
+         const QString accountPathForUid(uint uid) const;
+         void addAccount(const QString &path);
+         void addAccountToCache(const QString &path, OrgFreedesktopAccountsUserInterface *acc, int pos = -1);
++        void replaceAccount(const QString &path, OrgFreedesktopAccountsUserInterface *acc, int pos);
+         void removeAccount(const QString &path);
+         bool checkForErrors(QDBusPendingReply <void> reply) const;
+         QString cryptPassword(const QString &password) const;
+-- 
+cgit v0.11.2
+

diff --git a/kde-plasma/user-manager/user-manager-5.12.5-r1.ebuild b/kde-plasma/user-manager/user-manager-5.12.5-r1.ebuild
new file mode 100644
index 00000000000..7be2c877f07
--- /dev/null
+++ b/kde-plasma/user-manager/user-manager-5.12.5-r1.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit kde5
+
+DESCRIPTION="Simple system settings module to manage the users of your system"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+
+DEPEND="
+	$(add_frameworks_dep kauth)
+	$(add_frameworks_dep kcmutils)
+	$(add_frameworks_dep kconfig)
+	$(add_frameworks_dep kconfigwidgets)
+	$(add_frameworks_dep kcoreaddons)
+	$(add_frameworks_dep ki18n)
+	$(add_frameworks_dep kiconthemes)
+	$(add_frameworks_dep kio)
+	$(add_frameworks_dep kwidgetsaddons)
+	$(add_qt_dep qtdbus)
+	$(add_qt_dep qtgui)
+	$(add_qt_dep qtwidgets)
+	>=dev-libs/libpwquality-1.3.0
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}/${P}-fix-addAccountToCache.patch" )