diff --git a/libdino/src/plugin/interfaces.vala b/libdino/src/plugin/interfaces.vala
index 535addf2..6b85a70c 100644
--- a/libdino/src/plugin/interfaces.vala
+++ b/libdino/src/plugin/interfaces.vala
@@ -26,6 +26,7 @@ public interface EncryptionListEntry : Object {
public abstract string name { get; }
public abstract void encryption_activated(Entities.Conversation conversation, Plugins.SetInputFieldStatus callback);
+ public abstract Object? get_encryption_icon(Entities.Conversation conversation, ContentItem content_item);
}
public abstract class AccountSettingsEntry : Object {
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index f2c605d4..083e64c8 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -18,6 +18,7 @@ set(RESOURCE_LIST
icons/dino-double-tick-symbolic.svg
icons/dino-emoticon-symbolic.svg
icons/dino-qr-code-symbolic.svg
+ icons/dino-security-high-symbolic.svg
icons/dino-party-popper-symbolic.svg
icons/dino-status-away.svg
icons/dino-status-chat.svg
diff --git a/main/data/conversation_content_view/item_metadata_header.ui b/main/data/conversation_content_view/item_metadata_header.ui
index 4252a0a3..31aa7e44 100644
--- a/main/data/conversation_content_view/item_metadata_header.ui
+++ b/main/data/conversation_content_view/item_metadata_header.ui
@@ -42,15 +42,5 @@
-
-
-
-
-
-
diff --git a/main/data/icons/dino-security-high-symbolic.svg b/main/data/icons/dino-security-high-symbolic.svg
new file mode 100644
index 00000000..d930b901
--- /dev/null
+++ b/main/data/icons/dino-security-high-symbolic.svg
@@ -0,0 +1,5 @@
+
+
diff --git a/main/src/ui/conversation_content_view/chat_state_populator.vala b/main/src/ui/conversation_content_view/chat_state_populator.vala
index 54b41b7d..0438e014 100644
--- a/main/src/ui/conversation_content_view/chat_state_populator.vala
+++ b/main/src/ui/conversation_content_view/chat_state_populator.vala
@@ -62,7 +62,6 @@ class ChatStatePopulator : Plugins.ConversationItemPopulator, Plugins.Conversati
}
private class MetaChatStateItem : Plugins.MetaConversationItem {
- public override bool dim { get; set; default=true; }
public override DateTime sort_time { get; set; default=new DateTime.now_utc().add_years(10); }
public override bool can_merge { get; set; default=false; }
diff --git a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
index 589bcddd..b4cd766f 100644
--- a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
+++ b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
@@ -88,8 +88,8 @@ public class ItemMetaDataHeader : Box {
[GtkChild] public Label name_label;
[GtkChild] public Label dot_label;
[GtkChild] public Label time_label;
- [GtkChild] public Image encryption_image;
- [GtkChild] public Image received_image;
+ public Image received_image = new Image() { opacity=0.4 };
+ public Image? encryption_image = null;
public static IconSize ICON_SIZE_HEADER = Gtk.icon_size_register("im.dino.Dino.HEADER_ICON", 17, 12);
@@ -106,9 +106,23 @@ public class ItemMetaDataHeader : Box {
update_name_label();
name_label.style_updated.connect(update_name_label);
- if (item.encryption != Encryption.NONE) {
- encryption_image.visible = true;
- encryption_image.set_from_icon_name("dino-changes-prevent-symbolic", ICON_SIZE_HEADER);
+
+ Application app = GLib.Application.get_default() as Application;
+
+ ContentMetaItem ci = item as ContentMetaItem;
+ if (ci != null) {
+ foreach(var e in app.plugin_registry.encryption_list_entries) {
+ if (e.encryption == item.encryption) {
+ Object? w = e.get_encryption_icon(conversation, ci.content_item);
+ if (w != null) {
+ this.add(w as Widget);
+ } else {
+ Image image = new Image.from_icon_name("dino-changes-prevent-symbolic", ICON_SIZE_HEADER) { opacity=0.4, visible = true };
+ this.add(image);
+ }
+ break;
+ }
+ }
}
if (item.display_time != null) {
update_time();
@@ -143,11 +157,9 @@ public class ItemMetaDataHeader : Box {
received_image.visible = true;
received_image.set_from_icon_name("dialog-warning-symbolic", ICON_SIZE_HEADER);
Util.force_error_color(received_image);
- Util.force_error_color(encryption_image);
Util.force_error_color(time_label);
string error_text = _("Unable to send message");
received_image.tooltip_text = error_text;
- encryption_image.tooltip_text = error_text;
time_label.tooltip_text = error_text;
return;
} else if (item.mark != Message.Marked.READ) {
diff --git a/plugins/omemo/src/ui/encryption_list_entry.vala b/plugins/omemo/src/ui/encryption_list_entry.vala
index a4891442..aaec517f 100644
--- a/plugins/omemo/src/ui/encryption_list_entry.vala
+++ b/plugins/omemo/src/ui/encryption_list_entry.vala
@@ -1,12 +1,16 @@
+using Gtk;
+using Qlite;
using Xmpp;
namespace Dino.Plugins.Omemo {
public class EncryptionListEntry : Plugins.EncryptionListEntry, Object {
private Plugin plugin;
+ private Database db;
public EncryptionListEntry(Plugin plugin) {
this.plugin = plugin;
+ this.db = plugin.db;
}
public Entities.Encryption encryption { get {
@@ -17,6 +21,22 @@ public class EncryptionListEntry : Plugins.EncryptionListEntry, Object {
return "OMEMO";
}}
+ public static IconSize ICON_SIZE_HEADER = Gtk.icon_size_register("im.dino.Dino.HEADER_ICON2", 17, 12);
+
+ public Object? get_encryption_icon(Entities.Conversation conversation, ContentItem content_item) {
+ if (content_item.encryption != encryption) return null;
+
+ RowOption row = db.content_item_meta.select( { db.identity_meta.trust_level } ).with(db.content_item_meta.content_item_id, "=", content_item.id)
+ .join_on(db.identity_meta, @"$(db.identity_meta.address_name)=$(db.content_item_meta.address_name) AND $(db.identity_meta.device_id)=$(db.content_item_meta.device_id)")
+ .single().row();
+
+
+ if (row.is_present() && (TrustLevel) row[db.identity_meta.trust_level] == TrustLevel.VERIFIED) {
+ return new Image.from_icon_name("dino-security-high-symbolic", ICON_SIZE_HEADER) { opacity=0.4, visible = true };
+ }
+ return null;
+ }
+
public void encryption_activated(Entities.Conversation conversation, Plugins.SetInputFieldStatus input_status_callback) {
encryption_activated_async.begin(conversation, input_status_callback);
}
diff --git a/plugins/openpgp/src/encryption_list_entry.vala b/plugins/openpgp/src/encryption_list_entry.vala
index 5b89ec1c..4169a2a2 100644
--- a/plugins/openpgp/src/encryption_list_entry.vala
+++ b/plugins/openpgp/src/encryption_list_entry.vala
@@ -1,4 +1,5 @@
using Gee;
+using Gtk;
using Dino.Entities;
using Xmpp;
@@ -23,6 +24,12 @@ private class EncryptionListEntry : Plugins.EncryptionListEntry, Object {
return "OpenPGP";
}}
+ public static IconSize ICON_SIZE_HEADER = Gtk.icon_size_register("im.dino.Dino.HEADER_ICON3", 17, 12);
+
+ public Object? get_encryption_icon(Entities.Conversation conversation, ContentItem content_item) {
+ return null;
+ }
+
public void encryption_activated(Entities.Conversation conversation, Plugins.SetInputFieldStatus input_status_callback) {
try {
GPGHelper.get_public_key(db.get_account_key(conversation.account) ?? "");