Merge branch 'readonly-p4-donut' into donut

This commit is contained in:
Andy Stadler 2009-04-27 17:18:43 -07:00 committed by The Android Open Source Project
commit 0f8a57891f

View File

@ -1077,22 +1077,31 @@ public class MessagingController implements Runnable {
} }
if (remoteTrashFolder.exists()) { if (remoteTrashFolder.exists()) {
/*
* Because remoteTrashFolder may be new, we need to explicitly open it
* and pass in the persistence callbacks.
*/
final LocalFolder localTrashFolder =
(LocalFolder) localStore.getFolder(account.getTrashFolderName());
remoteTrashFolder.open(OpenMode.READ_WRITE, localTrashFolder.getPersistentCallbacks());
if (remoteTrashFolder.getMode() != OpenMode.READ_WRITE) {
return;
}
remoteFolder.copyMessages(new Message[] { remoteMessage }, remoteTrashFolder, remoteFolder.copyMessages(new Message[] { remoteMessage }, remoteTrashFolder,
new Folder.MessageUpdateCallbacks() { new Folder.MessageUpdateCallbacks() {
public void onMessageUidChange(Message message, String newUid) public void onMessageUidChange(Message message, String newUid)
throws MessagingException { throws MessagingException {
// update the UID in the local trash folder, because some stores will // update the UID in the local trash folder, because some stores will
// have to change it when copying to remoteTrashFolder // have to change it when copying to remoteTrashFolder
LocalFolder localTrashFolder = LocalMessage localMessage =
(LocalFolder) localStore.getFolder(account.getTrashFolderName()); (LocalMessage) localTrashFolder.getMessage(message.getUid());
LocalMessage localMessage = if(localMessage != null) {
(LocalMessage) localTrashFolder.getMessage(message.getUid()); localMessage.setUid(newUid);
if(localMessage != null) { localTrashFolder.updateMessage(localMessage);
localMessage.setUid(newUid);
localTrashFolder.updateMessage(localMessage);
}
}
} }
}
}
); );
} }