fix(StatusPopupMenu): ensure icon or image settings exist

Fixes #295
This commit is contained in:
Pascal Precht 2021-08-09 14:50:11 +02:00 committed by Pascal Precht
parent 2e1359c9e2
commit 90aa9d76c0
1 changed files with 15 additions and 8 deletions

View File

@ -132,23 +132,30 @@ Menu {
sourceComponent: { sourceComponent: {
let subMenuItemIcon = statusPopupMenu.subMenuItemIcons[parent.subMenuIndex] let subMenuItemIcon = statusPopupMenu.subMenuItemIcons[parent.subMenuIndex]
if ((parent.subMenu && subMenuItemIcon && subMenuItemIcon.source) || !!statusPopupMenuItem.action.image.source.toString()) { if ((parent.subMenu && subMenuItemIcon && subMenuItemIcon.source) ||
statusPopupMenuItem.action.image && !!statusPopupMenuItem.action.image.source.toString()) {
return statusRoundImageCmp return statusRoundImageCmp
} }
return (parent.subMenu && subMenuItemIcon && subMenuItemIcon.isLetterIdenticon) || return (parent.subMenu && subMenuItemIcon && subMenuItemIcon.isLetterIdenticon) ||
statusPopupMenuItem.action.iconSettings.isLetterIdenticon ? (statusPopupMenuItem.action.iconsSettings && statusPopupMenuItem.action.iconSettings.isLetterIdenticon) ?
statusLetterIdenticonCmp : indicatorComponent statusLetterIdenticonCmp : indicatorComponent
} }
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 8 anchors.leftMargin: 8
active: (parent.subMenu && !!statusPopupMenu.subMenuItemIcons[parent.subMenuIndex] || active: {
(!!statusPopupMenuItem.action.icon.name || if (enabled) {
!!statusPopupMenuItem.action.iconSettings.name) || let hasIconSettings = !!statusPopupMenuItem.action.icon.name ||
!!statusPopupMenuItem.action.iconSettings.isLetterIdenticon || (statusPopupMenuItem.action.iconSettings &&
!!statusPopupMenuItem.action.image.source.toString()) && (!!statusPopupMenuItem.action.iconSettings.name || !!statusPopupMenuItem.action.iconSettings.isLetterIdenticon))
statusPopupMenuItem.action.enabled
let hasImageSettings = statusPopupMenuItem.action.image && !!statusPopupMenuItem.action.image.source.toString()
return enabled && (parent.subMenu && !!statusPopupMenu.subMenuItemIcons[parent.subMenuIndex]) || hasIconSettings || hasImageSettings
}
return false
}
} }
contentItem: StatusBaseText { contentItem: StatusBaseText {