Added option to specify the message quote prefix character/string (default ">"). Applied patch provided by fiouzy (Thanks!) with some small modifications.
Fixes issue 1830
This commit is contained in:
parent
7f625b5ef4
commit
648e3bd829
5 changed files with 49 additions and 2 deletions
|
@ -491,6 +491,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
|||
<string name="account_settings_folders">Folders</string>
|
||||
<string name="account_settings_message_lists">Listing messages</string>
|
||||
<string name="account_settings_message_view">Viewing messages</string>
|
||||
<string name="account_settings_quote_prefix_label">Quote prefix</string>
|
||||
|
||||
<string name="account_settings_mail_check_frequency_label">Folder poll check frequency</string>
|
||||
<string name="account_settings_second_class_check_frequency_label">2nd class check frequency</string>
|
||||
|
|
|
@ -171,6 +171,13 @@
|
|||
|
||||
/>
|
||||
|
||||
<EditTextPreference
|
||||
android:key="account_quote_prefix"
|
||||
android:singleLine="true"
|
||||
android:title="@string/account_settings_quote_prefix_label"
|
||||
android:summary=""
|
||||
android:dialogTitle="@string/account_settings_quote_prefix_label" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/account_settings_notifications">
|
||||
|
|
|
@ -44,6 +44,7 @@ public class Account implements BaseAccount
|
|||
public static final String TYPE_OTHER = "OTHER";
|
||||
private static String[] networkTypes = { TYPE_WIFI, TYPE_MOBILE, TYPE_OTHER };
|
||||
|
||||
private static final String DEFAULT_QUOTE_PREFIX = ">";
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
|
@ -97,6 +98,7 @@ public class Account implements BaseAccount
|
|||
// Tracks if we have sent a notification for this account for
|
||||
// current set of fetched messages
|
||||
private boolean mRingNotified;
|
||||
private String mQuotePrefix;
|
||||
|
||||
private List<Identity> identities;
|
||||
|
||||
|
@ -146,6 +148,7 @@ public class Account implements BaseAccount
|
|||
goToUnreadMessageSearch = false;
|
||||
subscribedFoldersOnly = false;
|
||||
maximumPolledMessageAge = 10;
|
||||
mQuotePrefix = DEFAULT_QUOTE_PREFIX;
|
||||
|
||||
searchableFolders = Searchable.ALL;
|
||||
|
||||
|
@ -215,6 +218,7 @@ public class Account implements BaseAccount
|
|||
false);
|
||||
maximumPolledMessageAge = preferences.getPreferences().getInt(mUuid
|
||||
+ ".maximumPolledMessageAge", -1);
|
||||
mQuotePrefix = preferences.getPreferences().getString(mUuid + ".quotePrefix", DEFAULT_QUOTE_PREFIX);
|
||||
for (String type : networkTypes)
|
||||
{
|
||||
Boolean useCompression = preferences.getPreferences().getBoolean(mUuid + ".useCompression." + type,
|
||||
|
@ -386,6 +390,7 @@ public class Account implements BaseAccount
|
|||
editor.remove(mUuid + ".goToUnreadMessageSearch");
|
||||
editor.remove(mUuid + ".subscribedFoldersOnly");
|
||||
editor.remove(mUuid + ".maximumPolledMessageAge");
|
||||
editor.remove(mUuid + ".quotePrefix");
|
||||
for (String type : networkTypes)
|
||||
{
|
||||
editor.remove(mUuid + ".useCompression." + type);
|
||||
|
@ -471,6 +476,7 @@ public class Account implements BaseAccount
|
|||
editor.putBoolean(mUuid + ".goToUnreadMessageSearch", goToUnreadMessageSearch);
|
||||
editor.putBoolean(mUuid + ".subscribedFoldersOnly", subscribedFoldersOnly);
|
||||
editor.putInt(mUuid + ".maximumPolledMessageAge", maximumPolledMessageAge);
|
||||
editor.putString(mUuid + ".quotePrefix", mQuotePrefix);
|
||||
|
||||
for (String type : networkTypes)
|
||||
{
|
||||
|
@ -1242,6 +1248,7 @@ public class Account implements BaseAccount
|
|||
{
|
||||
this.maximumPolledMessageAge = maximumPolledMessageAge;
|
||||
}
|
||||
|
||||
public Date getEarliestPollDate()
|
||||
{
|
||||
int age = getMaximumPolledMessageAge();
|
||||
|
@ -1282,4 +1289,14 @@ public class Account implements BaseAccount
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getQuotePrefix()
|
||||
{
|
||||
return mQuotePrefix;
|
||||
}
|
||||
|
||||
public void setQuotePrefix(String quotePrefix)
|
||||
{
|
||||
mQuotePrefix = quotePrefix;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1343,7 +1343,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||
getString(R.string.message_compose_reply_header_fmt),
|
||||
Address.toString(mSourceMessage.getFrom()));
|
||||
|
||||
quotedText += MimeUtility.getTextFromPart(part).replaceAll("(?m)^", ">");
|
||||
final String prefix = mAccount.getQuotePrefix();
|
||||
// "$" and "\" in the quote prefix have to be escaped for
|
||||
// the replaceAll() invocation.
|
||||
final String escapedPrefix = prefix.replaceAll("(\\\\|\\$)", "\\\\$1");
|
||||
quotedText += MimeUtility.getTextFromPart(part).replaceAll(
|
||||
"(?m)^", escapedPrefix);
|
||||
|
||||
quotedText = quotedText.replaceAll("\\\r", "");
|
||||
mQuotedText.setText(quotedText);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class AccountSettings extends K9PreferenceActivity
|
|||
private static final String PREFERENCE_LED_COLOR = "led_color";
|
||||
private static final String PREFERENCE_NOTIFICATION_OPENS_UNREAD = "notification_opens_unread";
|
||||
private static final String PREFERENCE_MESSAGE_AGE = "account_message_age";
|
||||
|
||||
private static final String PREFERENCE_QUOTE_PREFIX = "account_quote_prefix";
|
||||
|
||||
|
||||
private Account mAccount;
|
||||
|
@ -81,6 +81,7 @@ public class AccountSettings extends K9PreferenceActivity
|
|||
private Preference mLedColor;
|
||||
private boolean mIncomingChanged = false;
|
||||
private CheckBoxPreference mNotificationOpensUnread;
|
||||
private EditTextPreference mAccountQuotePrefix;
|
||||
|
||||
|
||||
public static void actionSettings(Context context, Account account)
|
||||
|
@ -131,6 +132,20 @@ public class AccountSettings extends K9PreferenceActivity
|
|||
}
|
||||
});
|
||||
|
||||
mAccountQuotePrefix = (EditTextPreference) findPreference(PREFERENCE_QUOTE_PREFIX);
|
||||
mAccountQuotePrefix.setSummary(mAccount.getQuotePrefix());
|
||||
mAccountQuotePrefix.setText(mAccount.getQuotePrefix());
|
||||
mAccountQuotePrefix.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
||||
{
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue)
|
||||
{
|
||||
final String value = newValue.toString();
|
||||
mAccountQuotePrefix.setSummary(value);
|
||||
mAccountQuotePrefix.setText(value);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mCheckFrequency = (ListPreference) findPreference(PREFERENCE_FREQUENCY);
|
||||
mCheckFrequency.setValue(String.valueOf(mAccount.getAutomaticCheckIntervalMinutes()));
|
||||
|
@ -441,6 +456,7 @@ public class AccountSettings extends K9PreferenceActivity
|
|||
mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue()));
|
||||
mAccount.setExpungePolicy(mExpungePolicy.getValue());
|
||||
mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue()));
|
||||
mAccount.setQuotePrefix(mAccountQuotePrefix.getText());
|
||||
|
||||
boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
|
||||
needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));
|
||||
|
|
Loading…
Reference in a new issue