Add a button to access all emojis from the message menu

Add a button to access all emojis from the message menu for when that button is not availble in the quick actions

requires libraries/kirigami-addons!362
This commit is contained in:
James Graham
2025-05-15 18:41:09 +01:00
committed by Joshua Goins
parent a1513b30cd
commit e2742cbf8b
2 changed files with 33 additions and 2 deletions

View File

@@ -292,6 +292,7 @@ Kirigami.Page {
Component { Component {
id: messageDelegateContextMenu id: messageDelegateContextMenu
MessageDelegateContextMenu { MessageDelegateContextMenu {
room: root.currentRoom
connection: root.connection connection: root.connection
} }
} }
@@ -299,6 +300,7 @@ Kirigami.Page {
Component { Component {
id: fileDelegateContextMenu id: fileDelegateContextMenu
FileDelegateContextMenu { FileDelegateContextMenu {
room: root.currentRoom
connection: root.connection connection: root.connection
} }
} }

View File

@@ -29,6 +29,11 @@ import org.kde.neochat
KirigamiComponents.ConvergentContextMenu { KirigamiComponents.ConvergentContextMenu {
id: root id: root
/**
* @brief The NeoChatRoom the delegate is being displayed in.
*/
required property NeoChatRoom room
/** /**
* @brief The current connection for the account accessing the event. * @brief The current connection for the account accessing the event.
*/ */
@@ -195,12 +200,15 @@ KirigamiComponents.ConvergentContextMenu {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.gridUnit * 2.5 Layout.preferredHeight: Kirigami.Units.gridUnit * 2.5
Repeater { Repeater {
model: ["👍", "👎️", "😄", "🎉", "🚀", "👀"] model: ["👍", "👎️", "😄", "🎉", "👀", ""]
delegate: Delegates.RoundedItemDelegate { delegate: Delegates.RoundedItemDelegate {
id: emojiDelegate
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: Kirigami.Units.gridUnit * 2.5
Layout.fillHeight: true Layout.fillHeight: true
contentItem: Kirigami.Heading { contentItem: Kirigami.Heading {
id: emojiText
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
@@ -209,11 +217,32 @@ KirigamiComponents.ConvergentContextMenu {
} }
onClicked: { onClicked: {
if (emojiText.text === "⋮") {
var dialog = emojiDialog.createObject(emojiDelegate);
dialog.showStickers = false;
dialog.chosen.connect(emoji => {
root.room.toggleReaction(root.eventId, emoji);
root.menuItem.close();
});
dialog.closed.connect(() => {
root.menuItem.close();
});
dialog.open();
return;
}
currentRoom.toggleReaction(eventId, modelData); currentRoom.toggleReaction(eventId, modelData);
root.item.close();
} }
} }
} }
Component {
id: emojiDialog
EmojiDialog {
currentRoom: root.Message.room
showQuickReaction: true
}
}
} }
} }