fix the ability to choose GPG key before we connect

remove useless config option usegpg
This commit is contained in:
Yann Leboulanger 2007-11-30 15:18:26 +00:00
parent ca796ae62f
commit 75ee2169d7
4 changed files with 8 additions and 14 deletions

View File

@ -157,7 +157,6 @@ class Config:
'lastfm_username': [ opt_str, '', _('The username used to identify the Last.fm account.')],
'notify_on_new_gmail_email': [ opt_bool, True ],
'notify_on_new_gmail_email_extra': [ opt_bool, False ],
'usegpg': [ opt_bool, False, '', True ],
'use_gpg_agent': [ opt_bool, False ],
'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')],
'restore_lines': [opt_int, 4, _('How many lines to remember from previous conversation when a chat tab/window is reopened.')],

View File

@ -107,6 +107,8 @@ class Connection(ConnectionHandlers):
self.last_connection = None # last ClientCommon instance
self.is_zeroconf = False
self.gpg = None
if USE_GPG:
self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent'))
self.status = ''
self.priority = gajim.get_priority(name, 'offline')
self.old_show = ''
@ -767,9 +769,6 @@ class Connection(ConnectionHandlers):
})
if USE_GPG and not self.gpg:
self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent'))
gajim.config.set('usegpg', True)
else:
gajim.config.set('usegpg', False)
self.connect_and_init(show, msg, sign_msg)
elif show == 'offline':
@ -1036,9 +1035,6 @@ class Connection(ConnectionHandlers):
return
if USE_GPG:
self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent'))
gajim.config.set('usegpg', True)
else:
gajim.config.set('usegpg', False)
gajim.connections[self.name] = self
self.dispatch('ACC_OK', (self.new_account_info))
self.new_account_info = None

View File

@ -62,6 +62,8 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
self.connected = 0 # offline
self.connection = None
self.gpg = None
if USE_GPG:
self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent'))
self.is_zeroconf = True
self.privacy_rules_supported = False
self.blocked_contacts = []
@ -87,10 +89,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
# Do we continue connection when we get roster (send presence,get vcard...)
self.continue_connect_info = None
if USE_GPG:
self.gpg = GnuPG.GnuPG()
gajim.config.set('usegpg', True)
else:
gajim.config.set('usegpg', False)
self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent'))
self.get_config_values_or_default()

View File

@ -1514,7 +1514,7 @@ class AccountsWindow:
# Personal tab
gpg_key_label = self.xml.get_widget('gpg_key_label2')
if gajim.config.get('usegpg'):
if rajim.connections[gajim.ZEROCONF_ACC_NAME].gpg:
self.xml.get_widget('gpg_choose_button2').set_sensitive(True)
self.init_account_gpg()
else:
@ -1542,7 +1542,7 @@ class AccountsWindow:
use_gpg_agent_checkbutton = self.xml.get_widget(
'use_gpg_agent_checkbutton' + widget_name_add)
if not keyid or not gajim.config.get('usegpg'):
if not keyid or not gajim.connections[account].gpg:
use_gpg_agent_checkbutton.set_sensitive(False)
gpg_key_label.set_text(_('No key selected'))
gpg_name_label.set_text('')
@ -1605,7 +1605,7 @@ class AccountsWindow:
# Personal tab
gpg_key_label = self.xml.get_widget('gpg_key_label1')
if gajim.config.get('usegpg'):
if gajim.connections[account].gpg:
self.xml.get_widget('gpg_choose_button1').set_sensitive(True)
self.init_account_gpg()
else: