mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
configured so setting message format to auto does not break k-9 if it is downgraded.
This commit is contained in:
parent
9201d16659
commit
994f474aae
@ -60,6 +60,7 @@ public class Account implements BaseAccount {
|
||||
private static final String[] networkTypes = { TYPE_WIFI, TYPE_MOBILE, TYPE_OTHER };
|
||||
|
||||
public static final MessageFormat DEFAULT_MESSAGE_FORMAT = MessageFormat.HTML;
|
||||
public static final boolean DEFAULT_AUTO_MESSAGE_FORMAT = false;
|
||||
public static final boolean DEFAULT_MESSAGE_READ_RECEIPT = false;
|
||||
public static final QuoteStyle DEFAULT_QUOTE_STYLE = QuoteStyle.PREFIX;
|
||||
public static final String DEFAULT_QUOTE_PREFIX = ">";
|
||||
@ -137,6 +138,7 @@ public class Account implements BaseAccount {
|
||||
// current set of fetched messages
|
||||
private boolean mRingNotified;
|
||||
private MessageFormat mMessageFormat;
|
||||
private boolean mAutoMessageFormat;
|
||||
private boolean mMessageReadReceipt;
|
||||
private QuoteStyle mQuoteStyle;
|
||||
private String mQuotePrefix;
|
||||
@ -226,6 +228,7 @@ public class Account implements BaseAccount {
|
||||
maximumPolledMessageAge = -1;
|
||||
maximumAutoDownloadMessageSize = 32768;
|
||||
mMessageFormat = DEFAULT_MESSAGE_FORMAT;
|
||||
mAutoMessageFormat = DEFAULT_AUTO_MESSAGE_FORMAT;
|
||||
mMessageReadReceipt = DEFAULT_MESSAGE_READ_RECEIPT;
|
||||
mQuoteStyle = DEFAULT_QUOTE_STYLE;
|
||||
mQuotePrefix = DEFAULT_QUOTE_PREFIX;
|
||||
@ -302,6 +305,10 @@ public class Account implements BaseAccount {
|
||||
maximumPolledMessageAge = prefs.getInt(mUuid + ".maximumPolledMessageAge", -1);
|
||||
maximumAutoDownloadMessageSize = prefs.getInt(mUuid + ".maximumAutoDownloadMessageSize", 32768);
|
||||
mMessageFormat = MessageFormat.valueOf(prefs.getString(mUuid + ".messageFormat", DEFAULT_MESSAGE_FORMAT.name()));
|
||||
mAutoMessageFormat = prefs.getBoolean(mUuid + ".autoMessageFormat", DEFAULT_AUTO_MESSAGE_FORMAT);
|
||||
if (mAutoMessageFormat && mMessageFormat == MessageFormat.TEXT) {
|
||||
mMessageFormat = MessageFormat.AUTO;
|
||||
}
|
||||
mMessageReadReceipt = prefs.getBoolean(mUuid + ".messageReadReceipt", DEFAULT_MESSAGE_READ_RECEIPT);
|
||||
mQuoteStyle = QuoteStyle.valueOf(prefs.getString(mUuid + ".quoteStyle", DEFAULT_QUOTE_STYLE.name()));
|
||||
mQuotePrefix = prefs.getString(mUuid + ".quotePrefix", DEFAULT_QUOTE_PREFIX);
|
||||
@ -461,6 +468,7 @@ public class Account implements BaseAccount {
|
||||
editor.remove(mUuid + ".subscribedFoldersOnly");
|
||||
editor.remove(mUuid + ".maximumPolledMessageAge");
|
||||
editor.remove(mUuid + ".maximumAutoDownloadMessageSize");
|
||||
editor.remove(mUuid + ".autoMessageFormat");
|
||||
editor.remove(mUuid + ".quoteStyle");
|
||||
editor.remove(mUuid + ".quotePrefix");
|
||||
editor.remove(mUuid + ".showPicturesEnum");
|
||||
@ -612,7 +620,16 @@ public class Account implements BaseAccount {
|
||||
editor.putBoolean(mUuid + ".subscribedFoldersOnly", subscribedFoldersOnly);
|
||||
editor.putInt(mUuid + ".maximumPolledMessageAge", maximumPolledMessageAge);
|
||||
editor.putInt(mUuid + ".maximumAutoDownloadMessageSize", maximumAutoDownloadMessageSize);
|
||||
if (MessageFormat.AUTO.equals(mMessageFormat)) {
|
||||
// saving MessageFormat.AUTO as is to the database will cause downgrades to crash on
|
||||
// startup, so we save as MessageFormat.TEXT instead with a separate flag for auto.
|
||||
editor.putString(mUuid + ".messageFormat", Account.MessageFormat.TEXT.name());
|
||||
mAutoMessageFormat = true;
|
||||
} else {
|
||||
editor.putString(mUuid + ".messageFormat", mMessageFormat.name());
|
||||
mAutoMessageFormat = false;
|
||||
}
|
||||
editor.putBoolean(mUuid + ".autoMessageFormat", mAutoMessageFormat);
|
||||
editor.putBoolean(mUuid + ".messageReadReceipt", mMessageReadReceipt);
|
||||
editor.putString(mUuid + ".quoteStyle", mQuoteStyle.name());
|
||||
editor.putString(mUuid + ".quotePrefix", mQuotePrefix);
|
||||
|
@ -858,7 +858,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
mBccWrapper.setVisibility(savedInstanceState
|
||||
.getBoolean(STATE_KEY_BCC_SHOWN) ? View.VISIBLE : View.GONE);
|
||||
showOrHideQuotedText((QuotedTextMode)savedInstanceState.getSerializable(STATE_KEY_QUOTED_TEXT_MODE));
|
||||
|
||||
if (mQuotedTextMode != QuotedTextMode.NONE && mMessageFormat == MessageFormat.HTML) {
|
||||
mQuotedHtmlContent = (InsertableHtmlContent) savedInstanceState.getSerializable(STATE_KEY_HTML_QUOTE);
|
||||
if (mQuotedHtmlContent != null && mQuotedHtmlContent.getQuotedContent() != null) {
|
||||
|
@ -55,6 +55,7 @@ public class AccountSettings {
|
||||
R.array.account_settings_message_age_values));
|
||||
s.put("messageFormat",
|
||||
new EnumSetting(Account.MessageFormat.class, Account.DEFAULT_MESSAGE_FORMAT));
|
||||
//s.put("autoMessageFormat", new BooleanSetting(Account.DEFAULT_AUTO_MESSAGE_FORMAT)); // added to version 2
|
||||
s.put("messageReadReceipt", new BooleanSetting(Account.DEFAULT_MESSAGE_READ_RECEIPT));
|
||||
s.put("notificationUnreadCount", new BooleanSetting(true));
|
||||
s.put("notifyMailCheck", new BooleanSetting(false));
|
||||
|
Loading…
Reference in New Issue
Block a user