From ae46818a1925cc22fe20ee26ffee8779561a903b Mon Sep 17 00:00:00 2001 From: Alon Albert Date: Tue, 29 Oct 2013 10:35:03 -0700 Subject: [PATCH] Disable Move Actions for POP3 Folders Bug: 11311812 Change-Id: I5813281cca76b9b4a373b5b40dbbd1909800f951 --- res/values/attrs.xml | 1 + res/xml/services.xml | 3 +++ src/com/android/email/provider/EmailProvider.java | 8 +++++++- src/com/android/email/service/EmailServiceUtils.java | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/res/values/attrs.xml b/res/values/attrs.xml index a438b1bcf..322934c27 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -40,6 +40,7 @@ + diff --git a/res/xml/services.xml b/res/xml/services.xml index 096f81a4c..2d7446ad4 100644 --- a/res/xml/services.xml +++ b/res/xml/services.xml @@ -64,6 +64,7 @@ email:offerLocalDeletes="true" email:inferPrefix="pop" email:offerLoadMore="true" + email:offerMoveTo="false" /> diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 1ffefda93..e03e4c1ea 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -2832,7 +2832,7 @@ public class EmailProvider extends ContentProvider { return sb.toString(); } - private static int getFolderCapabilities(EmailServiceInfo info, int type, long mailboxId) { + private int getFolderCapabilities(EmailServiceInfo info, int type, long mailboxId) { // Special case for Search folders: only permit delete, do not try to give any other caps. if (type == Mailbox.TYPE_SEARCH) { return UIProvider.FolderCapabilities.DELETE; @@ -2865,6 +2865,12 @@ public class EmailProvider extends ContentProvider { if (isVirtualMailbox(mailboxId)) { caps |= UIProvider.FolderCapabilities.IS_VIRTUAL; } + + if (!info.offerMoveTo) { + caps &= ~UIProvider.FolderCapabilities.CAN_ACCEPT_MOVED_MESSAGES & + ~UIProvider.FolderCapabilities.ALLOWS_REMOVE_CONVERSATION & + ~UIProvider.FolderCapabilities.ALLOWS_MOVE_TO_INBOX; + } return caps; } diff --git a/src/com/android/email/service/EmailServiceUtils.java b/src/com/android/email/service/EmailServiceUtils.java index 1122bad96..c9b083bdb 100644 --- a/src/com/android/email/service/EmailServiceUtils.java +++ b/src/com/android/email/service/EmailServiceUtils.java @@ -201,6 +201,7 @@ public class EmailServiceUtils { public int defaultSyncInterval; public String inferPrefix; public boolean offerLoadMore; + public boolean offerMoveTo; public boolean requiresSetup; public boolean hide; @@ -576,6 +577,8 @@ public class EmailServiceUtils { info.inferPrefix = ta.getString(R.styleable.EmailServiceInfo_inferPrefix); info.offerLoadMore = ta.getBoolean(R.styleable.EmailServiceInfo_offerLoadMore, false); + info.offerMoveTo = + ta.getBoolean(R.styleable.EmailServiceInfo_offerMoveTo, false); info.requiresSetup = ta.getBoolean(R.styleable.EmailServiceInfo_requiresSetup, false);