Folder specials

This commit is contained in:
M66B 2020-12-01 21:07:13 +01:00
parent d550f312fc
commit e7a9266b2b
6 changed files with 12 additions and 4 deletions

View File

@ -1718,19 +1718,18 @@ class Core {
folder = db.folder().getFolderByName(account.id, fullName);
if (folder == null) {
boolean synchronize = "Unbekannt".equals(fullName);
folder = new EntityFolder();
folder.account = account.id;
folder.name = fullName;
folder.type = (EntityFolder.SYSTEM.equals(type) ? type : EntityFolder.USER);
folder.synchronize = (synchronize || (subscribed && subscriptions && sync_subscribed));
folder.synchronize = (subscribed && subscriptions && sync_subscribed);
folder.subscribed = subscribed;
folder.poll = true;
folder.sync_days = EntityFolder.DEFAULT_SYNC;
folder.keep_days = EntityFolder.DEFAULT_KEEP;
folder.selectable = selectable;
folder.inferiors = inferiors;
folder.setSpecials(account);
folder.id = db.folder().insertFolder(folder);
Log.i(folder.name + " added type=" + folder.type);
} else {

View File

@ -260,6 +260,11 @@ public class EntityFolder extends EntityOrder implements Serializable {
}
}
void setSpecials(EntityAccount account) {
if ("imap.web.de".equals(account.host) && "Unbekannt".equals(name))
synchronize = true;
}
static boolean shouldPoll(String type) {
int sync = EntityFolder.SYSTEM_FOLDER_SYNC.indexOf(type);
return (sync < 0 || EntityFolder.SYSTEM_FOLDER_POLL.get(sync));

View File

@ -1223,8 +1223,9 @@ public class FragmentAccount extends FragmentBase {
EntityFolder existing = db.folder().getFolderByName(account.id, folder.name);
if (existing == null) {
folder.account = account.id;
EntityLog.log(context, "Added folder=" + folder.name + " type=" + folder.type);
folder.setSpecials(account);
folder.id = db.folder().insertFolder(folder);
EntityLog.log(context, "Added folder=" + folder.name + " type=" + folder.type);
if (folder.synchronize)
EntityOperation.sync(context, folder.id, false);
} else {

View File

@ -436,6 +436,7 @@ public class FragmentGmail extends FragmentBase {
EntityFolder existing = db.folder().getFolderByName(account.id, folder.name);
if (existing == null) {
folder.account = account.id;
folder.setSpecials(account);
folder.id = db.folder().insertFolder(folder);
EntityLog.log(context, "Gmail folder=" + folder.name + " type=" + folder.type);
if (folder.synchronize)

View File

@ -560,6 +560,7 @@ public class FragmentOAuth extends FragmentBase {
EntityFolder existing = db.folder().getFolderByName(account.id, folder.name);
if (existing == null) {
folder.account = account.id;
folder.setSpecials(account);
folder.id = db.folder().insertFolder(folder);
EntityLog.log(context, "OAuth folder=" + folder.name + " type=" + folder.type);
if (folder.synchronize)

View File

@ -411,6 +411,7 @@ public class FragmentQuickSetup extends FragmentBase {
EntityFolder existing = db.folder().getFolderByName(account.id, folder.name);
if (existing == null) {
folder.account = account.id;
folder.setSpecials(account);
folder.id = db.folder().insertFolder(folder);
EntityLog.log(context, "Quick added folder=" + folder.name + " type=" + folder.type);
}