From 4577551873d6ae5064d72f9a59f1a6693122dcf7 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Tue, 15 Jun 2021 16:10:43 +0200 Subject: [PATCH] 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. --- src/StatusQ/Components/StatusChatListCategory.qml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/StatusQ/Components/StatusChatListCategory.qml b/src/StatusQ/Components/StatusChatListCategory.qml index 4450432a..632e1469 100644 --- a/src/StatusQ/Components/StatusChatListCategory.qml +++ b/src/StatusQ/Components/StatusChatListCategory.qml @@ -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