Search in sources :

Example 46 with K9

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

the class MessagingController method moveOrCopyMessageSynchronous.

private void moveOrCopyMessageSynchronous(final Account account, final String srcFolder, final List<? extends Message> inMessages, final String destFolder, final boolean isCopy) {
    try {
        LocalStore localStore = account.getLocalStore();
        Store remoteStore = account.getRemoteStore();
        if (!isCopy && (!remoteStore.isMoveCapable() || !localStore.isMoveCapable())) {
            return;
        }
        if (isCopy && (!remoteStore.isCopyCapable() || !localStore.isCopyCapable())) {
            return;
        }
        LocalFolder localSrcFolder = localStore.getFolder(srcFolder);
        Folder localDestFolder = localStore.getFolder(destFolder);
        boolean unreadCountAffected = false;
        List<String> uids = new LinkedList<>();
        for (Message message : inMessages) {
            String uid = message.getUid();
            if (!uid.startsWith(K9.LOCAL_UID_PREFIX)) {
                uids.add(uid);
            }
            if (!unreadCountAffected && !message.isSet(Flag.SEEN)) {
                unreadCountAffected = true;
            }
        }
        List<LocalMessage> messages = localSrcFolder.getMessagesByUids(uids);
        if (messages.size() > 0) {
            Map<String, Message> origUidMap = new HashMap<>();
            for (Message message : messages) {
                origUidMap.put(message.getUid(), message);
            }
            Timber.i("moveOrCopyMessageSynchronous: source folder = %s, %d messages, destination folder = %s, " + "isCopy = %s", srcFolder, messages.size(), destFolder, isCopy);
            Map<String, String> uidMap;
            if (isCopy) {
                FetchProfile fp = new FetchProfile();
                fp.add(Item.ENVELOPE);
                fp.add(Item.BODY);
                localSrcFolder.fetch(messages, fp, null);
                uidMap = localSrcFolder.copyMessages(messages, localDestFolder);
                if (unreadCountAffected) {
                    // If this copy operation changes the unread count in the destination
                    // folder, notify the listeners.
                    int unreadMessageCount = localDestFolder.getUnreadMessageCount();
                    for (MessagingListener l : getListeners()) {
                        l.folderStatusChanged(account, destFolder, unreadMessageCount);
                    }
                }
            } else {
                uidMap = localSrcFolder.moveMessages(messages, localDestFolder);
                for (Entry<String, Message> entry : origUidMap.entrySet()) {
                    String origUid = entry.getKey();
                    Message message = entry.getValue();
                    for (MessagingListener l : getListeners()) {
                        l.messageUidChanged(account, srcFolder, origUid, message.getUid());
                    }
                }
                unsuppressMessages(account, messages);
                if (unreadCountAffected) {
                    // If this move operation changes the unread count, notify the listeners
                    // that the unread count changed in both the source and destination folder.
                    int unreadMessageCountSrc = localSrcFolder.getUnreadMessageCount();
                    int unreadMessageCountDest = localDestFolder.getUnreadMessageCount();
                    for (MessagingListener l : getListeners()) {
                        l.folderStatusChanged(account, srcFolder, unreadMessageCountSrc);
                        l.folderStatusChanged(account, destFolder, unreadMessageCountDest);
                    }
                }
            }
            List<String> origUidKeys = new ArrayList<>(origUidMap.keySet());
            queueMoveOrCopy(account, srcFolder, destFolder, isCopy, origUidKeys, uidMap);
        }
        processPendingCommands(account);
    } catch (UnavailableStorageException e) {
        Timber.i("Failed to move/copy message because storage is not available - trying again later.");
        throw new UnavailableAccountException(e);
    } catch (MessagingException me) {
        addErrorMessage(account, null, me);
        throw new RuntimeException("Error moving message", me);
    }
}
Also used : LocalMessage(com.fsck.k9.mailstore.LocalMessage) FetchProfile(com.fsck.k9.mail.FetchProfile) LocalMessage(com.fsck.k9.mailstore.LocalMessage) MimeMessage(com.fsck.k9.mail.internet.MimeMessage) Message(com.fsck.k9.mail.Message) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) MessagingException(com.fsck.k9.mail.MessagingException) UnavailableStorageException(com.fsck.k9.mailstore.UnavailableStorageException) ArrayList(java.util.ArrayList) LocalStore(com.fsck.k9.mailstore.LocalStore) Store(com.fsck.k9.mail.Store) Pop3Store(com.fsck.k9.mail.store.pop3.Pop3Store) LocalStore(com.fsck.k9.mailstore.LocalStore) Folder(com.fsck.k9.mail.Folder) LocalFolder(com.fsck.k9.mailstore.LocalFolder) LinkedList(java.util.LinkedList) SuppressLint(android.annotation.SuppressLint) LocalFolder(com.fsck.k9.mailstore.LocalFolder)

