From b0e4d9cdff26a122938fa7372bd8b24b0599ba7d Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Mon, 13 Dec 2010 00:33:00 +0000 Subject: [PATCH] Try calculating content preview from HTML part if text part is unsuccessful on appendMessages. --- src/com/fsck/k9/mail/store/LocalStore.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 23dfcfff4..de04f2ab1 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -2951,6 +2951,11 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati String text = sbText.toString(); String html = markupContent(text, sbHtml.toString()); String preview = calculateContentPreview(text); + // If we couldn't generate a reasonable preview from the text part, try doing it with the HTML part. + if (preview == null || preview.length() == 0) + { + preview = calculateContentPreview(Html.fromHtml(html).toString()); + } try { @@ -3074,6 +3079,7 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati String text = sbText.toString(); String html = markupContent(text, sbHtml.toString()); String preview = calculateContentPreview(text); + // If we couldn't generate a reasonable preview from the text part, try doing it with the HTML part. if (preview == null || preview.length() == 0) { preview = calculateContentPreview(Html.fromHtml(html).toString()); @@ -3204,7 +3210,7 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati /** * @param messageId * @param attachment - * @param attachmentId -1 to create a new attachment or >= 0 to update an existing + * @param saveAsNew * @throws IOException * @throws MessagingException */