diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 98187dc9dc..5a207892c6 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -1454,6 +1454,9 @@ class Core { // Move message DB db = DB.getInstance(context); + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); + boolean expunge_trash = pref.getBoolean("expunge_trash", false); + // Get arguments long id = jargs.getLong(0); boolean seen = jargs.optBoolean(1); @@ -1618,7 +1621,7 @@ class Core { ex.getCause().getMessage().contains("[EXPUNGEISSUED]"))) throw ex; } - else + else if (!expunge_trash || !EntityFolder.TRASH.equals(target.type)) ifolder.copyMessages(map.keySet().toArray(new Message[0]), itarget); } diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 1119c50f6f..3e0f10a4f2 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -207,6 +207,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swUid; private SwitchCompat swExpunge; private SwitchCompat swUidExpunge; + private SwitchCompat swExpungeTrash; private SwitchCompat swImapCompress; private SwitchCompat swAuthPlain; private SwitchCompat swAuthLogin; @@ -309,7 +310,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "viewport_height", "ignore_formatted_size", "show_recent", - "use_modseq", "preamble", "uid_command", "perform_expunge", "uid_expunge", + "use_modseq", "preamble", "uid_command", "perform_expunge", "uid_expunge", "expunge_trash", "imap_compress", "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "use_top", "forget_top", "keep_alive_poll", "empty_pool", "idle_done", "fast_fetch", "max_backoff_power", "logarithmic_backoff", @@ -484,6 +485,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swUid = view.findViewById(R.id.swUid); swExpunge = view.findViewById(R.id.swExpunge); swUidExpunge = view.findViewById(R.id.swUidExpunge); + swExpungeTrash = view.findViewById(R.id.swExpungeTrash); swImapCompress = view.findViewById(R.id.swImapCompress); swAuthPlain = view.findViewById(R.id.swAuthPlain); swAuthLogin = view.findViewById(R.id.swAuthLogin); @@ -1540,6 +1542,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swExpungeTrash.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("expunge_trash", checked).apply(); + } + }); + swImapCompress.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -2642,6 +2651,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swUid.setChecked(prefs.getBoolean("uid_command", false)); swExpunge.setChecked(prefs.getBoolean("perform_expunge", true)); swUidExpunge.setChecked(prefs.getBoolean("uid_expunge", false)); + swExpungeTrash.setChecked(prefs.getBoolean("expunge_trash", false)); swImapCompress.setChecked(prefs.getBoolean("imap_compress", true)); swAuthPlain.setChecked(prefs.getBoolean("auth_plain", true)); swAuthLogin.setChecked(prefs.getBoolean("auth_login", true)); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 2e8004fb05..3c3e02663e 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -1480,6 +1480,20 @@ app:layout_constraintTop_toBottomOf="@id/swExpunge" app:switchPadding="12dp" /> + + UID command AUTO EXPUNGE UID EXPUNGE + Expunge > trash Hide deleted messages COMPRESS PLAIN