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