UTC time in quotes (Issue #2403)

Before, the time in the quoted message of a reply was always in the
local timezone, even when the "Hide timezone" setting was selected. Now,
when the option is enabled, that is changed to UTC just like the time in
headers. I also changed the description for the option in the English
strings.xml to better describe the new different behavior.
This commit is contained in:
ndew623 2017-03-25 14:51:40 -05:00
parent 289363ae88
commit aac3b69c4f
2 changed files with 8 additions and 3 deletions

View file

@ -4,9 +4,11 @@ package com.fsck.k9.message.quote;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import android.content.res.Resources;
import com.fsck.k9.K9;
import com.fsck.k9.mail.Message;
@ -27,8 +29,11 @@ class QuoteHelper {
final int timeStyle = DateFormat.LONG;
Date date = message.getSentDate();
Locale locale = resources.getConfiguration().locale;
return DateFormat.getDateTimeInstance(dateStyle, timeStyle, locale)
.format(date);
DateFormat dateFormat = DateFormat.getDateTimeInstance(dateStyle, timeStyle, locale);
if (K9.hideTimeZone()) {
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
}
return dateFormat.format(date);
} catch (Exception e) {
return "";
}

View file

@ -342,7 +342,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="global_settings_privacy_hide_useragent">Hide mail client</string>
<string name="global_settings_privacy_hide_useragent_detail">Remove K-9 User-Agent from mail headers</string>
<string name="global_settings_privacy_hide_timezone">Hide timezone</string>
<string name="global_settings_privacy_hide_timezone_detail">Use UTC instead of local timezone in mail headers</string>
<string name="global_settings_privacy_hide_timezone_detail">Use UTC instead of local timezone in mail headers and reply quotes</string>
<string name="global_settings_notification_hide_subject_title">Hide subject in notifications</string>
<string name="global_settings_notification_hide_subject_never">Never</string>
<string name="global_settings_notification_hide_subject_when_locked">When device is locked</string>