From 1079b6e9628910e726881233f62808976d5d3be1 Mon Sep 17 00:00:00 2001 From: Scott Kennedy Date: Tue, 11 Jun 2013 19:56:44 -0700 Subject: [PATCH] Move to Inbox Add a new Account setting field: Uri moveToInbox This contains the Uri to use for the "move to inbox" action, which may differ from defaultInbox. There is no Move to Inbox in Email right now. Bug: 9256654 Change-Id: I7c81c8115eda83123a09a9b7da7adf97a3c79964 --- .../android/email/provider/EmailProvider.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 7e0245768..1f8cb4179 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -2602,20 +2602,21 @@ public class EmailProvider extends ContentProvider { textZoomToUiValue(textZoom)); } // Set default inbox, if we've got an inbox; otherwise, say initial sync needed - long mailboxId = Mailbox.findMailboxOfType(context, accountId, Mailbox.TYPE_INBOX); + final long inboxMailboxId = + Mailbox.findMailboxOfType(context, accountId, Mailbox.TYPE_INBOX); if (projectionColumns.contains(UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX) && - mailboxId != Mailbox.NO_MAILBOX) { + inboxMailboxId != Mailbox.NO_MAILBOX) { values.put(UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX, - uiUriString("uifolder", mailboxId)); + uiUriString("uifolder", inboxMailboxId)); } if (projectionColumns.contains( UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX_NAME) && - mailboxId != Mailbox.NO_MAILBOX) { + inboxMailboxId != Mailbox.NO_MAILBOX) { values.put(UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX_NAME, - Mailbox.getDisplayName(context, mailboxId)); + Mailbox.getDisplayName(context, inboxMailboxId)); } if (projectionColumns.contains(UIProvider.AccountColumns.SYNC_STATUS)) { - if (mailboxId != Mailbox.NO_MAILBOX) { + if (inboxMailboxId != Mailbox.NO_MAILBOX) { values.put(UIProvider.AccountColumns.SYNC_STATUS, UIProvider.SyncStatus.NO_SYNC); } else { values.put(UIProvider.AccountColumns.SYNC_STATUS, @@ -2653,6 +2654,11 @@ public class EmailProvider extends ContentProvider { values.put(UIProvider.AccountColumns.TYPE, type); } + if (projectionColumns.contains(UIProvider.AccountColumns.SettingsColumns.MOVE_TO_INBOX) && + inboxMailboxId != Mailbox.NO_MAILBOX) { + values.put(UIProvider.AccountColumns.SettingsColumns.MOVE_TO_INBOX, + uiUriString("uifolder", inboxMailboxId)); + } final StringBuilder sb = genSelect(getAccountListMap(getContext()), uiProjection, values); sb.append(" FROM " + Account.TABLE_NAME + " WHERE " + AccountColumns.ID + "=?"); @@ -2843,6 +2849,10 @@ public class EmailProvider extends ContentProvider { values[colPosMap.get(UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX)] = combinedUriString("uifolder", combinedMailboxId(Mailbox.TYPE_INBOX)); } + if (colPosMap.containsKey(UIProvider.AccountColumns.SettingsColumns.MOVE_TO_INBOX)) { + values[colPosMap.get(UIProvider.AccountColumns.SettingsColumns.MOVE_TO_INBOX)] = + combinedUriString("uifolder", combinedMailboxId(Mailbox.TYPE_INBOX)); + } mc.addRow(values); }