1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 09:08:49 -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; MessageView.this.mMessage = message;
mHandler.removeAllAttachments(); mHandler.removeAllAttachments();
String text; String text, type;
String type = "text/html";
if (mPgpData.getDecryptedData() != null) if (mPgpData.getDecryptedData() != null)
{ {
text = mPgpData.getDecryptedData(); text = mPgpData.getDecryptedData();
@ -1987,11 +1986,14 @@ public class MessageView extends K9Activity implements OnClickListener
} }
else else
{ {
// getTextForDisplay() always returns HTML-ified content.
text = ((LocalMessage)mMessage).getTextForDisplay(); text = ((LocalMessage)mMessage).getTextForDisplay();
type = "text/html";
} }
if (text != null) if (text != null)
{ {
final String emailText = text; final String emailText = text;
final String contentType = type;
mHandler.post(new Runnable() mHandler.post(new Runnable()
{ {
public void run() public void run()
@ -2000,12 +2002,12 @@ public class MessageView extends K9Activity implements OnClickListener
if (mScreenReaderEnabled) if (mScreenReaderEnabled)
{ {
mAccessibleMessageContentView.loadDataWithBaseURL("http://", mAccessibleMessageContentView.loadDataWithBaseURL("http://",
emailText, "text/html", "utf-8", null); emailText, contentType, "utf-8", null);
} }
else else
{ {
mMessageContentView.loadDataWithBaseURL("http://", emailText, mMessageContentView.loadDataWithBaseURL("http://", emailText,
"text/html", "utf-8", null); contentType, "utf-8", null);
mMessageContentView.scrollTo(0, 0); mMessageContentView.scrollTo(0, 0);
} }
updateDecryptLayout(); updateDecryptLayout();

View File

@ -5305,6 +5305,9 @@ public class LocalStore extends Store implements Serializable
public static class LocalTextBody extends TextBody public static class LocalTextBody extends TextBody
{ {
/**
* This is an HTML-ified version of the message for display purposes.
*/
private String mBodyForDisplay; private String mBodyForDisplay;
public LocalTextBody(String body) public LocalTextBody(String body)
@ -5412,8 +5415,12 @@ public class LocalStore extends Store implements Serializable
} }
} }
/**
* 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 public String getTextForDisplay() throws MessagingException
{ {
String text; // First try and fetch an HTML part. String text; // First try and fetch an HTML part.