mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
parent
9ab1dc253e
commit
2d678bdcf6
4 changed files with 17 additions and 4 deletions
|
@ -117,7 +117,7 @@ ScrollView {
|
||||||
image: ":/icons/icons/ui/vertical-ellipsis.png"
|
image: ":/icons/icons/ui/vertical-ellipsis.png"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.text: qsTr("Options")
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,12 @@ Item {
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
acceptedButtons: Qt.RightButton
|
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
|
gesturePolicy: TapHandler.ReleaseWithinBounds
|
||||||
}
|
}
|
||||||
|
|
||||||
TapHandler {
|
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
|
onDoubleTapped: chat.model.reply = model.id
|
||||||
gesturePolicy: TapHandler.ReleaseWithinBounds
|
gesturePolicy: TapHandler.ReleaseWithinBounds
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,15 +93,20 @@ Page {
|
||||||
|
|
||||||
property string eventId
|
property string eventId
|
||||||
property string link
|
property string link
|
||||||
|
property string text
|
||||||
property int eventType
|
property int eventType
|
||||||
property bool isEncrypted
|
property bool isEncrypted
|
||||||
property bool isEditable
|
property bool isEditable
|
||||||
|
|
||||||
function show(eventId_, eventType_, isEncrypted_, isEditable_, link_, showAt_) {
|
function show(eventId_, eventType_, isEncrypted_, isEditable_, link_, text_, showAt_) {
|
||||||
eventId = eventId_;
|
eventId = eventId_;
|
||||||
eventType = eventType_;
|
eventType = eventType_;
|
||||||
isEncrypted = isEncrypted_;
|
isEncrypted = isEncrypted_;
|
||||||
isEditable = isEditable_;
|
isEditable = isEditable_;
|
||||||
|
if (text_)
|
||||||
|
text = text_;
|
||||||
|
else
|
||||||
|
text = "";
|
||||||
if (link_)
|
if (link_)
|
||||||
link = link_;
|
link = link_;
|
||||||
else
|
else
|
||||||
|
@ -112,6 +117,13 @@ Page {
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Platform.MenuItem {
|
||||||
|
visible: messageContextMenu.text
|
||||||
|
enabled: visible
|
||||||
|
text: qsTr("Copy")
|
||||||
|
onTriggered: Clipboard.text = messageContextMenu.text
|
||||||
|
}
|
||||||
|
|
||||||
Platform.MenuItem {
|
Platform.MenuItem {
|
||||||
visible: messageContextMenu.link
|
visible: messageContextMenu.link
|
||||||
enabled: visible
|
enabled: visible
|
||||||
|
|
|
@ -7,6 +7,7 @@ import im.nheko 1.0
|
||||||
|
|
||||||
MatrixText {
|
MatrixText {
|
||||||
property string formatted: model.data.formattedBody
|
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 + "'>")
|
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
|
width: parent ? parent.width : undefined
|
||||||
|
|
Loading…
Reference in a new issue