aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-05-15 11:50:26 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-05 14:32:07 +0200
commit366a49a82073a591c9b06979fd2bbb0c102a9581 (patch)
treeacf4c8044e618257932af5379443cee920af2eef /main
parentcc6d8d5930769e48df8b604622afaae93cdaa8ff (diff)
downloaddino-366a49a82073a591c9b06979fd2bbb0c102a9581.tar.gz
Set up default encryption settings GUI
Diffstat (limited to 'main')
-rw-r--r--main/data/settings_dialog.ui71
-rw-r--r--main/src/ui/settings_dialog.vala25
2 files changed, 96 insertions, 0 deletions
diff --git a/main/data/settings_dialog.ui b/main/data/settings_dialog.ui
index d5b7ac92..2d4b52c3 100644
--- a/main/data/settings_dialog.ui
+++ b/main/data/settings_dialog.ui
@@ -77,6 +77,77 @@
<property name="height">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkBox" id ="default_encryption_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Default encryption</property>
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="encryption_radio_undecided">
+ <property name="label" translatable="yes">Ask</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">encryption_radio_undecided</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="encryption_radio_omemo">
+ <property name="label" translatable="yes">OMEMO</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">encryption_radio_undecided</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="encryption_radio_openpgp">
+ <property name="label" translatable="yes">OpenPGP</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">encryption_radio_undecided</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/main/src/ui/settings_dialog.vala b/main/src/ui/settings_dialog.vala
index e994e00c..59edef2c 100644
--- a/main/src/ui/settings_dialog.vala
+++ b/main/src/ui/settings_dialog.vala
@@ -1,4 +1,5 @@
using Gtk;
+using Dino.Entities;
namespace Dino.Ui {
@@ -10,6 +11,9 @@ class SettingsDialog : Dialog {
[GtkChild] private unowned CheckButton notification_checkbutton;
[GtkChild] private unowned CheckButton emoji_checkbutton;
[GtkChild] private unowned CheckButton check_spelling_checkbutton;
+ [GtkChild] private unowned RadioButton encryption_radio_undecided;
+ [GtkChild] private unowned RadioButton encryption_radio_omemo;
+ [GtkChild] private unowned RadioButton encryption_radio_openpgp;
Dino.Entities.Settings settings = Dino.Application.get_default().settings;
@@ -21,12 +25,33 @@ class SettingsDialog : Dialog {
notification_checkbutton.active = settings.notifications;
emoji_checkbutton.active = settings.convert_utf8_smileys;
check_spelling_checkbutton.active = settings.check_spelling;
+ encryption_radio_undecided.active = settings.default_encryption == Encryption.UNKNOWN;
+ encryption_radio_omemo.active = settings.default_encryption == Encryption.OMEMO;
+ encryption_radio_openpgp.active = settings.default_encryption == Encryption.PGP;
typing_checkbutton.toggled.connect(() => { settings.send_typing = typing_checkbutton.active; } );
marker_checkbutton.toggled.connect(() => { settings.send_marker = marker_checkbutton.active; } );
notification_checkbutton.toggled.connect(() => { settings.notifications = notification_checkbutton.active; } );
emoji_checkbutton.toggled.connect(() => { settings.convert_utf8_smileys = emoji_checkbutton.active; });
check_spelling_checkbutton.toggled.connect(() => { settings.check_spelling = check_spelling_checkbutton.active; });
+
+ encryption_radio_undecided.toggled.connect(() => {
+ if (encryption_radio_undecided.active) {
+ settings.default_encryption = Encryption.UNKNOWN;
+ }
+ });
+
+ encryption_radio_omemo.toggled.connect(() => {
+ if (encryption_radio_omemo.active) {
+ settings.default_encryption = Encryption.OMEMO;
+ }
+ });
+
+ encryption_radio_openpgp.toggled.connect(() => {
+ if (encryption_radio_openpgp.active) {
+ settings.default_encryption = Encryption.PGP;
+ }
+ });
}
}