1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Bulk flagging (read/unread, flag/unflag) implemented.

Message List batch ops wired to bulk flagging.

Manage batch button state when messages are deleted (from outside
agents) while in batch mode.

Remove throws clause from Folder.close() to make it easier to close
folders where necessary.

Eliminate some cruft from MessageList

Consolidate unreadMessageCount fetching in notifyAccount
This commit is contained in:
Daniel Applebaum 2009-11-29 16:55:35 +00:00
parent 61319d8c21
commit f1abdbb769
10 changed files with 226 additions and 321 deletions

View File

@ -616,7 +616,7 @@ public class MessagingController implements Runnable
{
if (Email.DEBUG)
{
Log.v(Email.LOG_TAG, "callbackRunner started");
Log.v(Email.LOG_TAG, "listLocalMessages callbackRunner started");
}
while (stop == false)
{
@ -631,7 +631,7 @@ public class MessagingController implements Runnable
}
catch (InterruptedException ie)
{
Log.i(Email.LOG_TAG, "callbackRunner interrupted");
Log.i(Email.LOG_TAG, "listLocalMessages callbackRunner interrupted");
}
}
else
@ -658,7 +658,7 @@ public class MessagingController implements Runnable
latch.countDown();
if (Email.DEBUG)
{
Log.v(Email.LOG_TAG, "callbackRunner finished");
Log.v(Email.LOG_TAG, "listLocalMessages callbackRunner finished");
}
}
private void callbackPending()
@ -1015,23 +1015,6 @@ public class MessagingController implements Runnable
}
remoteMessageArray = null;
/*
* Get a list of the messages that are in the remote list but not on the
* local store, or messages that are in the local store but failed to download
* on the last sync. These are the new messages that we will download.
*/
// Iterator<Message> iter = remoteMessages.iterator();
// while (iter.hasNext()) {
// Message message = iter.next();
// Message localMessage = localUidMap.get(message.getUid());
// if (localMessage == null ||
// (!localMessage.isSet(Flag.DELETED) &&
// !localMessage.isSet(Flag.X_DOWNLOADED_FULL) &&
// !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))) {
// unsyncedMessages.add(message);
// iter.remove();
// }
// }
}
else if (remoteMessageCount < 0)
{
@ -1222,17 +1205,28 @@ public class MessagingController implements Runnable
{
if (Email.DEBUG)
{
Log.v(Email.LOG_TAG, "Message with uid " + message.getUid() + " is already downloaded");
Log.v(Email.LOG_TAG, "Message with uid " + message.getUid() + " is already locally present");
}
String newPushState = remoteFolder.getNewPushState(localFolder.getPushState(), message);
if (newPushState != null)
{
localFolder.setPushState(newPushState);
}
if (!localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))
{
if (Email.DEBUG)
{
Log.v(Email.LOG_TAG, "Message with uid " + message.getUid() + " is downloaded, even partially; trying again");
}
unsyncedMessages.add(message);
}
else
{
syncFlagMessages.add(message);
}
}
}
}
Log.i(Email.LOG_TAG, "SYNC: Have " + unsyncedMessages.size() + " unsynced messages");
@ -1967,6 +1961,22 @@ public class MessagingController implements Runnable
}
private void queueSetFlag(Account account, String folderName, String newState, String flag, String[] uids)
{
PendingCommand command = new PendingCommand();
command.command = PENDING_COMMAND_SET_FLAG;
int length = 3 + uids.length;
command.arguments = new String[length];
command.arguments[0] = folderName;
command.arguments[1] = newState;
command.arguments[2] = flag;
for (int i = 0; i < uids.length; i++)
{
command.arguments[3 + i] = uids[i];
}
queuePendingCommand(account, command);
processPendingCommands(account);
}
/**
* Processes a pending mark read or unread command.
*
@ -1977,19 +1987,20 @@ public class MessagingController implements Runnable
throws MessagingException
{
String folder = command.arguments[0];
String uid = command.arguments[1];
if (account.getErrorFolderName().equals(folder))
{
return;
}
boolean newState = Boolean.parseBoolean(command.arguments[2]);
boolean newState = Boolean.parseBoolean(command.arguments[1]);
Flag flag = Flag.valueOf(command.arguments[3]);
Flag flag = Flag.valueOf(command.arguments[2]);
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
Folder remoteFolder = remoteStore.getFolder(folder);
try
{
if (!remoteFolder.exists())
{
return;
@ -1999,16 +2010,30 @@ public class MessagingController implements Runnable
{
return;
}
Message remoteMessage = null;
List<Message> messages = new ArrayList<Message>();
for (int i = 3; i < command.arguments.length; i++)
{
String uid = command.arguments[i];
if (!uid.startsWith(Email.LOCAL_UID_PREFIX))
{
remoteMessage = remoteFolder.getMessage(uid);
messages.add(remoteFolder.getMessage(uid));
}
if (remoteMessage == null)
}
if (messages.size() == 0)
{
return;
}
remoteMessage.setFlag(flag, newState);
remoteFolder.setFlags(messages.toArray(new Message[0]), new Flag[] { flag }, newState);
}
finally
{
if (remoteFolder != null)
{
remoteFolder.close(false);
}
}
}
private void processPendingMarkAllAsRead(PendingCommand command, Account account) throws MessagingException
@ -2193,95 +2218,40 @@ public class MessagingController implements Runnable
processPendingCommands(account);
}
/**
* Mark the message with the given account, folder and uid either Seen or not Seen.
* @param account
* @param folder
* @param uid
* @param seen
*/
public void markMessageRead(
public void setFlag(
final Account account,
final String folder,
final String uid,
final boolean seen)
{
setMessageFlag(account, folder, uid, Flag.SEEN, seen);
}
/**
* Mark the message with the given account, folder and uid either Seen or not Seen.
* @param account
* @param folder
* @param uid
* @param seen
*/
public void markMessageRead(
final Account account,
final Folder folder,
final Message message,
final boolean seen)
{
setMessageFlag(account, folder, message, Flag.SEEN, seen);
}
public void setFlag(final Account account, final String folder, final Message[] messages, final Flag flag, final boolean newState)
{
for (Message message : messages)
{
setMessageFlag(account, folder, message.getUid(), flag, newState);
}
}
public void setMessageFlag(
final Account account,
final String folder,
final String uid,
final String folderName,
final Message[] messages,
final Flag flag,
final boolean newState)
{
// TODO: put this into the background, but right now that causes odd behavior
// because the MessageList doesn't have its own cache of the flag states
try
String[] uids = new String[messages.length];
for (int i = 0; i < messages.length; i++)
{
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
Folder localFolder = localStore.getFolder(folder);
localFolder.open(OpenMode.READ_WRITE);
Message message = localFolder.getMessage(uid);
setMessageFlag(account, localFolder, message, flag, newState);
localFolder.close(false);
}
catch (MessagingException me)
{
addErrorMessage(account, me);
throw new RuntimeException(me);
uids[i] = messages[i].getUid();
}
setFlag(account, folderName, uids, flag, newState);
}
public void setMessageFlag(
public void setFlag(
final Account account,
final Folder folder,
final Message message,
final String folderName,
final String[] uids,
final Flag flag,
final boolean newState)
{
// TODO: put this into the background, but right now that causes odd behavior
// because the FolderMessageList doesn't have its own cache of the flag states
Folder localFolder = null;
try
{
String uid = message.getUid();
String folderName = folder.getName();
message.setFlag(flag, newState);
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
localFolder = localStore.getFolder(folderName);
localFolder.open(OpenMode.READ_WRITE);
Message[] messages = new Message[uids.length];
for (int i = 0; i < uids.length; i++)
{
String uid = uids[i];
// Allows for re-allowing sending of messages that could not be sent
if (flag == Flag.FLAGGED && newState == false
&& uid != null
@ -2289,6 +2259,11 @@ public class MessagingController implements Runnable
{
sendCount.remove(uid);
}
messages[i] = localFolder.getMessage(uid);
}
localFolder.setFlags(messages, new Flag[] {flag}, newState);
for (MessagingListener l : getListeners())
{
@ -2300,10 +2275,7 @@ public class MessagingController implements Runnable
return;
}
PendingCommand command = new PendingCommand();
command.command = PENDING_COMMAND_SET_FLAG;
command.arguments = new String[] { folderName, uid, Boolean.toString(newState), flag.toString() };
queuePendingCommand(account, command);
queueSetFlag(account, folderName, Boolean.toString(newState), flag.toString(), uids);
processPendingCommands(account);
}
catch (MessagingException me)
@ -2312,6 +2284,13 @@ public class MessagingController implements Runnable
throw new RuntimeException(me);
}
finally
{
if (localFolder != null)
{
localFolder.close(false);
}
}
}//setMesssageFlag
public void clearAllPending(final Account account)
@ -2386,7 +2365,7 @@ public class MessagingController implements Runnable
// This is a view message request, so mark it read
if (!message.isSet(Flag.SEEN))
{
markMessageRead(account, localFolder, message, true);
setFlag(account, localFolder.getName(), new Message[] { message }, Flag.SEEN, true);
}
if (listener != null && !getListeners().contains(listener))
@ -2422,28 +2401,14 @@ public class MessagingController implements Runnable
finally
{
if (remoteFolder!=null)
{
try
{
remoteFolder.close(false);
}
catch (MessagingException e)
{
Log.w(Email.LOG_TAG, null, e);
}
}
if (localFolder!=null)
{
try
{
localFolder.close(false);
}
catch (MessagingException e)
{
Log.w(Email.LOG_TAG, null, e);
}
}
}//finally
}//run
});
@ -2504,7 +2469,7 @@ public class MessagingController implements Runnable
localFolder.close(false);
if (!message.isSet(Flag.SEEN))
{
markMessageRead(account, localFolder, message, true);
setFlag(account, localFolder.getName(), new Message[] { message }, Flag.SEEN, true);
}
for (MessagingListener l : getListeners())
@ -3346,10 +3311,7 @@ public class MessagingController implements Runnable
}
else if (folder.equals(account.getTrashFolderName()) && account.getDeletePolicy() == Account.DELETE_POLICY_ON_DELETE)
{
PendingCommand command = new PendingCommand();
command.command = PENDING_COMMAND_SET_FLAG;
command.arguments = new String[] { folder, origUid, Boolean.toString(true), Flag.DELETED.toString() };
queuePendingCommand(account, command);
queueSetFlag(account, folder, Boolean.toString(true), Flag.DELETED.toString(), new String[] { origUid });
processPendingCommands(account);
}
else if (account.getDeletePolicy() == Account.DELETE_POLICY_ON_DELETE)
@ -3362,10 +3324,7 @@ public class MessagingController implements Runnable
}
else if (account.getDeletePolicy() == Account.DELETE_POLICY_MARK_AS_READ)
{
PendingCommand command = new PendingCommand();
command.command = PENDING_COMMAND_SET_FLAG;
command.arguments = new String[] { folder, origUid, Boolean.toString(true), Flag.SEEN.toString() };
queuePendingCommand(account, command);
queueSetFlag(account, folder, Boolean.toString(true), Flag.SEEN.toString(), new String[] { origUid });
processPendingCommands(account);
}
else
@ -3813,13 +3772,22 @@ public class MessagingController implements Runnable
});
}
public void notifyAccount(Context context, Account thisAccount, int newMailCount, int unreadMessageCount)
public void notifyAccount(Context context, Account thisAccount, int newMailCount)
{
Log.i(Email.LOG_TAG, "notifyAccount Account " + thisAccount.getDescription() + ", newMailCount = " + newMailCount
+ ", unreadMessageCount = " + unreadMessageCount);
int unreadMessageCount = 0;
try
{
unreadMessageCount = thisAccount.getUnreadMessageCount(context, mApplication);
}
catch (Exception e)
{
Log.e(Email.LOG_TAG, "Unable to get unread message count", e);
}
Log.i(Email.LOG_TAG, "notifyAccount Account " + thisAccount.getDescription() + ", newMailCount = " + newMailCount);
boolean isNotifyAccount = thisAccount.isNotifyNewMail();
if (isNotifyAccount)
{
NotificationManager notifMgr =
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
if (newMailCount > 0 && unreadMessageCount > 0)
@ -3858,6 +3826,10 @@ public class MessagingController implements Runnable
notifMgr.cancel(thisAccount.getAccountNumber());
}
}
for (MessagingListener l : getListeners())
{
l.accountStatusChanged(thisAccount, unreadMessageCount);
}
}
@ -4131,14 +4103,12 @@ public class MessagingController implements Runnable
localFolder.setLastPush(System.currentTimeMillis());
localFolder.setStatus(null);
int unreadMessageCount = account.getUnreadMessageCount(mApplication, mApplication);
Log.i(Email.LOG_TAG, "messagesArrived newCount = " + newCount + ", unreadMessageCount = " + unreadMessageCount);
notifyAccount(mApplication, account, newCount, unreadMessageCount);
Log.i(Email.LOG_TAG, "messagesArrived newCount = " + newCount);
notifyAccount(mApplication, account, newCount);
for (MessagingListener l : getListeners())
{
l.folderStatusChanged(account, remoteFolder.getName());
l.accountStatusChanged(account, unreadMessageCount);
}
}

