POP3 reload only if leave on server

pull/215/head
M66B 6 months ago
parent d71fd3d2ec
commit c116a8f999

File diff suppressed because it is too large Load Diff

@ -6414,12 +6414,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.setEnabled(message.uid != null ||
message.accountProtocol == EntityAccount.TYPE_POP)
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP ||
EntityFolder.INBOX.equals(message.folderType));
(EntityFolder.INBOX.equals(message.folderType) && message.accountLeaveOnServer));
popupMenu.getMenu().findItem(R.id.menu_charset)
.setEnabled(message.uid != null ||
message.accountProtocol == EntityAccount.TYPE_POP)
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP ||
EntityFolder.INBOX.equals(message.folderType));
(EntityFolder.INBOX.equals(message.folderType) && message.accountLeaveOnServer));
popupMenu.getMenu().findItem(R.id.menu_alternative)
.setTitle(message.isPlainOnly()
@ -6427,7 +6427,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.setEnabled(message.hasAlt() && !message.isEncrypted() &&
(message.uid != null || message.accountProtocol == EntityAccount.TYPE_POP))
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP ||
EntityFolder.INBOX.equals(message.folderType));
(EntityFolder.INBOX.equals(message.folderType) && message.accountLeaveOnServer));
popupMenu.insertIcons(context);

@ -70,7 +70,7 @@ import javax.mail.internet.InternetAddress;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 297,
version = 298,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2902,8 +2902,8 @@ public abstract class DB extends RoomDatabase {
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `account` ADD COLUMN `summary` INTEGER NOT NULL DEFAULT 0");
db.execSQL("DROP VIEW IF EXISTS `account_view`");
db.execSQL("CREATE VIEW IF NOT EXISTS `account_view` AS " + TupleAccountView.query);
//db.execSQL("DROP VIEW IF EXISTS `account_view`");
//db.execSQL("CREATE VIEW IF NOT EXISTS `account_view` AS " + TupleAccountView.query);
}
}).addMigrations(new Migration(279, 280) {
@Override
@ -3025,10 +3025,12 @@ public abstract class DB extends RoomDatabase {
logMigration(startVersion, endVersion);
db.execSQL("UPDATE `account` SET `prefix` = NULL");
}
}).addMigrations(new Migration(297, 296) {
}).addMigrations(new Migration(297, 298) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("DROP VIEW IF EXISTS `account_view`");
db.execSQL("CREATE VIEW IF NOT EXISTS `account_view` AS " + TupleAccountView.query);
}
}).addMigrations(new Migration(998, 999) {
@Override

@ -48,7 +48,7 @@ public interface DaoMessage {
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@Query("SELECT message.*" +
", account.pop AS accountProtocol, account.name AS accountName, account.category AS accountCategory, COALESCE(identity.color, folder.color, account.color) AS accountColor" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_on_server AS accountLeaveOnServer, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, NULL AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
", '[' || substr(group_concat(message.`from`, ','), 0, 2048) || ']' AS senders" +
@ -126,7 +126,7 @@ public interface DaoMessage {
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@Query("SELECT message.*" +
", account.pop AS accountProtocol, account.name AS accountName, account.category AS accountCategory, COALESCE(identity.color, folder.color, account.color) AS accountColor" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_on_server AS accountLeaveOnServer, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, f.inherited_type AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
", '[' || substr(group_concat(message.`from`, ','), 0, 2048) || ']' AS senders" +
@ -201,7 +201,7 @@ public interface DaoMessage {
@Transaction
@Query("SELECT message.*" +
", account.pop AS accountProtocol, account.name AS accountName, account.category AS accountCategory, COALESCE(identity.color, folder.color, account.color) AS accountColor" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_on_server AS accountLeaveOnServer, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, NULL AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
", message.`from` AS senders" +
@ -518,7 +518,7 @@ public interface DaoMessage {
String FETCH_MESSAGE = "SELECT message.*" +
", account.pop AS accountProtocol, account.name AS accountName, account.category AS accountCategory, identity.color AS accountColor" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_on_server AS accountLeaveOnServer, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, NULL AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
", message.`from` AS senders" +
@ -554,7 +554,7 @@ public interface DaoMessage {
@Transaction
@Query("SELECT message.*" +
", account.pop AS accountProtocol, account.name AS accountName, account.category AS accountCategory, COALESCE(identity.color, folder.color, account.color) AS accountColor" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_on_server AS accountLeaveOnServer, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, NULL AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
", message.`from` AS senders" +
@ -1073,7 +1073,7 @@ public interface DaoMessage {
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@Query("SELECT message.*" +
", account.pop AS accountProtocol, account.name AS accountName, account.category AS accountCategory, COALESCE(identity.color, folder.color, account.color) AS accountColor" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_on_server AS accountLeaveOnServer, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, NULL AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
", '[' || substr(group_concat(message.`from`, ','), 0, 2048) || ']' AS senders" +
@ -1159,7 +1159,7 @@ public interface DaoMessage {
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@Query("SELECT message.*" +
", account.pop AS accountProtocol, account.name AS accountName, account.category AS accountCategory, COALESCE(identity.color, folder.color, account.color) AS accountColor" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_on_server AS accountLeaveOnServer, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, f.inherited_type AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
", '[' || substr(group_concat(message.`from`, ','), 0, 2048) || ']' AS senders" +

@ -31,7 +31,7 @@ import java.util.Objects;
value = TupleAccountView.query
)
public class TupleAccountView {
static final String query = "SELECT id, pop, name, category, color, synchronize, notify, summary, leave_deleted, auto_seen, created FROM account";
static final String query = "SELECT id, pop, name, category, color, synchronize, notify, summary, leave_on_server, leave_deleted, auto_seen, created FROM account";
@NonNull
public Long id;
@ -48,6 +48,8 @@ public class TupleAccountView {
@NonNull
public Boolean summary = false;
@NonNull
public Boolean leave_on_server = true;
@NonNull
public Boolean leave_deleted = false;
@NonNull
public Boolean auto_seen = true;
@ -64,6 +66,7 @@ public class TupleAccountView {
this.synchronize.equals(other.synchronize) &&
this.notify.equals(other.notify) &&
this.summary.equals(other.summary) &&
this.leave_on_server.equals(other.leave_on_server) &&
this.leave_deleted.equals(other.leave_deleted) &&
this.auto_seen.equals(other.auto_seen) &&
Objects.equals(this.created, other.created));

@ -39,6 +39,7 @@ public class TupleMessageEx extends EntityMessage {
public Integer accountColor;
public boolean accountNotify;
public boolean accountSummary;
public boolean accountLeaveOnServer;
public boolean accountLeaveDeleted;
public boolean accountAutoSeen;
public String folderName;
@ -136,6 +137,7 @@ public class TupleMessageEx extends EntityMessage {
Objects.equals(this.accountColor, other.accountColor) &&
this.accountNotify == other.accountNotify &&
this.accountSummary == other.accountSummary &&
this.accountLeaveOnServer == other.accountLeaveOnServer &&
this.accountLeaveDeleted == other.accountLeaveDeleted &&
this.accountAutoSeen == other.accountAutoSeen &&
this.folderName.equals(other.folderName) &&

Loading…
Cancel
Save