File 0001-Load-user-information-once-on-startup.patch of Package kscreenlocker

From 08178c059fd3db53774de4035d54b8be0fe42cdd Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Thu, 16 Jan 2020 14:54:20 +0100
Subject: [PATCH] Load user information once on startup

Summary:
Apparently the seccomp filter can break KUser in certain setups, so load the
info before the sandbox is active.

Test Plan:
Provided a test package to the reporter on the downstream bug
(https://bugzilla.opensuse.org/show_bug.cgi?id=1160995), who reported
success.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26722
---
 greeter/greeterapp.cpp | 11 +++++++----
 greeter/greeterapp.h   |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/greeter/greeterapp.cpp b/greeter/greeterapp.cpp
index 48b7a77..4d41542 100644
--- a/greeter/greeterapp.cpp
+++ b/greeter/greeterapp.cpp
@@ -196,6 +196,11 @@ void UnlockApp::initialize()
     m_lnfIntegration->setConfig(KScreenSaverSettings::self()->sharedConfig());
     m_lnfIntegration->init();
 
+    const KUser user;
+    const QString fullName = user.property(KUser::FullName).toString();
+
+    m_userName = fullName.isEmpty() ? user.loginName() : fullName;
+    m_userImage = user.faceIconPath();
 
     installEventFilter(this);
 }
@@ -297,11 +302,9 @@ void UnlockApp::desktopResized()
 
         // engine stuff
         QQmlContext* context = view->engine()->rootContext();
-        const KUser user;
-        const QString fullName = user.property(KUser::FullName).toString();
 
-        context->setContextProperty(QStringLiteral("kscreenlocker_userName"), fullName.isEmpty() ? user.loginName() : fullName);
-        context->setContextProperty(QStringLiteral("kscreenlocker_userImage"), user.faceIconPath());
+        context->setContextProperty(QStringLiteral("kscreenlocker_userName"), m_userName);
+        context->setContextProperty(QStringLiteral("kscreenlocker_userImage"), m_userImage);
         context->setContextProperty(QStringLiteral("authenticator"), m_authenticator);
         context->setContextProperty(QStringLiteral("org_kde_plasma_screenlocker_greeter_interfaceVersion"), 2);
         context->setContextProperty(QStringLiteral("org_kde_plasma_screenlocker_greeter_view"), view);
diff --git a/greeter/greeterapp.h b/greeter/greeterapp.h
index 68cd019..c3bc4f6 100644
--- a/greeter/greeterapp.h
+++ b/greeter/greeterapp.h
@@ -110,6 +110,7 @@ private:
 
     bool m_canSuspend = false;
     bool m_canHibernate = false;
+    QString m_userName, m_userImage;
 
     KWayland::Client::ConnectionThread *m_ksldConnection = nullptr;
     KWayland::Client::Registry *m_ksldRegistry = nullptr;
-- 
2.23.0

openSUSE Build Service is sponsored by