Optional inbox (2)

This commit is contained in:
M66B 2021-02-07 21:19:31 +01:00
parent 89393d0299
commit 22a6d2a0eb
4 changed files with 3 additions and 44 deletions

View File

@ -1651,7 +1651,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean archive = (move && (hasArchive && !inArchive && !inSent && !inTrash && !inJunk));
boolean trash = (move || outbox || debug ||
message.accountProtocol == EntityAccount.TYPE_POP);
boolean junk = (move && hasJunk);
boolean junk = (move && hasJunk && hasInbox);
boolean inbox = (move && hasInbox && (inArchive || inTrash || inJunk));
boolean keywords = (!message.folderReadOnly && message.uid != null &&
message.accountProtocol == EntityAccount.TYPE_IMAP);
@ -6473,7 +6473,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 || !inbox.selectable)
if (inbox == null)
throw new IllegalArgumentException(context.getString(R.string.title_no_inbox));
return inbox;

View File

@ -1915,8 +1915,6 @@ 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

@ -672,23 +672,6 @@ public class EmailService implements AutoCloseable {
EntityFolder.guessTypes(folders, getStore().getDefaultFolder().getSeparator());
boolean inbox = false;
for (EntityFolder folder : folders)
if (EntityFolder.INBOX.equals(folder.type)) {
inbox = true;
break;
}
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

@ -57,7 +57,6 @@ import androidx.lifecycle.Lifecycle;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputLayout;
import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.protocol.IMAPProtocol;
import java.net.UnknownHostException;
import java.util.ArrayList;
@ -676,8 +675,8 @@ public class FragmentAccount extends FragmentBase {
certificate, fingerprint);
result.idle = iservice.hasCapability("IDLE");
result.utf8 = iservice.hasCapability("UTF8=ACCEPT");
boolean inbox = false;
for (Folder ifolder : iservice.getStore().getDefaultFolder().list("*")) {
// Check folder attributes
String fullName = ifolder.getFullName();
@ -700,17 +699,6 @@ public class FragmentAccount extends FragmentBase {
folder = new EntityFolder(fullName, type);
result.folders.add(folder);
if (EntityFolder.INBOX.equals(type)) {
inbox = true;
result.utf8 = (Boolean) ((IMAPFolder) ifolder).doCommand(new IMAPFolder.ProtocolCommand() {
@Override
public Object doCommand(IMAPProtocol protocol) {
return protocol.supportsUtf8();
}
});
}
Log.i(folder.name + " id=" + folder.id +
" type=" + folder.type + " attr=" + TextUtils.join(",", attrs));
}
@ -718,16 +706,6 @@ public class FragmentAccount extends FragmentBase {
EntityFolder.guessTypes(result.folders, iservice.getStore().getDefaultFolder().getSeparator());
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));
}