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

View File

@ -28,12 +28,12 @@ Item {
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton 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 gesturePolicy: TapHandler.ReleaseWithinBounds
} }
TapHandler { 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 onDoubleTapped: chat.model.reply = model.id
gesturePolicy: TapHandler.ReleaseWithinBounds gesturePolicy: TapHandler.ReleaseWithinBounds
} }

View File

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

View File

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