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 Michał Cieślak
parent 8081da7fa0
commit 4582886d90
1 changed files with 9 additions and 1 deletions

View File

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