Fix #277: Disable action menu if all of its children are disabled

This commit is contained in:
Akash Yadav
2022-07-12 12:48:10 +05:30
parent c6f5c9774e
commit 41fb116a78
3 changed files with 8 additions and 2 deletions
@@ -102,14 +102,20 @@ class DefaultActionsRegistry : ActionsRegistry() {
val item: MenuItem =
if (action is ActionMenu) {
val sub = menu.addSubMenu(action.label)
var shouldBeEnabled = false
for (subItem in action.children) {
subItem.prepare(data)
if (subItem.visible) {
addActionToMenu(sub, subItem, data)
}
if (action.enabled && subItem.enabled && !shouldBeEnabled) {
shouldBeEnabled = true
}
}
action.enabled = shouldBeEnabled
sub.item
} else {
menu.add(action.label)
Binary file not shown.
Binary file not shown.