diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index 29c658f7..1f483bf9 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -117,7 +117,7 @@ ScrollView {
image: ":/icons/icons/ui/vertical-ellipsis.png"
ToolTip.visible: hovered
ToolTip.text: qsTr("Options")
- onClicked: messageContextMenu.show(row.model.id, row.model.type, row.model.isEncrypted, row.model.isEditable, "", optionsButton)
+ onClicked: messageContextMenu.show(row.model.id, row.model.type, row.model.isEncrypted, row.model.isEditable, "", row.model.body, optionsButton)
}
}
diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index e9c8b297..7bc3df63 100644
--- a/resources/qml/TimelineRow.qml
+++ b/resources/qml/TimelineRow.qml
@@ -28,12 +28,12 @@ Item {
TapHandler {
acceptedButtons: Qt.RightButton
- onSingleTapped: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, contentItem.child.hoveredLink)
+ onSingleTapped: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, contentItem.child.hoveredLink, contentItem.child.copyText)
gesturePolicy: TapHandler.ReleaseWithinBounds
}
TapHandler {
- onLongPressed: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, contentItem.child.hoveredLink)
+ onLongPressed: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, contentItem.child.hoveredLink, contentItem.child.copyText)
onDoubleTapped: chat.model.reply = model.id
gesturePolicy: TapHandler.ReleaseWithinBounds
}
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index ce5d54c0..442047d5 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -93,15 +93,20 @@ Page {
property string eventId
property string link
+ property string text
property int eventType
property bool isEncrypted
property bool isEditable
- function show(eventId_, eventType_, isEncrypted_, isEditable_, link_, showAt_) {
+ function show(eventId_, eventType_, isEncrypted_, isEditable_, link_, text_, showAt_) {
eventId = eventId_;
eventType = eventType_;
isEncrypted = isEncrypted_;
isEditable = isEditable_;
+ if (text_)
+ text = text_;
+ else
+ text = "";
if (link_)
link = link_;
else
@@ -113,6 +118,13 @@ Page {
}
Platform.MenuItem {
+ visible: messageContextMenu.text
+ enabled: visible
+ text: qsTr("Copy")
+ onTriggered: Clipboard.text = messageContextMenu.text
+ }
+
+ Platform.MenuItem {
visible: messageContextMenu.link
enabled: visible
text: qsTr("Copy address location")
diff --git a/resources/qml/delegates/TextMessage.qml b/resources/qml/delegates/TextMessage.qml
index 1624d95c..f44165b4 100644
--- a/resources/qml/delegates/TextMessage.qml
+++ b/resources/qml/delegates/TextMessage.qml
@@ -7,6 +7,7 @@ import im.nheko 1.0
MatrixText {
property string formatted: model.data.formattedBody
+ property string copyText: selectedText ? getText(selectionStart, selectionEnd) : model.data.body
text: "<style type=\"text/css\">a { color:" + colors.link + ";}\ncode { background-color: " + colors.alternateBase + ";}</style>" + formatted.replace("<pre>", "<pre style='white-space: pre-wrap; background-color: " + colors.alternateBase + "'>")
width: parent ? parent.width : undefined
|