diff options
Diffstat (limited to 'main')
3 files changed, 33 insertions, 7 deletions
diff --git a/main/src/ui/conversation_content_view/file_widget.vala b/main/src/ui/conversation_content_view/file_widget.vala index 8dbc3dc8..52a26f33 100644 --- a/main/src/ui/conversation_content_view/file_widget.vala +++ b/main/src/ui/conversation_content_view/file_widget.vala @@ -10,19 +10,44 @@ namespace Dino.Ui { public class FileMetaItem : ConversationSummary.ContentMetaItem { private StreamInteractor stream_interactor; + private FileItem file_item; + private FileTransfer file_transfer; public FileMetaItem(ContentItem content_item, StreamInteractor stream_interactor) { base(content_item); this.stream_interactor = stream_interactor; + this.file_item = content_item as FileItem; + this.file_transfer = file_item.file_transfer; } public override Object? get_widget(Plugins.ConversationItemWidgetInterface outer, Plugins.WidgetType type) { - FileItem file_item = content_item as FileItem; - FileTransfer transfer = file_item.file_transfer; - return new FileWidget(stream_interactor, transfer); + return new FileWidget(stream_interactor, file_transfer); } - public override Gee.List<Plugins.MessageAction>? get_item_actions(Plugins.WidgetType type) { return null; } + public override Gee.List<Plugins.MessageAction>? get_item_actions(Plugins.WidgetType type) { + if (file_transfer.provider != 0 || file_transfer.info == null) return null; + + Gee.List<Plugins.MessageAction> actions = new ArrayList<Plugins.MessageAction>(); + + if (stream_interactor.get_module(ContentItemStore.IDENTITY).get_message_id_for_content_item(file_item.conversation, content_item) != null) { + Plugins.MessageAction reply_action = new Plugins.MessageAction(); + reply_action.icon_name = "mail-reply-sender-symbolic"; + reply_action.callback = (button, content_meta_item_activated, widget) => { + GLib.Application.get_default().activate_action("quote", new GLib.Variant.tuple(new GLib.Variant[] { new GLib.Variant.int32(file_item.conversation.id), new GLib.Variant.int32(content_item.id) })); + }; + actions.add(reply_action); + + Plugins.MessageAction action2 = new Plugins.MessageAction(); + action2.icon_name = "dino-emoticon-add-symbolic"; + EmojiChooser chooser = new EmojiChooser(); + chooser.emoji_picked.connect((emoji) => { + stream_interactor.get_module(Reactions.IDENTITY).add_reaction(file_item.conversation, content_item, emoji); + }); + action2.popover = chooser; + actions.add(action2); + } + return actions; + } } public class FileWidget : SizeRequestBox { diff --git a/main/src/ui/conversation_content_view/message_widget.vala b/main/src/ui/conversation_content_view/message_widget.vala index f4e1d22c..fb4ba162 100644 --- a/main/src/ui/conversation_content_view/message_widget.vala +++ b/main/src/ui/conversation_content_view/message_widget.vala @@ -198,7 +198,7 @@ public class MessageMetaItem : ContentMetaItem { if (quoted_content_item != null) { var quote_model = new Quote.Model.from_content_item(quoted_content_item, message_item.conversation, stream_interactor); quote_model.jump_to.connect(() => { - GLib.Application.get_default().activate_action("jump-to-conversation-message", new GLib.Variant.tuple(new GLib.Variant[] { new GLib.Variant.int32(message_item.conversation.id), new GLib.Variant.int32(message_item.id) })); + GLib.Application.get_default().activate_action("jump-to-conversation-message", new GLib.Variant.tuple(new GLib.Variant[] { new GLib.Variant.int32(message_item.conversation.id), new GLib.Variant.int32(quoted_content_item.id) })); }); var quote_widget = Quote.get_widget(quote_model); outer.set_widget(quote_widget, Plugins.WidgetType.GTK4, 1); @@ -226,7 +226,7 @@ public class MessageMetaItem : ContentMetaItem { Plugins.MessageAction reply_action = new Plugins.MessageAction(); reply_action.icon_name = "mail-reply-sender-symbolic"; reply_action.callback = (button, content_meta_item_activated, widget) => { - GLib.Application.get_default().activate_action("quote", new GLib.Variant.tuple(new GLib.Variant[] { new GLib.Variant.int32(message_item.conversation.id), new GLib.Variant.int32(message_item.id) })); + GLib.Application.get_default().activate_action("quote", new GLib.Variant.tuple(new GLib.Variant[] { new GLib.Variant.int32(message_item.conversation.id), new GLib.Variant.int32(content_item.id) })); }; actions.add(reply_action); diff --git a/main/src/ui/conversation_content_view/quote_widget.vala b/main/src/ui/conversation_content_view/quote_widget.vala index f627c852..cfe2f153 100644 --- a/main/src/ui/conversation_content_view/quote_widget.vala +++ b/main/src/ui/conversation_content_view/quote_widget.vala @@ -27,7 +27,8 @@ namespace Dino.Ui.Quote { var message = ((MessageItem) content_item).message; this.message = Dino.message_body_without_reply_fallback(message); } else if (content_item.type_ == FileItem.TYPE) { - this.message = "[File]"; + var file_transfer = ((FileItem) content_item).file_transfer; + this.message = _("File") + ": " + file_transfer.file_name; } this.message_time = content_item.time; |