Skip to content
Snippets Groups Projects
Commit 964af7fe authored by Sébastien Blin's avatar Sébastien Blin
Browse files

misc: improve touch screen support

Support single tap for showing call overlay and long press
to show context menu for the smartlist

Change-Id: I31a77169827860c07ec9d60e076c0c5c4e875408
parent 3b4e09d4
No related branches found
No related tags found
No related merge requests found
......@@ -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()
}
}
......
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment