1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-12 06:08:25 -05:00

Show "check mail" action when displaying Unified Inbox etc.

This commit is contained in:
cketti 2013-04-02 19:30:41 +02:00
parent 0c5bdf2c97
commit c5dc626bbc
2 changed files with 23 additions and 12 deletions

View File

@ -1045,21 +1045,15 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
if (!mMessageListFragment.isSingleAccountMode()) { if (!mMessageListFragment.isSingleAccountMode()) {
menu.findItem(R.id.expunge).setVisible(false); menu.findItem(R.id.expunge).setVisible(false);
menu.findItem(R.id.check_mail).setVisible(false);
menu.findItem(R.id.send_messages).setVisible(false); menu.findItem(R.id.send_messages).setVisible(false);
} else { } else {
menu.findItem(R.id.send_messages).setVisible(mMessageListFragment.isOutbox()); menu.findItem(R.id.send_messages).setVisible(mMessageListFragment.isOutbox());
menu.findItem(R.id.expunge).setVisible(mMessageListFragment.isRemoteFolder() &&
if (mMessageListFragment.isRemoteFolder()) { mMessageListFragment.isAccountExpungeCapable());
menu.findItem(R.id.check_mail).setVisible(true);
menu.findItem(R.id.expunge).setVisible(
mMessageListFragment.isAccountExpungeCapable());
} else {
menu.findItem(R.id.check_mail).setVisible(false);
menu.findItem(R.id.expunge).setVisible(false);
}
} }
menu.findItem(R.id.check_mail).setVisible(mMessageListFragment.isCheckMailSupported());
// If this is an explicit local search, show the option to search on the server // If this is an explicit local search, show the option to search on the server
if (!mMessageListFragment.isRemoteSearch() && if (!mMessageListFragment.isRemoteSearch() &&
mMessageListFragment.isRemoteSearchAllowed()) { mMessageListFragment.isRemoteSearchAllowed()) {

View File

@ -384,6 +384,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
private LocalSearch mSearch = null; private LocalSearch mSearch = null;
private boolean mSingleAccountMode; private boolean mSingleAccountMode;
private boolean mSingleFolderMode; private boolean mSingleFolderMode;
private boolean mAllAccounts;
private MessageListHandler mHandler = new MessageListHandler(); private MessageListHandler mHandler = new MessageListHandler();
@ -901,11 +902,13 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
mCurrentFolder = getFolder(mFolderName, mAccount); mCurrentFolder = getFolder(mFolderName, mAccount);
} }
mAllAccounts = false;
if (mSingleAccountMode) { if (mSingleAccountMode) {
mAccountUuids = new String[] { mAccount.getUuid() }; mAccountUuids = new String[] { mAccount.getUuid() };
} else { } else {
if (accountUuids.length == 1 && if (accountUuids.length == 1 &&
accountUuids[0].equals(SearchSpecification.ALL_ACCOUNTS)) { accountUuids[0].equals(SearchSpecification.ALL_ACCOUNTS)) {
mAllAccounts = true;
Account[] accounts = mPreferences.getAccounts(); Account[] accounts = mPreferences.getAccounts();
@ -2829,8 +2832,17 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
} }
public void checkMail() { public void checkMail() {
mController.synchronizeMailbox(mAccount, mFolderName, mListener, null); if (isSingleAccountMode() && isSingleFolderMode()) {
mController.sendPendingMessages(mAccount, mListener); mController.synchronizeMailbox(mAccount, mFolderName, mListener, null);
mController.sendPendingMessages(mAccount, mListener);
} else if (mAllAccounts) {
mController.checkMail(mContext, null, true, true, mListener);
} else {
for (String accountUuid : mAccountUuids) {
Account account = mPreferences.getAccount(accountUuid);
mController.checkMail(mContext, account, true, true, mListener);
}
}
} }
/** /**
@ -3452,4 +3464,9 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
mController.markAllMessagesRead(mAccount, mFolderName); mController.markAllMessagesRead(mAccount, mFolderName);
} }
} }
public boolean isCheckMailSupported() {
return (mAllAccounts || !isSingleAccountMode() || !isSingleFolderMode() ||
isRemoteFolder());
}
} }