diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-05-08 14:35:21 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-05-08 14:35:21 +0200 |
commit | 99a56a2bde1af0e260f795a4c6fbdae63b7d5453 (patch) | |
tree | 344a2ab5fabaa8923655d502ce74327c61e31907 /src/eu/siacs/conversations/ui/ConversationActivity.java | |
parent | 0ed29c1c77c065d73af5c9f1d7769c6c1a1a9c6f (diff) |
offer to announce pgp key if pgp encryption is selected from menu
Diffstat (limited to 'src/eu/siacs/conversations/ui/ConversationActivity.java')
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationActivity.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index 7c87a0f6..99af97e2 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -423,7 +423,7 @@ public class ConversationActivity extends XmppActivity { startActivity(inviteIntent); break; case R.id.action_security: - final Conversation selConv = getSelectedConversation(); + final Conversation conversation = getSelectedConversation(); View menuItemView = findViewById(R.id.action_security); PopupMenu popup = new PopupMenu(this, menuItemView); final ConversationFragment fragment = (ConversationFragment) getFragmentManager() @@ -435,19 +435,25 @@ public class ConversationActivity extends XmppActivity { public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.encryption_choice_none: - selConv.setNextEncryption(Message.ENCRYPTION_NONE); + conversation.setNextEncryption(Message.ENCRYPTION_NONE); item.setChecked(true); break; case R.id.encryption_choice_otr: - selConv.setNextEncryption(Message.ENCRYPTION_OTR); + conversation.setNextEncryption(Message.ENCRYPTION_OTR); item.setChecked(true); break; case R.id.encryption_choice_pgp: - selConv.setNextEncryption(Message.ENCRYPTION_PGP); - item.setChecked(true); + if (hasPgp()) { + if (conversation.getAccount().getKeys().has("pgp_signature")) { + conversation.setNextEncryption(Message.ENCRYPTION_PGP); + item.setChecked(true); + } else { + announcePgp(conversation.getAccount()); + } + } break; default: - selConv.setNextEncryption(Message.ENCRYPTION_NONE); + conversation.setNextEncryption(Message.ENCRYPTION_NONE); break; } fragment.updateChatMsgHint(); @@ -455,7 +461,7 @@ public class ConversationActivity extends XmppActivity { } }); popup.inflate(R.menu.encryption_choices); - switch (selConv.getNextEncryption()) { + switch (conversation.getNextEncryption()) { case Message.ENCRYPTION_NONE: popup.getMenu().findItem(R.id.encryption_choice_none) .setChecked(true); @@ -468,10 +474,6 @@ public class ConversationActivity extends XmppActivity { popup.getMenu().findItem(R.id.encryption_choice_pgp) .setChecked(true); break; - case Message.ENCRYPTION_DECRYPTED: - popup.getMenu().findItem(R.id.encryption_choice_pgp) - .setChecked(true); - break; default: popup.getMenu().findItem(R.id.encryption_choice_none) .setChecked(true); |