Example 47 with K9

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

the class FontSizeSettings method saveSettings.

/**
     * Update the global FontSize object and permanently store the (possibly
     * changed) font size settings.
     */
private void saveSettings() {
    FontSizes fontSizes = K9.getFontSizes();
    fontSizes.setAccountName(Integer.parseInt(mAccountName.getValue()));
    fontSizes.setAccountDescription(Integer.parseInt(mAccountDescription.getValue()));
    fontSizes.setFolderName(Integer.parseInt(mFolderName.getValue()));
    fontSizes.setFolderStatus(Integer.parseInt(mFolderStatus.getValue()));
    fontSizes.setMessageListSubject(Integer.parseInt(mMessageListSubject.getValue()));
    fontSizes.setMessageListSender(Integer.parseInt(mMessageListSender.getValue()));
    fontSizes.setMessageListDate(Integer.parseInt(mMessageListDate.getValue()));
    fontSizes.setMessageListPreview(Integer.parseInt(mMessageListPreview.getValue()));
    fontSizes.setMessageViewSender(Integer.parseInt(mMessageViewSender.getValue()));
    fontSizes.setMessageViewTo(Integer.parseInt(mMessageViewTo.getValue()));
    fontSizes.setMessageViewCC(Integer.parseInt(mMessageViewCC.getValue()));
    fontSizes.setMessageViewAdditionalHeaders(Integer.parseInt(mMessageViewAdditionalHeaders.getValue()));
    fontSizes.setMessageViewSubject(Integer.parseInt(mMessageViewSubject.getValue()));
    fontSizes.setMessageViewDate(Integer.parseInt(mMessageViewDate.getValue()));
    fontSizes.setMessageViewContentAsPercent(scaleToInt(mMessageViewContentSlider.getValue()));
    fontSizes.setMessageComposeInput(Integer.parseInt(mMessageComposeInput.getValue()));
    Storage storage = Preferences.getPreferences(this).getStorage();
    StorageEditor editor = storage.edit();
    fontSizes.save(editor);
    editor.commit();
}
Also used : Storage(com.fsck.k9.preferences.Storage) StorageEditor(com.fsck.k9.preferences.StorageEditor)

Example 48 with K9

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

the class OpenPgpAppSelectDialog method persistOpenPgpProviderSetting.

private void persistOpenPgpProviderSetting(String selectedPackage) {
    K9.setOpenPgpProvider(selectedPackage);
    StorageEditor editor = Preferences.getPreferences(this).getStorage().edit();
    K9.save(editor);
    editor.commit();
}
Also used : StorageEditor(com.fsck.k9.preferences.StorageEditor)

Example 49 with K9

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

