diff --git a/greeter/greeterapp.h b/greeter/greeterapp.h --- a/greeter/greeterapp.h +++ b/greeter/greeterapp.h @@ -110,6 +110,7 @@ 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; diff --git a/greeter/greeterapp.cpp b/greeter/greeterapp.cpp --- a/greeter/greeterapp.cpp +++ b/greeter/greeterapp.cpp @@ -196,6 +196,11 @@ 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 @@ // 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);