[evolution] I#1962 - Mail: Option to use user-specified Date format in Inline reply style
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1962 - Mail: Option to use user-specified Date format in Inline reply style
- Date: Tue, 12 Jul 2022 16:41:01 +0000 (UTC)
commit a845eac0c7f281d5f85f33ad317bbacc16cc58e1
Author: Milan Crha <mcrha redhat com>
Date: Tue Jul 12 18:40:04 2022 +0200
I#1962 - Mail: Option to use user-specified Date format in Inline reply style
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1962
data/org.gnome.evolution.mail.gschema.xml.in | 5 +++++
src/em-format/e-mail-formatter-quote-headers.c | 28 ++++++++++++++++----------
src/em-format/e-mail-formatter-utils.c | 12 +++++++----
3 files changed, 30 insertions(+), 15 deletions(-)
---
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index f82cdb37fa..dd0fcacfc6 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -263,6 +263,11 @@
<_summary>Convert UTC time in reply credits to local time</_summary>
<_description>Whether the time in reply credits should be converted to local time when it’s in UTC in
the message.</_description>
</key>
+ <key name="composer-reply-credits-date-user-format" type="b">
+ <default>true</default>
+ <_summary>Use user date format in reply credits</_summary>
+ <_description>Whether the date in reply credits should be shown in the user date format. If unset,
shows the header value from the original message.</_description>
+ </key>
<key name="composer-mark-read-on-reply" type="b">
<default>true</default>
<_summary>Mark replied to messages as read</_summary>
diff --git a/src/em-format/e-mail-formatter-quote-headers.c b/src/em-format/e-mail-formatter-quote-headers.c
index 7e99d012c7..2c36d23b52 100644
--- a/src/em-format/e-mail-formatter-quote-headers.c
+++ b/src/em-format/e-mail-formatter-quote-headers.c
@@ -209,6 +209,8 @@ emfqe_format_header (EMailFormatter *formatter,
g_str_equal (canon_name, "Resent-Date")) {
CamelMedium *medium;
GSettings *settings;
+ time_t date;
+ gint offset = 0;
medium = CAMEL_MEDIUM (mime_part);
txt = camel_medium_get_header (medium, canon_name);
@@ -219,27 +221,31 @@ emfqe_format_header (EMailFormatter *formatter,
flags |= E_MAIL_FORMATTER_HEADER_FLAG_BOLD;
+ date = camel_header_decode_date (txt, &offset);
+
settings = e_util_ref_settings ("org.gnome.evolution.mail");
- if (g_settings_get_boolean (settings, "composer-reply-credits-utc-to-localtime")) {
- time_t date;
- gint offset = 0;
+ if (date > 0 && !offset && g_settings_get_boolean (settings,
"composer-reply-credits-utc-to-localtime")) {
+ struct tm local;
- date = camel_header_decode_date (txt, &offset);
- if (date > 0 && !offset) {
- struct tm local;
- gint tzone = 0;
+ e_localtime_with_offset (date, &local, &offset);
- e_localtime_with_offset (date, &local, &offset);
+ if (g_settings_get_boolean (settings, "composer-reply-credits-date-user-format")) {
+ value = e_datetime_format_format_tm ("mail", "header", DTFormatKindDateTime,
&local);
+ } else {
+ gint tzone = 0;
tzone = offset / 3600;
tzone = (tzone * 100) + ((offset / 60) % 60);
value = camel_header_format_date (date, tzone);
-
- if (value && *value)
- txt = value;
}
+ } else if (date > 0 && g_settings_get_boolean (settings,
"composer-reply-credits-date-user-format")) {
+ value = e_datetime_format_format ("mail", "header", DTFormatKindDateTime, date);
}
+
+ if (value && *value)
+ txt = value;
+
g_object_unref (settings);
} else {
CamelMedium *medium;
diff --git a/src/em-format/e-mail-formatter-utils.c b/src/em-format/e-mail-formatter-utils.c
index 929da58db6..24eee3d6f1 100644
--- a/src/em-format/e-mail-formatter-utils.c
+++ b/src/em-format/e-mail-formatter-utils.c
@@ -400,21 +400,25 @@ e_mail_formatter_format_header (EMailFormatter *formatter,
txt = value = html;
} else {
gchar *date_str;
+ gchar *date_html;
date_str = e_datetime_format_format (
"mail", "header",
DTFormatKindDateTime, msg_date);
+ date_html = camel_text_to_html (date_str, text_format_flags, 0);
+
if (hide_real_date) {
/* Show only the local-formatted date, losing
* all timezone information like Outlook does.
* Should we attempt to show it somehow? */
- txt = value = date_str;
+ txt = value = date_html;
} else {
- txt = value = g_strdup_printf (
- "%s (<I>%s</I>)", html, date_str);
- g_free (date_str);
+ txt = value = g_strdup_printf ("%s (<I>%s</I>)", html, date_html);
+ g_free (date_html);
}
+
+ g_free (date_str);
g_free (html);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]