Add context menu to copy message link URLs
This commit is contained in:
@@ -7,6 +7,9 @@ Row {
|
||||
id: eventContent
|
||||
spacing: theme.spacing / 2
|
||||
|
||||
readonly property string hoveredLink:
|
||||
nameLabel.hoveredLink || contentLabel.hoveredLink
|
||||
|
||||
readonly property string eventText: Utils.processedEventText(model)
|
||||
readonly property string eventTime: Utils.formatTime(model.date)
|
||||
readonly property int eventTimeSpaces: 2
|
||||
|
@@ -60,7 +60,51 @@ Column {
|
||||
}
|
||||
|
||||
EventContent {
|
||||
id: eventContent
|
||||
x: onRight ? parent.width - width : 0
|
||||
|
||||
Behavior on x { HNumberAnimation {} }
|
||||
}
|
||||
|
||||
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
onTapped: {
|
||||
contextMenu.link = eventContent.hoveredLink
|
||||
contextMenu.popup()
|
||||
}
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onLongPressed: {
|
||||
contextMenu.link = eventContent.hoveredLink
|
||||
contextMenu.popup()
|
||||
}
|
||||
}
|
||||
|
||||
HMenu {
|
||||
id: contextMenu
|
||||
|
||||
property string link: ""
|
||||
|
||||
onClosed: link = ""
|
||||
|
||||
HMenuItem {
|
||||
id: copyLink
|
||||
icon.name: "copy-link"
|
||||
text: qsTr("Copy link address")
|
||||
visible: Boolean(contextMenu.link)
|
||||
onTriggered: Utils.copyToClipboard(contextMenu.link)
|
||||
}
|
||||
|
||||
HMenuItem {
|
||||
icon.name: "copy-text"
|
||||
text: qsTr("Copy text")
|
||||
visible: enabled || ! copyLink.visible
|
||||
enabled: Boolean(selectableLabelContainer.joinedSelection)
|
||||
onTriggered:
|
||||
Utils.copyToClipboard(selectableLabelContainer.joinedSelection)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user