diff --git a/email2/emailcommon/src/com/android/emailcommon/provider/Mailbox.java b/email2/emailcommon/src/com/android/emailcommon/provider/Mailbox.java index adde91194..c7a1aecc4 100644 --- a/email2/emailcommon/src/com/android/emailcommon/provider/Mailbox.java +++ b/email2/emailcommon/src/com/android/emailcommon/provider/Mailbox.java @@ -518,6 +518,14 @@ public class Mailbox extends EmailContent implements SyncColumns, MailboxColumns return false; } + public boolean uploadsToServer(Context context) { + if (mType == TYPE_DRAFTS || mType == TYPE_OUTBOX || mType == TYPE_SEARCH) { + return false; + } + String protocol = Account.getProtocol(context, mAccountKey); + return (!protocol.equals(HostAuth.SCHEME_POP3)); + } + /** * @return true if messages in a mailbox of a type can be replied/forwarded. */ diff --git a/email2/src/com/android/email/provider/EmailProvider.java b/email2/src/com/android/email/provider/EmailProvider.java index 9dd13b840..741e02fdf 100644 --- a/email2/src/com/android/email/provider/EmailProvider.java +++ b/email2/src/com/android/email/provider/EmailProvider.java @@ -3332,10 +3332,15 @@ outer: } private int uiUpdateMessage(Uri uri, ContentValues values) { - Uri ourUri = convertToEmailProviderUri(uri, Message.SYNCED_CONTENT_URI, true); - if (ourUri == null) return 0; + Context context = getContext(); Message msg = getMessageFromLastSegment(uri); if (msg == null) return 0; + Mailbox mailbox = Mailbox.restoreMailboxWithId(context, msg.mMailboxKey); + if (mailbox == null) return 0; + Uri ourBaseUri = + mailbox.uploadsToServer(context) ? Message.SYNCED_CONTENT_URI : Message.CONTENT_URI; + Uri ourUri = convertToEmailProviderUri(uri, ourBaseUri, true); + if (ourUri == null) return 0; ContentValues undoValues = new ContentValues(); ContentValues ourValues = convertUiMessageValues(msg, values); for (String columnName: ourValues.keySet()) { @@ -3352,7 +3357,7 @@ outer: } ContentProviderOperation op = ContentProviderOperation.newUpdate(convertToEmailProviderUri( - uri,Message.SYNCED_CONTENT_URI, false)) + uri, ourBaseUri, false)) .withValues(undoValues) .build(); addToSequence(uri, op);