mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-17 07:30:16 -05:00
add MessageFormat.AUTO so that text/html messages are created only when necessary.
This commit is contained in:
parent
b3bfcbde15
commit
9201d16659
@ -677,11 +677,13 @@
|
|||||||
<string-array name="account_settings_message_format_entries">
|
<string-array name="account_settings_message_format_entries">
|
||||||
<item>@string/account_settings_message_format_text</item>
|
<item>@string/account_settings_message_format_text</item>
|
||||||
<item>@string/account_settings_message_format_html</item>
|
<item>@string/account_settings_message_format_html</item>
|
||||||
|
<item>@string/account_settings_message_format_auto</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="account_settings_message_format_values">
|
<string-array name="account_settings_message_format_values">
|
||||||
<item>TEXT</item>
|
<item>TEXT</item>
|
||||||
<item>HTML</item>
|
<item>HTML</item>
|
||||||
|
<item>AUTO</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -568,6 +568,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
|||||||
<string name="account_settings_message_format_label">Message Format</string>
|
<string name="account_settings_message_format_label">Message Format</string>
|
||||||
<string name="account_settings_message_format_text">Plain Text (images and formatting will be removed)</string>
|
<string name="account_settings_message_format_text">Plain Text (images and formatting will be removed)</string>
|
||||||
<string name="account_settings_message_format_html">HTML (images and formatting are preserved)</string>
|
<string name="account_settings_message_format_html">HTML (images and formatting are preserved)</string>
|
||||||
|
<string name="account_settings_message_format_auto">Automatic (plain text unless replying to an html message)</string>
|
||||||
|
|
||||||
<string name="account_settings_message_read_receipt_label">Read receipt</string>
|
<string name="account_settings_message_read_receipt_label">Read receipt</string>
|
||||||
<string name="account_settings_message_read_receipt_summary">Always request a read receipt</string>
|
<string name="account_settings_message_read_receipt_summary">Always request a read receipt</string>
|
||||||
|
@ -191,7 +191,7 @@ public class Account implements BaseAccount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum MessageFormat {
|
public enum MessageFormat {
|
||||||
TEXT, HTML
|
TEXT, HTML, AUTO
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Account(Context context) {
|
protected Account(Context context) {
|
||||||
|
@ -75,6 +75,7 @@ import com.fsck.k9.mail.store.LocalStore.LocalAttachmentBody;
|
|||||||
public class MessageCompose extends K9Activity implements OnClickListener, OnFocusChangeListener {
|
public class MessageCompose extends K9Activity implements OnClickListener, OnFocusChangeListener {
|
||||||
private static final int DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE = 1;
|
private static final int DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE = 1;
|
||||||
|
|
||||||
|
private static final String ACTION_COMPOSE = "com.fsck.k9.intent.action.COMPOSE";
|
||||||
private static final String ACTION_REPLY = "com.fsck.k9.intent.action.REPLY";
|
private static final String ACTION_REPLY = "com.fsck.k9.intent.action.REPLY";
|
||||||
private static final String ACTION_REPLY_ALL = "com.fsck.k9.intent.action.REPLY_ALL";
|
private static final String ACTION_REPLY_ALL = "com.fsck.k9.intent.action.REPLY_ALL";
|
||||||
private static final String ACTION_FORWARD = "com.fsck.k9.intent.action.FORWARD";
|
private static final String ACTION_FORWARD = "com.fsck.k9.intent.action.FORWARD";
|
||||||
@ -280,6 +281,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
Intent i = new Intent(context, MessageCompose.class);
|
Intent i = new Intent(context, MessageCompose.class);
|
||||||
i.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
i.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
||||||
|
i.setAction(ACTION_COMPOSE);
|
||||||
context.startActivity(i);
|
context.startActivity(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,6 +535,16 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
|
|
||||||
mMessageFormat = mAccount.getMessageFormat();
|
mMessageFormat = mAccount.getMessageFormat();
|
||||||
|
if (mMessageFormat == MessageFormat.AUTO) {
|
||||||
|
if (ACTION_COMPOSE.equals(action)) {
|
||||||
|
mMessageFormat = MessageFormat.TEXT;
|
||||||
|
} else if (mSourceMessageBody != null) {
|
||||||
|
// mSourceMessageBody is set to something when replying to and forwarding decrypted
|
||||||
|
// messages, so we set the format to plain text.
|
||||||
|
mMessageFormat = MessageFormat.TEXT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mReadReceipt = mAccount.isMessageReadReceiptAlways();
|
mReadReceipt = mAccount.isMessageReadReceiptAlways();
|
||||||
|
|
||||||
if (!mSourceMessageProcessed) {
|
if (!mSourceMessageProcessed) {
|
||||||
@ -2243,6 +2255,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
private void populateUIWithQuotedMessage(boolean shown) throws MessagingException {
|
private void populateUIWithQuotedMessage(boolean shown) throws MessagingException {
|
||||||
|
if (mMessageFormat == MessageFormat.AUTO) {
|
||||||
|
mMessageFormat = MimeUtility.findFirstPartByMimeType(mSourceMessage, "text/html") == null
|
||||||
|
? MessageFormat.TEXT
|
||||||
|
: MessageFormat.HTML;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO -- I am assuming that mSourceMessageBody will always be a text part. Is this a safe assumption?
|
// TODO -- I am assuming that mSourceMessageBody will always be a text part. Is this a safe assumption?
|
||||||
|
|
||||||
// Handle the original message in the reply
|
// Handle the original message in the reply
|
||||||
|
Loading…
Reference in New Issue
Block a user