1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Added option to disable trashing sent messages / conversation

This commit is contained in:
M66B 2023-01-28 11:04:40 +01:00
parent 52d8b0b402
commit ca727b254e
5 changed files with 32 additions and 5 deletions

View file

@ -351,6 +351,7 @@ public class FragmentMessages extends FragmentBase
private boolean threading;
private boolean swipenav;
private boolean seekbar;
private boolean thread_sent_trash;
private boolean actionbar;
private int actionbar_delete_id;
private int actionbar_archive_id;
@ -498,6 +499,7 @@ public class FragmentMessages extends FragmentBase
args.getBoolean("force_threading"));
swipenav = prefs.getBoolean("swipenav", true);
seekbar = prefs.getBoolean("seekbar", false);
thread_sent_trash = prefs.getBoolean("thread_sent_trash", true);
actionbar = prefs.getBoolean("actionbar", true);
boolean actionbar_swap = prefs.getBoolean("actionbar_swap", false);
actionbar_delete_id = (actionbar_swap ? R.id.action_archive : R.id.action_delete);
@ -1385,7 +1387,7 @@ public class FragmentMessages extends FragmentBase
!targetFolder.id.equals(threaded.folder) &&
(!filter_archive || !EntityFolder.ARCHIVE.equals(sourceFolder.type)) &&
!EntityFolder.DRAFTS.equals(sourceFolder.type) && !EntityFolder.OUTBOX.equals(sourceFolder.type) &&
(!EntityFolder.SENT.equals(sourceFolder.type) || EntityFolder.TRASH.equals(targetFolder.type)) &&
(!EntityFolder.SENT.equals(sourceFolder.type) || !EntityFolder.TRASH.equals(targetFolder.type) || thread_sent_trash) &&
!EntityFolder.TRASH.equals(sourceFolder.type) && !EntityFolder.JUNK.equals(sourceFolder.type))
result.add(new MessageTarget(context, threaded, account, sourceFolder, account, targetFolder));
}
@ -6887,6 +6889,7 @@ public class FragmentMessages extends FragmentBase
args.putLong("account", account);
args.putString("thread", thread);
args.putLong("id", id);
args.putBoolean("thread_sent_trash", thread_sent_trash);
args.putBoolean("filter_archive", filter_archive);
new SimpleTask<ActionData>() {
@ -6895,6 +6898,7 @@ public class FragmentMessages extends FragmentBase
long aid = args.getLong("account");
String thread = args.getString("thread");
long id = args.getLong("id");
boolean thread_sent_trash = args.getBoolean("thread_sent_trash");
boolean filter_archive = args.getBoolean("filter_archive");
EntityAccount account;
@ -6931,7 +6935,7 @@ public class FragmentMessages extends FragmentBase
if (!folder.read_only &&
!EntityFolder.DRAFTS.equals(folder.type) &&
!EntityFolder.OUTBOX.equals(folder.type) &&
// allow sent
(!EntityFolder.SENT.equals(folder.type) || thread_sent_trash) &&
!EntityFolder.TRASH.equals(folder.type) &&
!EntityFolder.JUNK.equals(folder.type))
trashable = true;

View file

@ -151,7 +151,7 @@ public class FragmentOptions extends FragmentBase {
"collapse_quotes", "image_placeholders", "inline_images",
"seekbar", "actionbar", "actionbar_swap", "actionbar_color", "group_category",
"autoscroll", "swipenav", "reversed", "swipe_close", "swipe_move", "autoexpand", "autoclose", "onclose",
"swipe_reply",
"thread_sent_trash", "swipe_reply",
"language_detection",
"quick_filter", "quick_scroll", "quick_actions",
"experiments", "debug", "log_level", "test1", "test2", "test3", "test4", "test5",

View file

@ -102,6 +102,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swAutoRead;
private SwitchCompat swAutoUnflag;
private SwitchCompat swResetImportance;
private SwitchCompat swThreadSentTrash;
private SwitchCompat swFlagSnoozed;
private SwitchCompat swAutoImportant;
private SwitchCompat swResetSnooze;
@ -123,8 +124,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
"autoexpand", "expand_first", "expand_all", "expand_one", "collapse_multiple",
"autoclose", "onclose", "autoclose_unseen", "autoclose_send", "collapse_marked",
"undo_timeout",
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance", "reset_snooze", "auto_block_sender",
"swipe_reply", "default_folder"
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance", "thread_sent_trash",
"reset_snooze", "auto_block_sender", "swipe_reply", "default_folder"
};
@Override
@ -177,6 +178,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoRead = view.findViewById(R.id.swAutoRead);
swAutoUnflag = view.findViewById(R.id.swAutoUnflag);
swResetImportance = view.findViewById(R.id.swResetImportance);
swThreadSentTrash = view.findViewById(R.id.swThreadSentTrash);
swFlagSnoozed = view.findViewById(R.id.swFlagSnoozed);
swAutoImportant = view.findViewById(R.id.swAutoImportant);
swResetSnooze = view.findViewById(R.id.swResetSnooze);
@ -514,6 +516,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swThreadSentTrash.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("thread_sent_trash", checked).apply();
}
});
swFlagSnoozed.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -690,6 +699,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoRead.setChecked(prefs.getBoolean("autoread", false));
swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false));
swResetImportance.setChecked(prefs.getBoolean("reset_importance", false));
swThreadSentTrash.setChecked(prefs.getBoolean("thread_sent_trash", true));
swFlagSnoozed.setChecked(prefs.getBoolean("flag_snoozed", false));
swAutoImportant.setChecked(prefs.getBoolean("auto_important", false));
swResetSnooze.setChecked(prefs.getBoolean("reset_snooze", true));

View file

@ -701,6 +701,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoUnflag"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swThreadSentTrash"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_thread_sent_trash"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swResetImportance"
app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

View file

@ -652,6 +652,7 @@
<string name="title_advanced_autoread">Automatically mark messages read on moving messages</string>
<string name="title_advanced_autounstar">Automatically remove stars from messages on moving messages</string>
<string name="title_advanced_reset_importance">Reset importance on moving messages</string>
<string name="title_advanced_thread_sent_trash">When trashing a conversation, also trash sent messages</string>
<string name="title_advanced_star_snoozed">Automatically add star on snoozing messages</string>
<string name="title_advanced_auto_important">Automatically make starred messages important</string>
<string name="title_advanced_cancel_snooze">Cancel snooze on moving messages</string>