fix the ability to choose GPG key before we connect
remove useless config option usegpg
This commit is contained in:
		
							parent
							
								
									ca796ae62f
								
							
						
					
					
						commit
						75ee2169d7
					
				
					 4 changed files with 8 additions and 14 deletions
				
			
		|  | @ -157,7 +157,6 @@ class Config: | ||||||
| 		'lastfm_username': [ opt_str, '', _('The username used to identify the Last.fm account.')], | 		'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': [ opt_bool, True ], | ||||||
| 		'notify_on_new_gmail_email_extra': [ opt_bool, False ], | 		'notify_on_new_gmail_email_extra': [ opt_bool, False ], | ||||||
| 		'usegpg': [ opt_bool, False, '', True ], |  | ||||||
| 		'use_gpg_agent': [ opt_bool, False ], | 		'use_gpg_agent': [ opt_bool, False ], | ||||||
| 		'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')], | 		'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.')], | 		'restore_lines': [opt_int, 4, _('How many lines to remember from previous conversation when a chat tab/window is reopened.')], | ||||||
|  |  | ||||||
|  | @ -107,6 +107,8 @@ class Connection(ConnectionHandlers): | ||||||
| 		self.last_connection = None # last ClientCommon instance | 		self.last_connection = None # last ClientCommon instance | ||||||
| 		self.is_zeroconf = False | 		self.is_zeroconf = False | ||||||
| 		self.gpg = None | 		self.gpg = None | ||||||
|  | 		if USE_GPG: | ||||||
|  | 			self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) | ||||||
| 		self.status = '' | 		self.status = '' | ||||||
| 		self.priority = gajim.get_priority(name, 'offline') | 		self.priority = gajim.get_priority(name, 'offline') | ||||||
| 		self.old_show = '' | 		self.old_show = '' | ||||||
|  | @ -767,9 +769,6 @@ class Connection(ConnectionHandlers): | ||||||
| 					}) | 					}) | ||||||
| 			if USE_GPG and not self.gpg: | 			if USE_GPG and not self.gpg: | ||||||
| 				self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) | 				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) | 			self.connect_and_init(show, msg, sign_msg) | ||||||
| 
 | 
 | ||||||
| 		elif show == 'offline': | 		elif show == 'offline': | ||||||
|  | @ -1036,9 +1035,6 @@ class Connection(ConnectionHandlers): | ||||||
| 				return | 				return | ||||||
| 			if USE_GPG: | 			if USE_GPG: | ||||||
| 				self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) | 				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 | 			gajim.connections[self.name] = self | ||||||
| 			self.dispatch('ACC_OK', (self.new_account_info)) | 			self.dispatch('ACC_OK', (self.new_account_info)) | ||||||
| 			self.new_account_info = None | 			self.new_account_info = None | ||||||
|  |  | ||||||
|  | @ -62,6 +62,8 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): | ||||||
| 		self.connected = 0 # offline | 		self.connected = 0 # offline | ||||||
| 		self.connection = None | 		self.connection = None | ||||||
| 		self.gpg = None | 		self.gpg = None | ||||||
|  | 		if USE_GPG: | ||||||
|  | 			self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) | ||||||
| 		self.is_zeroconf = True | 		self.is_zeroconf = True | ||||||
| 		self.privacy_rules_supported = False | 		self.privacy_rules_supported = False | ||||||
| 		self.blocked_contacts = [] | 		self.blocked_contacts = [] | ||||||
|  | @ -87,10 +89,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): | ||||||
| 		# Do we continue connection when we get roster (send presence,get vcard...) | 		# Do we continue connection when we get roster (send presence,get vcard...) | ||||||
| 		self.continue_connect_info = None | 		self.continue_connect_info = None | ||||||
| 		if USE_GPG: | 		if USE_GPG: | ||||||
| 			self.gpg = GnuPG.GnuPG() | 			self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) | ||||||
| 			gajim.config.set('usegpg', True) |  | ||||||
| 		else: |  | ||||||
| 			gajim.config.set('usegpg', False) |  | ||||||
| 		 | 		 | ||||||
| 		self.get_config_values_or_default() | 		self.get_config_values_or_default() | ||||||
| 		 | 		 | ||||||
|  |  | ||||||
|  | @ -1514,7 +1514,7 @@ class AccountsWindow: | ||||||
| 
 | 
 | ||||||
| 		# Personal tab | 		# Personal tab | ||||||
| 		gpg_key_label = self.xml.get_widget('gpg_key_label2') | 		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.xml.get_widget('gpg_choose_button2').set_sensitive(True) | ||||||
| 			self.init_account_gpg() | 			self.init_account_gpg() | ||||||
| 		else: | 		else: | ||||||
|  | @ -1542,7 +1542,7 @@ class AccountsWindow: | ||||||
| 		use_gpg_agent_checkbutton = self.xml.get_widget( | 		use_gpg_agent_checkbutton = self.xml.get_widget( | ||||||
| 			'use_gpg_agent_checkbutton' + widget_name_add) | 			'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) | 			use_gpg_agent_checkbutton.set_sensitive(False) | ||||||
| 			gpg_key_label.set_text(_('No key selected')) | 			gpg_key_label.set_text(_('No key selected')) | ||||||
| 			gpg_name_label.set_text('') | 			gpg_name_label.set_text('') | ||||||
|  | @ -1605,7 +1605,7 @@ class AccountsWindow: | ||||||
| 
 | 
 | ||||||
| 		# Personal tab | 		# Personal tab | ||||||
| 		gpg_key_label = self.xml.get_widget('gpg_key_label1') | 		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.xml.get_widget('gpg_choose_button1').set_sensitive(True) | ||||||
| 			self.init_account_gpg() | 			self.init_account_gpg() | ||||||
| 		else: | 		else: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue