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
Branches
No related tags found
No related merge requests found
...@@ -485,9 +485,9 @@ Rectangle { ...@@ -485,9 +485,9 @@ Rectangle {
hoverEnabled: true hoverEnabled: true
propagateComposedEvents: true propagateComposedEvents: true
acceptedButtons: Qt.NoButton acceptedButtons: Qt.LeftButton
onEntered: { function resetStates() {
if (overlayUpperPartRect.state !== 'entered') { if (overlayUpperPartRect.state !== 'entered') {
overlayUpperPartRect.state = 'entered' overlayUpperPartRect.state = 'entered'
} }
...@@ -497,14 +497,15 @@ Rectangle { ...@@ -497,14 +497,15 @@ Rectangle {
callOverlayTimer.restart() callOverlayTimer.restart()
} }
onReleased: {
resetStates()
}
onEntered: {
resetStates()
}
onMouseXChanged: { onMouseXChanged: {
if (overlayUpperPartRect.state !== 'entered') { resetStates()
overlayUpperPartRect.state = 'entered'
}
if (callOverlayButtonGroup.state !== 'entered') {
callOverlayButtonGroup.state = 'entered'
}
callOverlayTimer.restart()
} }
} }
......
...@@ -34,6 +34,8 @@ ItemDelegate { ...@@ -34,6 +34,8 @@ ItemDelegate {
signal updateContactAvatarUidRequested(string uid) signal updateContactAvatarUidRequested(string uid)
property bool openedMenu: false
function convUid() { function convUid() {
return UID return UID
} }
...@@ -190,6 +192,26 @@ ItemDelegate { ...@@ -190,6 +192,26 @@ ItemDelegate {
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton 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: { onPressed: {
if (!InCall) { if (!InCall) {
itemSmartListBackground.color = JamiTheme.pressColor itemSmartListBackground.color = JamiTheme.pressColor
...@@ -207,31 +229,20 @@ ItemDelegate { ...@@ -207,31 +229,20 @@ ItemDelegate {
communicationPageMessageWebView.setSendContactRequestButtonVisible(false) communicationPageMessageWebView.setSendContactRequestButtonVisible(false)
} }
} }
onPressAndHold: {
openContextMenu(mouse)
}
onReleased: { onReleased: {
if (!InCall) { if (!InCall) {
itemSmartListBackground.color = JamiTheme.selectionBlue itemSmartListBackground.color = JamiTheme.selectionBlue
} }
if (mouse.button === Qt.RightButton) { if (mouse.button === Qt.RightButton) {
smartListContextMenu.parent = mouseAreaSmartListItemDelegate openContextMenu(mouse)
} else if (mouse.button === Qt.LeftButton && !openedMenu) {
// 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) {
conversationSmartListView.currentIndex = -1 conversationSmartListView.currentIndex = -1
conversationSmartListView.currentIndex = index conversationSmartListView.currentIndex = index
} }
openedMenu = false
} }
onEntered: { onEntered: {
if (!InCall) { if (!InCall) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment