Optional inbox (2)

pull/194/head
M66B 5 years ago
parent 89393d0299
commit 22a6d2a0eb

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

@ -1915,8 +1915,6 @@ class Core {
Log.i("Delete local count=" + local.size()); Log.i("Delete local count=" + local.size());
for (String name : local.keySet()) { for (String name : local.keySet()) {
EntityFolder folder = local.get(name); EntityFolder folder = local.get(name);
if (EntityFolder.INBOX.equals(name) && !folder.selectable)
continue;
List<EntityFolder> childs = parentFolders.get(name); List<EntityFolder> childs = parentFolders.get(name);
if (EntityFolder.USER.equals(folder.type) || if (EntityFolder.USER.equals(folder.type) ||
childs == null || childs.size() == 0) { childs == null || childs.size() == 0) {

@ -672,23 +672,6 @@ public class EmailService implements AutoCloseable {
EntityFolder.guessTypes(folders, getStore().getDefaultFolder().getSeparator()); 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; return folders;
} }

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

Loading…
Cancel
Save