mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
Merge pull request #437 from zjw/misc_clean_up
This commit is contained in:
commit
4955e34886
2
.gitignore
vendored
2
.gitignore
vendored
@ -22,3 +22,5 @@ target
|
||||
build
|
||||
.gradle
|
||||
out
|
||||
build.xml
|
||||
proguard-project.txt
|
||||
|
@ -1,23 +0,0 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked in Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
||||
# Indicates whether an apk should be generated for each density.
|
||||
split.density=false
|
||||
java.encoding=utf8
|
||||
# Project target.
|
||||
target=android-17
|
||||
extensible.libs.classpath=compile-only-libs
|
@ -264,6 +264,7 @@ Please submit bug reports, contribute new features and ask questions at
|
||||
<string name="message_compose_quote_header_to">To:</string>
|
||||
<string name="message_compose_quote_header_cc">Cc:</string>
|
||||
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> wrote:</string>
|
||||
<string name="message_compose_reply_header_fmt_with_date">On <xliff:g id="sent_date">%1$s</xliff:g>, <xliff:g id="sender">%2$s</xliff:g> wrote:</string>
|
||||
<string name="message_compose_error_no_recipients">You must add at least one recipient.</string>
|
||||
<string name="error_contact_address_not_found">No email address could be found for this contact.</string>
|
||||
<string name="message_compose_attachments_skipped_toast">Some attachments cannot be forwarded because they have not been downloaded.</string>
|
||||
|
@ -529,7 +529,6 @@ public class Account implements BaseAccount {
|
||||
}
|
||||
|
||||
editor.remove(mUuid + ".storeUri");
|
||||
editor.remove(mUuid + ".localStoreUri");
|
||||
editor.remove(mUuid + ".transportUri");
|
||||
editor.remove(mUuid + ".description");
|
||||
editor.remove(mUuid + ".name");
|
||||
@ -555,12 +554,10 @@ public class Account implements BaseAccount {
|
||||
editor.remove(mUuid + ".vibrateTimes");
|
||||
editor.remove(mUuid + ".ring");
|
||||
editor.remove(mUuid + ".ringtone");
|
||||
editor.remove(mUuid + ".lastFullSync");
|
||||
editor.remove(mUuid + ".folderDisplayMode");
|
||||
editor.remove(mUuid + ".folderSyncMode");
|
||||
editor.remove(mUuid + ".folderPushMode");
|
||||
editor.remove(mUuid + ".folderTargetMode");
|
||||
editor.remove(mUuid + ".hideButtonsEnum");
|
||||
editor.remove(mUuid + ".signatureBeforeQuotedText");
|
||||
editor.remove(mUuid + ".expungePolicy");
|
||||
editor.remove(mUuid + ".syncRemoteDeletions");
|
||||
@ -586,13 +583,24 @@ public class Account implements BaseAccount {
|
||||
editor.remove(mUuid + ".cryptoAutoSignature");
|
||||
editor.remove(mUuid + ".cryptoAutoEncrypt");
|
||||
editor.remove(mUuid + ".enabled");
|
||||
editor.remove(mUuid + ".hideMoveButtonsEnum");
|
||||
editor.remove(mUuid + ".markMessageAsReadOnView");
|
||||
editor.remove(mUuid + ".alwaysShowCcBcc");
|
||||
editor.remove(mUuid + ".allowRemoteSearch");
|
||||
editor.remove(mUuid + ".remoteSearchFullText");
|
||||
editor.remove(mUuid + ".remoteSearchNumResults");
|
||||
editor.remove(mUuid + ".defaultQuotedTextShown");
|
||||
editor.remove(mUuid + ".displayCount");
|
||||
editor.remove(mUuid + ".inboxFolderName");
|
||||
editor.remove(mUuid + ".localStorageProvider");
|
||||
editor.remove(mUuid + ".messageFormat");
|
||||
editor.remove(mUuid + ".messageReadReceipt");
|
||||
editor.remove(mUuid + ".notifyMailCheck");
|
||||
for (String type : networkTypes) {
|
||||
editor.remove(mUuid + ".useCompression." + type);
|
||||
}
|
||||
deleteIdentities(preferences.getPreferences(), editor);
|
||||
// TODO: Remove preference settings that may exist for individual
|
||||
// folders in the account.
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,8 @@ import org.htmlcleaner.CleanerProperties;
|
||||
import org.htmlcleaner.HtmlCleaner;
|
||||
import org.htmlcleaner.SimpleHtmlSerializer;
|
||||
import org.htmlcleaner.TagNode;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@ -3703,12 +3705,20 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
*/
|
||||
private String quoteOriginalTextMessage(final Message originalMessage, final String messageBody, final QuoteStyle quoteStyle) throws MessagingException {
|
||||
String body = messageBody == null ? "" : messageBody;
|
||||
String sentDate = getSentDateText(originalMessage);
|
||||
if (quoteStyle == QuoteStyle.PREFIX) {
|
||||
StringBuilder quotedText = new StringBuilder(body.length() + QUOTE_BUFFER_LENGTH);
|
||||
quotedText.append(String.format(
|
||||
getString(R.string.message_compose_reply_header_fmt) + "\r\n",
|
||||
Address.toString(originalMessage.getFrom()))
|
||||
);
|
||||
if (sentDate.length() != 0) {
|
||||
quotedText.append(String.format(
|
||||
getString(R.string.message_compose_reply_header_fmt_with_date) + "\r\n",
|
||||
sentDate,
|
||||
Address.toString(originalMessage.getFrom())));
|
||||
} else {
|
||||
quotedText.append(String.format(
|
||||
getString(R.string.message_compose_reply_header_fmt) + "\r\n",
|
||||
Address.toString(originalMessage.getFrom()))
|
||||
);
|
||||
}
|
||||
|
||||
final String prefix = mAccount.getQuotePrefix();
|
||||
final String wrappedText = Utility.wrap(body, REPLY_WRAP_LINE_WIDTH - prefix.length());
|
||||
@ -3726,8 +3736,8 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
if (originalMessage.getFrom() != null && Address.toString(originalMessage.getFrom()).length() != 0) {
|
||||
quotedText.append(getString(R.string.message_compose_quote_header_from)).append(" ").append(Address.toString(originalMessage.getFrom())).append("\r\n");
|
||||
}
|
||||
if (originalMessage.getSentDate() != null) {
|
||||
quotedText.append(getString(R.string.message_compose_quote_header_send_date)).append(" ").append(originalMessage.getSentDate()).append("\r\n");
|
||||
if (sentDate.length() != 0) {
|
||||
quotedText.append(getString(R.string.message_compose_quote_header_send_date)).append(" ").append(sentDate).append("\r\n");
|
||||
}
|
||||
if (originalMessage.getRecipients(RecipientType.TO) != null && originalMessage.getRecipients(RecipientType.TO).length != 0) {
|
||||
quotedText.append(getString(R.string.message_compose_quote_header_to)).append(" ").append(Address.toString(originalMessage.getRecipients(RecipientType.TO))).append("\r\n");
|
||||
@ -3760,13 +3770,22 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
private InsertableHtmlContent quoteOriginalHtmlMessage(final Message originalMessage, final String messageBody, final QuoteStyle quoteStyle) throws MessagingException {
|
||||
InsertableHtmlContent insertable = findInsertionPoints(messageBody);
|
||||
|
||||
String sentDate = getSentDateText(originalMessage);
|
||||
if (quoteStyle == QuoteStyle.PREFIX) {
|
||||
StringBuilder header = new StringBuilder(QUOTE_BUFFER_LENGTH);
|
||||
header.append("<div class=\"gmail_quote\">");
|
||||
header.append(HtmlConverter.textToHtmlFragment(String.format(
|
||||
getString(R.string.message_compose_reply_header_fmt),
|
||||
Address.toString(originalMessage.getFrom()))
|
||||
));
|
||||
if (sentDate.length() != 0) {
|
||||
header.append(HtmlConverter.textToHtmlFragment(String.format(
|
||||
getString(R.string.message_compose_reply_header_fmt_with_date),
|
||||
sentDate,
|
||||
Address.toString(originalMessage.getFrom()))
|
||||
));
|
||||
} else {
|
||||
header.append(HtmlConverter.textToHtmlFragment(String.format(
|
||||
getString(R.string.message_compose_reply_header_fmt),
|
||||
Address.toString(originalMessage.getFrom()))
|
||||
));
|
||||
}
|
||||
header.append("<blockquote class=\"gmail_quote\" " +
|
||||
"style=\"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;\">\r\n");
|
||||
|
||||
@ -3779,29 +3798,29 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
StringBuilder header = new StringBuilder();
|
||||
header.append("<div style='font-size:10.0pt;font-family:\"Tahoma\",\"sans-serif\";padding:3.0pt 0in 0in 0in'>\r\n");
|
||||
header.append("<hr style='border:none;border-top:solid #E1E1E1 1.0pt'>\r\n"); // This gets converted into a horizontal line during html to text conversion.
|
||||
if (mSourceMessage.getFrom() != null && Address.toString(mSourceMessage.getFrom()).length() != 0) {
|
||||
if (originalMessage.getFrom() != null && Address.toString(originalMessage.getFrom()).length() != 0) {
|
||||
header.append("<b>").append(getString(R.string.message_compose_quote_header_from)).append("</b> ")
|
||||
.append(HtmlConverter.textToHtmlFragment(Address.toString(mSourceMessage.getFrom())))
|
||||
.append(HtmlConverter.textToHtmlFragment(Address.toString(originalMessage.getFrom())))
|
||||
.append("<br>\r\n");
|
||||
}
|
||||
if (mSourceMessage.getSentDate() != null) {
|
||||
if (sentDate.length() != 0) {
|
||||
header.append("<b>").append(getString(R.string.message_compose_quote_header_send_date)).append("</b> ")
|
||||
.append(mSourceMessage.getSentDate())
|
||||
.append(sentDate)
|
||||
.append("<br>\r\n");
|
||||
}
|
||||
if (mSourceMessage.getRecipients(RecipientType.TO) != null && mSourceMessage.getRecipients(RecipientType.TO).length != 0) {
|
||||
if (originalMessage.getRecipients(RecipientType.TO) != null && originalMessage.getRecipients(RecipientType.TO).length != 0) {
|
||||
header.append("<b>").append(getString(R.string.message_compose_quote_header_to)).append("</b> ")
|
||||
.append(HtmlConverter.textToHtmlFragment(Address.toString(mSourceMessage.getRecipients(RecipientType.TO))))
|
||||
.append(HtmlConverter.textToHtmlFragment(Address.toString(originalMessage.getRecipients(RecipientType.TO))))
|
||||
.append("<br>\r\n");
|
||||
}
|
||||
if (mSourceMessage.getRecipients(RecipientType.CC) != null && mSourceMessage.getRecipients(RecipientType.CC).length != 0) {
|
||||
if (originalMessage.getRecipients(RecipientType.CC) != null && originalMessage.getRecipients(RecipientType.CC).length != 0) {
|
||||
header.append("<b>").append(getString(R.string.message_compose_quote_header_cc)).append("</b> ")
|
||||
.append(HtmlConverter.textToHtmlFragment(Address.toString(mSourceMessage.getRecipients(RecipientType.CC))))
|
||||
.append(HtmlConverter.textToHtmlFragment(Address.toString(originalMessage.getRecipients(RecipientType.CC))))
|
||||
.append("<br>\r\n");
|
||||
}
|
||||
if (mSourceMessage.getSubject() != null) {
|
||||
if (originalMessage.getSubject() != null) {
|
||||
header.append("<b>").append(getString(R.string.message_compose_quote_header_subject)).append("</b> ")
|
||||
.append(HtmlConverter.textToHtmlFragment(mSourceMessage.getSubject()))
|
||||
.append(HtmlConverter.textToHtmlFragment(originalMessage.getSubject()))
|
||||
.append("<br>\r\n");
|
||||
}
|
||||
header.append("</div>\r\n");
|
||||
@ -3990,6 +4009,26 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
return (mQuotedTextMode == QuotedTextMode.SHOW);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the date from a message and convert it into a locale-specific
|
||||
* date string suitable for use in a header for a quoted message.
|
||||
*
|
||||
* @param message
|
||||
* @return A string with the formatted date/time
|
||||
*/
|
||||
private String getSentDateText(Message message) {
|
||||
try {
|
||||
final int dateStyle = DateFormat.LONG;
|
||||
final int timeStyle = DateFormat.LONG;
|
||||
Date date = message.getSentDate();
|
||||
Locale locale = getResources().getConfiguration().locale;
|
||||
return DateFormat.getDateTimeInstance(dateStyle, timeStyle, locale)
|
||||
.format(date);
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An {@link EditText} extension with methods that convert line endings from
|
||||
* {@code \r\n} to {@code \n} and back again when setting and getting text.
|
||||
|
@ -354,7 +354,7 @@ public class Pop3Store extends Store {
|
||||
mCapabilities = getCapabilities();
|
||||
|
||||
if (mCapabilities.stls) {
|
||||
writeLine(STLS_COMMAND);
|
||||
executeSimpleCommand(STLS_COMMAND);
|
||||
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED;
|
||||
|
Loading…
Reference in New Issue
Block a user