1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

when quoting an html body part for forwarding, downrez it to plain text.

In the glorious future, we should be forwarding as an attachment. but
this is better than the previous behaviour
This commit is contained in:
Jesse Vincent 2010-10-05 06:04:16 +00:00
parent ae53a0c5ff
commit 58bb54a588

View File

@ -26,6 +26,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import android.provider.OpenableColumns;
import android.text.Html;
import android.text.TextWatcher;
import android.text.util.Rfc822Tokenizer;
import android.util.Log;
@ -1861,18 +1862,31 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
{
mSubjectView.setText(message.getSubject());
}
Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
if (part == null)
String quotedText = null;
Part part = null;
if ( mSourceMessageBody != null)
{
part = MimeUtility.findFirstPartByMimeType(message, "text/html");
quotedText = mSourceMessageBody;
}
if (part != null || mSourceMessageBody != null)
if (quotedText == null)
{
String quotedText = mSourceMessageBody;
if (quotedText == null)
{
part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
if (part != null) {
quotedText = MimeUtility.getTextFromPart(part);
}
}
if (quotedText == null)
{
part = MimeUtility.findFirstPartByMimeType(message, "text/html");
if (part != null) {
quotedText = (Html.fromHtml(MimeUtility.getTextFromPart(part))).toString();
}
}
if (quotedText != null)
{
String text = String.format(
@ -1883,12 +1897,14 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
mSourceMessage.getRecipients(RecipientType.TO)),
Address.toString(
mSourceMessage.getRecipients(RecipientType.CC)));
if (quotedText != null) {
quotedText = quotedText.replaceAll("\\\r", "");
text += quotedText;
mQuotedText.setText(text);
mQuotedText.append(quotedText);
}
mQuotedTextBar.setVisibility(View.VISIBLE);
mQuotedText.setVisibility(View.VISIBLE);
}
}
if (!mSourceMessageProcessed)
{