summaryrefslogtreecommitdiff
path: root/kde-plasma/kscreenlocker/files/kscreenlocker-6.1.2-greeter-unlock-button.patch
blob: 7fc6a2e5e2254dd93ded1f897db911e32fdb2c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From 6297d4d2e37abadfab0f7389aec9aa4af7f928bc Mon Sep 17 00:00:00 2001
From: Xaver Hugl <xaver.hugl@gmail.com>
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 <xaver.hugl@gmail.com>
---
 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