1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-14 07:08:00 -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 { private void processPendingMarkAllAsRead(PendingCommand command, Account account) throws MessagingException {
String folder = command.arguments[0]; String folder = command.arguments[0];
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication); Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
LocalFolder localFolder = (LocalFolder)localStore.getFolder(folder); LocalFolder localFolder = (LocalFolder) localStore.getFolder(folder);
localFolder.open(OpenMode.READ_WRITE); localFolder.open(OpenMode.READ_WRITE);
Message[] messages = localFolder.getMessages(null); Message[] messages = localFolder.getMessages(null);
for (Message message : messages) for (Message message : messages) {
{ if (message.isSet(Flag.SEEN) == false) {
if (message.isSet(Flag.SEEN) == false) message.setFlag(Flag.SEEN, true);
{ for (MessagingListener l : getListeners()) {
message.setFlag(Flag.SEEN, true); l.listLocalMessagesUpdateMessage(account, folder, message);
} }
} }
localFolder.setUnreadMessageCount(0);
for (MessagingListener l : getListeners()) {
l.folderStatusChanged(account, folder);
} }
try localFolder.setUnreadMessageCount(0);
{ for (MessagingListener l : getListeners()) {
if (account.getErrorFolderName().equals(folder)) l.folderStatusChanged(account, folder);
{ }
return; try {
} if (account.getErrorFolderName().equals(folder)) {
return;
}
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication); Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
Folder remoteFolder = remoteStore.getFolder(folder); Folder remoteFolder = remoteStore.getFolder(folder);
if (!remoteFolder.exists()) { if (!remoteFolder.exists()) {
return; return;
} }
remoteFolder.open(OpenMode.READ_WRITE); remoteFolder.open(OpenMode.READ_WRITE);
if (remoteFolder.getMode() != OpenMode.READ_WRITE) { if (remoteFolder.getMode() != OpenMode.READ_WRITE) {
return; 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);
}
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; static long uidfill = 0;

View File

@ -48,6 +48,9 @@ public class MessagingListener {
public void listLocalMessagesAddMessage(Account account, String folder, Message message) { 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) { 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 mAttachmentIcon;
private Drawable mAnsweredIcon; private Drawable mAnsweredIcon;
private View footerView = null; private View footerView = null;