diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml
index e9f3a6b9..da76c6ac 100644
--- a/resources/qml/MessageInput.qml
+++ b/resources/qml/MessageInput.qml
@@ -88,8 +88,7 @@ Rectangle {
}
Connections {
- onInsertText: textArea.insert(textArea.cursorPosition, text);
-
+ onInsertText: textArea.insert(textArea.cursorPosition, text)
target: TimelineManager.timeline.input
}
@@ -110,6 +109,8 @@ Rectangle {
}
ImageButton {
+ id: emojiButton
+
Layout.alignment: Qt.AlignRight | Qt.AlignBottom
hoverEnabled: true
width: 22
@@ -119,6 +120,9 @@ Rectangle {
Layout.bottomMargin: 8
ToolTip.visible: hovered
ToolTip.text: qsTr("Emoji")
+ onClicked: emojiPopup.visible ? emojiPopup.close() : emojiPopup.show(emojiButton, function(emoji) {
+ textArea.insert(textArea.cursorPosition, emoji);
+ })
}
ImageButton {
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 5fce0846..c23564c1 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -72,7 +72,9 @@ Page {
MenuItem {
text: qsTr("React")
- onClicked: emojiPopup.show(messageContextMenu.parent, messageContextMenu.eventId)
+ onClicked: emojiPopup.show(messageContextMenu.parent, function(emoji) {
+ TimelineManager.queueReactionMessage(messageContextMenu.eventId, emoji);
+ })
}
MenuItem {
diff --git a/resources/qml/emoji/EmojiButton.qml b/resources/qml/emoji/EmojiButton.qml
index 1fcfc0c5..928d6226 100644
--- a/resources/qml/emoji/EmojiButton.qml
+++ b/resources/qml/emoji/EmojiButton.qml
@@ -12,5 +12,7 @@ ImageButton {
property string event_id
image: ":/icons/icons/ui/smile.png"
- onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.show(emojiButton, event_id)
+ onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.show(emojiButton, function(emoji) {
+ TimelineManager.queueReactionMessage(event_id, emoji);
+ })
}
diff --git a/resources/qml/emoji/EmojiPicker.qml b/resources/qml/emoji/EmojiPicker.qml
index afe16350..e0e1ceaf 100644
--- a/resources/qml/emoji/EmojiPicker.qml
+++ b/resources/qml/emoji/EmojiPicker.qml
@@ -9,7 +9,7 @@ import im.nheko.EmojiModel 1.0
Popup {
id: emojiPopup
- property string event_id
+ property var callback
property var colors
property alias model: gridView.model
property var textArea
@@ -18,14 +18,14 @@ Popup {
property real highlightSat: colors.highlight.hslSaturation
property real highlightLight: colors.highlight.hslLightness
- function show(showAt, event_id) {
- console.debug("Showing emojiPicker for " + event_id);
+ function show(showAt, callback) {
+ console.debug("Showing emojiPicker");
if (showAt) {
parent = showAt;
x = Math.round((showAt.width - width) / 2);
y = showAt.height;
}
- emojiPopup.event_id = event_id;
+ emojiPopup.callback = callback;
open();
}
@@ -70,9 +70,9 @@ Popup {
ToolTip.visible: hovered
// TODO: maybe add favorites at some point?
onClicked: {
- console.debug("Picked " + model.unicode + "in response to " + emojiPopup.event_id);
+ console.debug("Picked " + model.unicode);
emojiPopup.close();
- TimelineManager.queueReactionMessage(emojiPopup.event_id, model.unicode);
+ callback(model.unicode);
}
// give the emoji a little oomf
|