2019-11-03 03:28:16 +01:00
|
|
|
import QtQuick 2.5
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
|
2020-06-24 16:24:22 +02:00
|
|
|
import im.nheko 1.0
|
|
|
|
|
2020-02-27 16:48:23 +01:00
|
|
|
TextEdit {
|
2019-11-03 03:28:16 +01:00
|
|
|
textFormat: TextEdit.RichText
|
|
|
|
readOnly: true
|
|
|
|
wrapMode: Text.Wrap
|
2020-08-06 19:19:13 +02:00
|
|
|
selectByMouse: true
|
|
|
|
activeFocusOnPress: false
|
2020-02-27 16:48:23 +01:00
|
|
|
color: colors.text
|
2019-11-03 03:28:16 +01:00
|
|
|
|
|
|
|
onLinkActivated: {
|
|
|
|
if (/^https:\/\/matrix.to\/#\/(@.*)$/.test(link)) chat.model.openUserProfile(/^https:\/\/matrix.to\/#\/(@.*)$/.exec(link)[1])
|
2020-06-24 16:24:22 +02:00
|
|
|
else if (/^https:\/\/matrix.to\/#\/(![^\/]*)$/.test(link)) TimelineManager.setHistoryView(/^https:\/\/matrix.to\/#\/(!.*)$/.exec(link)[1])
|
2019-11-08 22:29:47 +01:00
|
|
|
else if (/^https:\/\/matrix.to\/#\/(![^\/]*)\/(\$.*)$/.test(link)) {
|
2019-11-03 03:28:16 +01:00
|
|
|
var match = /^https:\/\/matrix.to\/#\/(![^\/]*)\/(\$.*)$/.exec(link)
|
2020-06-24 16:24:22 +02:00
|
|
|
TimelineManager.setHistoryView(match[1])
|
2019-11-03 03:28:16 +01:00
|
|
|
chat.positionViewAtIndex(chat.model.idToIndex(match[2]), ListView.Contain)
|
|
|
|
}
|
2020-09-04 08:32:24 +02:00
|
|
|
else TimelineManager.openLink(link)
|
2019-11-03 03:28:16 +01:00
|
|
|
}
|
|
|
|
MouseArea
|
|
|
|
{
|
2020-02-02 00:27:28 +01:00
|
|
|
id: ma
|
2019-11-03 03:28:16 +01:00
|
|
|
anchors.fill: parent
|
2020-02-26 23:43:54 +01:00
|
|
|
propagateComposedEvents: true
|
|
|
|
acceptedButtons: Qt.NoButton
|
2019-11-03 03:28:16 +01:00
|
|
|
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
}
|
|
|
|
|
2020-02-02 00:27:28 +01:00
|
|
|
ToolTip.visible: hoveredLink
|
|
|
|
ToolTip.text: hoveredLink
|
2019-11-03 03:28:16 +01:00
|
|
|
}
|