refactor(StatusPopupMenu): expose category and chat id via open handler
Closes #192
This commit is contained in:
parent
7a2648f69f
commit
a98bae48dd
|
@ -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"
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue