1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-26 09:38:52 -05:00

FIxed issue 501

This commit is contained in:
Bao-Long Nguyen-Trong 2009-06-23 14:57:16 +00:00
parent 13cc3899d6
commit e6132286a0
3 changed files with 55 additions and 47 deletions

View File

@ -1461,53 +1461,49 @@ public class MessagingController implements Runnable {
}
private void processPendingMarkAllAsRead(PendingCommand command, Account account) throws MessagingException {
String folder = command.arguments[0];
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
LocalFolder localFolder = (LocalFolder)localStore.getFolder(folder);
localFolder.open(OpenMode.READ_WRITE);
Message[] messages = localFolder.getMessages(null);
for (Message message : messages)
{
if (message.isSet(Flag.SEEN) == false)
{
message.setFlag(Flag.SEEN, true);
}
}
localFolder.setUnreadMessageCount(0);
for (MessagingListener l : getListeners()) {
l.folderStatusChanged(account, folder);
}
try
{
if (account.getErrorFolderName().equals(folder))
{
return;
}
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
Folder remoteFolder = remoteStore.getFolder(folder);
if (!remoteFolder.exists()) {
return;
}
remoteFolder.open(OpenMode.READ_WRITE);
if (remoteFolder.getMode() != OpenMode.READ_WRITE) {
return;
}
remoteFolder.setFlags(new Flag[] { Flag.SEEN }, true);
remoteFolder.close(false);
}
catch (UnsupportedOperationException uoe)
{
Log.w(Email.LOG_TAG, "Could not mark all server-side as read because store doesn't support operation", uoe);
}
finally
{
localFolder.close(false);
}
String folder = command.arguments[0];
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
LocalFolder localFolder = (LocalFolder) localStore.getFolder(folder);
localFolder.open(OpenMode.READ_WRITE);
Message[] messages = localFolder.getMessages(null);
for (Message message : messages) {
if (message.isSet(Flag.SEEN) == false) {
message.setFlag(Flag.SEEN, true);
for (MessagingListener l : getListeners()) {
l.listLocalMessagesUpdateMessage(account, folder, message);
}
}
}
localFolder.setUnreadMessageCount(0);
for (MessagingListener l : getListeners()) {
l.folderStatusChanged(account, folder);
}
try {
if (account.getErrorFolderName().equals(folder)) {
return;
}
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
Folder remoteFolder = remoteStore.getFolder(folder);
if (!remoteFolder.exists()) {
return;
}
remoteFolder.open(OpenMode.READ_WRITE);
if (remoteFolder.getMode() != OpenMode.READ_WRITE) {
return;
}
remoteFolder.setFlags(new Flag[]{Flag.SEEN}, true);
remoteFolder.close(false);
}
catch (UnsupportedOperationException uoe) {
Log.w(Email.LOG_TAG, "Could not mark all server-side as read because store doesn't support operation", uoe);
}
finally {
localFolder.close(false);
}
}
static long uidfill = 0;

View File

@ -47,7 +47,10 @@ public class MessagingListener {
public void listLocalMessagesAddMessage(Account account, String folder, Message message) {
}
public void listLocalMessagesUpdateMessage(Account account, String folder, Message message) {
}
public void listLocalMessagesRemoveMessage(Account account, String folder, Message message) {
}

View File

@ -1228,8 +1228,17 @@ public class MessageList extends K9ListActivity {
}
@Override
public void listLocalMessagesUpdateMessage(Account account, String folder, Message message) {
if (!account.equals(mAccount) || !folder.equals(mFolderName)) {
return;
}
addOrUpdateMessage(folder, message, false, true);
}
};
private Drawable mAttachmentIcon;
private Drawable mAnsweredIcon;
private View footerView = null;