mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-18 17:49:00 +00:00
refactor(StatusChatToolBar): open/close handlers get called if they are set for popupMenu
of StatusChatToolBar
component
This commit is contained in:
parent
ce8603b0e1
commit
ab835857fb
@ -93,6 +93,25 @@ Rectangle {
|
|||||||
|
|
||||||
property bool showMoreMenu: false
|
property bool showMoreMenu: false
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
menuButton.highlighted = true
|
||||||
|
|
||||||
|
let originalOpenHandler = popupMenuSlot.item.openHandler
|
||||||
|
let originalCloseHandler = popupMenuSlot.item.closeHandler
|
||||||
|
|
||||||
|
popupMenuSlot.item.openHandler = function () {
|
||||||
|
if (!!originalOpenHandler) {
|
||||||
|
originalOpenHandler()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
popupMenuSlot.item.closeHandler = function () {
|
||||||
|
menuButton.highlighted = false
|
||||||
|
if (!!originalCloseHandler) {
|
||||||
|
originalCloseHandler()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
popupMenuSlot.item.openHandler = originalOpenHandler
|
||||||
popupMenuSlot.item.popup(-popupMenuSlot.item.width + menuButton.width, menuButton.height + 4)
|
popupMenuSlot.item.popup(-popupMenuSlot.item.width + menuButton.width, menuButton.height + 4)
|
||||||
statusChatToolBar.menuButtonClicked()
|
statusChatToolBar.menuButtonClicked()
|
||||||
}
|
}
|
||||||
@ -100,15 +119,6 @@ Rectangle {
|
|||||||
Loader {
|
Loader {
|
||||||
id: popupMenuSlot
|
id: popupMenuSlot
|
||||||
active: !!statusChatToolBar.popupMenu
|
active: !!statusChatToolBar.popupMenu
|
||||||
onLoaded: {
|
|
||||||
popupMenuSlot.item.closeHandler = function () {
|
|
||||||
menuButton.highlighted = false
|
|
||||||
}
|
|
||||||
|
|
||||||
popupMenuSlot.item.openHandler = function () {
|
|
||||||
menuButton.highlighted = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user