Fixed quick setup

This commit is contained in:
M66B 2019-07-23 17:25:04 +02:00
parent ccfffe71e0
commit c197562c3d
1 changed files with 17 additions and 12 deletions

View File

@ -252,34 +252,39 @@ public class FragmentQuickSetup extends FragmentBase {
String fullName = ifolder.getFullName(); String fullName = ifolder.getFullName();
String[] attrs = ((IMAPFolder) ifolder).getAttributes(); String[] attrs = ((IMAPFolder) ifolder).getAttributes();
String type = EntityFolder.getType(attrs, fullName, true); String type = EntityFolder.getType(attrs, fullName, true);
boolean alt = fullName.toLowerCase().contains("draft"); Log.i(fullName + " attrs=" + TextUtils.join(" ", attrs) + " type=" + type);
Log.i(fullName + if (type != null) {
" attrs=" + TextUtils.join(" ", attrs) +
" type=" + type + " alt=" + altDrafts);
if (type != null && (!EntityFolder.USER.equals(type) || alt)) {
int sync = EntityFolder.SYSTEM_FOLDER_SYNC.indexOf(type); int sync = EntityFolder.SYSTEM_FOLDER_SYNC.indexOf(type);
EntityFolder folder = new EntityFolder(); EntityFolder folder = new EntityFolder();
folder.name = fullName; folder.name = fullName;
folder.type = (alt ? EntityFolder.DRAFTS : type); folder.type = type;
folder.synchronize = (sync >= 0); folder.synchronize = (sync >= 0);
folder.download = (sync < 0 ? true : EntityFolder.SYSTEM_FOLDER_DOWNLOAD.get(sync)); folder.download = (sync < 0 ? true : EntityFolder.SYSTEM_FOLDER_DOWNLOAD.get(sync));
folder.sync_days = EntityFolder.DEFAULT_SYNC; folder.sync_days = EntityFolder.DEFAULT_SYNC;
folder.keep_days = EntityFolder.DEFAULT_KEEP; folder.keep_days = EntityFolder.DEFAULT_KEEP;
if (alt)
altDrafts = folder;
else
folders.add(folder);
if (EntityFolder.INBOX.equals(type)) { if (EntityFolder.INBOX.equals(type)) {
folder.unified = true; folder.unified = true;
folder.notify = true; folder.notify = true;
inbox = true; inbox = true;
} else if (EntityFolder.DRAFTS.equals(type)) } else if (EntityFolder.DRAFTS.equals(type))
drafts = true; drafts = true;
folders.add(folder);
} else if (fullName.toLowerCase().contains("draft")) {
int sync = EntityFolder.SYSTEM_FOLDER_SYNC.indexOf(EntityFolder.DRAFTS);
EntityFolder folder = new EntityFolder();
folder.name = fullName;
folder.type = EntityFolder.DRAFTS;
folder.synchronize = (sync >= 0);
folder.download = (sync < 0 ? true : EntityFolder.SYSTEM_FOLDER_DOWNLOAD.get(sync));
folder.sync_days = EntityFolder.DEFAULT_SYNC;
folder.keep_days = EntityFolder.DEFAULT_KEEP;
altDrafts = folder;
} }
} }