diff --git a/src/dialogs.py b/src/dialogs.py index 4fd4a8d2c..1acce3bb6 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -1848,6 +1848,31 @@ class ConfirmationDialogDoubleCheck(ConfirmationDialog): is_checked_2 = False return [is_checked_1, is_checked_2] +class PlainConnectionDialog(ConfirmationDialogDoubleCheck): + """ + Dialog that is shown when using an insecure connection + """ + def __init__(self, account, on_ok, on_cancel): + pritext = _('Insecure connection') + sectext = _('You are about to connect to the account %(account)s ' + '(%(server)s) with an insecure connection. This means all your ' + 'conversations will be exchanged unencrypted. This type of ' + 'connection is really discouraged.\nAre you sure you want to do ' + 'that?') % {'account': account, + 'server': gajim.get_hostname_from_account(account)} + checktext1 = _('Yes, I really want to connect insecurely') + tooltip1 = _('Gajim will NOT connect unless you check this box') + checktext2 = _('_Do not ask me again') + ConfirmationDialogDoubleCheck.__init__(self, pritext, sectext, + checktext1, checktext2, tooltip1=tooltip1, on_response_ok=on_ok, + on_response_cancel=on_cancel, is_modal=False) + self.ok_button = self.action_area.get_children()[0] # right to left + self.ok_button.set_sensitive(False) + self.checkbutton1.connect('clicked', self.on_checkbutton_clicked) + + def on_checkbutton_clicked(self, widget): + self.ok_button.set_sensitive(widget.get_active()) + class ConfirmationDialogDoubleRadio(ConfirmationDialog): """ HIG compliant confirmation dialog with 2 radios diff --git a/src/gui_interface.py b/src/gui_interface.py index a4c9691f2..34a97b806 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -1409,23 +1409,11 @@ class Interface: gajim.nec.push_incoming_event(OurShowEvent(None, conn=obj.conn, show='offline')) - pritext = _('Insecure connection') - sectext = _('You are about to connect to the account %(account)s ' - '(%(server)s) with an insecure connection. This means all your ' - 'conversations will be exchanged unencrypted. This type of ' - 'connection is really discouraged.\nAre you sure you want to do ' - 'that?') % {'account': obj.conn.name, - 'server': gajim.get_hostname_from_account(obj.conn.name)} - checktext1 = _('Yes, I really want to connect insecurely') - tooltip1 = _('Gajim will NOT connect unless you check this box') - checktext2 = _('_Do not ask me again') if 'plain_connection' in self.instances[obj.conn.name]['online_dialog']: self.instances[obj.conn.name]['online_dialog']['plain_connection'].\ destroy() self.instances[obj.conn.name]['online_dialog']['plain_connection'] = \ - dialogs.ConfirmationDialogDoubleCheck(pritext, sectext, checktext1, - checktext2, tooltip1=tooltip1, on_response_ok=on_ok, - on_response_cancel=on_cancel, is_modal=False) + dialogs.PlainConnectionDialog(obj.conn.name, on_ok, on_cancel) def handle_event_insecure_ssl_connection(self, obj): # ('INSECURE_SSL_CONNECTION', account, (connection, connection_type))