Skip to content

Commit 36bfe35

Browse files
committed
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 <[email protected]>
1 parent 174db2f commit 36bfe35

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

panels/notification/center/notifyitem.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,19 @@ void AppNotifyItem::updateActions()
186186
return;
187187
}
188188

189+
auto hints = m_entity.hints();
190+
auto processed = m_entity.processed();
189191
QVariantList array;
190192
for (int i = 0; i < actions.size(); i += 2) {
191193
const auto id = actions[i];
192194
const auto text = actions[i + 1];
193195
QVariantMap item;
194196
item["id"] = id;
195197
item["text"] = text;
198+
199+
// we only allow to invoke the action if we have the extension hint and it's not in the notify center.
200+
item["enabled"] = hints.contains("x-deepin-action-" + id) || !processed;
201+
196202
array.append(item);
197203
}
198204

panels/notification/plugin/NotifyAction.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ Control {
120120
id: actionButton
121121
required property var actionData
122122
text: actionData ? actionData.text : ""
123+
enabled: actionData ? actionData.enabled : false
123124
topPadding: undefined
124125
bottomPadding: undefined
125126
leftPadding: undefined

0 commit comments

Comments
 (0)