From 8060edd1c60fc78cc6a82d48dc252f2b9c78396b Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sun, 20 Dec 2020 17:05:05 +0000 Subject: [PATCH] Allow opening links in the MessageDelegateContextMenu Fixes #167 (cherry picked from commit 449adf993c1694389ec97dcfbb2da1aad4082d19) --- .../Menu/Timeline/MessageDelegateContextMenu.qml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/imports/NeoChat/Menu/Timeline/MessageDelegateContextMenu.qml b/imports/NeoChat/Menu/Timeline/MessageDelegateContextMenu.qml index 400b59486..611733689 100644 --- a/imports/NeoChat/Menu/Timeline/MessageDelegateContextMenu.qml +++ b/imports/NeoChat/Menu/Timeline/MessageDelegateContextMenu.qml @@ -55,6 +55,18 @@ Kirigami.OverlaySheet { text: message Layout.fillWidth: true wrapMode: Text.WordWrap + + onLinkActivated: { + if (link.startsWith("https://matrix.to/")) { + var result = link.replace(/\?.*/, "").match("https://matrix.to/#/(!.*:.*)/(\\$.*:.*)") + if (!result || result.length < 3) return + if (result[1] != currentRoom.id) return + if (!result[2]) return + goToEvent(result[2]) + } else { + Qt.openUrlExternally(link) + } + } } } }