diff --git a/.gitignore b/.gitignore index dc6a2dda6..ad16c6241 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ target build .gradle out +build.xml +proguard-project.txt diff --git a/ant.properties b/ant.properties deleted file mode 100644 index cf3bfb120..000000000 --- a/ant.properties +++ /dev/null @@ -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 diff --git a/res/values/strings.xml b/res/values/strings.xml index 23e764826..98ab1e85b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -264,6 +264,7 @@ Please submit bug reports, contribute new features and ask questions at To: Cc: %s wrote: + On %1$s, %2$s wrote: You must add at least one recipient. No email address could be found for this contact. Some attachments cannot be forwarded because they have not been downloaded. diff --git a/src/com/fsck/k9/Account.java b/src/com/fsck/k9/Account.java index 67a83e7ef..f9a9bb51e 100644 --- a/src/com/fsck/k9/Account.java +++ b/src/com/fsck/k9/Account.java @@ -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(); } diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java index f6451fbd4..5bdd96877 100644 --- a/src/com/fsck/k9/activity/MessageCompose.java +++ b/src/com/fsck/k9/activity/MessageCompose.java @@ -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("
"); - 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("
\r\n"); @@ -3779,29 +3798,29 @@ public class MessageCompose extends K9Activity implements OnClickListener, StringBuilder header = new StringBuilder(); header.append("
\r\n"); header.append("
\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("").append(getString(R.string.message_compose_quote_header_from)).append(" ") - .append(HtmlConverter.textToHtmlFragment(Address.toString(mSourceMessage.getFrom()))) + .append(HtmlConverter.textToHtmlFragment(Address.toString(originalMessage.getFrom()))) .append("
\r\n"); } - if (mSourceMessage.getSentDate() != null) { + if (sentDate.length() != 0) { header.append("").append(getString(R.string.message_compose_quote_header_send_date)).append(" ") - .append(mSourceMessage.getSentDate()) + .append(sentDate) .append("
\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("").append(getString(R.string.message_compose_quote_header_to)).append(" ") - .append(HtmlConverter.textToHtmlFragment(Address.toString(mSourceMessage.getRecipients(RecipientType.TO)))) + .append(HtmlConverter.textToHtmlFragment(Address.toString(originalMessage.getRecipients(RecipientType.TO)))) .append("
\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("").append(getString(R.string.message_compose_quote_header_cc)).append(" ") - .append(HtmlConverter.textToHtmlFragment(Address.toString(mSourceMessage.getRecipients(RecipientType.CC)))) + .append(HtmlConverter.textToHtmlFragment(Address.toString(originalMessage.getRecipients(RecipientType.CC)))) .append("
\r\n"); } - if (mSourceMessage.getSubject() != null) { + if (originalMessage.getSubject() != null) { header.append("").append(getString(R.string.message_compose_quote_header_subject)).append(" ") - .append(HtmlConverter.textToHtmlFragment(mSourceMessage.getSubject())) + .append(HtmlConverter.textToHtmlFragment(originalMessage.getSubject())) .append("
\r\n"); } header.append("
\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. diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index 80711a48f..ab2133001 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -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;