Add "Copy Link Address" context menu
Allows copying just the link address of a hyperlink.
This commit is contained in:
@@ -57,6 +57,11 @@ Loader {
|
||||
*/
|
||||
property string selectedText: ""
|
||||
|
||||
/**
|
||||
* @brief The link the user has currently hovered.
|
||||
*/
|
||||
property string hoveredLink: ""
|
||||
|
||||
/**
|
||||
* @brief The list of menu item actions that have sub-actions.
|
||||
*
|
||||
|
||||
@@ -63,6 +63,12 @@ DelegateContextMenu {
|
||||
separator: true
|
||||
},
|
||||
DelegateContextMenu.RemoveMessageAction {},
|
||||
Kirigami.Action {
|
||||
text: i18nc("@action:inmenu", "Copy Link Address")
|
||||
icon.name: "edit-copy"
|
||||
visible: root.hoveredLink.length > 0
|
||||
onTriggered: Clipboard.saveText(root.hoveredLink)
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18nc("@action:inmenu", "Copy Text")
|
||||
icon.name: "edit-copy"
|
||||
|
||||
@@ -245,9 +245,10 @@ Kirigami.Page {
|
||||
});
|
||||
}
|
||||
|
||||
function onShowMessageMenu(eventId, author, messageComponentType, plainText, htmlText, selectedText, isThread) {
|
||||
function onShowMessageMenu(eventId, author, messageComponentType, plainText, htmlText, selectedText, hoveredLink, isThread) {
|
||||
const contextMenu = messageDelegateContextMenu.createObject(root, {
|
||||
selectedText: selectedText,
|
||||
hoveredLink: hoveredLink,
|
||||
author: author,
|
||||
eventId: eventId,
|
||||
messageComponentType: messageComponentType,
|
||||
|
||||
Reference in New Issue
Block a user