don't allow to enable GPG encryption if no GPG key is assigned.
Better getInfoDialog when no key is assigned. Fixes #4330
This commit is contained in:
parent
9850bfccc8
commit
eef9cf2de9
|
@ -1516,6 +1516,11 @@ class ChatControl(ChatControlBase):
|
||||||
banner_name_tooltip.set_tip(banner_name_label, label_tooltip)
|
banner_name_tooltip.set_tip(banner_name_label, label_tooltip)
|
||||||
|
|
||||||
def _toggle_gpg(self):
|
def _toggle_gpg(self):
|
||||||
|
if not self.gpg_is_active and not self.contact.keyID:
|
||||||
|
dialogs.ErrorDialog(_('No GPG key assigned'),
|
||||||
|
_('No GPG key is assigned to this contact. So you cannot '
|
||||||
|
'encrypt messages with GPG.'))
|
||||||
|
return
|
||||||
ec = gajim.encrypted_chats[self.account]
|
ec = gajim.encrypted_chats[self.account]
|
||||||
if self.gpg_is_active:
|
if self.gpg_is_active:
|
||||||
# Disable encryption
|
# Disable encryption
|
||||||
|
|
|
@ -3898,11 +3898,17 @@ class GPGInfoWindow:
|
||||||
info = _('The contact\'s key (%s) <b>does not match</b> the key '
|
info = _('The contact\'s key (%s) <b>does not match</b> the key '
|
||||||
'assigned in Gajim.') % keyID[:8]
|
'assigned in Gajim.') % keyID[:8]
|
||||||
image = 'security-low-big.png'
|
image = 'security-low-big.png'
|
||||||
|
elif not keyID:
|
||||||
|
# No key assigned nor a key is used by remote contact
|
||||||
|
verification_status = _('No GPG key assigned')
|
||||||
|
info = _('No GPG key is assigned to this contact. So you cannot '
|
||||||
|
'encrypt messages.')
|
||||||
|
image = 'security-low-big.png'
|
||||||
else:
|
else:
|
||||||
msgenc, error = gajim.connections[account].gpg.encrypt('test', [keyID])
|
msgenc, error = gajim.connections[account].gpg.encrypt('test', [keyID])
|
||||||
if error:
|
if error:
|
||||||
verification_status = _('''Contact's identity NOT verified''')
|
verification_status = _('''Contact's identity NOT verified''')
|
||||||
info = _('GPG Key is assigned to this contact, but <b>you do not '
|
info = _('GPG key is assigned to this contact, but <b>you do not '
|
||||||
'trust his key</b>, so message <b>cannot</b> be encrypted. Use '
|
'trust his key</b>, so message <b>cannot</b> be encrypted. Use '
|
||||||
'your GPG client to trust this key.')
|
'your GPG client to trust this key.')
|
||||||
image = 'security-low-big.png'
|
image = 'security-low-big.png'
|
||||||
|
|
Loading…
Reference in New Issue