From f66ec626f0fbeb5b788ce2e2b37f8ccc764404e6 Mon Sep 17 00:00:00 2001
From: Malte E <malte.e@mailbox.org>
Date: Mon, 28 Mar 2022 20:22:58 +0200
Subject: [PATCH] fix tapping messages, fix pressandhold/doubletap on touch

---
 resources/qml/TimelineRow.qml           | 8 ++++++++
 resources/qml/delegates/Reply.qml       | 1 +
 resources/qml/delegates/TextMessage.qml | 1 +
 3 files changed, 10 insertions(+)

diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index 43de679c1..3a7bf5610 100644
--- a/resources/qml/TimelineRow.qml
+++ b/resources/qml/TimelineRow.qml
@@ -59,6 +59,7 @@ AbstractButton {
             acceptedButtons: Qt.RightButton
             onSingleTapped: messageContextMenu.show(eventId, type, isSender, isEncrypted, isEditable, contentItem.child.hoveredLink, contentItem.child.copyText)
             gesturePolicy: TapHandler.ReleaseWithinBounds
+            acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
         }
     }
 
@@ -92,6 +93,13 @@ AbstractButton {
         }
     }
 
+    onClicked: {
+        let link = contentItem.child.linkAt != undefined && contentItem.child.linkAt(pressX-row.x-msg.x, pressY-row.y-msg.y-contentItem.y);
+        if (link) {
+            Nheko.openLink(link)
+        }
+    }
+
     Rectangle {
         id: row
         property bool bubbleOnRight : isSender && Settings.bubbles
diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index 53a007fe5..87eb371a2 100644
--- a/resources/qml/delegates/Reply.qml
+++ b/resources/qml/delegates/Reply.qml
@@ -78,6 +78,7 @@ AbstractButton {
             acceptedButtons: Qt.RightButton
             onSingleTapped: replyContextMenu.show(reply.child.copyText, reply.child.linkAt(eventPoint.position.x, eventPoint.position.y - userName_.implicitHeight), r.eventId)
             gesturePolicy: TapHandler.ReleaseWithinBounds
+            acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
         }
 
         AbstractButton {
diff --git a/resources/qml/delegates/TextMessage.qml b/resources/qml/delegates/TextMessage.qml
index 73411ab60..6031093eb 100644
--- a/resources/qml/delegates/TextMessage.qml
+++ b/resources/qml/delegates/TextMessage.qml
@@ -39,6 +39,7 @@ MatrixText {
     height: isReply ? Math.round(Math.min(timelineView.height / 8, implicitHeight)) : implicitHeight
     clip: isReply
     selectByMouse: !Settings.mobileMode && !isReply
+    enabled: !Settings.mobileMode
     font.pointSize: (Settings.enlargeEmojiOnlyMessages && isOnlyEmoji > 0 && isOnlyEmoji < 4) ? Settings.fontSize * 3 : Settings.fontSize
 
     CursorShape {
-- 
GitLab