Philipp Hörist pushed to branch master at gajim / gajim
Commits: 0a3bd34e by Daniel Brötzmann at 2019-09-05T19:33:28Z Replace PlainConnectionDialog with NewConfirmationCheckDialog
- - - - - 911aaa1f by Daniel Brötzmann at 2019-09-05T19:34:05Z Remove PlainConnectionDialog
- - - - -
2 changed files:
- gajim/gtk/dialogs.py - gajim/gui_interface.py
Changes:
===================================== gajim/gtk/dialogs.py ===================================== @@ -319,31 +319,6 @@ class ConfirmationDialogDoubleCheck(ConfirmationDialog): 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) insecurely. This means conversations will not be ' - 'encrypted, and is strongly discouraged.\nAre you sure you want ' - 'to do that?') % {'account': account, - 'server': app.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.get_widget_for_response(Gtk.ResponseType.OK) - self.ok_button.set_sensitive(False) - self.checkbutton1.connect('clicked', self.on_checkbutton_clicked) - self.set_title(_('Insecure connection')) - - def on_checkbutton_clicked(self, widget): - self.ok_button.set_sensitive(widget.get_active()) - class ConfirmationDialogDoubleRadio(ConfirmationDialog): """ HIG compliant confirmation dialog with 2 radios
===================================== gajim/gui_interface.py ===================================== @@ -99,10 +99,10 @@ from gajim.gtk.dialogs import ErrorDialog from gajim.gtk.dialogs import WarningDialog from gajim.gtk.dialogs import InformationDialog from gajim.gtk.dialogs import NewConfirmationDialog +from gajim.gtk.dialogs import NewConfirmationCheckDialog from gajim.gtk.dialogs import DialogButton from gajim.gtk.dialogs import InputDialog from gajim.gtk.dialogs import PassphraseDialog -from gajim.gtk.dialogs import PlainConnectionDialog from gajim.gtk.dialogs import SSLErrorDialog from gajim.gtk.dialogs import InvitationReceivedDialog from gajim.gtk.profile import ProfileWindow @@ -1161,34 +1161,38 @@ class Interface:
def handle_event_plain_connection(self, obj): # ('PLAIN_CONNECTION', account, (connection)) - def on_ok(is_checked): - if not is_checked[0]: - if is_checked[1]: - app.config.set_per('accounts', obj.conn.name, - 'action_when_plaintext_connection', 'disconnect') - on_cancel() - return - # On cancel call del self.instances, so don't call it another time - # before - del self.instances[obj.conn.name]['online_dialog']\ - ['plain_connection'] - if is_checked[1]: + def _on_connect_anyway(is_checked): + if is_checked: app.config.set_per('accounts', obj.conn.name, - 'action_when_plaintext_connection', 'connect') + 'action_when_plaintext_connection', + 'connect') obj.conn.connection_accepted(obj.xmpp_client, 'plain')
- def on_cancel(): - del self.instances[obj.conn.name]['online_dialog']\ - ['plain_connection'] + def _on_abort(is_checked): + if is_checked: + app.config.set_per('accounts', obj.conn.name, + 'action_when_plaintext_connection', + 'disconnect') obj.conn.disconnect(reconnect=False) app.nec.push_incoming_event(OurShowEvent(None, conn=obj.conn, - show='offline')) - - 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'] = \ - PlainConnectionDialog(obj.conn.name, on_ok, on_cancel) + show='offline')) + + NewConfirmationCheckDialog( + _('Insecure Connection'), + _('Insecure Connection'), + _('You are about to connect to the account %(account)s ' + '(%(server)s) using an insecure connection method. This means ' + 'conversations will not be encrypted. Connecting PLAIN is ' + 'strongly discouraged.') % { + 'account': obj.conn.name, + 'server': app.get_hostname_from_account(obj.conn.name)}, + _('_Do not ask me again'), + [DialogButton.make('Cancel', + text=_('_Abort'), + callback=_on_abort), + DialogButton.make('Remove', + text=_('_Connect Anyway'), + callback=_on_connect_anyway)]).show()
def create_core_handlers_list(self): self.handlers = {
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/18070f5983296936b1f71da5f3ed1bec33...