Verified Commit af98cef3 authored by ivan tkachenko's avatar ivan tkachenko
Browse files

[applets/devicenotifier] Prevent empty or duplicated actions in expanded view

Unfortunately, the list<> basic QML type is too primitive, it does not
even expose any kind of remove() functionality, so the only supported
way is to create a new list and assign it instead.

This fixes the bug when there may appear multiple empty or duplicating
actions in the expanded view due to the fact they they were only added
to but never cleaned up / removed from the list of contextual actions.

BUG: 449778
parent a0965f39
......@@ -258,7 +258,11 @@ PlasmaExtras.ExpandableListItem {
devicenotifier.currentIndex = -1;
}
}
onObjectAdded: contextualActionsModel.push(object)
onObjectAdded: (index, object) => deviceItem.contextualActionsModel.push(object)
onObjectRemoved: (index, object) => {
deviceItem.contextualActionsModel = Array.prototype.slice.call(deviceItem.contextualActionsModel)
.filter(action => action !== object);
}
}
// "Mount" action that does not open it in the file manager
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment