Fix capabilities to allow discarding drafts.

Bug: 10098652
Change-Id: Iebceb203cd054a1550f7c1f118841a77429f853a
This commit is contained in:
Yu Ping Hu 2013-08-06 20:20:15 -07:00
parent 9d628b4c41
commit 6edccbf1f1
3 changed files with 17 additions and 6 deletions

View File

@ -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()) {

View File

@ -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

View File

@ -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