From 5fc0435cc1227bf445d06a3931343020faaecd10 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Thu, 9 Mar 2017 15:34:32 +0100 Subject: Save unsent messages (acc offline etc) and send later; don't send pgp messages if pgp error --- client/src/ui/conversation_selector/list.vala | 2 +- .../ui/conversation_summary/merged_message_item.vala | 8 +++++++- client/src/ui/conversation_summary/view.vala | 3 ++- client/src/ui/conversation_titlebar.vala | 20 ++++++++++---------- 4 files changed, 20 insertions(+), 13 deletions(-) (limited to 'client/src/ui') diff --git a/client/src/ui/conversation_selector/list.vala b/client/src/ui/conversation_selector/list.vala index b114c3fa..e6a5231c 100644 --- a/client/src/ui/conversation_selector/list.vala +++ b/client/src/ui/conversation_selector/list.vala @@ -95,7 +95,7 @@ public class List : ListBox { public void add_conversation(Conversation conversation) { ConversationRow row; if (!rows.has_key(conversation)) { - if (conversation.type_ == Conversation.TYPE_GROUPCHAT) { + if (conversation.type_ == Conversation.Type.GROUPCHAT) { row = new GroupchatRow(stream_interactor, conversation); } else { row = new ChatRow(stream_interactor, conversation); diff --git a/client/src/ui/conversation_summary/merged_message_item.vala b/client/src/ui/conversation_summary/merged_message_item.vala index b1e99d3e..b73e8b4f 100644 --- a/client/src/ui/conversation_summary/merged_message_item.vala +++ b/client/src/ui/conversation_summary/merged_message_item.vala @@ -68,10 +68,16 @@ public class MergedMessageItem : Grid { } private void update_received() { + received_image.visible = true; bool all_received = true; bool all_read = true; foreach (Message message in messages) { - if (message.marked != Message.Marked.READ) { + if (message.marked == Message.Marked.WONTSEND) { + Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default(); + Gtk.IconInfo? icon_info = icon_theme.lookup_icon("dialog-warning-symbolic", IconSize.SMALL_TOOLBAR, 0); + received_image.set_from_pixbuf(icon_info.load_symbolic({1,0,0,1})); + return; + } else if (message.marked != Message.Marked.READ) { all_read = false; if (message.marked != Message.Marked.RECEIVED) { all_received = false; diff --git a/client/src/ui/conversation_summary/view.vala b/client/src/ui/conversation_summary/view.vala index 0ea1a32c..59cf88aa 100644 --- a/client/src/ui/conversation_summary/view.vala +++ b/client/src/ui/conversation_summary/view.vala @@ -203,7 +203,8 @@ public class View : Box { return message_item != null && message_item.from.equals(message.from) && message_item.messages.get(0).encryption == message.encryption && - message.time.difference(message_item.initial_time) < TimeSpan.MINUTE; + message.time.difference(message_item.initial_time) < TimeSpan.MINUTE && + (message_item.messages.get(0).marked == Entities.Message.Marked.WONTSEND) == (message.marked == Entities.Message.Marked.WONTSEND); } private void force_alloc_width(Widget widget, int width) { diff --git a/client/src/ui/conversation_titlebar.vala b/client/src/ui/conversation_titlebar.vala index cd21353c..25304e1a 100644 --- a/client/src/ui/conversation_titlebar.vala +++ b/client/src/ui/conversation_titlebar.vala @@ -41,19 +41,19 @@ public class Dino.Ui.ConversationTitlebar : Gtk.HeaderBar { string? pgp_id = PgpManager.get_instance(stream_interactor).get_key_id(conversation.account, conversation.counterpart); button_pgp.set_sensitive(pgp_id != null); switch (conversation.encryption) { - case Conversation.ENCRYPTION_UNENCRYPTED: + case Conversation.Encryption.UNENCRYPTED: button_unencrypted.set_active(true); break; - case Conversation.ENCRYPTION_PGP: + case Conversation.Encryption.PGP: button_pgp.set_active(true); break; } } private void update_encryption_menu_icon() { - encryption_button.visible = conversation.type_ == Conversation.TYPE_CHAT; - if (conversation.type_ == Conversation.TYPE_CHAT) { - if (conversation.encryption == Conversation.ENCRYPTION_UNENCRYPTED) { + encryption_button.visible = (conversation.type_ == Conversation.Type.CHAT); + if (conversation.type_ == Conversation.Type.CHAT) { + if (conversation.encryption == Conversation.Encryption.UNENCRYPTED) { encryption_button.set_image(new Image.from_icon_name("changes-allow-symbolic", IconSize.BUTTON)); } else { encryption_button.set_image(new Image.from_icon_name("changes-prevent-symbolic", IconSize.BUTTON)); @@ -62,8 +62,8 @@ public class Dino.Ui.ConversationTitlebar : Gtk.HeaderBar { } private void update_groupchat_menu() { - groupchat_button.visible = conversation.type_ == Conversation.TYPE_GROUPCHAT; - if (conversation.type_ == Conversation.TYPE_GROUPCHAT) { + groupchat_button.visible = conversation.type_ == Conversation.Type.GROUPCHAT; + if (conversation.type_ == Conversation.Type.GROUPCHAT) { groupchat_button.set_use_popover(true); Popover popover = new Popover(null); OccupantList occupant_list = new OccupantList(stream_interactor, conversation); @@ -80,7 +80,7 @@ public class Dino.Ui.ConversationTitlebar : Gtk.HeaderBar { private void update_subtitle(string? subtitle = null) { if (subtitle != null) { set_subtitle(subtitle); - } else if (conversation.type_ == Conversation.TYPE_GROUPCHAT) { + } else if (conversation.type_ == Conversation.Type.GROUPCHAT) { string subject = MucManager.get_instance(stream_interactor).get_groupchat_subject(conversation.counterpart, conversation.account); set_subtitle(subject != "" ? subject : null); } else { @@ -106,9 +106,9 @@ public class Dino.Ui.ConversationTitlebar : Gtk.HeaderBar { button_unencrypted.toggled.connect(() => { if (conversation != null) { if (button_unencrypted.get_active()) { - conversation.encryption = Conversation.ENCRYPTION_UNENCRYPTED; + conversation.encryption = Conversation.Encryption.UNENCRYPTED; } else if (button_pgp.get_active()) { - conversation.encryption = Conversation.ENCRYPTION_PGP; + conversation.encryption = Conversation.Encryption.PGP; } update_encryption_menu_icon(); } -- cgit v1.2.3-70-g09d2