Search in sources :

Example 56 with LocalStore

use of com.fsck.k9.mailstore.LocalStore in project k-9 by k9mail.

the class AttachmentProvider method getType.

private String getType(String accountUuid, String id, String mimeType) {
    String type;
    final Account account = Preferences.getPreferences(getContext()).getAccount(accountUuid);
    try {
        final LocalStore localStore = LocalStore.getInstance(account, getContext());
        AttachmentInfo attachmentInfo = localStore.getAttachmentInfo(id);
        if (mimeType != null) {
            type = mimeType;
        } else {
            type = attachmentInfo.type;
        }
    } catch (MessagingException e) {
        Timber.e(e, "Unable to retrieve LocalStore for %s", account);
        type = MimeUtility.DEFAULT_ATTACHMENT_MIME_TYPE;
    }
    return type;
}
Also used : Account(com.fsck.k9.Account) MessagingException(com.fsck.k9.mail.MessagingException) AttachmentInfo(com.fsck.k9.mailstore.LocalStore.AttachmentInfo) LocalStore(com.fsck.k9.mailstore.LocalStore)

Example 57 with LocalStore

use of com.fsck.k9.mailstore.LocalStore in project k-9 by k9mail.

the class SqlQueryBuilder method getFolderId.

private static long getFolderId(Account account, String folderName) {
    long folderId = 0;
    try {
        LocalStore localStore = account.getLocalStore();
        LocalFolder folder = localStore.getFolder(folderName);
        folder.open(Folder.OPEN_MODE_RO);
        folderId = folder.getId();
    } catch (MessagingException e) {
        //FIXME
        e.printStackTrace();
    }
    return folderId;
}
Also used : LocalFolder(com.fsck.k9.mailstore.LocalFolder) MessagingException(com.fsck.k9.mail.MessagingException) LocalStore(com.fsck.k9.mailstore.LocalStore)

Aggregations

LocalStore (com.fsck.k9.mailstore.LocalStore)41 MessagingException (com.fsck.k9.mail.MessagingException)33 LocalFolder (com.fsck.k9.mailstore.LocalFolder)33 Store (com.fsck.k9.mail.Store)18 LocalMessage (com.fsck.k9.mailstore.LocalMessage)18 Folder (com.fsck.k9.mail.Folder)17 Pop3Store (com.fsck.k9.mail.store.pop3.Pop3Store)17 MimeMessage (com.fsck.k9.mail.internet.MimeMessage)15 FetchProfile (com.fsck.k9.mail.FetchProfile)14 Message (com.fsck.k9.mail.Message)13 UnavailableStorageException (com.fsck.k9.mailstore.UnavailableStorageException)13 IOException (java.io.IOException)12 AuthenticationFailedException (com.fsck.k9.mail.AuthenticationFailedException)11 CertificateValidationException (com.fsck.k9.mail.CertificateValidationException)11 Test (org.junit.Test)10 Account (com.fsck.k9.Account)9 ArrayList (java.util.ArrayList)9 SuppressLint (android.annotation.SuppressLint)8 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)8 VisibleForTesting (android.support.annotation.VisibleForTesting)5