Browse read-only folder

pull/168/head
M66B 5 years ago
parent 4d508cf3a7
commit 0d1d7f6ae9

@ -4038,7 +4038,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
same = false; same = false;
Log.i("folderType changed id=" + next.id); Log.i("folderType changed id=" + next.id);
} }
// folderReadOnly if (prev.folderReadOnly != next.folderReadOnly) {
same = false;
Log.i("folderReadOnly changed id=" + next.id);
}
if (!Objects.equals(prev.identityName, next.identityName)) { if (!Objects.equals(prev.identityName, next.identityName)) {
same = false; same = false;
Log.i("identityName changed id=" + next.id); Log.i("identityName changed id=" + next.id);

@ -53,6 +53,7 @@ import javax.mail.FolderClosedException;
import javax.mail.Message; import javax.mail.Message;
import javax.mail.MessageRemovedException; import javax.mail.MessageRemovedException;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import javax.mail.ReadOnlyFolderException;
import javax.mail.UIDFolder; import javax.mail.UIDFolder;
import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage;
import javax.mail.search.AndTerm; import javax.mail.search.AndTerm;
@ -286,7 +287,13 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
Log.i("Boundary server opening folder=" + browsable.name); Log.i("Boundary server opening folder=" + browsable.name);
state.ifolder = (IMAPFolder) state.iservice.getStore().getFolder(browsable.name); state.ifolder = (IMAPFolder) state.iservice.getStore().getFolder(browsable.name);
state.ifolder.open(Folder.READ_WRITE); try {
state.ifolder.open(Folder.READ_WRITE);
db.folder().setFolderReadOnly(browsable.id, state.ifolder.getUIDNotSticky());
} catch (ReadOnlyFolderException ex) {
state.ifolder.open(Folder.READ_ONLY);
db.folder().setFolderReadOnly(browsable.id, true);
}
int count = state.ifolder.getMessageCount(); int count = state.ifolder.getMessageCount();
db.folder().setFolderTotal(browsable.id, count < 0 ? null : count); db.folder().setFolderTotal(browsable.id, count < 0 ? null : count);

Loading…
Cancel
Save