From 36bfe3519a38435de0a5bd74edc2e826c4adb1a1 Mon Sep 17 00:00:00 2001 From: ComixHe Date: Fri, 30 Jan 2026 17:40:09 +0800 Subject: [PATCH] feat(notification): Adjust the activation logic for the notification button Only enable action buttons when extension hint exists or it's not in the notification center Pms: BUG-333027 Log: Adjust the activation logic for the notification button Signed-off-by: ComixHe --- panels/notification/center/notifyitem.cpp | 6 ++++++ panels/notification/plugin/NotifyAction.qml | 1 + 2 files changed, 7 insertions(+) diff --git a/panels/notification/center/notifyitem.cpp b/panels/notification/center/notifyitem.cpp index 7fdd37f54..1650efef6 100644 --- a/panels/notification/center/notifyitem.cpp +++ b/panels/notification/center/notifyitem.cpp @@ -186,6 +186,8 @@ void AppNotifyItem::updateActions() return; } + auto hints = m_entity.hints(); + auto processed = m_entity.processed(); QVariantList array; for (int i = 0; i < actions.size(); i += 2) { const auto id = actions[i]; @@ -193,6 +195,10 @@ void AppNotifyItem::updateActions() QVariantMap item; item["id"] = id; item["text"] = text; + + // we only allow to invoke the action if we have the extension hint and it's not in the notify center. + item["enabled"] = hints.contains("x-deepin-action-" + id) || !processed; + array.append(item); } diff --git a/panels/notification/plugin/NotifyAction.qml b/panels/notification/plugin/NotifyAction.qml index 6b6c48be9..290e2ed05 100644 --- a/panels/notification/plugin/NotifyAction.qml +++ b/panels/notification/plugin/NotifyAction.qml @@ -120,6 +120,7 @@ Control { id: actionButton required property var actionData text: actionData ? actionData.text : "" + enabled: actionData ? actionData.enabled : false topPadding: undefined bottomPadding: undefined leftPadding: undefined