|
|
@ -1975,8 +1975,27 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
private void onMenuEncrypt() {
|
|
|
|
private void onMenuEncrypt() {
|
|
|
|
EntityIdentity identity = (EntityIdentity) spIdentity.getSelectedItem();
|
|
|
|
EntityIdentity identity = (EntityIdentity) spIdentity.getSelectedItem();
|
|
|
|
if (identity == null || identity.encrypt == 0) {
|
|
|
|
if (identity == null || identity.encrypt == 0) {
|
|
|
|
|
|
|
|
if (EntityMessage.ENCRYPT_NONE.equals(encrypt) || encrypt == null)
|
|
|
|
|
|
|
|
encrypt = EntityMessage.PGP_SIGNENCRYPT;
|
|
|
|
|
|
|
|
else if (EntityMessage.PGP_SIGNENCRYPT.equals(encrypt))
|
|
|
|
|
|
|
|
encrypt = EntityMessage.PGP_SIGNONLY;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
encrypt = EntityMessage.ENCRYPT_NONE;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (EntityMessage.ENCRYPT_NONE.equals(encrypt) || encrypt == null)
|
|
|
|
|
|
|
|
encrypt = EntityMessage.SMIME_SIGNENCRYPT;
|
|
|
|
|
|
|
|
else if (EntityMessage.SMIME_SIGNENCRYPT.equals(encrypt))
|
|
|
|
|
|
|
|
encrypt = EntityMessage.SMIME_SIGNONLY;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
encrypt = EntityMessage.ENCRYPT_NONE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
final Context context = getContext();
|
|
|
|
final Context context = getContext();
|
|
|
|
if (!Helper.isOpenKeychainInstalled(context)) {
|
|
|
|
if ((EntityMessage.PGP_SIGNONLY.equals(encrypt) ||
|
|
|
|
|
|
|
|
EntityMessage.PGP_SIGNENCRYPT.equals(encrypt))
|
|
|
|
|
|
|
|
&& !Helper.isOpenKeychainInstalled(context)) {
|
|
|
|
|
|
|
|
encrypt = EntityMessage.ENCRYPT_NONE;
|
|
|
|
|
|
|
|
|
|
|
|
new AlertDialog.Builder(context)
|
|
|
|
new AlertDialog.Builder(context)
|
|
|
|
.setIcon(R.drawable.twotone_lock_24)
|
|
|
|
.setIcon(R.drawable.twotone_lock_24)
|
|
|
|
.setTitle(R.string.title_no_openpgp)
|
|
|
|
.setTitle(R.string.title_no_openpgp)
|
|
|
@ -1988,23 +2007,32 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.setNegativeButton(android.R.string.cancel, null)
|
|
|
|
.setNegativeButton(android.R.string.cancel, null)
|
|
|
|
.show();
|
|
|
|
.setNeutralButton(R.string.title_reset, new DialogInterface.OnClickListener() {
|
|
|
|
return;
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
|
|
new SimpleTask<Void>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
prefs.edit()
|
|
|
|
|
|
|
|
.remove("sign_default")
|
|
|
|
|
|
|
|
.remove("encrypt_default")
|
|
|
|
|
|
|
|
.apply();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
|
|
|
db.identity().resetIdentityPGP();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (EntityMessage.ENCRYPT_NONE.equals(encrypt) || encrypt == null)
|
|
|
|
@Override
|
|
|
|
encrypt = EntityMessage.PGP_SIGNENCRYPT;
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
else if (EntityMessage.PGP_SIGNENCRYPT.equals(encrypt))
|
|
|
|
Log.unexpectedError(getParentFragmentManager(), ex);
|
|
|
|
encrypt = EntityMessage.PGP_SIGNONLY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
}.execute(FragmentCompose.this, new Bundle(), "encrypt: fix");
|
|
|
|
encrypt = EntityMessage.ENCRYPT_NONE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
})
|
|
|
|
if (EntityMessage.ENCRYPT_NONE.equals(encrypt) || encrypt == null)
|
|
|
|
.show();
|
|
|
|
encrypt = EntityMessage.SMIME_SIGNENCRYPT;
|
|
|
|
|
|
|
|
else if (EntityMessage.SMIME_SIGNENCRYPT.equals(encrypt))
|
|
|
|
|
|
|
|
encrypt = EntityMessage.SMIME_SIGNONLY;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
encrypt = EntityMessage.ENCRYPT_NONE;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
invalidateOptionsMenu();
|
|
|
|
invalidateOptionsMenu();
|
|
|
|