diff --git a/ui/StatusQ/sandbox/DemoApp.qml b/ui/StatusQ/sandbox/DemoApp.qml index d34fdf6b66..c2aef2b522 100644 --- a/ui/StatusQ/sandbox/DemoApp.qml +++ b/ui/StatusQ/sandbox/DemoApp.qml @@ -204,6 +204,10 @@ Rectangle { property string chatId + openHandler: function (id) { + chatId = id + } + StatusMenuItem { text: "View Profile" icon.name: "group-chat" @@ -355,6 +359,10 @@ Rectangle { property string categoryId + openHandler: function (id) { + categoryId = id + } + StatusMenuItem { text: "Mute Category" icon.name: "notification" diff --git a/ui/StatusQ/src/StatusQ/Components/StatusChatList.qml b/ui/StatusQ/src/StatusQ/Components/StatusChatList.qml index 275f1ff96f..41a55319bc 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusChatList.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusChatList.qml @@ -50,7 +50,7 @@ Column { hasUnreadMessages: !!model.hasUnreadMessages hasMention: !!model.hasMention badge.value: model.unreadMessagesCount || 0 - selected: model.chatId === statusChatList.selectedChatId + selected: (model.chatId || model.id) === statusChatList.selectedChatId icon.color: model.color || "" image.isIdenticon: !!!profileImage && !!!model.identityImage && !!model.identicon @@ -64,11 +64,8 @@ Column { let originalCloseHandler = popupMenuSlot.item.closeHandler popupMenuSlot.item.openHandler = function () { - if (popupMenuSlot.item.hasOwnProperty('chatId')) { - popupMenuSlot.item.chatId = model.chatId || model.id - } if (!!originalOpenHandler) { - originalOpenHandler() + originalOpenHandler((model.chatId || model.id)) } } diff --git a/ui/StatusQ/src/StatusQ/Components/StatusChatListCategory.qml b/ui/StatusQ/src/StatusQ/Components/StatusChatListCategory.qml index 0078019878..8efd2f0e20 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusChatListCategory.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusChatListCategory.qml @@ -68,14 +68,21 @@ Column { id: popupMenuSlot active: !!statusChatListCategory.popupMenu onLoaded: { + let originalOpenHandler = popupMenuSlot.item.openHandler + let originalCloseHandler = popupMenuSlot.item.closeHandler + popupMenuSlot.item.openHandler = function () { - if (popupMenuSlot.item.hasOwnProperty('categoryId')) { - popupMenuSlot.item.categoryId = statusChatListCategory.categoryId + if (!!originalOpenHandler) { + originalOpenHandler(statusChatListCategory.categoryId) } } + popupMenuSlot.item.closeHandler = function () { statusChatListCategoryItem.highlighted = false statusChatListCategoryItem.menuButton.highlighted = false + if (!!originalCloseHandler) { + originalCloseHandler() + } } } }