commit:     8bccc0d6db2283430ff320ad85f6d1db088c7a0e
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  8 17:00:21 2024 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Jul  8 17:55:02 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8bccc0d6

kde-plasma/kscreenlocker: Fix redundant unlock button

KDE-bug: https://bugs.kde.org/show_bug.cgi?id=485520

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...kscreenlocker-6.1.2-greeter-unlock-button.patch | 85 ++++++++++++++++++++++
 .../kscreenlocker/kscreenlocker-6.1.2-r1.ebuild    | 82 +++++++++++++++++++++
 2 files changed, 167 insertions(+)

diff --git 
a/kde-plasma/kscreenlocker/files/kscreenlocker-6.1.2-greeter-unlock-button.patch
 
b/kde-plasma/kscreenlocker/files/kscreenlocker-6.1.2-greeter-unlock-button.patch
new file mode 100644
index 000000000000..7fc6a2e5e225
--- /dev/null
+++ 
b/kde-plasma/kscreenlocker/files/kscreenlocker-6.1.2-greeter-unlock-button.patch
@@ -0,0 +1,85 @@
+From 6297d4d2e37abadfab0f7389aec9aa4af7f928bc Mon Sep 17 00:00:00 2001
+From: Xaver Hugl <[email protected]>
+Date: Tue, 2 Jul 2024 20:07:06 +0000
+Subject: [PATCH] greeter/authenticators: add a property for if a prompt was
+ shown in the past
+
+This is needed to properly check for whether or not to show an unlock button
+
+CCBUG: 485520
+
+
+(cherry picked from commit bc1e4a18ce37d1f40cb6a50acf3d9c53b052bf5e)
+
+Co-authored-by: Xaver Hugl <[email protected]>
+---
+ greeter/pamauthenticators.cpp | 14 ++++++++++++++
+ greeter/pamauthenticators.h   |  5 +++++
+ 2 files changed, 19 insertions(+)
+
+diff --git a/greeter/pamauthenticators.cpp b/greeter/pamauthenticators.cpp
+index 8fcbb6d5..d564420 100644
+--- a/greeter/pamauthenticators.cpp
++++ b/greeter/pamauthenticators.cpp
+@@ -17,6 +17,7 @@ struct PamAuthenticators::Private {
+     PamAuthenticator::NoninteractiveAuthenticatorTypes computedTypes = 
PamAuthenticator::NoninteractiveAuthenticatorType::None;
+     AuthenticatorsState state = AuthenticatorsState::Idle;
+     bool graceLocked = false;
++    bool hadPrompt = false;
+ 
+     void recomputeNoninteractiveAuthenticationTypes()
+     {
+@@ -83,10 +84,18 @@ 
PamAuthenticators::PamAuthenticators(std::unique_ptr<PamAuthenticator> &&interac
+         Q_EMIT busyChanged();
+     });
+     connect(d->interactive.get(), &PamAuthenticator::prompt, this, [this] {
++        if (!d->hadPrompt) {
++            d->hadPrompt = true;
++            Q_EMIT hadPromptChanged();
++        }
+         qCDebug(KSCREENLOCKER_GREET) << "PamAuthenticators: Normal prompt 
from interactive authenticator" << qUtf8Printable(d->interactive->service());
+         Q_EMIT promptChanged();
+     });
+     connect(d->interactive.get(), &PamAuthenticator::promptForSecret, this, 
[this] {
++        if (!d->hadPrompt) {
++            d->hadPrompt = true;
++            Q_EMIT hadPromptChanged();
++        }
+         qCDebug(KSCREENLOCKER_GREET) << "PamAuthenticators: Secret prompt 
from interactive authenticator" << qUtf8Printable(d->interactive->service());
+         Q_EMIT promptForSecretChanged();
+     });
+@@ -198,3 +207,8 @@ void PamAuthenticators::setGraceLocked(bool b)
+ {
+     d->graceLocked = b;
+ }
++
++bool PamAuthenticators::hadPrompt() const
++{
++    return d->hadPrompt;
++}
+diff --git a/greeter/pamauthenticators.h b/greeter/pamauthenticators.h
+index e82f77b..9184e7e 100644
+--- a/greeter/pamauthenticators.h
++++ b/greeter/pamauthenticators.h
+@@ -31,6 +31,8 @@ class PamAuthenticators : public QObject
+ 
+     Q_PROPERTY(AuthenticatorsState state READ state NOTIFY stateChanged)
+ 
++    Q_PROPERTY(bool hadPrompt READ hadPrompt NOTIFY hadPromptChanged)
++
+ public:
+     PamAuthenticators(std::unique_ptr<PamAuthenticator> &&interactive,
+                       std::vector<std::unique_ptr<PamAuthenticator>> 
&&noninteractive,
+@@ -78,6 +80,9 @@ public:
+ 
+     void setGraceLocked(bool b);
+ 
++    bool hadPrompt() const;
++    Q_SIGNAL void hadPromptChanged();
++
+ private:
+     struct Private;
+     QScopedPointer<Private> d;
+-- 
+2.45.2
+

diff --git a/kde-plasma/kscreenlocker/kscreenlocker-6.1.2-r1.ebuild 
b/kde-plasma/kscreenlocker/kscreenlocker-6.1.2-r1.ebuild
new file mode 100644
index 000000000000..ab2b1699cdf0
--- /dev/null
+++ b/kde-plasma/kscreenlocker/kscreenlocker-6.1.2-r1.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_TEST="forceoptional"
+KFMIN=6.3.0
+PVCUT=$(ver_cut 1-3)
+QTMIN=6.7.1
+inherit ecm plasma.kde.org pam
+
+DESCRIPTION="Library and components for secure lock screen architecture"
+
+LICENSE="GPL-2" # TODO: CHECK
+SLOT="6"
+KEYWORDS="~amd64 ~arm64 ~riscv"
+IUSE=""
+
+RESTRICT="test"
+
+# qtbase slot op: GuiPrivate use in greeter
+COMMON_DEPEND="
+       dev-libs/wayland
+       >=dev-qt/qtbase-${QTMIN}:6=[dbus,gui,network,widgets]
+       >=dev-qt/qtdeclarative-${QTMIN}:6
+       >=kde-frameworks/kcmutils-${KFMIN}:6
+       >=kde-frameworks/kconfig-${KFMIN}:6[qml]
+       >=kde-frameworks/kconfigwidgets-${KFMIN}:6
+       >=kde-frameworks/kcoreaddons-${KFMIN}:6
+       >=kde-frameworks/kcrash-${KFMIN}:6
+       >=kde-frameworks/kglobalaccel-${KFMIN}:6
+       >=kde-frameworks/ki18n-${KFMIN}:6
+       >=kde-frameworks/kidletime-${KFMIN}:6
+       >=kde-frameworks/kio-${KFMIN}:6
+       >=kde-frameworks/knotifications-${KFMIN}:6
+       >=kde-frameworks/ksvg-${KFMIN}:6
+       >=kde-frameworks/kwindowsystem-${KFMIN}:6
+       >=kde-frameworks/solid-${KFMIN}:6
+       >=kde-plasma/layer-shell-qt-${PVCUT}:6
+       >=kde-plasma/libplasma-${PVCUT}:6
+       >=kde-plasma/libkscreen-${PVCUT}:6
+       sys-libs/pam
+       x11-libs/libX11
+       x11-libs/libXi
+       x11-libs/libxcb
+       x11-libs/xcb-util-keysyms
+"
+DEPEND="${COMMON_DEPEND}
+       x11-base/xorg-proto
+"
+RDEPEND="${COMMON_DEPEND}
+       >=kde-frameworks/kirigami-${KFMIN}:6
+       >=kde-plasma/libplasma-${PVCUT}:6
+"
+BDEPEND="
+       dev-util/wayland-scanner
+       >=kde-frameworks/kcmutils-${KFMIN}:6
+"
+PDEPEND=">=kde-plasma/kde-cli-tools-${PVCUT}:*"
+
+PATCHES=( "${FILESDIR}/${P}-greeter-unlock-button.patch" ) # KDE-bug 485520
+
+src_prepare() {
+       ecm_src_prepare
+       use test || cmake_run_in greeter cmake_comment_add_subdirectory 
autotests
+}
+
+src_test() {
+       # requires running environment
+       local myctestargs=(
+               -E x11LockerTest
+       )
+       ecm_src_test
+}
+
+src_install() {
+       ecm_src_install
+
+       newpamd "${FILESDIR}/kde-r1.pam" kde
+       newpamd "${FILESDIR}/kde-fingerprint.pam" kde-fingerprint
+       newpamd "${FILESDIR}/kde-smartcard.pam" kde-smartcard
+}

Reply via email to