mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-25 07:23:03 +00:00
Allow batch permanent deletion without confirmation
This commit is contained in:
parent
decd8f75c0
commit
8b95df4128
4 changed files with 56 additions and 7 deletions
|
@ -4557,10 +4557,20 @@ public class FragmentMessages extends FragmentBase
|
|||
aargs.putLongArray("ids", Helper.toLongArray(ids));
|
||||
aargs.putBoolean("warning", true);
|
||||
|
||||
FragmentDialogAsk ask = new FragmentDialogAsk();
|
||||
ask.setArguments(aargs);
|
||||
ask.setTargetFragment(FragmentMessages.this, REQUEST_MESSAGES_DELETE);
|
||||
ask.show(getParentFragmentManager(), "messages:delete");
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean delete_confirmation = prefs.getBoolean("delete_confirmation", true);
|
||||
|
||||
if (delete_confirmation) {
|
||||
FragmentDialogAsk ask = new FragmentDialogAsk();
|
||||
ask.setArguments(aargs);
|
||||
ask.setTargetFragment(FragmentMessages.this, REQUEST_MESSAGES_DELETE);
|
||||
ask.show(getParentFragmentManager(), "messages:delete");
|
||||
} else {
|
||||
Intent data = new Intent();
|
||||
data.putExtra("args", aargs);
|
||||
onActivityResult(REQUEST_MESSAGES_DELETE, RESULT_OK, data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4909,7 +4919,9 @@ public class FragmentMessages extends FragmentBase
|
|||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean delete_asked = prefs.getBoolean("delete_asked", false);
|
||||
if (leave_deleted && delete_asked) {
|
||||
boolean delete_confirmation = prefs.getBoolean("delete_confirmation", true);
|
||||
|
||||
if (leave_deleted ? delete_asked : !delete_confirmation) {
|
||||
Intent data = new Intent();
|
||||
data.putExtra("args", aargs);
|
||||
onActivityResult(REQUEST_MESSAGES_DELETE, RESULT_OK, data);
|
||||
|
|
|
@ -240,6 +240,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private SwitchCompat swDupMsgId;
|
||||
private SwitchCompat swThreadByRef;
|
||||
private SwitchCompat swMdn;
|
||||
private SwitchCompat swDeleteConfirmation;
|
||||
private EditText etKeywords;
|
||||
private SwitchCompat swTestIab;
|
||||
private Button btnImportProviders;
|
||||
|
@ -302,7 +303,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
"max_backoff_power", "logarithmic_backoff",
|
||||
"exact_alarms",
|
||||
"native_dkim", "native_arc", "native_arc_whitelist",
|
||||
"infra", "tld_flags", "dup_msgids", "thread_byref", "mdn", "global_keywords", "test_iab"
|
||||
"infra", "tld_flags", "dup_msgids", "thread_byref", "mdn", "delete_confirmation", "global_keywords", "test_iab"
|
||||
};
|
||||
|
||||
private final static String[] RESET_QUESTIONS = new String[]{
|
||||
|
@ -491,6 +492,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
swDupMsgId = view.findViewById(R.id.swDupMsgId);
|
||||
swThreadByRef = view.findViewById(R.id.swThreadByRef);
|
||||
swMdn = view.findViewById(R.id.swMdn);
|
||||
swDeleteConfirmation = view.findViewById(R.id.swDeleteConfirmation);
|
||||
etKeywords = view.findViewById(R.id.etKeywords);
|
||||
swTestIab = view.findViewById(R.id.swTestIab);
|
||||
btnImportProviders = view.findViewById(R.id.btnImportProviders);
|
||||
|
@ -1857,6 +1859,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
swDeleteConfirmation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("delete_confirmation", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
etKeywords.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
@ -2603,6 +2612,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
swDupMsgId.setChecked(prefs.getBoolean("dup_msgids", false));
|
||||
swThreadByRef.setChecked(prefs.getBoolean("thread_byref", true));
|
||||
swMdn.setChecked(prefs.getBoolean("mdn", swExperiments.isChecked()));
|
||||
swDeleteConfirmation.setChecked(prefs.getBoolean("delete_confirmation", true));
|
||||
etKeywords.setText(prefs.getString("global_keywords", null));
|
||||
swTestIab.setChecked(prefs.getBoolean("test_iab", false));
|
||||
|
||||
|
|
|
@ -2283,6 +2283,31 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/swThreadByRef"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swDeleteConfirmation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_delete_confirmation"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swMdn"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDeleteConfirmationHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_deletion_confirmation_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?attr/colorError"
|
||||
android:textStyle="bold|italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swDeleteConfirmation" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etKeywords"
|
||||
android:layout_width="0dp"
|
||||
|
@ -2293,7 +2318,7 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swMdn" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDeleteConfirmationHint" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvKeywordsHint"
|
||||
|
|
|
@ -902,6 +902,8 @@
|
|||
<string name="title_advanced_dup_msgid" translatable="false">Duplicates by message ID</string>
|
||||
<string name="title_advanced_thread_by_ref" translatable="false">Thread by common reference</string>
|
||||
<string name="title_advanced_mdn" translatable="false">Process MDNs</string>
|
||||
<string name="title_advanced_delete_confirmation" translatable="false">Permanent deletion confirmation</string>
|
||||
<string name="title_advanced_deletion_confirmation_hint" translatable="false">If you turn this off, please do not complain if you accidentally delete messages irreversibly</string>
|
||||
<string name="title_advanced_global_keywords" translatable="false">Global keywords</string>
|
||||
<string name="title_advanced_test_iab" translatable="false">Test IAB</string>
|
||||
<string name="title_advanced_import_providers" translatable="false">Import providers</string>
|
||||
|
|
Loading…
Reference in a new issue