mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-06 12:54:11 +01:00
Added settings to leave deleted POP3 messages on server
This commit is contained in:
2193
app/schemas/eu.faircode.email.DB/149.json
Normal file
2193
app/schemas/eu.faircode.email.DB/149.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1022,7 +1022,8 @@ class Core {
|
||||
// Delete message
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
if (EntityFolder.INBOX.equals(folder.type)) {
|
||||
if (!account.leave_deleted &&
|
||||
EntityFolder.INBOX.equals(folder.type)) {
|
||||
Map<String, String> caps = istore.capabilities();
|
||||
|
||||
Message[] imessages = ifolder.getMessages();
|
||||
|
||||
@@ -60,7 +60,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
|
||||
// https://developer.android.com/topic/libraries/architecture/room.html
|
||||
|
||||
@Database(
|
||||
version = 148,
|
||||
version = 149,
|
||||
entities = {
|
||||
EntityIdentity.class,
|
||||
EntityAccount.class,
|
||||
@@ -1415,6 +1415,13 @@ public abstract class DB extends RoomDatabase {
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `identity` ADD COLUMN `cc` TEXT");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(148, 149) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase db) {
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `account` ADD COLUMN `leave_deleted` INTEGER NOT NULL DEFAULT 0");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,8 @@ public class EntityAccount extends EntityOrder implements Serializable {
|
||||
@NonNull
|
||||
public Boolean leave_on_server = true;
|
||||
@NonNull
|
||||
public Boolean leave_deleted = false;
|
||||
@NonNull
|
||||
public Boolean leave_on_device = false;
|
||||
public Integer max_messages; // POP3
|
||||
@NonNull
|
||||
|
||||
@@ -81,6 +81,7 @@ public class FragmentPop extends FragmentBase {
|
||||
private CheckBox cbOnDemand;
|
||||
private CheckBox cbPrimary;
|
||||
private CheckBox cbLeaveServer;
|
||||
private CheckBox cbLeaveDeleted;
|
||||
private CheckBox cbLeaveDevice;
|
||||
private EditText etMax;
|
||||
private EditText etInterval;
|
||||
@@ -135,6 +136,7 @@ public class FragmentPop extends FragmentBase {
|
||||
cbNotify = view.findViewById(R.id.cbNotify);
|
||||
tvNotifyPro = view.findViewById(R.id.tvNotifyPro);
|
||||
cbLeaveServer = view.findViewById(R.id.cbLeaveServer);
|
||||
cbLeaveDeleted = view.findViewById(R.id.cbLeaveDeleted);
|
||||
cbLeaveDevice = view.findViewById(R.id.cbLeaveDevice);
|
||||
etMax = view.findViewById(R.id.etMax);
|
||||
etInterval = view.findViewById(R.id.etInterval);
|
||||
@@ -241,6 +243,7 @@ public class FragmentPop extends FragmentBase {
|
||||
args.putBoolean("primary", cbPrimary.isChecked());
|
||||
args.putBoolean("notify", cbNotify.isChecked());
|
||||
args.putBoolean("leave_server", cbLeaveServer.isChecked());
|
||||
args.putBoolean("leave_deleted", cbLeaveDeleted.isChecked());
|
||||
args.putBoolean("leave_device", cbLeaveDevice.isChecked());
|
||||
args.putString("max", etMax.getText().toString());
|
||||
args.putString("interval", etInterval.getText().toString());
|
||||
@@ -281,6 +284,7 @@ public class FragmentPop extends FragmentBase {
|
||||
boolean primary = args.getBoolean("primary");
|
||||
boolean notify = args.getBoolean("notify");
|
||||
boolean leave_server = args.getBoolean("leave_server");
|
||||
boolean leave_deleted = args.getBoolean("leave_deleted");
|
||||
boolean leave_device = args.getBoolean("leave_device");
|
||||
String max = args.getString("max");
|
||||
String interval = args.getString("interval");
|
||||
@@ -372,6 +376,7 @@ public class FragmentPop extends FragmentBase {
|
||||
account.primary = (account.synchronize && primary);
|
||||
account.notify = notify;
|
||||
account.leave_on_server = leave_server;
|
||||
account.leave_deleted = leave_deleted;
|
||||
account.leave_on_device = leave_device;
|
||||
account.max_messages = (TextUtils.isEmpty(max) ? null : Integer.parseInt(max));
|
||||
account.poll_interval = Integer.parseInt(interval);
|
||||
@@ -532,6 +537,7 @@ public class FragmentPop extends FragmentBase {
|
||||
cbOnDemand.setChecked(account == null ? false : account.ondemand);
|
||||
cbPrimary.setChecked(account == null ? false : account.primary);
|
||||
cbLeaveServer.setChecked(account == null ? true : account.leave_on_server);
|
||||
cbLeaveDeleted.setChecked(account == null ? true : account.leave_deleted);
|
||||
cbLeaveDevice.setChecked(account == null ? false : account.leave_on_device);
|
||||
etMax.setText(account == null || account.max_messages == null ? null : Integer.toString(account.max_messages));
|
||||
etInterval.setText(account == null ? "" : Long.toString(account.poll_interval));
|
||||
|
||||
@@ -305,6 +305,15 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvNotifyPro" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbLeaveDeleted"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_leave_deleted"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbLeaveServer" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbLeaveDevice"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -312,7 +321,7 @@
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_leave_on_device"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbLeaveServer" />
|
||||
app:layout_constraintTop_toBottomOf="@id/cbLeaveDeleted" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvMax"
|
||||
|
||||
@@ -564,6 +564,7 @@
|
||||
<string name="title_primary_account">Primary (default account)</string>
|
||||
<string name="title_primary_identity">Primary (default identity)</string>
|
||||
<string name="title_leave_on_server">Leave messages on server</string>
|
||||
<string name="title_leave_deleted">Leave deleted messages on server</string>
|
||||
<string name="title_leave_on_device">Leave messages on device</string>
|
||||
<string name="title_max_messages">Maximum number of messages to download (blank for all)</string>
|
||||
<string name="title_keep_alive_interval">Keep-alive/poll interval (minutes)</string>
|
||||
|
||||
Reference in New Issue
Block a user