1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

on search, only fire one start event and one end event

This commit is contained in:
Jesse Vincent 2009-12-27 17:22:51 +00:00
parent 6c383256a2
commit a53e9d1b89

View File

@ -679,10 +679,10 @@ public class MessagingController implements Runnable
Preferences prefs = Preferences.getPreferences(mApplication.getApplicationContext()); Preferences prefs = Preferences.getPreferences(mApplication.getApplicationContext());
Account[] accounts = prefs.getAccounts(); Account[] accounts = prefs.getAccounts();
listener.listLocalMessagesStarted(account, null);
for (final Account account : accounts) for (final Account account : accounts)
{ {
listener.listLocalMessagesStarted(account, null);
MessageRetrievalListener retrievalListener = new MessageRetrievalListener() MessageRetrievalListener retrievalListener = new MessageRetrievalListener()
{ {
@ -708,13 +708,16 @@ public class MessagingController implements Runnable
LocalStore localStore = (LocalStore)Store.getInstance(account.getLocalStoreUri(), mApplication); LocalStore localStore = (LocalStore)Store.getInstance(account.getLocalStoreUri(), mApplication);
localStore.searchForMessages(retrievalListener, query); localStore.searchForMessages(retrievalListener, query);
listener.listLocalMessagesFinished(account, null);
} }
catch (Exception e) catch (Exception e)
{ {
listener.listLocalMessagesFailed(account, null, e.getMessage()); listener.listLocalMessagesFailed(account, null, e.getMessage());
addErrorMessage(account, e); addErrorMessage(account, e);
} }
finally
{
listener.listLocalMessagesFinished(account, null);
}
} }
} }
}); });
@ -919,8 +922,8 @@ public class MessagingController implements Runnable
Log.i(K9.LOG_TAG, "SYNC: Expunging folder " + account.getDescription() + ":" + folder); Log.i(K9.LOG_TAG, "SYNC: Expunging folder " + account.getDescription() + ":" + folder);
remoteFolder.expunge(); remoteFolder.expunge();
} }
/* /*
* Get the remote message count. * Get the remote message count.
*/ */
@ -2165,7 +2168,7 @@ public class MessagingController implements Runnable
command.command = PENDING_COMMAND_EXPUNGE; command.command = PENDING_COMMAND_EXPUNGE;
command.arguments = new String[1]; command.arguments = new String[1];
command.arguments[0] = folderName; command.arguments[0] = folderName;
queuePendingCommand(account, command); queuePendingCommand(account, command);
processPendingCommands(account); processPendingCommands(account);
@ -2176,14 +2179,14 @@ public class MessagingController implements Runnable
throws MessagingException throws MessagingException
{ {
String folder = command.arguments[0]; String folder = command.arguments[0];
if (account.getErrorFolderName().equals(folder)) if (account.getErrorFolderName().equals(folder))
{ {
return; return;
} }
if (K9.DEBUG) if (K9.DEBUG)
{ {
Log.d(K9.LOG_TAG, "processPendingExpunge: folder = " + folder ); Log.d(K9.LOG_TAG, "processPendingExpunge: folder = " + folder);
} }
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication); Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
@ -2202,7 +2205,7 @@ public class MessagingController implements Runnable
remoteFolder.expunge(); remoteFolder.expunge();
if (K9.DEBUG) if (K9.DEBUG)
{ {
Log.d(K9.LOG_TAG, "processPendingExpunge: complete for folder = " + folder ); Log.d(K9.LOG_TAG, "processPendingExpunge: complete for folder = " + folder);
} }
} }
finally finally
@ -3404,7 +3407,7 @@ public class MessagingController implements Runnable
throw new RuntimeException("Error moving message", me); throw new RuntimeException("Error moving message", me);
} }
} }
public void expunge(final Account account, final String folder, final MessagingListener listener) public void expunge(final Account account, final String folder, final MessagingListener listener)
{ {
putBackground("expunge", null, new Runnable() putBackground("expunge", null, new Runnable()