From 1bd3f31b95adddd31fb6afb79e7ee33ad02d65e3 Mon Sep 17 00:00:00 2001 From: Daniel Applebaum Date: Tue, 27 Jan 2009 03:13:54 +0000 Subject: [PATCH] Attempt to fix Issue 192; making deleted messages stay deleted. --- src/com/android/email/MessagingController.java | 12 +++++++----- .../android/email/activity/FolderMessageList.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/com/android/email/MessagingController.java b/src/com/android/email/MessagingController.java index a92913b46..e0ca6c848 100644 --- a/src/com/android/email/MessagingController.java +++ b/src/com/android/email/MessagingController.java @@ -1910,6 +1910,7 @@ s * critical data as fast as possible, and then we'll fill in the de try { Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication); Folder localFolder = localStore.getFolder(folder); + Message lMessage = localFolder.getMessage(message.getUid()); if (folder.equals(account.getTrashFolderName())) { @@ -1917,7 +1918,7 @@ s * critical data as fast as possible, and then we'll fill in the de { Log.d(Email.LOG_TAG, "Deleting message in trash folder, not copying"); } - message.setFlag(Flag.DELETED, true); + lMessage.setFlag(Flag.DELETED, true); } else { @@ -1936,16 +1937,17 @@ s * critical data as fast as possible, and then we'll fill in the de fp.add(FetchProfile.Item.ENVELOPE); fp.add(FetchProfile.Item.BODY); // TODO: Turn the fetch/copy/delete into an atomic move - localFolder.fetch(new Message[] { message }, fp, null); - localFolder.copyMessages(new Message[] { message }, localTrashFolder); + localFolder.fetch(new Message[] { lMessage }, fp, null); + localFolder.copyMessages(new Message[] { lMessage }, localTrashFolder); if (folder.equals(account.getOutboxFolderName())) { - message.setFlag(Flag.X_DESTROYED, true); + lMessage.setFlag(Flag.X_DESTROYED, true); } else { - message.setFlag(Flag.DELETED, true); + lMessage.setFlag(Flag.DELETED, true); } } } + localFolder.close(false); if (listener != null) { listener.messageDeleted(account, folder, message); } diff --git a/src/com/android/email/activity/FolderMessageList.java b/src/com/android/email/activity/FolderMessageList.java index f3e40592a..0dc5d5473 100644 --- a/src/com/android/email/activity/FolderMessageList.java +++ b/src/com/android/email/activity/FolderMessageList.java @@ -1489,7 +1489,7 @@ public class FolderMessageList extends ExpandableListActivity private void addOrUpdateMessage(FolderInfoHolder folder, Message message, boolean sort, boolean notify) { - if (folder.deletedUids.remove(message.getUid())){ + if (folder.deletedUids.contains(message.getUid())){ return; } MessageInfoHolder m = getMessage(folder, message.getUid());