Allow accounts without inbox

This commit is contained in:
M66B 2021-02-07 15:36:26 +01:00
parent 17e74fc1b6
commit 0f32aa66a8
4 changed files with 23 additions and 5 deletions

View File

@ -6469,7 +6469,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
DB db = DB.getInstance(context);
EntityFolder inbox = db.folder().getFolderByType(account, EntityFolder.INBOX);
if (inbox == null)
if (inbox == null || !inbox.selectable)
throw new IllegalArgumentException(context.getString(R.string.title_no_inbox));
return inbox;

View File

@ -1019,6 +1019,8 @@ class Core {
throw new FolderNotFoundException();
if (folder.id.equals(target.id))
throw new IllegalArgumentException("self");
if (!target.selectable)
throw new IllegalArgumentException("not selectable");
// De-classify
for (EntityMessage message : messages)
@ -1910,6 +1912,8 @@ class Core {
Log.i("Delete local count=" + local.size());
for (String name : local.keySet()) {
EntityFolder folder = local.get(name);
if (EntityFolder.INBOX.equals(name) && !folder.selectable)
continue;
List<EntityFolder> childs = parentFolders.get(name);
if (EntityFolder.USER.equals(folder.type) ||
childs == null || childs.size() == 0) {

View File

@ -679,8 +679,15 @@ public class EmailService implements AutoCloseable {
break;
}
if (!inbox)
throw new IllegalArgumentException(context.getString(R.string.title_setup_no_inbox));
if (!inbox) {
EntityFolder in = new EntityFolder();
in.name = EntityFolder.INBOX;
in.type = EntityFolder.INBOX;
in.setProperties();
in.selectable = false;
folders.add(in);
//throw new IllegalArgumentException(context.getString(R.string.title_setup_no_inbox));
}
return folders;
}

View File

@ -718,8 +718,15 @@ public class FragmentAccount extends FragmentBase {
EntityFolder.guessTypes(result.folders, iservice.getStore().getDefaultFolder().getSeparator());
if (!inbox)
throw new IllegalArgumentException(context.getString(R.string.title_no_inbox));
if (!inbox) {
EntityFolder in = new EntityFolder();
in.name = EntityFolder.INBOX;
in.type = EntityFolder.INBOX;
in.setProperties();
in.selectable = false;
result.folders.add(in);
//throw new IllegalArgumentException(context.getString(R.string.title_no_inbox));
}
if (result.folders.size() > 0)
Collections.sort(result.folders, result.folders.get(0).getComparator(null));