[evolution] ECalComponentPreview: Linkify 'Location' value



commit 6a8cf8a96808d67c55f512c4af38f7f0fc427ee5
Author: Milan Crha <mcrha redhat com>
Date:   Tue Mar 29 09:53:57 2022 +0200

    ECalComponentPreview: Linkify 'Location' value
    
    The location can contain URL, thus make it clickable for easier
    access of it.

 src/calendar/gui/e-cal-component-preview.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/calendar/gui/e-cal-component-preview.c b/src/calendar/gui/e-cal-component-preview.c
index 5b4ca445c2..b84e633306 100644
--- a/src/calendar/gui/e-cal-component-preview.c
+++ b/src/calendar/gui/e-cal-component-preview.c
@@ -286,7 +286,19 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
 
        /* write location */
        location = e_cal_component_get_location (comp);
-       cal_component_preview_add_table_line (buffer, _("Location:"), location);
+       if (location && *location) {
+               markup = g_markup_escape_text (_("Location:"), -1);
+               g_string_append_printf (buffer, "<tr><th>%s</th>", markup);
+               g_free (markup);
+
+               markup = camel_text_to_html (location,
+                       CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
+                       CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
+                       CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
+                       CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, 0);
+               g_string_append_printf (buffer, "<td>%s</td></tr>", markup);
+               g_free (markup);
+       }
        g_free (location);
 
        /* write start date */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]