the class Prefs method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.global_preferences);
    mTheme = setupListPreference(PREFERENCE_THEME, themeIdToName(K9.getK9Theme()));
    mFixedMessageTheme = (CheckBoxPreference) findPreference(PREFERENCE_FIXED_MESSAGE_THEME);
    mFixedMessageTheme.setChecked(K9.useFixedMessageViewTheme());
    mMessageTheme = setupListPreference(PREFERENCE_MESSAGE_VIEW_THEME, themeIdToName(K9.getK9MessageViewThemeSetting()));
    mComposerTheme = setupListPreference(PREFERENCE_COMPOSER_THEME, themeIdToName(K9.getK9ComposerThemeSetting()));
    findPreference(PREFERENCE_FONT_SIZE).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        public boolean onPreferenceClick(Preference preference) {
            onFontSizeSettings();
            return true;
        }
    });
    mAnimations = (CheckBoxPreference) findPreference(PREFERENCE_ANIMATIONS);
    mAnimations.setChecked(K9.showAnimations());
    mGestures = (CheckBoxPreference) findPreference(PREFERENCE_GESTURES);
    mGestures.setChecked(K9.gesturesEnabled());
    mVolumeNavigation = (CheckBoxListPreference) findPreference(PREFERENCE_VOLUME_NAVIGATION);
    mVolumeNavigation.setItems(new CharSequence[] { getString(R.string.volume_navigation_message), getString(R.string.volume_navigation_list) });
    mVolumeNavigation.setCheckedItems(new boolean[] { K9.useVolumeKeysForNavigationEnabled(), K9.useVolumeKeysForListNavigationEnabled() });
    mStartIntegratedInbox = (CheckBoxPreference) findPreference(PREFERENCE_START_INTEGRATED_INBOX);
    mStartIntegratedInbox.setChecked(K9.startIntegratedInbox());
    mConfirmActions = (CheckBoxListPreference) findPreference(PREFERENCE_CONFIRM_ACTIONS);
    boolean canDeleteFromNotification = NotificationController.platformSupportsExtendedNotifications();
    CharSequence[] confirmActionEntries = new CharSequence[canDeleteFromNotification ? 6 : 5];
    boolean[] confirmActionValues = new boolean[confirmActionEntries.length];
    int index = 0;
    confirmActionEntries[index] = getString(R.string.global_settings_confirm_action_delete);
    confirmActionValues[index++] = K9.confirmDelete();
    confirmActionEntries[index] = getString(R.string.global_settings_confirm_action_delete_starred);
    confirmActionValues[index++] = K9.confirmDeleteStarred();
    if (canDeleteFromNotification) {
        confirmActionEntries[index] = getString(R.string.global_settings_confirm_action_delete_notif);
        confirmActionValues[index++] = K9.confirmDeleteFromNotification();
    }
    confirmActionEntries[index] = getString(R.string.global_settings_confirm_action_spam);
    confirmActionValues[index++] = K9.confirmSpam();
    confirmActionEntries[index] = getString(R.string.global_settings_confirm_menu_discard);
    confirmActionValues[index++] = K9.confirmDiscardMessage();
    confirmActionEntries[index] = getString(R.string.global_settings_confirm_menu_mark_all_read);
    confirmActionValues[index++] = K9.confirmMarkAllRead();
    mConfirmActions.setItems(confirmActionEntries);
    mConfirmActions.setCheckedItems(confirmActionValues);
    mNotificationHideSubject = setupListPreference(PREFERENCE_NOTIFICATION_HIDE_SUBJECT, K9.getNotificationHideSubject().toString());
    mMeasureAccounts = (CheckBoxPreference) findPreference(PREFERENCE_MEASURE_ACCOUNTS);
    mMeasureAccounts.setChecked(K9.measureAccounts());
    mCountSearch = (CheckBoxPreference) findPreference(PREFERENCE_COUNT_SEARCH);
    mCountSearch.setChecked(K9.countSearchMessages());
    mHideSpecialAccounts = (CheckBoxPreference) findPreference(PREFERENCE_HIDE_SPECIAL_ACCOUNTS);
    mHideSpecialAccounts.setChecked(K9.isHideSpecialAccounts());
    mPreviewLines = setupListPreference(PREFERENCE_MESSAGELIST_PREVIEW_LINES, Integer.toString(K9.messageListPreviewLines()));
    mSenderAboveSubject = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGELIST_SENDER_ABOVE_SUBJECT);
    mSenderAboveSubject.setChecked(K9.messageListSenderAboveSubject());
    mCheckboxes = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGELIST_CHECKBOXES);
    mCheckboxes.setChecked(K9.messageListCheckboxes());
    mStars = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGELIST_STARS);
    mStars.setChecked(K9.messageListStars());
    mShowCorrespondentNames = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES);
    mShowCorrespondentNames.setChecked(K9.showCorrespondentNames());
    mShowContactName = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME);
    mShowContactName.setChecked(K9.showContactName());
    mShowContactPicture = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGELIST_SHOW_CONTACT_PICTURE);
    mShowContactPicture.setChecked(K9.showContactPicture());
    mColorizeMissingContactPictures = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGELIST_COLORIZE_MISSING_CONTACT_PICTURES);
    mColorizeMissingContactPictures.setChecked(K9.isColorizeMissingContactPictures());
    mBackgroundAsUnreadIndicator = (CheckBoxPreference) findPreference(PREFERENCE_BACKGROUND_AS_UNREAD_INDICATOR);
    mBackgroundAsUnreadIndicator.setChecked(K9.useBackgroundAsUnreadIndicator());
    mChangeContactNameColor = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGELIST_CONTACT_NAME_COLOR);
    mChangeContactNameColor.setChecked(K9.changeContactNameColor());
    mThreadedView = (CheckBoxPreference) findPreference(PREFERENCE_THREADED_VIEW);
    mThreadedView.setChecked(K9.isThreadedViewEnabled());
    if (K9.changeContactNameColor()) {
        mChangeContactNameColor.setSummary(R.string.global_settings_registered_name_color_changed);
    } else {
        mChangeContactNameColor.setSummary(R.string.global_settings_registered_name_color_default);
    }
    mChangeContactNameColor.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {

        public boolean onPreferenceChange(Preference preference, Object newValue) {
            final Boolean checked = (Boolean) newValue;
            if (checked) {
                onChooseContactNameColor();
                mChangeContactNameColor.setSummary(R.string.global_settings_registered_name_color_changed);
            } else {
                mChangeContactNameColor.setSummary(R.string.global_settings_registered_name_color_default);
            }
            mChangeContactNameColor.setChecked(checked);
            return false;
        }
    });
    mFixedWidth = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_FIXEDWIDTH);
    mFixedWidth.setChecked(K9.messageViewFixedWidthFont());
    mReturnToList = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST);
    mReturnToList.setChecked(K9.messageViewReturnToList());
    mShowNext = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_SHOW_NEXT);
    mShowNext.setChecked(K9.messageViewShowNext());
    mAutofitWidth = (CheckBoxPreference) findPreference(PREFERENCE_AUTOFIT_WIDTH);
    mAutofitWidth.setChecked(K9.autofitWidth());
    mQuietTimeEnabled = (CheckBoxPreference) findPreference(PREFERENCE_QUIET_TIME_ENABLED);
    mQuietTimeEnabled.setChecked(K9.getQuietTimeEnabled());
    mDisableNotificationDuringQuietTime = (CheckBoxPreference) findPreference(PREFERENCE_DISABLE_NOTIFICATION_DURING_QUIET_TIME);
    mDisableNotificationDuringQuietTime.setChecked(!K9.isNotificationDuringQuietTimeEnabled());
    mQuietTimeStarts = (TimePickerPreference) findPreference(PREFERENCE_QUIET_TIME_STARTS);
    mQuietTimeStarts.setDefaultValue(K9.getQuietTimeStarts());
    mQuietTimeStarts.setSummary(K9.getQuietTimeStarts());
    mQuietTimeStarts.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {

        public boolean onPreferenceChange(Preference preference, Object newValue) {
            final String time = (String) newValue;
            mQuietTimeStarts.setSummary(time);
            return false;
        }
    });
    mQuietTimeEnds = (TimePickerPreference) findPreference(PREFERENCE_QUIET_TIME_ENDS);
    mQuietTimeEnds.setSummary(K9.getQuietTimeEnds());
    mQuietTimeEnds.setDefaultValue(K9.getQuietTimeEnds());
    mQuietTimeEnds.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {

        public boolean onPreferenceChange(Preference preference, Object newValue) {
            final String time = (String) newValue;
            mQuietTimeEnds.setSummary(time);
            return false;
        }
    });
    mNotificationQuickDelete = setupListPreference(PREFERENCE_NOTIF_QUICK_DELETE, K9.getNotificationQuickDeleteBehaviour().toString());
    if (!NotificationController.platformSupportsExtendedNotifications()) {
        PreferenceScreen prefs = (PreferenceScreen) findPreference("notification_preferences");
        prefs.removePreference(mNotificationQuickDelete);
        mNotificationQuickDelete = null;
    }
    mLockScreenNotificationVisibility = setupListPreference(PREFERENCE_LOCK_SCREEN_NOTIFICATION_VISIBILITY, K9.getLockScreenNotificationVisibility().toString());
    if (!NotificationController.platformSupportsLockScreenNotifications()) {
        ((PreferenceScreen) findPreference("notification_preferences")).removePreference(mLockScreenNotificationVisibility);
        mLockScreenNotificationVisibility = null;
    }
    mBackgroundOps = setupListPreference(PREFERENCE_BACKGROUND_OPS, K9.getBackgroundOps().name());
    mDebugLogging = (CheckBoxPreference) findPreference(PREFERENCE_DEBUG_LOGGING);
    mSensitiveLogging = (CheckBoxPreference) findPreference(PREFERENCE_SENSITIVE_LOGGING);
    mHideUserAgent = (CheckBoxPreference) findPreference(PREFERENCE_HIDE_USERAGENT);
    mHideTimeZone = (CheckBoxPreference) findPreference(PREFERENCE_HIDE_TIMEZONE);
    mDebugLogging.setChecked(K9.isDebug());
    mSensitiveLogging.setChecked(K9.DEBUG_SENSITIVE);
    mHideUserAgent.setChecked(K9.hideUserAgent());
    mHideTimeZone.setChecked(K9.hideTimeZone());
    mOpenPgpProvider = (OpenPgpAppPreference) findPreference(PREFERENCE_OPENPGP_PROVIDER);
    mOpenPgpProvider.setValue(K9.getOpenPgpProvider());
    if (OpenPgpAppPreference.isApgInstalled(getApplicationContext())) {
        mOpenPgpProvider.addLegacyProvider(APG_PROVIDER_PLACEHOLDER, getString(R.string.apg), R.drawable.ic_apg_small);
    }
    mOpenPgpProvider.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {

        public boolean onPreferenceChange(Preference preference, Object newValue) {
            String value = newValue.toString();
            if (APG_PROVIDER_PLACEHOLDER.equals(value)) {
                mOpenPgpProvider.setValue("");
                showDialog(DIALOG_APG_DEPRECATION_WARNING);
            } else {
                mOpenPgpProvider.setValue(value);
            }
            return false;
        }
    });
    mOpenPgpSupportSignOnly = (CheckBoxPreference) findPreference(PREFERENCE_OPENPGP_SUPPORT_SIGN_ONLY);
    mOpenPgpSupportSignOnly.setChecked(K9.getOpenPgpSupportSignOnly());
    mAttachmentPathPreference = findPreference(PREFERENCE_ATTACHMENT_DEF_PATH);
    mAttachmentPathPreference.setSummary(K9.getAttachmentDefaultPath());
    mAttachmentPathPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            FileBrowserHelper.getInstance().showFileBrowserActivity(Prefs.this, new File(K9.getAttachmentDefaultPath()), ACTIVITY_CHOOSE_FOLDER, callback);
            return true;
        }

        FileBrowserFailOverCallback callback = new FileBrowserFailOverCallback() {

            @Override
            public void onPathEntered(String path) {
                mAttachmentPathPreference.setSummary(path);
                K9.setAttachmentDefaultPath(path);
            }

            @Override
            public void onCancel() {
            // canceled, do nothing
            }
        };
    });
    mWrapFolderNames = (CheckBoxPreference) findPreference(PREFERENCE_FOLDERLIST_WRAP_NAME);
    mWrapFolderNames.setChecked(K9.wrapFolderNames());
    mVisibleRefileActions = (CheckBoxListPreference) findPreference(PREFERENCE_MESSAGEVIEW_VISIBLE_REFILE_ACTIONS);
    CharSequence[] visibleRefileActionsEntries = new CharSequence[5];
    visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_DELETE] = getString(R.string.delete_action);
    visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_ARCHIVE] = getString(R.string.archive_action);
    visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_MOVE] = getString(R.string.move_action);
    visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_COPY] = getString(R.string.copy_action);
    visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_SPAM] = getString(R.string.spam_action);
    boolean[] visibleRefileActionsValues = new boolean[5];
    visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_DELETE] = K9.isMessageViewDeleteActionVisible();
    visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_ARCHIVE] = K9.isMessageViewArchiveActionVisible();
    visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_MOVE] = K9.isMessageViewMoveActionVisible();
    visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_COPY] = K9.isMessageViewCopyActionVisible();
    visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_SPAM] = K9.isMessageViewSpamActionVisible();
    mVisibleRefileActions.setItems(visibleRefileActionsEntries);
    mVisibleRefileActions.setCheckedItems(visibleRefileActionsValues);
    mSplitViewMode = (ListPreference) findPreference(PREFERENCE_SPLITVIEW_MODE);
    initListPreference(mSplitViewMode, K9.getSplitViewMode().name(), mSplitViewMode.getEntries(), mSplitViewMode.getEntryValues());
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) OnPreferenceClickListener(android.preference.Preference.OnPreferenceClickListener) OnPreferenceClickListener(android.preference.Preference.OnPreferenceClickListener) TimePickerPreference(com.fsck.k9.preferences.TimePickerPreference) CheckBoxPreference(android.preference.CheckBoxPreference) OpenPgpAppPreference(org.openintents.openpgp.util.OpenPgpAppPreference) CheckBoxListPreference(com.fsck.k9.preferences.CheckBoxListPreference) ListPreference(android.preference.ListPreference) Preference(android.preference.Preference) FileBrowserFailOverCallback(com.fsck.k9.helper.FileBrowserHelper.FileBrowserFailOverCallback) File(java.io.File)

