From b4f37122463eb916d874ded2c99271844fd850e2 Mon Sep 17 00:00:00 2001 From: Koji Arai Date: Sat, 19 Feb 2011 23:10:51 +0900 Subject: [PATCH] Should retrieve just visibleLimit messages when the local folder is cleared. --- src/com/fsck/k9/controller/MessagingController.java | 2 +- src/com/fsck/k9/mail/store/LocalStore.java | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index fd4e0f7f1..f8cd2167f 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -793,7 +793,7 @@ public class MessagingController implements Runnable { LocalStore localStore = account.getLocalStore(); LocalFolder localFolder = localStore.getFolder(folder); if (localFolder.getVisibleLimit() > 0) { - localFolder.setVisibleLimit(localFolder.getVisibleLimit() + account.getDisplayCount()); + localFolder.setVisibleLimit(localFolder.getVisibleLimit() + localFolder.getMessageCount()); } synchronizeMailbox(account, folder, listener, null); } catch (MessagingException me) { diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 2fb64dd07..52d28b8d7 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -485,9 +485,6 @@ public class LocalStore extends Store implements Serializable { cursor = db.rawQuery("SELECT COUNT(*) FROM messages", null); cursor.moveToFirst(); return cursor.getInt(0); // message count - - - } finally { if (cursor != null) { cursor.close(); @@ -497,8 +494,6 @@ public class LocalStore extends Store implements Serializable { }); } - - public void getMessageCounts(final AccountStats stats) throws MessagingException { final Account.FolderMode displayMode = mAccount.getFolderDisplayMode(); @@ -1269,7 +1264,7 @@ public class LocalStore extends Store implements Serializable { } Cursor cursor = null; try { - cursor = db.rawQuery("SELECT COUNT(*) FROM messages WHERE folder_id = ?", + cursor = db.rawQuery("SELECT COUNT(*) FROM messages WHERE deleted = 0 and folder_id = ?", new String[] { Long.toString(mFolderId) });