Report message count for folders where total count < 0.

Local-only folders will set total count = -1 to signify that
they should never sync with server.

Change-Id: I6034633e453343f14faac077902e67ea4e6b0a35
This commit is contained in:
Yu Ping Hu 2013-08-02 12:23:19 -07:00
parent 431811986f
commit bcd81d96a4
1 changed files with 4 additions and 2 deletions

View File

@ -1934,10 +1934,12 @@ public class EmailProvider extends ContentProvider {
+ " ELSE -1 END";
/**
* For local folders, use message count instead of total count.
* TODO: Improve how we determine this is a local folder.
* Local-only folders set totalCount < 0; such folders should substitute message count for
* total count.
* TODO: IMAP and POP don't adhere to this convention yet so for now we force a few types.
*/
private static final String TOTAL_COUNT = "CASE WHEN "
+ MailboxColumns.TOTAL_COUNT + "<0 OR "
+ MailboxColumns.TYPE + "=" + Mailbox.TYPE_DRAFTS + " OR "
+ MailboxColumns.TYPE + "=" + Mailbox.TYPE_OUTBOX + " OR "
+ MailboxColumns.TYPE + "=" + Mailbox.TYPE_TRASH