2020-02-28 02:00:23 +00:00
|
|
|
import QtQuick 2.5
|
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
import QtQuick.Controls.Material 2.1
|
|
|
|
|
|
|
|
TextEdit
|
|
|
|
{
|
|
|
|
property var onClicked: function () {}
|
|
|
|
|
|
|
|
id: label
|
|
|
|
selectByMouse: true
|
|
|
|
readOnly: true
|
|
|
|
persistentSelection: true
|
|
|
|
selectionColor: Material.accent
|
2020-02-28 15:55:52 +00:00
|
|
|
textFormat: Text.RichText
|
|
|
|
|
|
|
|
onLinkActivated: function(link) {
|
|
|
|
if (link.startsWith("telephant://")) {
|
|
|
|
var us = link.substr(12, link.length).split("/")
|
|
|
|
if (us[1] == "user") {
|
|
|
|
uiBridge.loadAccount(us[us.length-1])
|
|
|
|
ComponentCreator.createAccountPopup(this).open();
|
|
|
|
}
|
|
|
|
if (us[1] == "tag") {
|
|
|
|
uiBridge.tag(us[us.length-1])
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
Qt.openUrlExternally(link)
|
|
|
|
}
|
2020-02-28 02:00:23 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
// we don't want to eat clicks on the Label
|
|
|
|
acceptedButtons: Qt.RightButton
|
2020-02-28 15:55:52 +00:00
|
|
|
cursorShape: label.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
|
2020-02-28 02:00:23 +00:00
|
|
|
propagateComposedEvents: true
|
|
|
|
|
|
|
|
onReleased: {
|
|
|
|
if (mouse.button == Qt.RightButton) {
|
|
|
|
contextMenu.x = mouse.x;
|
|
|
|
contextMenu.y = mouse.y;
|
|
|
|
contextMenu.open();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mouse.accepted = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Menu {
|
|
|
|
id: contextMenu
|
|
|
|
MenuItem {
|
|
|
|
text: "Copy"
|
|
|
|
onTriggered: label.copy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|