From 87673c91a5e627e349a5b5b4a2ac3a31b41e8c94 Mon Sep 17 00:00:00 2001 From: Daniel Applebaum Date: Mon, 30 Nov 2009 04:57:29 +0000 Subject: [PATCH] Implement Bao-Long's suggestion to modify LocalStore.purgeToVisibleLimit only to work on undeleted messages. Convert LocalStore.clear() to use the new DELETED column. Make markAllAsRead only work on undeleted messages. --- src/com/android/email/MessagingController.java | 2 +- src/com/android/email/mail/store/LocalStore.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/android/email/MessagingController.java b/src/com/android/email/MessagingController.java index 276e134e8..d5dc5b35d 100644 --- a/src/com/android/email/MessagingController.java +++ b/src/com/android/email/MessagingController.java @@ -2067,7 +2067,7 @@ public class MessagingController implements Runnable Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication); LocalFolder localFolder = (LocalFolder) localStore.getFolder(folder); localFolder.open(OpenMode.READ_WRITE); - Message[] messages = localFolder.getMessages(null); + Message[] messages = localFolder.getMessages(null, false); for (Message message : messages) { if (message.isSet(Flag.SEEN) == false) diff --git a/src/com/android/email/mail/store/LocalStore.java b/src/com/android/email/mail/store/LocalStore.java index 4310c4263..aed7fc2d5 100644 --- a/src/com/android/email/mail/store/LocalStore.java +++ b/src/com/android/email/mail/store/LocalStore.java @@ -267,8 +267,8 @@ public class LocalStore extends Store implements Serializable Log.i(Email.LOG_TAG, "After prune / before clear size = " + getSize()); // don't delete messages that are Local, since there is no copy on the server. // Don't delete deleted messages. They are essentially placeholders for UIDs of messages that have - // been deleted locally. They take up no space, and are indicated with a null date. - mDb.execSQL("DELETE FROM messages WHERE date is not null and uid not like 'Local%'"); + // been deleted locally. They take up insignificant space + mDb.execSQL("DELETE FROM messages WHERE deleted = 0 and uid not like 'Local%'"); compact(); Log.i(Email.LOG_TAG, "After clear message count = " + getMessageCount()); @@ -829,7 +829,7 @@ public class LocalStore extends Store implements Serializable public void purgeToVisibleLimit(MessageRemovalListener listener) throws MessagingException { open(OpenMode.READ_WRITE); - Message[] messages = getMessages(null); + Message[] messages = getMessages(null, false); for (int i = mVisibleLimit; i < messages.length; i++) { if (listener != null)