View File

@ -1373,14 +1373,8 @@ public class FolderList extends K9ListActivity
this.unreadMessageCount = unreadCount;
try
{
folder.close(false);
}
catch (MessagingException me)
{
Log.e(Email.LOG_TAG, "Folder.close() failed", me);
}
}
}

View File

@ -562,7 +562,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
Log.d(Email.LOG_TAG, "Setting message ANSWERED flag to true");
// TODO: Really, we should wait until we send the message, but that would require saving the original
// message info along with a Draft copy, in case it is left in Drafts for a while before being sent
MessagingController.getInstance(getApplication()).setMessageFlag(mAccount, mFolder, mSourceMessageUid, Flag.ANSWERED, true);
MessagingController.getInstance(getApplication()).setFlag(mAccount, mFolder, new String[] { mSourceMessageUid }, Flag.ANSWERED, true);
}
updateTitle();

View File

@ -196,11 +196,17 @@ public class MessageList
case MSG_REMOVE_MESSAGE:
{
List<MessageInfoHolder> messages = (List<MessageInfoHolder>)((Object[]) msg.obj)[0];
for (MessageInfoHolder message : messages)
{
if (message != null && message.selected && mSelectedCount > 0)
{
mSelectedCount--;
}
mAdapter.messages.remove(message);
}
mAdapter.notifyDataSetChanged();
configureBatchButtons();
break;
}
@ -875,11 +881,6 @@ public class MessageList
private void onDelete(MessageInfoHolder holder, int position)
{
if (holder.read == false && holder.folder.unreadMessageCount > 0)
{
holder.folder.unreadMessageCount--;
}
mAdapter.removeMessage(holder);
MessagingController.getInstance(getApplication()).deleteMessage(mAccount, holder.message.getFolder().getName(), holder.message, null);
mListView.setSelection(position);
@ -986,14 +987,6 @@ public class MessageList
return;
}
if (holder.read == false)
{
if (holder.folder.unreadMessageCount > 0)
{
holder.folder.unreadMessageCount--;
}
}
mAdapter.removeMessage(holder);
MessagingController.getInstance(getApplication()).moveMessage(mAccount, holder.message.getFolder().getName(), holder.message, folderName, null);
@ -1085,8 +1078,6 @@ public class MessageList
holder.read = true;
}
mCurrentFolder.unreadMessageCount = 0;
mHandler.sortMessages();
@ -1111,15 +1102,7 @@ public class MessageList
private void onToggleRead(MessageInfoHolder holder)
{
holder.folder.unreadMessageCount += (holder.read ? 1 : -1);
if (holder.folder.unreadMessageCount < 0)
{
holder.folder.unreadMessageCount = 0;
}
MessagingController.getInstance(getApplication()).markMessageRead(mAccount, holder.message.getFolder().getName(), holder.uid, !holder.read);
MessagingController.getInstance(getApplication()).setFlag(mAccount, holder.message.getFolder().getName(), new String[] { holder.uid }, Flag.SEEN, !holder.read);
holder.read = !holder.read;
mHandler.sortMessages();
}
@ -1127,7 +1110,7 @@ public class MessageList
private void onToggleFlag(MessageInfoHolder holder)
{
MessagingController.getInstance(getApplication()).setMessageFlag(mAccount, holder.message.getFolder().getName(), holder.uid, Flag.FLAGGED, !holder.flagged);
MessagingController.getInstance(getApplication()).setFlag(mAccount, holder.message.getFolder().getName(), new String[] { holder.uid }, Flag.FLAGGED, !holder.flagged);
holder.flagged = !holder.flagged;
mHandler.sortMessages();
}
@ -1661,10 +1644,11 @@ public class MessageList
public FolderInfoHolder getFolder(String folder)
{
LocalFolder local_folder = null;
try
{
LocalStore localStore = (LocalStore)Store.getInstance(mAccount.getLocalStoreUri(), getApplication());
LocalFolder local_folder = localStore.getFolder(folder);
local_folder = localStore.getFolder(folder);
return new FolderInfoHolder((Folder)local_folder);
}
catch (Exception e)
@ -1672,6 +1656,13 @@ public class MessageList
Log.e(Email.LOG_TAG, "getFolder(" + folder + ") goes boom: ",e);
return null;
}
finally
{
if (local_folder != null)
{
local_folder.close(false);
}
}
}
private static final int NON_MESSAGE_ITEMS = 1;
@ -2121,20 +2112,12 @@ public class MessageList
if (isChecked)
{
mSelectedCount++;
if (mSelectedCount > 0)
{
enableBatchButtons();
}
}
else
else if (mSelectedCount > 0)
{
mSelectedCount--;
if (mSelectedCount==0)
{
disableBatchButtons();
}
}
showBatchButtons();
message.selected = isChecked;
}
}
@ -2162,6 +2145,17 @@ public class MessageList
}
private void showBatchButtons()
{
configureBatchButtons();
//TODO: Fade in animation
mBatchButtonArea.setVisibility(View.VISIBLE);
}
private void configureBatchButtons()
{
if (mSelectedCount < 0)
{
mSelectedCount = 0;
}
if (mSelectedCount==0)
{
disableBatchButtons();
@ -2170,8 +2164,6 @@ public class MessageList
{
enableBatchButtons();
}
//TODO: Fade in animation
mBatchButtonArea.setVisibility(View.VISIBLE);
}
class FooterViewHolder
@ -2180,65 +2172,27 @@ public class MessageList
public TextView main;
}
/* THERE IS NO FUCKING REASON THIS IS CLONED HERE */
public class FolderInfoHolder implements Comparable<FolderInfoHolder>
public class FolderInfoHolder
{
public String name;
public String displayName;
public long lastChecked;
public int unreadMessageCount;
public boolean loading;
public String status;
public boolean lastCheckFailed;
public boolean needsRefresh = false;
/**
* Outbox is handled differently from any other folder.
*/
public boolean outbox;
public int compareTo(FolderInfoHolder o)
{
String s1 = this.name;
String s2 = o.name;
if (Email.INBOX.equalsIgnoreCase(s1))
{
return -1;
}
else if (Email.INBOX.equalsIgnoreCase(s2))
{
return 1;
}
else
return s1.compareToIgnoreCase(s2);
}
public FolderInfoHolder(Folder folder)
{
populate(folder);
}
public void populate(Folder folder)
{
int unreadCount = 0;
try
{
folder.open(Folder.OpenMode.READ_WRITE);
unreadCount = folder.getUnreadMessageCount();
}
catch (MessagingException me)
{
Log.e(Email.LOG_TAG, "Folder.getUnreadMessageCount() failed", me);
}
this.name = folder.getName();
if (this.name.equalsIgnoreCase(Email.INBOX))
@ -2270,63 +2224,55 @@ public class MessageList
{
this.displayName = String.format(getString(R.string.special_mailbox_name_sent_fmt), this.name);
}
this.lastChecked = folder.getLastChecked();
String mess = truncateStatus(folder.getStatus());
this.status = mess;
this.unreadMessageCount = unreadCount;
try
{
folder.close(false);
}
catch (MessagingException me)
{
Log.e(Email.LOG_TAG, "Folder.close() failed", me);
}
}
}
@Override
public void onClick(View v)
{
if (v==mBatchDeleteButton)
{
List<Message> messageList = new ArrayList<Message>();
//TODO: Optimize i.e. batch all these operations
for (MessageInfoHolder holder : mAdapter.messages)
{
if (holder.selected)
{
if (holder.read == false && holder.folder.unreadMessageCount > 0)
if (v == mBatchDeleteButton)
{
holder.folder.unreadMessageCount--;
}
mAdapter.removeMessage(holder);
}
else if (v == mBatchFlagButton)
{
holder.flagged = true;
}
else if (v == mBatchReadButton)
{
holder.read = true;
}
messageList.add(holder.message);
}
}
if (!messageList.isEmpty())
{
//We assume that all messages are in the same folder
String folderName = messageList.get(0).getFolder().getName();
MessagingController.getInstance(getApplication()).deleteMessageList(mAccount, folderName, messageList, null);
if (mBatchDeleteButton == v)
{
MessagingController.getInstance(getApplication()).deleteMessageList(mAccount, mCurrentFolder.name, messageList, null);
mSelectedCount = 0;
hideBatchButtons();
configureBatchButtons();
}
else
{
MessagingController.getInstance(getApplication()).setFlag(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]),
(v == mBatchReadButton ? Flag.SEEN : Flag.FLAGGED), true);
}
}
else
{
//Should not happen
Toast.makeText(this, R.string.no_message_seletected_toast, Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(this, "Not yet implemented", Toast.LENGTH_SHORT).show();
}
mHandler.sortMessages();
}

