The nixpkgs patch is to clear out a conflict with a patch that's applied to plasma-workspace by nixpkgs
102 lines
4.5 KiB
Diff
102 lines
4.5 KiB
Diff
From 9fabf42c39a25308739dd3483881cc889243bf58 Mon Sep 17 00:00:00 2001
|
|
From: Kristen McWilliam <kristen@kde.org>
|
|
Date: Tue, 24 Jun 2025 17:44:33 -0400
|
|
Subject: [PATCH] applets/notifications: Add actions to missed notifications
|
|
notification
|
|
|
|
When a notification is displayed informing the user that notifications were missed while in Do Not
|
|
Disturb, now clicking the button or the notification itself will open the notifications applet to
|
|
show the missed notifications.
|
|
|
|
BUG: 502423
|
|
---
|
|
.../package/contents/ui/main.qml | 10 ++++++
|
|
libnotificationmanager/notifications.cpp | 34 ++++++++++++++-----
|
|
libnotificationmanager/notifications.h | 7 ++++
|
|
3 files changed, 42 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/applets/notifications/package/contents/ui/main.qml b/applets/notifications/package/contents/ui/main.qml
|
|
index c96afa0558d..ab66a52f45e 100644
|
|
--- a/applets/notifications/package/contents/ui/main.qml
|
|
+++ b/applets/notifications/package/contents/ui/main.qml
|
|
@@ -268,4 +268,14 @@ PlasmoidItem {
|
|
Component.onDestruction: {
|
|
Globals.forget(root);
|
|
}
|
|
+
|
|
+ Connections {
|
|
+ target: Globals.popupNotificationsModel
|
|
+
|
|
+ // The user requested to show the notifications popup, probably by
|
|
+ // clicking the "Missed Notifications in Do Not Disturb" notification.
|
|
+ function onShowNotificationsRequested(): void {
|
|
+ root.expanded = true;
|
|
+ }
|
|
+ }
|
|
}
|
|
diff --git a/libnotificationmanager/notifications.cpp b/libnotificationmanager/notifications.cpp
|
|
index 2cba1360b10..7b5cd9d68c4 100644
|
|
--- a/libnotificationmanager/notifications.cpp
|
|
+++ b/libnotificationmanager/notifications.cpp
|
|
@@ -903,15 +903,31 @@ void Notifications::showInhibitionSummary(Urgency urgency, const QStringList &bl
|
|
return;
|
|
}
|
|
|
|
- KNotification::event(u"inhibitionSummary"_s,
|
|
- i18ncp("@title", "Unread Notification", "Unread Notifications", inhibited),
|
|
- i18ncp("@info",
|
|
- "%1 notification was received while Do Not Disturb was active.",
|
|
- "%1 notifications were received while Do Not Disturb was active.",
|
|
- inhibited),
|
|
- u"preferences-desktop-notification-bell"_s,
|
|
- KNotification::CloseOnTimeout,
|
|
- u"libnotificationmanager"_s);
|
|
+ KNotification *notification = new KNotification(u"inhibitionSummary"_s);
|
|
+ notification->setTitle(i18ncp("@title", "Unread Notification", "Unread Notifications", inhibited));
|
|
+ notification->setText(i18ncp("@info",
|
|
+ "%1 notification was received while Do Not Disturb was active.",
|
|
+ "%1 notifications were received while Do Not Disturb was active.",
|
|
+ inhibited));
|
|
+ notification->setIconName(u"preferences-desktop-notification-bell"_s);
|
|
+ notification->setFlags(KNotification::CloseOnTimeout);
|
|
+ notification->setComponentName(u"libnotificationmanager"_s);
|
|
+
|
|
+ const QString showNotificationsText = i18nc( //
|
|
+ "@action:button Show the notifications popup; translate this in as short a form as possible",
|
|
+ "Show Notifications");
|
|
+
|
|
+ const KNotificationAction *defaultShowNotificationsAction = notification->addDefaultAction(showNotificationsText);
|
|
+ connect(defaultShowNotificationsAction, &KNotificationAction::activated, this, [this]() {
|
|
+ Q_EMIT showNotificationsRequested();
|
|
+ });
|
|
+
|
|
+ const KNotificationAction *showNotificationsAction = notification->addAction(showNotificationsText);
|
|
+ connect(showNotificationsAction, &KNotificationAction::activated, this, [this]() {
|
|
+ Q_EMIT showNotificationsRequested();
|
|
+ });
|
|
+
|
|
+ notification->sendEvent();
|
|
}
|
|
|
|
QVariant Notifications::data(const QModelIndex &index, int role) const
|
|
diff --git a/libnotificationmanager/notifications.h b/libnotificationmanager/notifications.h
|
|
index e927c472c8f..8544b6271ae 100644
|
|
--- a/libnotificationmanager/notifications.h
|
|
+++ b/libnotificationmanager/notifications.h
|
|
@@ -597,6 +597,13 @@ Q_SIGNALS:
|
|
void jobsPercentageChanged();
|
|
void windowChanged(QWindow *window);
|
|
|
|
+ /**
|
|
+ * Emitted when the user has requested to show the notifications popup.
|
|
+ *
|
|
+ * This is typically connected to a button in the "Missed Notifications in Do Not Disturb" notification.
|
|
+ */
|
|
+ void showNotificationsRequested();
|
|
+
|
|
protected:
|
|
void classBegin() override;
|
|
void componentComplete() override;
|
|
--
|
|
GitLab
|
|
|