|
|
|
@ -1975,23 +1975,6 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
private void onMenuEncrypt() {
|
|
|
|
|
EntityIdentity identity = (EntityIdentity) spIdentity.getSelectedItem();
|
|
|
|
|
if (identity == null || identity.encrypt == 0) {
|
|
|
|
|
final Context context = getContext();
|
|
|
|
|
if (!Helper.isOpenKeychainInstalled(context)) {
|
|
|
|
|
new AlertDialog.Builder(context)
|
|
|
|
|
.setIcon(R.drawable.twotone_lock_24)
|
|
|
|
|
.setTitle(R.string.title_no_openpgp)
|
|
|
|
|
.setMessage(R.string.title_no_openpgp_remark)
|
|
|
|
|
.setPositiveButton(R.string.title_info, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
Helper.viewFAQ(context, 12);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.setNegativeButton(android.R.string.cancel, null)
|
|
|
|
|
.show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (EntityMessage.ENCRYPT_NONE.equals(encrypt) || encrypt == null)
|
|
|
|
|
encrypt = EntityMessage.PGP_SIGNENCRYPT;
|
|
|
|
|
else if (EntityMessage.PGP_SIGNENCRYPT.equals(encrypt))
|
|
|
|
@ -2007,6 +1990,51 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
encrypt = EntityMessage.ENCRYPT_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final Context context = getContext();
|
|
|
|
|
if ((EntityMessage.PGP_SIGNONLY.equals(encrypt) ||
|
|
|
|
|
EntityMessage.PGP_SIGNENCRYPT.equals(encrypt))
|
|
|
|
|
&& !Helper.isOpenKeychainInstalled(context)) {
|
|
|
|
|
encrypt = EntityMessage.ENCRYPT_NONE;
|
|
|
|
|
|
|
|
|
|
new AlertDialog.Builder(context)
|
|
|
|
|
.setIcon(R.drawable.twotone_lock_24)
|
|
|
|
|
.setTitle(R.string.title_no_openpgp)
|
|
|
|
|
.setMessage(R.string.title_no_openpgp_remark)
|
|
|
|
|
.setPositiveButton(R.string.title_info, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
Helper.viewFAQ(context, 12);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.setNegativeButton(android.R.string.cancel, null)
|
|
|
|
|
.setNeutralButton(R.string.title_reset, new DialogInterface.OnClickListener() {
|
|
|
|
|
@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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
|
Log.unexpectedError(getParentFragmentManager(), ex);
|
|
|
|
|
}
|
|
|
|
|
}.execute(FragmentCompose.this, new Bundle(), "encrypt: fix");
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
invalidateOptionsMenu();
|
|
|
|
|
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|