make the Ok button of Insecure connection dialog insensitive when yes checkbox is not checked. Fixes #7373

This commit is contained in:
Yann Leboulanger 2013-07-18 20:32:45 +02:00
parent e98b184e28
commit 5f5afab1e2
2 changed files with 26 additions and 13 deletions

View File

@ -1826,6 +1826,31 @@ class ConfirmationDialogDoubleCheck(ConfirmationDialog):
is_checked_2 = False is_checked_2 = False
return [is_checked_1, is_checked_2] 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): class ConfirmationDialogDoubleRadio(ConfirmationDialog):
""" """
HIG compliant confirmation dialog with 2 radios HIG compliant confirmation dialog with 2 radios

View File

@ -1409,23 +1409,11 @@ class Interface:
gajim.nec.push_incoming_event(OurShowEvent(None, conn=obj.conn, gajim.nec.push_incoming_event(OurShowEvent(None, conn=obj.conn,
show='offline')) 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']: if 'plain_connection' in self.instances[obj.conn.name]['online_dialog']:
self.instances[obj.conn.name]['online_dialog']['plain_connection'].\ self.instances[obj.conn.name]['online_dialog']['plain_connection'].\
destroy() destroy()
self.instances[obj.conn.name]['online_dialog']['plain_connection'] = \ self.instances[obj.conn.name]['online_dialog']['plain_connection'] = \
dialogs.ConfirmationDialogDoubleCheck(pritext, sectext, checktext1, dialogs.PlainConnectionDialog(obj.conn.name, on_ok, on_cancel)
checktext2, tooltip1=tooltip1, on_response_ok=on_ok,
on_response_cancel=on_cancel, is_modal=False)
def handle_event_insecure_ssl_connection(self, obj): def handle_event_insecure_ssl_connection(self, obj):
# ('INSECURE_SSL_CONNECTION', account, (connection, connection_type)) # ('INSECURE_SSL_CONNECTION', account, (connection, connection_type))