1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Add more comments about LocalTextBody.

Display decrypted PGP data as text/plain (content type was being set, but not being passed to WebViews).
This commit is contained in:
Andrew Chen 2010-12-29 07:34:57 +00:00
parent b85f0b64c0
commit 605a0bdc93
2 changed files with 17 additions and 8 deletions

View File

@ -1978,8 +1978,7 @@ public class MessageView extends K9Activity implements OnClickListener
}
MessageView.this.mMessage = message;
mHandler.removeAllAttachments();
String text;
String type = "text/html";
String text, type;
if (mPgpData.getDecryptedData() != null)
{
text = mPgpData.getDecryptedData();
@ -1987,11 +1986,14 @@ public class MessageView extends K9Activity implements OnClickListener
}
else
{
// getTextForDisplay() always returns HTML-ified content.
text = ((LocalMessage)mMessage).getTextForDisplay();
type = "text/html";
}
if (text != null)
{
final String emailText = text;
final String contentType = type;
mHandler.post(new Runnable()
{
public void run()
@ -2000,12 +2002,12 @@ public class MessageView extends K9Activity implements OnClickListener
if (mScreenReaderEnabled)
{
mAccessibleMessageContentView.loadDataWithBaseURL("http://",
emailText, "text/html", "utf-8", null);
emailText, contentType, "utf-8", null);
}
else
{
mMessageContentView.loadDataWithBaseURL("http://", emailText,
"text/html", "utf-8", null);
contentType, "utf-8", null);
mMessageContentView.scrollTo(0, 0);
}
updateDecryptLayout();

View File

@ -5305,6 +5305,9 @@ public class LocalStore extends Store implements Serializable
public static class LocalTextBody extends TextBody
{
/**
* This is an HTML-ified version of the message for display purposes.
*/
private String mBodyForDisplay;
public LocalTextBody(String body)
@ -5412,11 +5415,15 @@ public class LocalStore extends Store implements Serializable
}
}
public String getTextForDisplay() throws MessagingException
/**
* Fetch the message text for display. This always returns an HTML-ified version of the
* message, even if it was originally a text-only message.
* @return HTML version of message for display purposes.
* @throws MessagingException
*/
public String getTextForDisplay() throws MessagingException
{
String text;// First try and fetch an HTML part.
String text; // First try and fetch an HTML part.
Part part = MimeUtility.findFirstPartByMimeType(this, "text/html");
if (part == null)
{