summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2020-05-16 15:52:51 -0400
committerJoseph Donofry <joedonofry@gmail.com>2020-05-16 15:52:51 -0400
commitf4ea0b215d64dda5860a9e75f7771884d786a828 (patch)
treeebe23af029270b2c53bd79641140e5da9e5ac13f /resources/qml
parentMerge remote-tracking branch 'origin/master' into reactions (diff)
downloadnheko-f4ea0b215d64dda5860a9e75f7771884d786a828.tar.xz
Attach emoji picker picked to reaction sender
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/TimelineRow.qml2
-rw-r--r--resources/qml/TimelineView.qml3
-rw-r--r--resources/qml/emoji/EmojiButton.qml4
-rw-r--r--resources/qml/emoji/EmojiPicker.qml16
4 files changed, 21 insertions, 4 deletions
diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index 07831c59..f2e3e12b 100644
--- a/resources/qml/TimelineRow.qml
+++ b/resources/qml/TimelineRow.qml
@@ -87,6 +87,8 @@ MouseArea {
 			ToolTip.visible: hovered
 			ToolTip.text: qsTr("React")
 			emojiPicker: emojiPopup
+			room_id: model.roomId
+			event_id: model.id
 //			onClicked: chat.model.reactAction(model.id)
 		}
 		ImageButton {
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 721fd2b8..3da2f09c 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -46,6 +46,9 @@ Page {
             category: Emoji.Category.People
             sourceModel: EmojiModel {}
         }
+		Component.onCompleted: {
+        	emojiPopup.picked.connect(timelineManager.queueReactionMessage)
+    	}
     }
 
 	Menu {
diff --git a/resources/qml/emoji/EmojiButton.qml b/resources/qml/emoji/EmojiButton.qml
index 0940adfe..ce856db4 100644
--- a/resources/qml/emoji/EmojiButton.qml
+++ b/resources/qml/emoji/EmojiButton.qml
@@ -8,9 +8,11 @@ import "../"
 ImageButton {
     property var colors: currentActivePalette
     property var emojiPicker
+    property string room_id
+    property string event_id
 
     image: ":/icons/icons/ui/smile.png"
     id: emojiButton
-    onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.show(emojiButton)
+    onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.show(emojiButton, room_id, event_id)
 
 }
\ No newline at end of file
diff --git a/resources/qml/emoji/EmojiPicker.qml b/resources/qml/emoji/EmojiPicker.qml
index 3a0eb365..8618e63f 100644
--- a/resources/qml/emoji/EmojiPicker.qml
+++ b/resources/qml/emoji/EmojiPicker.qml
@@ -10,12 +10,19 @@ import "../"
 
 Popup {
 
-	function show(showAt) {
+	function show(showAt, room_id, event_id) {
+        console.debug("Showing emojiPicker for " + event_id + "in room " + room_id)
         parent = showAt
         x = Math.round((showAt.width - width) / 2)
         y = showAt.height
+        emojiPopup.room_id = room_id
+        emojiPopup.event_id = event_id
         open()
 	}
+    signal picked(string room_id, string event_id, string key)
+
+    property string room_id
+    property string event_id
     property var colors
     property alias model: gridView.model
     property var textArea
@@ -80,7 +87,7 @@ Popup {
                 ToolTip.text: model.shortName
                 ToolTip.visible: hovered
 
-                    // give the emoji a little oomf
+                // give the emoji a little oomf
                 DropShadow {
                     width: parent.width;
                     height: parent.height;
@@ -92,7 +99,10 @@ Popup {
                     source: parent.contentItem
                 }
                 // TODO: emit a signal and maybe add favorites at some point?
-                //onClicked: textArea.insert(textArea.cursorPosition, modelData.unicode)
+                onClicked: {
+                    console.debug("Picked " + model.unicode + "in response to " + emojiPopup.event_id + " in room " + emojiPopup.room_id)
+                    emojiPopup.picked(emojiPopup.room_id, emojiPopup.event_id, model.unicode)
+                }
             }
 
             // Search field