1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-31 23:30:11 -05:00

Add Account.hasArchiveFolder() method.

This commit is contained in:
Andrew Chen 2012-04-06 14:45:44 -07:00
parent 12d1301056
commit e94db81ecb
3 changed files with 14 additions and 6 deletions

View File

@ -935,6 +935,14 @@ public class Account implements BaseAccount {
mArchiveFolderName = archiveFolderName; mArchiveFolderName = archiveFolderName;
} }
/**
* Checks if this account has an archive folder set.
* @return true if account has an archive folder set.
*/
public synchronized boolean hasArchiveFolder() {
return !K9.FOLDER_NONE.equalsIgnoreCase(mArchiveFolderName);
}
public synchronized String getSpamFolderName() { public synchronized String getSpamFolderName() {
return mSpamFolderName; return mSpamFolderName;
} }
@ -1276,7 +1284,6 @@ public class Account implements BaseAccount {
* Only to be called durin initial account-setup!<br/> * Only to be called durin initial account-setup!<br/>
* Side-effect: changes {@link #mLocalStorageProviderId}. * Side-effect: changes {@link #mLocalStorageProviderId}.
* *
* @param context
* @param newStorageProviderId * @param newStorageProviderId
* Never <code>null</code>. * Never <code>null</code>.
* @throws MessagingException * @throws MessagingException

View File

@ -1631,7 +1631,7 @@ public class MessageList
if (mCurrentFolder != null && K9.ERROR_FOLDER_NAME.equals(mCurrentFolder.name)) { if (mCurrentFolder != null && K9.ERROR_FOLDER_NAME.equals(mCurrentFolder.name)) {
menu.findItem(R.id.expunge).setVisible(false); menu.findItem(R.id.expunge).setVisible(false);
} }
if (K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getArchiveFolderName())) { if (!mAccount.hasArchiveFolder()) {
menu.findItem(R.id.batch_archive_op).setVisible(false); menu.findItem(R.id.batch_archive_op).setVisible(false);
} }
if (K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getSpamFolderName())) { if (K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getSpamFolderName())) {
@ -1839,9 +1839,10 @@ public class MessageList
menu.findItem(R.id.spam).setVisible(false); menu.findItem(R.id.spam).setVisible(false);
} }
if (K9.FOLDER_NONE.equalsIgnoreCase(account.getArchiveFolderName())) { if (!account.hasArchiveFolder()) {
menu.findItem(R.id.archive).setVisible(false); menu.findItem(R.id.archive).setVisible(false);
} }
if (K9.FOLDER_NONE.equalsIgnoreCase(account.getSpamFolderName())) { if (K9.FOLDER_NONE.equalsIgnoreCase(account.getSpamFolderName())) {
menu.findItem(R.id.spam).setVisible(false); menu.findItem(R.id.spam).setVisible(false);
} }

View File

@ -449,9 +449,9 @@ public class MessageView extends K9Activity implements OnClickListener {
mPrevious.setEnabled(mPreviousMessage != null); mPrevious.setEnabled(mPreviousMessage != null);
// If moving isn't support at all, then all of them must be disabled anyway. // If moving isn't support at all, then all of them must be disabled anyway.
if (mController.isMoveCapable(mAccount)) { if (mController.isMoveCapable(mAccount)) {
// Only enable the button if the Archive folder is not the current folder and not NONE. // Only enable the button if they have an archive folder and it's not the current folder.
mArchive.setEnabled(!mMessageReference.folderName.equals(mAccount.getArchiveFolderName()) && mArchive.setEnabled(!mMessageReference.folderName.equals(mAccount.getArchiveFolderName()) &&
!K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getArchiveFolderName())); mAccount.hasArchiveFolder());
// Only enable the button if the Spam folder is not the current folder and not NONE. // Only enable the button if the Spam folder is not the current folder and not NONE.
mSpam.setEnabled(!mMessageReference.folderName.equals(mAccount.getSpamFolderName()) && mSpam.setEnabled(!mMessageReference.folderName.equals(mAccount.getSpamFolderName()) &&
!K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getSpamFolderName())); !K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getSpamFolderName()));
@ -878,7 +878,7 @@ public class MessageView extends K9Activity implements OnClickListener {
menu.findItem(R.id.archive).setVisible(false); menu.findItem(R.id.archive).setVisible(false);
menu.findItem(R.id.spam).setVisible(false); menu.findItem(R.id.spam).setVisible(false);
} }
if (K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getArchiveFolderName())) { if (!mAccount.hasArchiveFolder()) {
menu.findItem(R.id.archive).setVisible(false); menu.findItem(R.id.archive).setVisible(false);
} }
if (K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getSpamFolderName())) { if (K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getSpamFolderName())) {