From 9f568e3e0887bf10d81fc5aa3ec14e9c8ba8be7d Mon Sep 17 00:00:00 2001 From: Sander Bogaert Date: Thu, 26 Jul 2012 10:02:06 -0400 Subject: [PATCH] Hide move & copy options for mixed messagelists. Also use hide and show the new grouped icon for them correctly. --- src/com/fsck/k9/activity/MessageList.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index d51036b65..9d0f4fc29 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -2766,6 +2766,7 @@ public class MessageList extends K9ListActivity implements menu.findItem(R.id.archive).setVisible(true); menu.findItem(R.id.spam).setVisible(true); menu.findItem(R.id.copy).setVisible(true); + menu.findItem(R.id.move_or_copy).setVisible(true); // hide uncapable /* @@ -2804,6 +2805,21 @@ public class MessageList extends K9ListActivity implements } private void setContextCapabilities(Account mAccount, Menu menu) { + /* + * TODO get rid of this when we finally split the messagelist into + * a folder content display and a search result display + */ + if (mQueryString != null) { + menu.findItem(R.id.move).setVisible(false); + menu.findItem(R.id.copy).setVisible(false); + menu.findItem(R.id.move_or_copy).setVisible(false); + + menu.findItem(R.id.archive).setVisible(false); + menu.findItem(R.id.spam).setVisible(false); + + return; + } + // hide unsupported if (!mController.isCopyCapable(mAccount)) { menu.findItem(R.id.copy).setVisible(false); @@ -2815,6 +2831,11 @@ public class MessageList extends K9ListActivity implements menu.findItem(R.id.spam).setVisible(false); } + if (!mController.isMoveCapable(mAccount) + && !mController.isCopyCapable(mAccount)) { + menu.findItem(R.id.move_or_copy).setVisible(false); + } + if (!mAccount.hasArchiveFolder()) { menu.findItem(R.id.archive).setVisible(false); }