Example 50 with K9

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

the class MessagingController method addErrorMessage.

void addErrorMessage(Account account, String subject, Throwable t) {
    try {
        if (t == null) {
            return;
        }
        CharArrayWriter baos = new CharArrayWriter(t.getStackTrace().length * 10);
        PrintWriter ps = new PrintWriter(baos);
        try {
            PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
            ps.format("K9-Mail version: %s\r\n", packageInfo.versionName);
        } catch (Exception e) {
        // ignore
        }
        ps.format("Device make: %s\r\n", Build.MANUFACTURER);
        ps.format("Device model: %s\r\n", Build.MODEL);
        ps.format("Android version: %s\r\n\r\n", Build.VERSION.RELEASE);
        t.printStackTrace(ps);
        ps.close();
        if (subject == null) {
            subject = getRootCauseMessage(t);
        }
        addErrorMessage(account, subject, baos.toString());
    } catch (Throwable it) {
        Timber.e(it, "Could not save error message to %s", account.getErrorFolderName());
    }
}
Also used : PackageInfo(android.content.pm.PackageInfo) CharArrayWriter(java.io.CharArrayWriter) CertificateValidationException(com.fsck.k9.mail.CertificateValidationException) UnavailableStorageException(com.fsck.k9.mailstore.UnavailableStorageException) IOException(java.io.IOException) MessagingException(com.fsck.k9.mail.MessagingException) AuthenticationFailedException(com.fsck.k9.mail.AuthenticationFailedException) PrintWriter(java.io.PrintWriter)

Aggregations

Account (com.fsck.k9.Account)20 MessagingException (com.fsck.k9.mail.MessagingException)13 IOException (java.io.IOException)11 ArrayList (java.util.ArrayList)11 MimeMessage (com.fsck.k9.mail.internet.MimeMessage)10 LocalStore (com.fsck.k9.mailstore.LocalStore)10 Message (com.fsck.k9.mail.Message)9 Store (com.fsck.k9.mail.Store)9 LocalFolder (com.fsck.k9.mailstore.LocalFolder)9 UnavailableStorageException (com.fsck.k9.mailstore.UnavailableStorageException)9 Intent (android.content.Intent)8 Pop3Store (com.fsck.k9.mail.store.pop3.Pop3Store)8 LocalMessage (com.fsck.k9.mailstore.LocalMessage)8 SuppressLint (android.annotation.SuppressLint)7 BaseAccount (com.fsck.k9.BaseAccount)7 Preferences (com.fsck.k9.Preferences)7 AuthenticationFailedException (com.fsck.k9.mail.AuthenticationFailedException)7 CertificateValidationException (com.fsck.k9.mail.CertificateValidationException)7 Folder (com.fsck.k9.mail.Folder)7 SearchAccount (com.fsck.k9.search.SearchAccount)7