feat(StatusChatListCategory): apply chat list filter and expose category id in popup menu

This uses the newly introduced `filterFn` in `StatusChatList` to hide chat items
that don't belong to a given category.

It also optionally exposes the `categoryId` on the provided popup menu, so it has
access to it inside menu item triggers.
This commit is contained in:
Pascal Precht 2021-06-15 16:10:43 +02:00 committed by Pascal Precht
parent cb07813444
commit 4577551873
1 changed files with 9 additions and 1 deletions

View File

@ -51,15 +51,23 @@ Column {
StatusChatList { StatusChatList {
id: statusChatList id: statusChatList
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: statusChatListCategory.opened visible: statusChatListCategory.opened
categoryId: statusChatListCategory.categoryId
filterFn: function (model) {
return !!model.categoryId && model.categoryId == statusChatList.categoryId
}
} }
Loader { Loader {
id: popupMenuSlot id: popupMenuSlot
active: !!statusChatListCategory.popupMenu active: !!statusChatListCategory.popupMenu
onLoaded: { onLoaded: {
popupMenuSlot.item.openHandler = function () {
if (popupMenuSlot.item.hasOwnProperty('categoryId')) {
popupMenuSlot.item.categoryId = statusChatListCategory.categoryId
}
}
popupMenuSlot.item.closeHandler = function () { popupMenuSlot.item.closeHandler = function () {
statusChatListCategoryItem.highlighted = false statusChatListCategoryItem.highlighted = false
statusChatListCategoryItem.menuButton.highlighted = false statusChatListCategoryItem.menuButton.highlighted = false