Added identity menu item to clear sign key

pull/168/head
M66B 5 years ago
parent f74c360b92
commit 9bb2b6bd14

@ -168,7 +168,10 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
popupMenu.getMenu().add(Menu.NONE, R.string.title_enabled, 1, R.string.title_enabled)
.setCheckable(true).setChecked(identity.synchronize);
popupMenu.getMenu().add(Menu.NONE, R.string.title_copy, 2, R.string.title_copy);
if (identity.sign_key != null)
popupMenu.getMenu().add(Menu.NONE, R.string.title_reset_sign_key, 2, R.string.title_reset_sign_key);
popupMenu.getMenu().add(Menu.NONE, R.string.title_copy, 3, R.string.title_copy);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
@ -178,6 +181,10 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
onActionSync(!item.isChecked());
return true;
case R.string.title_reset_sign_key:
onActionClearSignKey();
return true;
case R.string.title_copy:
onActionCopy();
return true;
@ -213,6 +220,28 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
}.execute(context, owner, args, "identitty:enable");
}
private void onActionClearSignKey() {
Bundle args = new Bundle();
args.putLong("id", identity.id);
new SimpleTask<Boolean>() {
@Override
protected Boolean onExecute(Context context, Bundle args) {
long id = args.getLong("id");
DB db = DB.getInstance(context);
db.identity().setIdentitySignKey(id, null);
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(parentFragment.getParentFragmentManager(), ex);
}
}.execute(context, owner, args, "identitty:clear_sign_key");
}
private void onActionCopy() {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(

@ -256,7 +256,7 @@ public class EntityIdentity {
Objects.equals(this.sender_extra_regex, other.sender_extra_regex) &&
Objects.equals(this.replyto, other.replyto) &&
Objects.equals(this.bcc, other.bcc) &&
this.encrypt.equals(other.encrypt) &&
Objects.equals(this.sign_key, other.sign_key) &&
Objects.equals(this.tbd, other.tbd) &&
Objects.equals(this.state, other.state) &&
Objects.equals(this.error, other.error) &&

@ -690,6 +690,7 @@
<string name="title_resync">Resync</string>
<string name="title_no_openpgp">OpenKeychain not found</string>
<string name="title_not_encrypted">Message is not encrypted</string>
<string name="title_reset_sign_key">Reset sign key</string>
<string name="title_signature_none">Message not signed</string>
<string name="title_signature_valid">Message signature valid</string>

Loading…
Cancel
Save