mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 23:12:55 +00:00
Added reset aliases button
This commit is contained in:
parent
e356f16ca3
commit
4316b851fb
4 changed files with 53 additions and 0 deletions
|
@ -141,6 +141,9 @@ public interface DaoIdentity {
|
|||
@Query("UPDATE identity SET sign_key_alias = :alias WHERE id = :id AND NOT (sign_key_alias IS :alias)")
|
||||
int setIdentitySignKeyAlias(long id, String alias);
|
||||
|
||||
@Query("UPDATE identity SET sign_key_alias = NULL")
|
||||
int clearIdentitySignKeyAliases();
|
||||
|
||||
@Query("UPDATE identity SET max_size = :max_size WHERE id = :id AND NOT (max_size IS :max_size)")
|
||||
int setIdentityMaxSize(long id, Long max_size);
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ public class FragmentOptionsEncryption extends FragmentBase
|
|||
private SwitchCompat swEncryptAuto;
|
||||
private SwitchCompat swAutoDecrypt;
|
||||
private SwitchCompat swAutoUndoDecrypt;
|
||||
private Button btnReset;
|
||||
|
||||
private Spinner spOpenPgp;
|
||||
private ImageButton ibOpenKeychain;
|
||||
|
@ -140,6 +141,7 @@ public class FragmentOptionsEncryption extends FragmentBase
|
|||
swEncryptAuto = view.findViewById(R.id.swEncryptAuto);
|
||||
swAutoDecrypt = view.findViewById(R.id.swAutoDecrypt);
|
||||
swAutoUndoDecrypt = view.findViewById(R.id.swAutoUndoDecrypt);
|
||||
btnReset = view.findViewById(R.id.btnReset);
|
||||
|
||||
spOpenPgp = view.findViewById(R.id.spOpenPgp);
|
||||
ibOpenKeychain = view.findViewById(R.id.ibOpenKeychain);
|
||||
|
@ -237,6 +239,30 @@ public class FragmentOptionsEncryption extends FragmentBase
|
|||
}
|
||||
});
|
||||
|
||||
btnReset.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
||||
DB db = DB.getInstance(context);
|
||||
db.identity().clearIdentitySignKeyAliases();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ToastEx.makeText(v.getContext(), R.string.title_completed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(getParentFragmentManager(), ex);
|
||||
}
|
||||
}.execute(FragmentOptionsEncryption.this, new Bundle(), "encryption:reset");
|
||||
}
|
||||
});
|
||||
|
||||
// PGP
|
||||
|
||||
spOpenPgp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
|
|
|
@ -140,6 +140,28 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAutoDecrypt"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnReset"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:drawableEnd="@drawable/twotone_clear_all_24"
|
||||
android:drawablePadding="6dp"
|
||||
android:text="@string/title_reset_selected_keys"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAutoUndoDecrypt" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvResetHint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_reset_selected_keys_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnReset" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
|
|
@ -1659,6 +1659,8 @@
|
|||
<string name="title_not_encrypted">Message is not signed or encrypted</string>
|
||||
<string name="title_no_sign_key">No sign key selected</string>
|
||||
<string name="title_reset_sign_key">Reset sign key</string>
|
||||
<string name="title_reset_selected_keys">Reset selected keys</string>
|
||||
<string name="title_reset_selected_keys_hint">Can be used in case of new certificates, etc.</string>
|
||||
|
||||
<string name="title_signature_none">Message not signed</string>
|
||||
<string name="title_signature_valid">Message signature valid</string>
|
||||
|
|
Loading…
Reference in a new issue