Copy address location

fixes #463
This commit is contained in:
Nicolas Werner 2021-04-29 23:09:13 +02:00
parent 6d464381e4
commit 9ab1dc253e
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
4 changed files with 18 additions and 5 deletions

View file

@ -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, "", optionsButton)
}
}

View file

@ -28,12 +28,12 @@ Item {
TapHandler {
acceptedButtons: Qt.RightButton
onSingleTapped: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable)
onSingleTapped: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, contentItem.child.hoveredLink)
gesturePolicy: TapHandler.ReleaseWithinBounds
}
TapHandler {
onLongPressed: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable)
onLongPressed: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, contentItem.child.hoveredLink)
onDoubleTapped: chat.model.reply = model.id
gesturePolicy: TapHandler.ReleaseWithinBounds
}

View file

@ -92,21 +92,33 @@ Page {
id: messageContextMenu
property string eventId
property string link
property int eventType
property bool isEncrypted
property bool isEditable
function show(eventId_, eventType_, isEncrypted_, isEditable_, showAt_) {
function show(eventId_, eventType_, isEncrypted_, isEditable_, link_, showAt_) {
eventId = eventId_;
eventType = eventType_;
isEncrypted = isEncrypted_;
isEditable = isEditable_;
if (link_)
link = link_;
else
link = "";
if (showAt_)
open(showAt_);
else
open();
}
Platform.MenuItem {
visible: messageContextMenu.link
enabled: visible
text: qsTr("Copy address location")
onTriggered: Clipboard.text = messageContextMenu.link
}
Platform.MenuItem {
id: reactionOption
@ -177,7 +189,7 @@ Page {
enabled: visible
text: qsTr("Open in external program")
onTriggered: TimelineManager.timeline.openMedia(messageContextMenu.eventId)
}
}
Platform.MenuItem {
visible: messageContextMenu.eventId

View file

@ -8,6 +8,7 @@ import im.nheko 1.0
Item {
property alias modelData: model.data
property alias isReply: model.isReply
property alias child: chooser.child
property real implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : width
height: chooser.childrenRect.height