use of com.fsck.k9.mail.Folder.FolderClass in project k-9 by k9mail.
the class FolderSettings method saveSettings.
private void saveSettings() throws MessagingException {
mFolder.setInTopGroup(mInTopGroup.isChecked());
mFolder.setIntegrate(mIntegrate.isChecked());
// We call getPushClass() because display class changes can affect push class when push class is set to inherit
FolderClass oldPushClass = mFolder.getPushClass();
FolderClass oldDisplayClass = mFolder.getDisplayClass();
mFolder.setDisplayClass(FolderClass.valueOf(mDisplayClass.getValue()));
mFolder.setSyncClass(FolderClass.valueOf(mSyncClass.getValue()));
mFolder.setPushClass(FolderClass.valueOf(mPushClass.getValue()));
mFolder.setNotifyClass(FolderClass.valueOf(mNotifyClass.getValue()));
mFolder.save();
FolderClass newPushClass = mFolder.getPushClass();
FolderClass newDisplayClass = mFolder.getDisplayClass();
if (oldPushClass != newPushClass || (newPushClass != FolderClass.NO_CLASS && oldDisplayClass != newDisplayClass)) {
MailService.actionRestartPushers(getApplication(), null);
}
}
use of com.fsck.k9.mail.Folder.FolderClass in project k-9 by k9mail.
the class MessagingController method checkMailForAccount.
private void checkMailForAccount(Account account, boolean ignoreLastCheckedTime, boolean notify, MessagingListener listener) {
Timber.i("Synchronizing account %s", account);
NotificationState notificationState = new NotificationState();
sendPendingMessages(account, listener);
refreshFolderListIfStale(account);
try {
Account.FolderMode aDisplayMode = account.getFolderDisplayMode();
Account.FolderMode aSyncMode = account.getFolderSyncMode();
LocalStore localStore = localStoreProvider.getInstance(account);
for (final LocalFolder folder : localStore.getPersonalNamespaces(false)) {
folder.open();
FolderClass fDisplayClass = folder.getDisplayClass();
FolderClass fSyncClass = folder.getSyncClass();
if (LocalFolder.isModeMismatch(aDisplayMode, fDisplayClass)) {
// Never sync a folder that isn't displayed
continue;
}
if (LocalFolder.isModeMismatch(aSyncMode, fSyncClass)) {
// Do not sync folders in the wrong class
continue;
}
synchronizeFolder(account, folder, ignoreLastCheckedTime, notify, listener, notificationState);
}
} catch (MessagingException e) {
Timber.e(e, "Unable to synchronize account %s", account);
} finally {
putBackground("clear notification flag for " + account, null, new Runnable() {
@Override
public void run() {
Timber.v("Clearing notification flag for %s", account);
clearFetchingMailNotification(account);
if (getUnreadMessageCount(account) == 0) {
notificationController.clearNewMailNotifications(account, false);
}
}
});
}
}
Aggregations