File 0001-KUserProxy-Adjust-to-accounts-service.patch of Package kdeclarative

From 6655238c02824259a0a4f5224fb0a0b8d120e0b5 Mon Sep 17 00:00:00 2001
From: Kai Uwe Broulik <kde@privat.broulik.de>
Date: Tue, 24 Apr 2018 23:12:47 +0200
Subject: [PATCH] [KUserProxy] Adjust to accounts service

The avatar can also lie in the accounts service directory. Monitor there and also monitor for removal.
Also in the handler check all paths we monitor rather than faceIconPath which might be empty due to the file having been removed.

BUG: 384107

Differential Revision: https://phabricator.kde.org/D9951
---
 src/qmlcontrols/kcoreaddons/kuserproxy.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/qmlcontrols/kcoreaddons/kuserproxy.cpp b/src/qmlcontrols/kcoreaddons/kuserproxy.cpp
index 9d14af0..eba2eaf 100644
--- a/src/qmlcontrols/kcoreaddons/kuserproxy.cpp
+++ b/src/qmlcontrols/kcoreaddons/kuserproxy.cpp
@@ -31,6 +31,7 @@ License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 #include <QDebug>
 
 const QString etcPasswd = QStringLiteral("/etc/passwd");
+const QString accountsServiceIconPath = QStringLiteral("/var/lib/AccountsService/icons");
 
 KUserProxy::KUserProxy (QObject *parent)
     : QObject(parent),
@@ -45,12 +46,14 @@ KUserProxy::KUserProxy (QObject *parent)
     }
 
     m_dirWatch.addFile(pathToFaceIcon);
+    m_dirWatch.addFile(accountsServiceIconPath + QLatin1Char('/') + m_user.loginName());
     if (QFile::exists(etcPasswd)) {
         m_dirWatch.addFile(etcPasswd);
     }
 
     connect(&m_dirWatch, &KDirWatch::dirty, this, &KUserProxy::update);
     connect(&m_dirWatch, &KDirWatch::created, this, &KUserProxy::update);
+    connect(&m_dirWatch, &KDirWatch::deleted, this, &KUserProxy::update);
 }
 
 KUserProxy::~KUserProxy()
@@ -59,7 +62,8 @@ KUserProxy::~KUserProxy()
 
 void KUserProxy::update(const QString &path)
 {
-    if (path == m_user.faceIconPath()) {
+    if (path == m_user.faceIconPath() || path == QDir::homePath() + QLatin1String("/.face.icon")
+            || path == accountsServiceIconPath + QLatin1Char('/') + m_user.loginName()) {
         // we need to force updates, even when the path doesn't change,
         // but the underlying image does. Change path temporarily, to
         // make the Image reload.
-- 
2.16.2

openSUSE Build Service is sponsored by