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:
committed by
Joshua Goins
parent
a1513b30cd
commit
e2742cbf8b
@@ -292,6 +292,7 @@ Kirigami.Page {
|
||||
Component {
|
||||
id: messageDelegateContextMenu
|
||||
MessageDelegateContextMenu {
|
||||
room: root.currentRoom
|
||||
connection: root.connection
|
||||
}
|
||||
}
|
||||
@@ -299,6 +300,7 @@ Kirigami.Page {
|
||||
Component {
|
||||
id: fileDelegateContextMenu
|
||||
FileDelegateContextMenu {
|
||||
room: root.currentRoom
|
||||
connection: root.connection
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,11 @@ import org.kde.neochat
|
||||
KirigamiComponents.ConvergentContextMenu {
|
||||
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.
|
||||
*/
|
||||
@@ -195,12 +200,15 @@ KirigamiComponents.ConvergentContextMenu {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 2.5
|
||||
Repeater {
|
||||
model: ["👍", "👎️", "😄", "🎉", "🚀", "👀"]
|
||||
model: ["👍", "👎️", "😄", "🎉", "👀", "⋮"]
|
||||
delegate: Delegates.RoundedItemDelegate {
|
||||
id: emojiDelegate
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 2.5
|
||||
Layout.fillHeight: true
|
||||
|
||||
contentItem: Kirigami.Heading {
|
||||
id: emojiText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
@@ -209,11 +217,32 @@ KirigamiComponents.ConvergentContextMenu {
|
||||
}
|
||||
|
||||
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);
|
||||
root.item.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: emojiDialog
|
||||
|
||||
EmojiDialog {
|
||||
currentRoom: root.Message.room
|
||||
showQuickReaction: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user