View File

@ -844,8 +844,8 @@ public class MessageView extends K9Activity
{
if (mMessage != null)
{
MessagingController.getInstance(getApplication()).setMessageFlag(mAccount,
mMessage.getFolder().getName(), mMessage.getUid(), Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
MessagingController.getInstance(getApplication()).setFlag(mAccount,
mMessage.getFolder().getName(), new String[] { mMessage.getUid() }, Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
try
{
mMessage.setFlag(Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
@ -970,10 +970,11 @@ public class MessageView extends K9Activity
{
if (mMessage != null)
{
MessagingController.getInstance(getApplication()).markMessageRead(
MessagingController.getInstance(getApplication()).setFlag(
mAccount,
mFolder,
mMessage.getUid(),
new String[] { mMessage.getUid() },
Flag.SEEN,
false);
}
}

View File

@ -37,7 +37,7 @@ public abstract class Folder
*
* @param expunge If true all deleted messages will be expunged.
*/
public abstract void close(boolean expunge) throws MessagingException;
public abstract void close(boolean expunge);
/**
* @return True if further commands are not expected to have to open the

View File

@ -613,7 +613,7 @@ public class ImapStore extends Store
return mMode;
}
public void close(boolean expunge) throws MessagingException
public void close(boolean expunge)
{
if (mMessageCount != -1)
{
@ -624,10 +624,17 @@ public class ImapStore extends Store
{
return;
}
try
{
if (expunge)
{
expunge();
}
}
catch (MessagingException me)
{
Log.e(Email.LOG_TAG, "Unable to expunge remote folder " + getName(), me);
}
synchronized (this)
{
releaseConnection(mConnection);

View File

@ -549,7 +549,7 @@ public class LocalStore extends Store implements Serializable
sb.append(": ");
for (String argument : arguments)
{
sb.append(" ");
sb.append(", ");
sb.append(argument);
//sb.append("\n");
}
@ -728,12 +728,19 @@ public class LocalStore extends Store implements Serializable
}
@Override
public void close(boolean expunge) throws MessagingException
public void close(boolean expunge)
{
try
{
if (expunge)
{
expunge();
}
}
catch (MessagingException me)
{
Log.e(Email.LOG_TAG, "Unable to close LocalFolder " + getName(), me);
}
mFolderId = -1;
}
@ -804,16 +811,14 @@ public class LocalStore extends Store implements Serializable
{
open(OpenMode.READ_WRITE);
Message[] messages = getMessages(null);
for (int i = 0; i < messages.length; i++)
{
if (i >= mVisibleLimit)
for (int i = mVisibleLimit; i < messages.length; i++)
{
if (listener != null)
{
listener.messageRemoved(messages[i]);
}
messages[i].setFlag(Flag.X_DESTROYED, true);
}
}
}

View File

@ -1148,16 +1148,9 @@ public class WebDavStore extends Store
finally
{
if (tmpFolder != null)
{
try
{
tmpFolder.close(false);
}
catch (MessagingException me)
{
Log.e(Email.LOG_TAG, "Caught MessagingException while closing folder " + tmpFolder.getName());
}
}
}
}
@ -1384,7 +1377,7 @@ public class WebDavStore extends Store
}
@Override
public void close(boolean expunge) throws MessagingException
public void close(boolean expunge)
{
this.mMessageCount = 0;
this.mUnreadMessageCount = 0;

View File

@ -150,18 +150,7 @@ public class PollService extends CoreService
Integer newMailCount = accountsChecked.get(thisAccount.getUuid());
if (newMailCount != null)
{
try
{
int unreadMessageCount = thisAccount.getUnreadMessageCount(context, getApplication());
MessagingController.getInstance(getApplication()).notifyAccount(context, thisAccount,
newMailCount, unreadMessageCount);
}
catch (MessagingException me)
{
Log.e(Email.LOG_TAG, "***** PollService *****: couldn't get unread count for account " +
thisAccount.getDescription(), me);
}
MessagingController.getInstance(getApplication()).notifyAccount(context, thisAccount, newMailCount);
}
}//for accounts
}//checkMailDone