Search in sources :

Example 1 with FolderClass

use of com.fsck.k9.mail.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);
    }
}
Also used : FolderClass(com.fsck.k9.mail.Folder.FolderClass)

Example 2 with FolderClass

use of com.fsck.k9.mail.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);
                }
            }
        });
    }
}
Also used : LocalFolder(com.fsck.k9.mailstore.LocalFolder) SearchAccount(com.fsck.k9.search.SearchAccount) Account(com.fsck.k9.Account) MessagingException(com.fsck.k9.mail.MessagingException) LocalStore(com.fsck.k9.mailstore.LocalStore) FolderClass(com.fsck.k9.mail.FolderClass)

Aggregations

Account (com.fsck.k9.Account)1 FolderClass (com.fsck.k9.mail.Folder.FolderClass)1 FolderClass (com.fsck.k9.mail.FolderClass)1 MessagingException (com.fsck.k9.mail.MessagingException)1 LocalFolder (com.fsck.k9.mailstore.LocalFolder)1 LocalStore (com.fsck.k9.mailstore.LocalStore)1 SearchAccount (com.fsck.k9.search.SearchAccount)1