mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-21 10:40:47 +03:00
Restore reply context menu
This commit is contained in:
parent
4d2a5d1e9b
commit
a7af3bb96c
3 changed files with 31 additions and 15 deletions
|
@ -26,7 +26,7 @@ Item {
|
|||
Connections {
|
||||
function onHideMenu() {
|
||||
messageContextMenuC.close();
|
||||
replyContextMenu.close();
|
||||
replyContextMenuC.close();
|
||||
}
|
||||
|
||||
target: MainWindow
|
||||
|
@ -65,6 +65,7 @@ Item {
|
|||
TimelineDefaultMessageStyle {
|
||||
messageActions: messageActionsC
|
||||
messageContextMenu: messageContextMenuC
|
||||
replyContextMenu: replyContextMenuC
|
||||
scrolledToThis: eventId === room.scrollTarget && (y + height > chat.y + chat.contentY && y < chat.y + chat.height + chat.contentY)
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +75,7 @@ Item {
|
|||
TimelineBubbleMessageStyle {
|
||||
messageActions: messageActionsC
|
||||
messageContextMenu: messageContextMenuC
|
||||
replyContextMenu: replyContextMenuC
|
||||
scrolledToThis: eventId === room.scrollTarget && (y + height > chat.y + chat.contentY && y < chat.y + chat.height + chat.contentY)
|
||||
}
|
||||
}
|
||||
|
@ -541,7 +543,7 @@ Item {
|
|||
}
|
||||
}
|
||||
Platform.Menu {
|
||||
id: replyContextMenu
|
||||
id: replyContextMenuC
|
||||
|
||||
property string eventId
|
||||
property string link
|
||||
|
@ -557,23 +559,23 @@ Item {
|
|||
Platform.MenuItem {
|
||||
enabled: visible
|
||||
text: qsTr("&Copy")
|
||||
visible: replyContextMenu.text
|
||||
visible: replyContextMenuC.text
|
||||
|
||||
onTriggered: Clipboard.text = replyContextMenu.text
|
||||
onTriggered: Clipboard.text = replyContextMenuC.text
|
||||
}
|
||||
Platform.MenuItem {
|
||||
enabled: visible
|
||||
text: qsTr("Copy &link location")
|
||||
visible: replyContextMenu.link
|
||||
visible: replyContextMenuC.link
|
||||
|
||||
onTriggered: Clipboard.text = replyContextMenu.link
|
||||
onTriggered: Clipboard.text = replyContextMenuC.link
|
||||
}
|
||||
Platform.MenuItem {
|
||||
enabled: visible
|
||||
text: qsTr("&Go to quoted message")
|
||||
visible: true
|
||||
|
||||
onTriggered: room.showEvent(replyContextMenu.eventId)
|
||||
onTriggered: room.showEvent(replyContextMenuC.eventId)
|
||||
}
|
||||
}
|
||||
RoundButton {
|
||||
|
|
|
@ -44,6 +44,7 @@ TimelineEvent {
|
|||
required property bool isEditable
|
||||
|
||||
required property QtObject messageContextMenu
|
||||
required property QtObject replyContextMenu
|
||||
required property Item messageActions
|
||||
|
||||
property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) // align bubble with section header
|
||||
|
@ -173,13 +174,14 @@ TimelineEvent {
|
|||
contentItem: Item {
|
||||
id: contentPlacementContainer
|
||||
|
||||
property int metadataWidth: 100
|
||||
property int metadataHeight: 20
|
||||
|
||||
property bool fitsMetadata: ((wrapper.main?.width ?? 0) + wrapper.mainInset + metadata.width) < wrapper.maxWidth
|
||||
|
||||
implicitWidth: Math.max((wrapper.reply?.width ?? 0) + wrapper.replyInset, (wrapper.main?.width ?? 0) + wrapper.mainInset + (fitsMetadata ? metadata.width : 0))
|
||||
implicitHeight: contentColumn.implicitHeight + (fitsMetadata ? 0 : metadata.height)
|
||||
// This doesnt work because of tables. They might have content in the top of the cell, while the background reaches to the bottom. Maybe using the textDocument we could do more?
|
||||
// property bool fitsMetadataInside: wrapper.main?.positionAt ? (wrapper.main.positionAt(wrapper.main.width, wrapper.main.height - 4) == wrapper.main.positionAt(wrapper.main.width - metadata.width, wrapper.main.height - 4)) : false
|
||||
property bool fitsMetadataInside: false
|
||||
|
||||
implicitWidth: Math.max((wrapper.reply?.width ?? 0) + wrapper.replyInset, (wrapper.main?.width ?? 0) + wrapper.mainInset + ((fitsMetadata && !fitsMetadataInside) ? metadata.width : 0))
|
||||
implicitHeight: contentColumn.implicitHeight + ((fitsMetadata || fitsMetadataInside) ? 0 : metadata.height)
|
||||
|
||||
TimelineMetadata {
|
||||
id: metadata
|
||||
|
@ -275,6 +277,13 @@ TimelineEvent {
|
|||
wrapper.room.showEvent(wrapper.replyTo)
|
||||
}
|
||||
}
|
||||
onPressAndHold: wrapper.replyContextMenu.show(wrapper.reply.copyText ?? "", wrapper.reply.linkAt ? wrapper.reply.linkAt(pressX-replyLine.width - Nheko.paddingSmall, pressY - replyUserButton.implicitHeight) : "", wrapper.replyTo)
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
onSingleTapped: (eventPoint) => wrapper.replyContextMenu.show(wrapper.reply.copyText ?? "", wrapper.reply.linkAt ? wrapper.reply.linkAt(eventPoint.position.x-replyLine.width - Nheko.paddingSmall, eventPoint.position.y - replyUserButton.implicitHeight) : "", wrapper.replyTo)
|
||||
gesturePolicy: TapHandler.ReleaseWithinBounds
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
|
||||
}
|
||||
}
|
||||
|
||||
data: [replyRow, wrapper.main]
|
||||
|
|
|
@ -44,6 +44,7 @@ TimelineEvent {
|
|||
required property bool isEditable
|
||||
|
||||
required property QtObject messageContextMenu
|
||||
required property QtObject replyContextMenu
|
||||
required property Item messageActions
|
||||
|
||||
property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) // align bubble with section header
|
||||
|
@ -261,6 +262,13 @@ TimelineEvent {
|
|||
wrapper.room.showEvent(wrapper.replyTo)
|
||||
}
|
||||
}
|
||||
onPressAndHold: wrapper.replyContextMenu.show(wrapper.reply.copyText ?? "", wrapper.reply.linkAt ? wrapper.reply.linkAt(pressX-replyLine.width - Nheko.paddingSmall, pressY - replyUserButton.implicitHeight) : "", wrapper.replyTo)
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
onSingleTapped: (eventPoint) => wrapper.replyContextMenu.show(wrapper.reply.copyText ?? "", wrapper.reply.linkAt ? wrapper.reply.linkAt(eventPoint.position.x-replyLine.width - Nheko.paddingSmall, eventPoint.position.y - replyUserButton.implicitHeight) : "", wrapper.replyTo)
|
||||
gesturePolicy: TapHandler.ReleaseWithinBounds
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
|
||||
}
|
||||
}
|
||||
|
||||
data: [
|
||||
|
@ -292,14 +300,11 @@ TimelineEvent {
|
|||
id: reactionRow
|
||||
|
||||
eventId: wrapper.eventId
|
||||
layoutDirection: row.bubbleOnRight ? Qt.RightToLeft : Qt.LeftToRight
|
||||
reactions: wrapper.reactions
|
||||
width: wrapper.width - wrapper.avatarMargin
|
||||
x: wrapper.avatarMargin
|
||||
|
||||
anchors {
|
||||
//left: row.bubbleOnRight ? undefined : row.left
|
||||
//right: row.bubbleOnRight ? row.right : undefined
|
||||
top: gridContainer.bottom
|
||||
topMargin: -4
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue