Added setting to permanently delete on discard

pull/161/head
M66B 6 years ago
parent 82697007b9
commit 3e3d0006bc

@ -2480,8 +2480,9 @@ public class FragmentCompose extends FragmentBase {
Log.i("Load action id=" + draft.id + " action=" + getActionName(action)); Log.i("Load action id=" + draft.id + " action=" + getActionName(action));
if (action == R.id.action_delete) { if (action == R.id.action_delete) {
boolean discard_delete = prefs.getBoolean("discard_delete", false);
EntityFolder trash = db.folder().getFolderByType(draft.account, EntityFolder.TRASH); EntityFolder trash = db.folder().getFolderByType(draft.account, EntityFolder.TRASH);
if (empty || trash == null) if (empty || trash == null || discard_delete)
EntityOperation.queue(context, draft, EntityOperation.DELETE); EntityOperation.queue(context, draft, EntityOperation.DELETE);
else else
EntityOperation.queue(context, draft, EntityOperation.MOVE, trash.id); EntityOperation.queue(context, draft, EntityOperation.MOVE, trash.id);

@ -49,12 +49,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swCollapse; private SwitchCompat swCollapse;
private SwitchCompat swAutoRead; private SwitchCompat swAutoRead;
private SwitchCompat swAutoMove; private SwitchCompat swAutoMove;
private SwitchCompat swDiscardDelete;
private SwitchCompat swAuthentication; private SwitchCompat swAuthentication;
private SwitchCompat swDisableTracking; private SwitchCompat swDisableTracking;
private final static String[] RESET_OPTIONS = new String[]{ private final static String[] RESET_OPTIONS = new String[]{
"pull", "autoscroll", "swipenav", "doubletap", "autoexpand", "autoclose", "onclose", "pull", "autoscroll", "swipenav", "doubletap", "autoexpand", "autoclose", "onclose",
"collapse", "autoread", "automove", "authentication", "disable_tracking" "collapse", "autoread", "automove", "discard_delete", "authentication", "disable_tracking"
}; };
@Override @Override
@ -77,6 +78,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swCollapse = view.findViewById(R.id.swCollapse); swCollapse = view.findViewById(R.id.swCollapse);
swAutoRead = view.findViewById(R.id.swAutoRead); swAutoRead = view.findViewById(R.id.swAutoRead);
swAutoMove = view.findViewById(R.id.swAutoMove); swAutoMove = view.findViewById(R.id.swAutoMove);
swDiscardDelete = view.findViewById(R.id.swDiscardDelete);
swAuthentication = view.findViewById(R.id.swAuthentication); swAuthentication = view.findViewById(R.id.swAuthentication);
swDisableTracking = view.findViewById(R.id.swDisableTracking); swDisableTracking = view.findViewById(R.id.swDisableTracking);
@ -167,6 +169,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
} }
}); });
swDiscardDelete.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("discard_delete", checked).apply();
}
});
swAuthentication.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swAuthentication.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -246,6 +255,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swCollapse.setChecked(prefs.getBoolean("collapse", false)); swCollapse.setChecked(prefs.getBoolean("collapse", false));
swAutoRead.setChecked(prefs.getBoolean("autoread", false)); swAutoRead.setChecked(prefs.getBoolean("autoread", false));
swAutoMove.setChecked(!prefs.getBoolean("automove", false)); swAutoMove.setChecked(!prefs.getBoolean("automove", false));
swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", false));
swAuthentication.setChecked(prefs.getBoolean("authentication", true)); swAuthentication.setChecked(prefs.getBoolean("authentication", true));
swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true)); swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true));
} }

@ -179,6 +179,17 @@
app:layout_constraintTop_toBottomOf="@id/swAutoRead" app:layout_constraintTop_toBottomOf="@id/swAutoRead"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDiscardDelete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_discard_delete"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoMove"
app:switchPadding="12dp" />
<ImageView <ImageView
android:id="@+id/ivAuth" android:id="@+id/ivAuth"
android:layout_width="21dp" android:layout_width="21dp"
@ -200,7 +211,7 @@
android:text="@string/title_advanced_authentication" android:text="@string/title_advanced_authentication"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ivAuth" app:layout_constraintStart_toEndOf="@id/ivAuth"
app:layout_constraintTop_toBottomOf="@id/swAutoMove" app:layout_constraintTop_toBottomOf="@id/swDiscardDelete"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat

@ -260,6 +260,7 @@
<string name="title_advanced_onclose">On closing a conversation</string> <string name="title_advanced_onclose">On closing a conversation</string>
<string name="title_advanced_autoread">Automatically mark messages read on moving messages</string> <string name="title_advanced_autoread">Automatically mark messages read on moving messages</string>
<string name="title_advanced_automove">Confirm moving messages</string> <string name="title_advanced_automove">Confirm moving messages</string>
<string name="title_advanced_discard_delete">On discard draft permanently delete draft</string>
<string name="title_advanced_authentication">Show a warning when the receiving server could not authenticate the message</string> <string name="title_advanced_authentication">Show a warning when the receiving server could not authenticate the message</string>
<string name="title_advanced_tracking">Automatically recognize and disable tracking images</string> <string name="title_advanced_tracking">Automatically recognize and disable tracking images</string>

Loading…
Cancel
Save