diff --git a/src/mainview/components/CallOverlay.qml b/src/mainview/components/CallOverlay.qml index 1a01bfc09e51aa577e695f93f4e3ff791b43c8e2..07082f91291ed07fd76ca3f05339debd43a594fc 100644 --- a/src/mainview/components/CallOverlay.qml +++ b/src/mainview/components/CallOverlay.qml @@ -485,9 +485,9 @@ Rectangle { hoverEnabled: true propagateComposedEvents: true - acceptedButtons: Qt.NoButton + acceptedButtons: Qt.LeftButton - onEntered: { + function resetStates() { if (overlayUpperPartRect.state !== 'entered') { overlayUpperPartRect.state = 'entered' } @@ -497,14 +497,15 @@ Rectangle { callOverlayTimer.restart() } + onReleased: { + resetStates() + } + onEntered: { + resetStates() + } + onMouseXChanged: { - if (overlayUpperPartRect.state !== 'entered') { - overlayUpperPartRect.state = 'entered' - } - if (callOverlayButtonGroup.state !== 'entered') { - callOverlayButtonGroup.state = 'entered' - } - callOverlayTimer.restart() + resetStates() } } diff --git a/src/mainview/components/ConversationSmartListViewItemDelegate.qml b/src/mainview/components/ConversationSmartListViewItemDelegate.qml index d1c00efb925b09679a1587d20f6862d841c4d9ea..cac1eb71bc046bd9d2a5cd1a0f7eea2aa7c481ab 100644 --- a/src/mainview/components/ConversationSmartListViewItemDelegate.qml +++ b/src/mainview/components/ConversationSmartListViewItemDelegate.qml @@ -34,6 +34,8 @@ ItemDelegate { signal updateContactAvatarUidRequested(string uid) + property bool openedMenu: false + function convUid() { return UID } @@ -190,6 +192,26 @@ ItemDelegate { hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton + function openContextMenu(mouse) { + openedMenu = true + smartListContextMenu.parent = mouseAreaSmartListItemDelegate + + // Make menu pos at mouse. + var relativeMousePos = mapToItem(itemSmartListBackground, + mouse.x, mouse.y) + smartListContextMenu.x = relativeMousePos.x + smartListContextMenu.y = relativeMousePos.y + smartListContextMenu.responsibleAccountId = AccountAdapter.currentAccountId + smartListContextMenu.responsibleConvUid = UID + smartListContextMenu.contactType = ContactType + userProfile.responsibleConvUid = UID + userProfile.aliasText = DisplayName + userProfile.registeredNameText = DisplayID + userProfile.idText = URI + userProfile.contactImageUid = UID + smartListContextMenu.openMenu() + } + onPressed: { if (!InCall) { itemSmartListBackground.color = JamiTheme.pressColor @@ -207,31 +229,20 @@ ItemDelegate { communicationPageMessageWebView.setSendContactRequestButtonVisible(false) } } + onPressAndHold: { + openContextMenu(mouse) + } onReleased: { if (!InCall) { itemSmartListBackground.color = JamiTheme.selectionBlue } if (mouse.button === Qt.RightButton) { - smartListContextMenu.parent = mouseAreaSmartListItemDelegate - - // Make menu pos at mouse. - var relativeMousePos = mapToItem(itemSmartListBackground, - mouse.x, mouse.y) - smartListContextMenu.x = relativeMousePos.x - smartListContextMenu.y = relativeMousePos.y - smartListContextMenu.responsibleAccountId = AccountAdapter.currentAccountId - smartListContextMenu.responsibleConvUid = UID - smartListContextMenu.contactType = ContactType - userProfile.responsibleConvUid = UID - userProfile.aliasText = DisplayName - userProfile.registeredNameText = DisplayID - userProfile.idText = URI - userProfile.contactImageUid = UID - smartListContextMenu.openMenu() - } else if (mouse.button === Qt.LeftButton) { + openContextMenu(mouse) + } else if (mouse.button === Qt.LeftButton && !openedMenu) { conversationSmartListView.currentIndex = -1 conversationSmartListView.currentIndex = index } + openedMenu = false } onEntered: { if (!InCall) {