From 4cc1ea489a513dc88b34da7b13001b58fd186607 Mon Sep 17 00:00:00 2001 From: Daniel Applebaum Date: Wed, 31 Dec 2008 16:05:03 +0000 Subject: [PATCH] Restored automatic creation of a local folder on open. Why was this removed in K9? I can't find the history of LocalStore.java to find the answer. Eliminated now redundant creation of Outbox and Drafts folders. --- src/com/android/email/MessagingController.java | 12 ------------ src/com/android/email/mail/store/LocalStore.java | 3 +++ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/com/android/email/MessagingController.java b/src/com/android/email/MessagingController.java index eb7f0827c..28aa0a84d 100644 --- a/src/com/android/email/MessagingController.java +++ b/src/com/android/email/MessagingController.java @@ -1392,10 +1392,6 @@ s * critical data as fast as possible, and then we'll fill in the de Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication); LocalFolder localFolder = (LocalFolder)localStore.getFolder(account.getErrorFolderName()); - if (localFolder.exists() == false) - { - localFolder.create(Folder.FolderType.HOLDS_MESSAGES); - } Message[] messages = new Message[1]; Message message = new MimeMessage(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -1733,10 +1729,6 @@ s * critical data as fast as possible, and then we'll fill in the de Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication); LocalFolder localFolder = (LocalFolder) localStore.getFolder(account.getOutboxFolderName()); - if (!localFolder.exists()) - { - localFolder.create(Folder.FolderType.HOLDS_MESSAGES); - } localFolder.open(OpenMode.READ_WRITE); localFolder.appendMessages(new Message[] { message @@ -2236,10 +2228,6 @@ s * critical data as fast as possible, and then we'll fill in the de Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication); LocalFolder localFolder = (LocalFolder) localStore.getFolder(account.getDraftsFolderName()); - if (!localFolder.exists()) - { - localFolder.create(Folder.FolderType.HOLDS_MESSAGES); - } localFolder.open(OpenMode.READ_WRITE); localFolder.appendMessages(new Message[] { message diff --git a/src/com/android/email/mail/store/LocalStore.java b/src/com/android/email/mail/store/LocalStore.java index ee76bbc37..398f26e11 100644 --- a/src/com/android/email/mail/store/LocalStore.java +++ b/src/com/android/email/mail/store/LocalStore.java @@ -359,6 +359,9 @@ public class LocalStore extends Store implements Serializable { if (isOpen()) { return; } + if (!exists()) { + create(FolderType.HOLDS_MESSAGES); + } Cursor cursor = null; try { cursor = mDb.rawQuery("SELECT id, unread_count, visible_limit, last_updated, status FROM folders "