summaryrefslogtreecommitdiffstats
path: root/resources/qml/MatrixText.qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-10-08 21:11:21 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-10-08 21:11:21 +0200
commit1a029112d9e6168b123f6cdf4b49319ce4ea356d (patch)
treea4797860c06eeff4db1154132a084dccc9a963d9 /resources/qml/MatrixText.qml
parent517a126a4427972668a97b21fc8684f7160976b9 (diff)
Lint qml with qml-format
Diffstat (limited to 'resources/qml/MatrixText.qml')
-rw-r--r--resources/qml/MatrixText.qml56
1 files changed, 29 insertions, 27 deletions
diff --git a/resources/qml/MatrixText.qml b/resources/qml/MatrixText.qml
index 29214168..6c96a539 100644
--- a/resources/qml/MatrixText.qml
+++ b/resources/qml/MatrixText.qml
@@ -1,35 +1,37 @@
import QtQuick 2.5
import QtQuick.Controls 2.3
-
import im.nheko 1.0
TextEdit {
- textFormat: TextEdit.RichText
- readOnly: true
- wrapMode: Text.Wrap
- selectByMouse: true
- activeFocusOnPress: false
- color: colors.text
+ textFormat: TextEdit.RichText
+ readOnly: true
+ wrapMode: Text.Wrap
+ selectByMouse: true
+ activeFocusOnPress: false
+ color: colors.text
+ onLinkActivated: {
+ if (/^https:\/\/matrix.to\/#\/(@.*)$/.test(link)) {
+ chat.model.openUserProfile(/^https:\/\/matrix.to\/#\/(@.*)$/.exec(link)[1]);
+ } else if (/^https:\/\/matrix.to\/#\/(![^\/]*)$/.test(link)) {
+ TimelineManager.setHistoryView(/^https:\/\/matrix.to\/#\/(!.*)$/.exec(link)[1]);
+ } else if (/^https:\/\/matrix.to\/#\/(![^\/]*)\/(\$.*)$/.test(link)) {
+ var match = /^https:\/\/matrix.to\/#\/(![^\/]*)\/(\$.*)$/.exec(link);
+ TimelineManager.setHistoryView(match[1]);
+ chat.positionViewAtIndex(chat.model.idToIndex(match[2]), ListView.Contain);
+ } else {
+ TimelineManager.openLink(link);
+ }
+ }
+ ToolTip.visible: hoveredLink
+ ToolTip.text: hoveredLink
+
+ MouseArea {
+ id: ma
- onLinkActivated: {
- if (/^https:\/\/matrix.to\/#\/(@.*)$/.test(link)) chat.model.openUserProfile(/^https:\/\/matrix.to\/#\/(@.*)$/.exec(link)[1])
- else if (/^https:\/\/matrix.to\/#\/(![^\/]*)$/.test(link)) TimelineManager.setHistoryView(/^https:\/\/matrix.to\/#\/(!.*)$/.exec(link)[1])
- else if (/^https:\/\/matrix.to\/#\/(![^\/]*)\/(\$.*)$/.test(link)) {
- var match = /^https:\/\/matrix.to\/#\/(![^\/]*)\/(\$.*)$/.exec(link)
- TimelineManager.setHistoryView(match[1])
- chat.positionViewAtIndex(chat.model.idToIndex(match[2]), ListView.Contain)
- }
- else TimelineManager.openLink(link)
- }
- MouseArea
- {
- id: ma
- anchors.fill: parent
- propagateComposedEvents: true
- acceptedButtons: Qt.NoButton
- cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
- }
+ anchors.fill: parent
+ propagateComposedEvents: true
+ acceptedButtons: Qt.NoButton
+ cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
+ }
- ToolTip.visible: hoveredLink
- ToolTip.text: hoveredLink
}