aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/e-mail-reader.c4
-rw-r--r--mail/em-format-html.c83
-rw-r--r--mail/em-format-html.h3
-rw-r--r--mail/evolution-mail.schemas.in15
-rw-r--r--modules/mail/e-mail-shell-settings.c4
-rw-r--r--modules/mail/em-mailer-prefs.c11
6 files changed, 103 insertions, 17 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index f6a3f99a26..d77fafc448 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2516,6 +2516,10 @@ e_mail_reader_init (EMailReader *reader)
shell_settings, "mail-show-sender-photo",
html_display, "show-sender-photo");
+ e_binding_new (
+ shell_settings, "mail-show-real-date",
+ html_display, "show-real-date");
+
action_name = "mail-caret-mode";
action = e_mail_reader_get_action (reader, action_name);
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 53d10e8f12..47213dc5d5 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -112,6 +112,7 @@ struct _EMFormatHTMLPrivate {
guint load_images_now : 1;
guint only_local_photos : 1;
guint show_sender_photo : 1;
+ guint show_real_date : 1;
};
enum {
@@ -125,6 +126,7 @@ enum {
PROP_MARK_CITATIONS,
PROP_ONLY_LOCAL_PHOTOS,
PROP_SHOW_SENDER_PHOTO,
+ PROP_SHOW_REAL_DATE,
PROP_TEXT_COLOR
};
@@ -485,6 +487,12 @@ efh_set_property (GObject *object,
g_value_get_boolean (value));
return;
+ case PROP_SHOW_REAL_DATE:
+ em_format_html_set_show_real_date (
+ EM_FORMAT_HTML (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_TEXT_COLOR:
em_format_html_set_color (
EM_FORMAT_HTML (object),
@@ -570,6 +578,12 @@ efh_get_property (GObject *object,
EM_FORMAT_HTML (object)));
return;
+ case PROP_SHOW_REAL_DATE:
+ g_value_set_boolean (
+ value, em_format_html_get_show_real_date (
+ EM_FORMAT_HTML (object)));
+ return;
+
case PROP_TEXT_COLOR:
em_format_html_get_color (
EM_FORMAT_HTML (object),
@@ -863,6 +877,17 @@ efh_class_init (EMFormatHTMLClass *class)
g_object_class_install_property (
object_class,
+ PROP_SHOW_REAL_DATE,
+ g_param_spec_boolean (
+ "show-real-date",
+ "Show real Date header value",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
PROP_TEXT_COLOR,
g_param_spec_boxed (
"text-color",
@@ -1135,6 +1160,25 @@ em_format_html_set_show_sender_photo (EMFormatHTML *efh,
g_object_notify (G_OBJECT (efh), "show-sender-photo");
}
+gboolean
+em_format_html_get_show_real_date (EMFormatHTML *efh)
+{
+ g_return_val_if_fail (EM_IS_FORMAT_HTML (efh), FALSE);
+
+ return efh->priv->show_real_date;
+}
+
+void
+em_format_html_set_show_real_date (EMFormatHTML *efh,
+ gboolean show_real_date)
+{
+ g_return_if_fail (EM_IS_FORMAT_HTML (efh));
+
+ efh->priv->show_real_date = show_real_date;
+
+ g_object_notify (G_OBJECT (efh), "show-real-date");
+}
+
CamelMimePart *
em_format_html_file_part(EMFormatHTML *efh, const gchar *mime_type, const gchar *filename)
{
@@ -2370,38 +2414,47 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct
gint msg_offset, local_tz;
time_t msg_date;
struct tm local;
- gchar *date_str;
+ gchar *html;
+ gboolean hide_real_date;
+
+ hide_real_date = !em_format_html_get_show_real_date (efh);
txt = header->value;
while (*txt == ' ' || *txt == '\t')
txt++;
+ html = camel_text_to_html (txt, efh->text_html_flags, 0);
+
msg_date = camel_header_decode_date(txt, &msg_offset);
e_localtime_with_offset (msg_date, &local, &local_tz);
- date_str = e_datetime_format_format ("mail", "header", DTFormatKindDateTime, msg_date);
-
/* Convert message offset to minutes (e.g. -0400 --> -240) */
msg_offset = ((msg_offset / 100) * 60) + (msg_offset % 100);
/* Turn into offset from localtime, not UTC */
msg_offset -= local_tz / 60;
- if (msg_offset) {
- gchar *html;
+ /* value will be freed at the end */
+ if (!hide_real_date && !msg_offset) {
+ /* No timezone difference; just show the real Date: header */
+ txt = value = html;
+ } else {
+ gchar *date_str;
- html = camel_text_to_html (txt, efh->text_html_flags, 0);
- txt = value = g_strdup_printf ("%s (<I>%s</I>)", date_str, html);
+ date_str = e_datetime_format_format ("mail", "header",
+ DTFormatKindDateTime, msg_date);
+ 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;
+ } else {
+ txt = value = g_strdup_printf ("%s (<I>%s</I>)", html, date_str);
+ g_free (date_str);
+ }
g_free (html);
- g_free (date_str);
-
- flags |= EM_FORMAT_HTML_HEADER_HTML;
- } else {
- /* date_str will be freed at the end */
- txt = value = date_str;
}
-
- flags |= EM_FORMAT_HEADER_BOLD;
+ flags |= EM_FORMAT_HTML_HEADER_HTML | EM_FORMAT_HEADER_BOLD;
} else if (!strcmp(name, "Newsgroups")) {
struct _camel_header_newsgroup *ng, *scan;
GString *html;
diff --git a/mail/em-format-html.h b/mail/em-format-html.h
index a76ae9cfb7..9d96c4056c 100644
--- a/mail/em-format-html.h
+++ b/mail/em-format-html.h
@@ -278,6 +278,9 @@ EMFormatHTMLJob *
gpointer data);
void em_format_html_job_queue (EMFormatHTML *efh,
EMFormatHTMLJob *job);
+gboolean em_format_html_get_show_real_date(EMFormatHTML *efh);
+void em_format_html_set_show_real_date(EMFormatHTML *efh,
+ gboolean show_real_date);
G_END_DECLS
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index 418e57d371..6039c31cef 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -1136,6 +1136,21 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/evolution/mail/display/show_real_date</key>
+ <applyto>/apps/evolution/mail/display/show_real_date</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Show original "Date" header value.</short>
+ <long>
+ Show the original "Date" header (with a local time only if the time zone differs).
+ Otherwise always show "Date" header value in a user preferred format and local time zone.
+ </long>
+ </locale>
+ </schema>
+
<!-- Labels and Colours -->
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index c20f57ce43..1434951b81 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -151,6 +151,10 @@ e_mail_shell_settings_init (EShell *shell)
"/apps/evolution/mail/display/photo_local");
e_shell_settings_install_property_for_key (
+ "mail-show-real-date",
+ "/apps/evolution/mail/display/show_real_date");
+
+ e_shell_settings_install_property_for_key (
"mail-prompt-delete-in-vfolder",
"/apps/evolution/mail/prompts/delete_in_vfolder");
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index f27ec7d04a..45071a1479 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -1143,8 +1143,15 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
/* date/time format */
table = glade_xml_get_widget (gui, "datetime_format_table");
- e_datetime_format_add_setup_widget (table, 0, "mail", "header", DTFormatKindDateTime, _("Date header:"));
- e_datetime_format_add_setup_widget (table, 1, "mail", "table", DTFormatKindDateTime, _("Table column:"));
+
+ e_datetime_format_add_setup_widget (table, 2, "mail", "table", DTFormatKindDateTime, _("_Table column:"));
+ e_datetime_format_add_setup_widget (table, 0, "mail", "header", DTFormatKindDateTime, _("_Date header:"));
+ widget = gtk_check_button_new_with_mnemonic (_("Show _original header value"));
+ gtk_widget_show (widget);
+ gtk_table_attach ((GtkTable *) table, widget, 0, 3, 1, 2, GTK_EXPAND | GTK_FILL, 0, 12, 0);
+ e_mutual_binding_new (
+ shell_settings, "mail-show-real-date",
+ widget, "active");
/* Junk prefs */
widget = glade_xml_get_widget (gui, "chkCheckIncomingMail");