diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 8f2b22db5..59deb8304 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -2368,8 +2368,11 @@ public class EmailProvider extends ContentProvider { private static int getFolderCapabilities(EmailServiceInfo info, int flags, int type, long mailboxId) { - // All folders support delete - int caps = UIProvider.FolderCapabilities.DELETE; + // All folders support delete, except drafts. + int caps = 0; + if (type != Mailbox.TYPE_DRAFTS) { + caps = UIProvider.FolderCapabilities.DELETE; + } if (info != null && info.offerLookback) { // Protocols supporting lookback support settings caps |= UIProvider.FolderCapabilities.SUPPORTS_SETTINGS; @@ -4080,6 +4083,14 @@ public class EmailProvider extends ContentProvider { return 1; } + // Another special case - deleting a draft. + final String operation = values.getAsString( + UIProvider.ConversationOperations.OPERATION_KEY); + if (UIProvider.ConversationOperations.DISCARD_DRAFTS.equals(operation)) { + uiDeleteMessage(uri); + return 1; + } + ContentValues undoValues = new ContentValues(); ContentValues ourValues = convertUiMessageValues(msg, values); for (String columnName: ourValues.keySet()) { diff --git a/src/com/android/email/service/ImapService.java b/src/com/android/email/service/ImapService.java index 4b2b7c58a..dc85b16aa 100644 --- a/src/com/android/email/service/ImapService.java +++ b/src/com/android/email/service/ImapService.java @@ -128,7 +128,8 @@ public class ImapService extends Service { public int getCapabilities(Account acct) throws RemoteException { return AccountCapabilities.SYNCABLE_FOLDERS | AccountCapabilities.FOLDER_SERVER_SEARCH | - AccountCapabilities.UNDO; + AccountCapabilities.UNDO | + AccountCapabilities.DISCARD_CONVERSATION_DRAFTS; } @Override diff --git a/src/com/android/email/service/Pop3Service.java b/src/com/android/email/service/Pop3Service.java index a1b21ffd4..50edb68fd 100644 --- a/src/com/android/email/service/Pop3Service.java +++ b/src/com/android/email/service/Pop3Service.java @@ -50,7 +50,6 @@ import com.android.emailcommon.provider.EmailContent.SyncColumns; import com.android.emailcommon.provider.Mailbox; import com.android.emailcommon.service.EmailServiceStatus; import com.android.emailcommon.service.IEmailServiceCallback; -import com.android.emailcommon.utility.AttachmentUtilities; import com.android.mail.providers.UIProvider; import com.android.mail.providers.UIProvider.AccountCapabilities; import com.android.mail.providers.UIProvider.AttachmentState; @@ -61,7 +60,6 @@ import org.apache.james.mime4j.EOLConvertingInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; public class Pop3Service extends Service { private static final String TAG = "Pop3Service"; @@ -78,7 +76,8 @@ public class Pop3Service extends Service { private final EmailServiceStub mBinder = new EmailServiceStub() { @Override public int getCapabilities(Account acct) throws RemoteException { - return AccountCapabilities.UNDO; + return AccountCapabilities.UNDO | + AccountCapabilities.DISCARD_CONVERSATION_DRAFTS; } @Override