remove no more used class
This commit is contained in:
parent
e02beb9eee
commit
587a4a4e68
206
src/config.py
206
src/config.py
|
@ -3450,212 +3450,6 @@ class AccountCreationWizardWindow:
|
|||
gajim.interface.roster.set_actions_menu_needs_rebuild()
|
||||
gajim.interface.save_config()
|
||||
|
||||
#---------- ZeroconfPropertiesWindow class -------------#
|
||||
class ZeroconfPropertiesWindow:
|
||||
def __init__(self):
|
||||
self.xml = gtkgui_helpers.get_glade('zeroconf_properties_window.glade')
|
||||
self.window = self.xml.get_widget('zeroconf_properties_window')
|
||||
self.window.set_transient_for(gajim.interface.roster.window)
|
||||
self.xml.signal_autoconnect(self)
|
||||
|
||||
self.init_account()
|
||||
self.init_account_gpg()
|
||||
|
||||
self.xml.get_widget('save_button').grab_focus()
|
||||
self.window.show_all()
|
||||
|
||||
def init_account(self):
|
||||
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||
'autoconnect')
|
||||
if st:
|
||||
self.xml.get_widget('autoconnect_checkbutton').set_active(st)
|
||||
|
||||
list_no_log_for = gajim.config.get_per('accounts',
|
||||
gajim.ZEROCONF_ACC_NAME,'no_log_for').split()
|
||||
if gajim.ZEROCONF_ACC_NAME in list_no_log_for:
|
||||
self.xml.get_widget('log_history_checkbutton').set_active(0)
|
||||
else:
|
||||
self.xml.get_widget('log_history_checkbutton').set_active(1)
|
||||
|
||||
|
||||
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||
'sync_with_global_status')
|
||||
if st:
|
||||
self.xml.get_widget('sync_with_global_status_checkbutton').set_active(
|
||||
st)
|
||||
|
||||
for opt in ('first_name', 'last_name', 'jabber_id', 'email'):
|
||||
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||
'zeroconf_' + opt)
|
||||
if st:
|
||||
self.xml.get_widget(opt + '_entry').set_text(st)
|
||||
|
||||
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||
'custom_port')
|
||||
if st:
|
||||
self.xml.get_widget('custom_port_entry').set_text(str(st))
|
||||
|
||||
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||
'use_custom_host')
|
||||
if st:
|
||||
self.xml.get_widget('custom_port_checkbutton').set_active(st)
|
||||
|
||||
self.xml.get_widget('custom_port_entry').set_sensitive(bool(st))
|
||||
|
||||
if not st:
|
||||
gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||
'custom_port', '5298')
|
||||
|
||||
def init_account_gpg(self):
|
||||
keyid = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'keyid')
|
||||
keyname = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||
'keyname')
|
||||
savegpgpass = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||
'savegpgpass')
|
||||
|
||||
if not keyid or not gajim.config.get('usegpg'):
|
||||
return
|
||||
|
||||
self.xml.get_widget('gpg_key_label').set_text(keyid)
|
||||
self.xml.get_widget('gpg_name_label').set_text(keyname)
|
||||
gpg_save_password_checkbutton = \
|
||||
self.xml.get_widget('gpg_save_password_checkbutton')
|
||||
gpg_save_password_checkbutton.set_sensitive(True)
|
||||
gpg_save_password_checkbutton.set_active(savegpgpass)
|
||||
|
||||
if savegpgpass:
|
||||
entry = self.xml.get_widget('gpg_password_entry')
|
||||
entry.set_sensitive(True)
|
||||
gpgpassword = gajim.config.get_per('accounts',
|
||||
gajim.ZEROCONF_ACC_NAME, 'gpgpassword')
|
||||
entry.set_text(gpgpassword)
|
||||
|
||||
def on_zeroconf_properties_window_destroy(self, widget):
|
||||
# close window
|
||||
if gajim.interface.instances.has_key('zeroconf_properties'):
|
||||
del gajim.interface.instances['zeroconf_properties']
|
||||
|
||||
def on_custom_port_checkbutton_toggled(self, widget):
|
||||
st = self.xml.get_widget('custom_port_checkbutton').get_active()
|
||||
self.xml.get_widget('custom_port_entry').set_sensitive(bool(st))
|
||||
|
||||
def on_cancel_button_clicked(self, widget):
|
||||
self.window.destroy()
|
||||
|
||||
def on_save_button_clicked(self, widget):
|
||||
config = {}
|
||||
|
||||
st = self.xml.get_widget('autoconnect_checkbutton').get_active()
|
||||
config['autoconnect'] = st
|
||||
list_no_log_for = gajim.config.get_per('accounts',
|
||||
gajim.ZEROCONF_ACC_NAME, 'no_log_for').split()
|
||||
if gajim.ZEROCONF_ACC_NAME in list_no_log_for:
|
||||
list_no_log_for.remove(gajim.ZEROCONF_ACC_NAME)
|
||||
if not self.xml.get_widget('log_history_checkbutton').get_active():
|
||||
list_no_log_for.append(gajim.ZEROCONF_ACC_NAME)
|
||||
config['no_log_for'] = ' '.join(list_no_log_for)
|
||||
|
||||
st = self.xml.get_widget('sync_with_global_status_checkbutton').\
|
||||
get_active()
|
||||
config['sync_with_global_status'] = st
|
||||
|
||||
st = self.xml.get_widget('first_name_entry').get_text()
|
||||
config['zeroconf_first_name'] = st.decode('utf-8')
|
||||
|
||||
st = self.xml.get_widget('last_name_entry').get_text()
|
||||
config['zeroconf_last_name'] = st.decode('utf-8')
|
||||
|
||||
st = self.xml.get_widget('jabber_id_entry').get_text()
|
||||
config['zeroconf_jabber_id'] = st.decode('utf-8')
|
||||
|
||||
st = self.xml.get_widget('email_entry').get_text()
|
||||
config['zeroconf_email'] = st.decode('utf-8')
|
||||
|
||||
use_custom_port = self.xml.get_widget('custom_port_checkbutton').\
|
||||
get_active()
|
||||
config['use_custom_host'] = use_custom_port
|
||||
|
||||
old_port = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
|
||||
'custom_port')
|
||||
if use_custom_port:
|
||||
port = self.xml.get_widget('custom_port_entry').get_text()
|
||||
else:
|
||||
port = 5298
|
||||
|
||||
config['custom_port'] = port
|
||||
|
||||
config['keyname'] = self.xml.get_widget('gpg_name_label').get_text().\
|
||||
decode('utf-8')
|
||||
if config['keyname'] == '': # no key selected
|
||||
config['keyid'] = ''
|
||||
config['savegpgpass'] = False
|
||||
config['gpgpassword'] = ''
|
||||
else:
|
||||
config['keyid'] = self.xml.get_widget('gpg_key_label').get_text().\
|
||||
decode('utf-8')
|
||||
config['savegpgpass'] = self.xml.get_widget(
|
||||
'gpg_save_password_checkbutton').get_active()
|
||||
config['gpgpassword'] = self.xml.get_widget('gpg_password_entry'
|
||||
).get_text().decode('utf-8')
|
||||
|
||||
reconnect = False
|
||||
for opt in ('zeroconf_first_name','zeroconf_last_name',
|
||||
'zeroconf_jabber_id', 'zeroconf_email', 'custom_port'):
|
||||
if gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, opt) != \
|
||||
config[opt]:
|
||||
reconnect = True
|
||||
|
||||
for opt in config:
|
||||
gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, opt,
|
||||
config[opt])
|
||||
|
||||
if gajim.connections.has_key(gajim.ZEROCONF_ACC_NAME):
|
||||
if port != old_port or reconnect:
|
||||
gajim.connections[gajim.ZEROCONF_ACC_NAME].update_details()
|
||||
|
||||
self.window.destroy()
|
||||
|
||||
def on_gpg_choose_button_clicked(self, widget, data = None):
|
||||
if gajim.connections.has_key(gajim.ZEROCONF_ACC_NAME):
|
||||
secret_keys = gajim.connections[gajim.ZEROCONF_ACC_NAME].\
|
||||
ask_gpg_secrete_keys()
|
||||
|
||||
# self.account is None and/or gajim.connections is {}
|
||||
else:
|
||||
if gajim.HAVE_GPG:
|
||||
secret_keys = GnuPG.GnuPG().get_secret_keys()
|
||||
else:
|
||||
secret_keys = []
|
||||
if not secret_keys:
|
||||
dialogs.ErrorDialog(_('Failed to get secret keys'),
|
||||
_('There was a problem retrieving your OpenPGP secret keys.'))
|
||||
return
|
||||
secret_keys[_('None')] = _('None')
|
||||
instance = dialogs.ChooseGPGKeyDialog(_('OpenPGP Key Selection'),
|
||||
_('Choose your OpenPGP key'), secret_keys)
|
||||
keyID = instance.run()
|
||||
if keyID is None:
|
||||
return
|
||||
checkbutton = self.xml.get_widget('gpg_save_password_checkbutton')
|
||||
gpg_key_label = self.xml.get_widget('gpg_key_label')
|
||||
gpg_name_label = self.xml.get_widget('gpg_name_label')
|
||||
if keyID[0] == _('None'):
|
||||
gpg_key_label.set_text(_('No key selected'))
|
||||
gpg_name_label.set_text('')
|
||||
checkbutton.set_sensitive(False)
|
||||
self.xml.get_widget('gpg_password_entry').set_sensitive(False)
|
||||
else:
|
||||
gpg_key_label.set_text(keyID[0])
|
||||
gpg_name_label.set_text(keyID[1])
|
||||
checkbutton.set_sensitive(True)
|
||||
checkbutton.set_active(False)
|
||||
self.xml.get_widget('gpg_password_entry').set_text('')
|
||||
|
||||
def on_gpg_save_password_checkbutton_toggled(self, widget):
|
||||
st = widget.get_active()
|
||||
w = self.xml.get_widget('gpg_password_entry')
|
||||
w.set_sensitive(bool(st))
|
||||
|
||||
class ManagePEPServicesWindow:
|
||||
def __init__(self, account):
|
||||
self.xml = gtkgui_helpers.get_glade('manage_pep_services_window.glade')
|
||||
|
|
Loading…
Reference in New Issue