File: upstream_40daa686_Add-notification-sound-to-authentication-dialog.patch

package info (click to toggle)
polkit-kde-agent-1 4%3A6.3.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 804 kB
  • sloc: cpp: 581; xml: 29; sh: 3; makefile: 3
file content (111 lines) | stat: -rw-r--r-- 3,775 bytes parent folder | download
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From 40daa6866264a51dfc15ae4487e6a3883a455147 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bogdan=20Cvetanovski=20Pa=C5=A1ali=C4=87?=
 <wackyideas@disroot.org>
Date: Sun, 27 Apr 2025 13:25:14 +0000
Subject: [PATCH] Add notification sound to authentication dialog

This commit fixes the notification event not activating when the
authentication dialog window appears, causing it to not play a sound.

Now, it plays `dialog-warning-auth`, which currently falls back to
`dialog-warning` if the desires sound is not found in the active sound
theme.

BUG: 448554
FIXED-IN: 6.4.0
---
 .kde-ci.yml                                                  | 1 +
 CMakeLists.txt                                               | 4 +++-
 QuickAuthDialog.cpp                                          | 5 ++++-
 ...de.notifyrc => polkit-kde-authentication-agent-1.notifyrc | 3 ++-
 4 files changed, 10 insertions(+), 3 deletions(-)
 rename policykit1-kde.notifyrc => polkit-kde-authentication-agent-1.notifyrc (99%)

diff --git a/.kde-ci.yml b/.kde-ci.yml
index 710cf40..a00ce49 100644
--- a/.kde-ci.yml
+++ b/.kde-ci.yml
@@ -9,6 +9,7 @@ Dependencies:
     'frameworks/kcrash': '@latest-kf6'
     'frameworks/kdbusaddons': '@latest-kf6'
     'frameworks/ki18n': '@latest-kf6'
+    'frameworks/knotifications': '@latest-kf6'
     'frameworks/kwindowsystem': '@latest-kf6'
     'libraries/polkit-qt-1': '@latest-kf6'
 Options:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d9532c6..86cc2bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,6 +30,7 @@ find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED Core DBus Widgets Quick Qml)
 find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
   I18n
   WindowSystem
+  Notifications
   DBusAddons
   CoreAddons
   Crash
@@ -78,6 +79,7 @@ target_link_libraries(polkit-kde-authentication-agent-1
     KF6::I18n
     KF6::Crash
     KF6::I18nQml
+    KF6::Notifications
     Qt::Qml
     Qt::Quick
     Qt::Widgets
@@ -93,7 +95,7 @@ install(FILES ${CMAKE_BINARY_DIR}/polkit-kde-authentication-agent-1.desktop DEST
 
 ecm_install_configured_files(INPUT plasma-polkit-agent.service.in DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR})
 
-install(FILES policykit1-kde.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR})
+install(FILES polkit-kde-authentication-agent-1.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR})
 
 # add clang-format target for all our real source files
 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
diff --git a/QuickAuthDialog.cpp b/QuickAuthDialog.cpp
index 4205652..7e9eae5 100644
--- a/QuickAuthDialog.cpp
+++ b/QuickAuthDialog.cpp
@@ -4,7 +4,6 @@
 
     SPDX-License-Identifier: GPL-2.0-or-later
 */
-
 #include "QuickAuthDialog.h"
 #include "IdentitiesModel.h"
 
@@ -12,6 +11,7 @@
 
 #include <KLocalizedQmlContext>
 #include <KLocalizedString>
+#include <KNotification>
 #include <KRuntimePlatform>
 #include <KUser>
 
@@ -106,6 +106,9 @@ void QuickAuthDialog::authenticationFailure()
 
 void QuickAuthDialog::show()
 {
+    KNotification *notification = new KNotification("authenticate");
+    notification->setText(i18n("Authentication Required"));
+    notification->sendEvent();
     QTimer::singleShot(0, m_theDialog, SLOT(show()));
 }
 
diff --git a/policykit1-kde.notifyrc b/polkit-kde-authentication-agent-1.notifyrc
similarity index 99%
rename from policykit1-kde.notifyrc
rename to polkit-kde-authentication-agent-1.notifyrc
index 4f68209..0eb1e8d 100644
--- a/policykit1-kde.notifyrc
+++ b/polkit-kde-authentication-agent-1.notifyrc
@@ -218,4 +218,5 @@ Comment[vi]=Bạn được yêu cầu xác thực
 Comment[x-test]=xxYou are required to authenticatexx
 Comment[zh_CN]=您需要进行身份验证
 Comment[zh_TW]=您需要認證
-Action=Popup
+Action=Sound
+Sound=dialog-warning-auth
-- 
GitLab