Skip to content

Commit

Permalink
right-click tap handler for replies
Browse files Browse the repository at this point in the history
  • Loading branch information
resolritter committed Aug 26, 2021
1 parent 8e5060b commit b9ce3af
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions resources/qml/delegates/Reply.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtQuick.Window 2.13
import im.nheko 1.0
import Qt.labs.platform 1.1 as Platform

Item {
id: r
Expand Down Expand Up @@ -41,6 +42,40 @@ Item {
gesturePolicy: TapHandler.ReleaseWithinBounds
}

Platform.Menu {
id: replyContextMenu

property string text
property string link

function show(text_, link_) {
text = text_;
link = link_;
open();
}

Platform.MenuItem {
visible: replyContextMenu.text
enabled: visible
text: qsTr("&Copy")
onTriggered: Clipboard.text = replyContextMenu.text
}

Platform.MenuItem {
visible: replyContextMenu.link
enabled: visible
text: qsTr("Copy &link location")
onTriggered: Clipboard.text = replyContextMenu.link
}

}

TapHandler {
acceptedButtons: Qt.RightButton
onSingleTapped: replyContextMenu.show(reply.child.copyText, reply.child.hoveredLink)
gesturePolicy: TapHandler.ReleaseWithinBounds
}

CursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
Expand Down Expand Up @@ -99,11 +134,10 @@ Item {
callType: r.callType
relatedEventCacheBuster: r.relatedEventCacheBuster
encryptionError: r.encryptionError
enabled: false
enabled: true
width: parent.width
isReply: true
}

}

Rectangle {
Expand Down

0 comments on commit b9ce3af

Please sign in to comment.