aboutsummaryrefslogtreecommitdiff
path: root/plugins/omemo/src/ui
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-05-16 20:41:41 +0200
committerfiaxh <git@lightrise.org>2019-07-08 18:46:30 +0200
commita7aa5130f821252c17ffc5725e4240553248ad17 (patch)
treec84c211b4d3ee395ee5e460e187b8eeb0431f6c2 /plugins/omemo/src/ui
parent837de4063dbe398735a5b1d35bde1821c177b555 (diff)
downloaddino-a7aa5130f821252c17ffc5725e4240553248ad17.tar.gz
dino-a7aa5130f821252c17ffc5725e4240553248ad17.zip
OMEMO code cleanup: Move TrustLevel out of Database
Diffstat (limited to 'plugins/omemo/src/ui')
-rw-r--r--plugins/omemo/src/ui/contact_details_dialog.vala34
-rw-r--r--plugins/omemo/src/ui/manage_key_dialog.vala14
2 files changed, 24 insertions, 24 deletions
diff --git a/plugins/omemo/src/ui/contact_details_dialog.vala b/plugins/omemo/src/ui/contact_details_dialog.vala
index 6899acf6..eee06f0f 100644
--- a/plugins/omemo/src/ui/contact_details_dialog.vala
+++ b/plugins/omemo/src/ui/contact_details_dialog.vala
@@ -91,7 +91,7 @@ public class ContactDetailsDialog : Gtk.Dialog {
if(own && device[plugin.db.identity_meta.device_id] == own_id) {
continue;
}
- add_fingerprint(device, (Database.IdentityMetaTable.TrustLevel) device[plugin.db.identity_meta.trust_level]);
+ add_fingerprint(device, (TrustLevel) device[plugin.db.identity_meta.trust_level]);
}
auto_accept_switch.set_active(plugin.db.trust.get_blind_trust(identity_id, jid.bare_jid.to_string()));
@@ -103,8 +103,8 @@ public class ContactDetailsDialog : Gtk.Dialog {
new_keys_container.visible = false;
foreach (Row device in plugin.db.identity_meta.get_new_devices(identity_id, jid.to_string())) {
- plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], Database.IdentityMetaTable.TrustLevel.TRUSTED);
- add_fingerprint(device, Database.IdentityMetaTable.TrustLevel.TRUSTED);
+ plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], TrustLevel.TRUSTED);
+ add_fingerprint(device, TrustLevel.TRUSTED);
}
}
@@ -121,17 +121,17 @@ public class ContactDetailsDialog : Gtk.Dialog {
private void set_row(int trust, bool now_active, Image img, Label status_lbl, Label lbl, ListBoxRow lbr){
switch(trust) {
- case Database.IdentityMetaTable.TrustLevel.TRUSTED:
+ case TrustLevel.TRUSTED:
img.icon_name = "emblem-ok-symbolic";
status_lbl.set_markup("<span color='#1A63D9'>%s</span>".printf(_("Accepted")));
lbl.get_style_context().remove_class("dim-label");
break;
- case Database.IdentityMetaTable.TrustLevel.UNTRUSTED:
+ case TrustLevel.UNTRUSTED:
img.icon_name = "action-unavailable-symbolic";
status_lbl.set_markup("<span color='#D91900'>%s</span>".printf(_("Rejected")));
lbl.get_style_context().add_class("dim-label");
break;
- case Database.IdentityMetaTable.TrustLevel.VERIFIED:
+ case TrustLevel.VERIFIED:
img.icon_name = "security-high-symbolic";
status_lbl.set_markup("<span color='#1A63D9'>%s</span>".printf(_("Verified")));
lbl.get_style_context().remove_class("dim-label");
@@ -145,7 +145,7 @@ public class ContactDetailsDialog : Gtk.Dialog {
}
}
- private void add_fingerprint(Row device, Database.IdentityMetaTable.TrustLevel trust) {
+ private void add_fingerprint(Row device, TrustLevel trust) {
keys_container.visible = true;
ListBoxRow lbr = new ListBoxRow() { visible = true, activatable = true, hexpand = true };
@@ -188,14 +188,14 @@ public class ContactDetailsDialog : Gtk.Dialog {
private void update_device(int response, Row device){
switch (response) {
- case Database.IdentityMetaTable.TrustLevel.TRUSTED:
- plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], Database.IdentityMetaTable.TrustLevel.TRUSTED);
+ case TrustLevel.TRUSTED:
+ plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], TrustLevel.TRUSTED);
break;
- case Database.IdentityMetaTable.TrustLevel.UNTRUSTED:
- plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], Database.IdentityMetaTable.TrustLevel.UNTRUSTED);
+ case TrustLevel.UNTRUSTED:
+ plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], TrustLevel.UNTRUSTED);
break;
- case Database.IdentityMetaTable.TrustLevel.VERIFIED:
- plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], Database.IdentityMetaTable.TrustLevel.VERIFIED);
+ case TrustLevel.VERIFIED:
+ plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], TrustLevel.VERIFIED);
plugin.trust_manager.set_blind_trust(account, jid, false);
auto_accept_switch.set_active(false);
break;
@@ -219,15 +219,15 @@ public class ContactDetailsDialog : Gtk.Dialog {
no_button.get_style_context().add_class("destructive-action");
yes_button.clicked.connect(() => {
- plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], Database.IdentityMetaTable.TrustLevel.TRUSTED);
- add_fingerprint(device, Database.IdentityMetaTable.TrustLevel.TRUSTED);
+ plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], TrustLevel.TRUSTED);
+ add_fingerprint(device, TrustLevel.TRUSTED);
new_keys_listbox.remove(lbr);
if (new_keys_listbox.get_children().length() < 1) new_keys_container.visible = false;
});
no_button.clicked.connect(() => {
- plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], Database.IdentityMetaTable.TrustLevel.UNTRUSTED);
- add_fingerprint(device, Database.IdentityMetaTable.TrustLevel.UNTRUSTED);
+ plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], TrustLevel.UNTRUSTED);
+ add_fingerprint(device, TrustLevel.UNTRUSTED);
new_keys_listbox.remove(lbr);
if (new_keys_listbox.get_children().length() < 1) new_keys_container.visible = false;
});
diff --git a/plugins/omemo/src/ui/manage_key_dialog.vala b/plugins/omemo/src/ui/manage_key_dialog.vala
index 87d43de8..51dcbad0 100644
--- a/plugins/omemo/src/ui/manage_key_dialog.vala
+++ b/plugins/omemo/src/ui/manage_key_dialog.vala
@@ -50,7 +50,7 @@ public class ManageKeyDialog : Gtk.Dialog {
manage_stack.set_visible_child_name("confirm");
ok_button.sensitive = true;
return_to_main = false;
- current_response = Database.IdentityMetaTable.TrustLevel.VERIFIED;
+ current_response = TrustLevel.VERIFIED;
});
verify_no_button.clicked.connect(() => {
@@ -115,17 +115,17 @@ public class ManageKeyDialog : Gtk.Dialog {
ListBoxRow accept_row = new ListBoxRow() {visible = true };
accept_row.add(make_action_box(_("Accept key"), _("Start accepting this key during communication with its associated contact")));
- switch((Database.IdentityMetaTable.TrustLevel) device[db.identity_meta.trust_level]) {
- case Database.IdentityMetaTable.TrustLevel.TRUSTED:
+ switch((TrustLevel) device[db.identity_meta.trust_level]) {
+ case TrustLevel.TRUSTED:
main_desc_label.set_markup(_("This key is currently %s.").printf("<span color='#1A63D9'>"+_("accepted")+"</span>")+" "+_("This means it can be used by %s to receive and send messages.").printf(@"<b>$(device[db.identity_meta.address_name])</b>"));
main_action_list.add(verify_row);
main_action_list.add(reject_row);
break;
- case Database.IdentityMetaTable.TrustLevel.VERIFIED:
+ case TrustLevel.VERIFIED:
main_desc_label.set_markup(_("This key is currently %s.").printf("<span color='#1A63D9'>"+_("verified")+"</span>")+" "+_("This means it can be used by %s to receive and send messages.") + " " + _("Additionally it has been verified to match the key on the contact's device.").printf(@"<b>$(device[db.identity_meta.address_name])</b>"));
main_action_list.add(reject_row);
break;
- case Database.IdentityMetaTable.TrustLevel.UNTRUSTED:
+ case TrustLevel.UNTRUSTED:
main_desc_label.set_markup(_("This key is currently %s.").printf("<span color='#D91900'>"+_("rejected")+"</span>")+" "+_("This means it cannot be used by %s to receive messages, and any messages sent by it will be ignored.").printf(@"<b>$(device[db.identity_meta.address_name])</b>"));
main_action_list.add(accept_row);
break;
@@ -142,7 +142,7 @@ public class ManageKeyDialog : Gtk.Dialog {
manage_stack.set_visible_child_name("confirm");
ok_button.sensitive = true;
return_to_main = true;
- current_response = Database.IdentityMetaTable.TrustLevel.UNTRUSTED;
+ current_response = TrustLevel.UNTRUSTED;
} else if (row == accept_row) {
confirm_image.set_from_icon_name("emblem-ok-symbolic", IconSize.DIALOG);
confirm_title_label.label = _("Accept key");
@@ -150,7 +150,7 @@ public class ManageKeyDialog : Gtk.Dialog {
manage_stack.set_visible_child_name("confirm");
ok_button.sensitive = true;
return_to_main = true;
- current_response = Database.IdentityMetaTable.TrustLevel.TRUSTED;
+ current_response = TrustLevel.TRUSTED;
}
cancel_button.label = _("Back");
});