I#1767 - ECalComponentPreview: Use full width for the Description

Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1767
This commit is contained in:
Milan Crha
2022-01-11 17:25:40 +01:00
parent 0068bf48ef
commit 6c2827601b
2 changed files with 52 additions and 39 deletions

View File

@ -93,6 +93,15 @@ a.evo-awrap {
word-break: break-all;
}
.calpreview th {
white-space: nowrap;
width: 1%;
}
.calpreview td {
width: 99%;
}
/**** HEADERS ****/
button.header-collapse {

View File

@ -233,7 +233,7 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
text = e_cal_component_get_summary (comp);
g_string_append (buffer, HTML_HEADER);
g_string_append (buffer, "<body class=\"-e-web-view-background-color -e-web-view-text-color\">");
g_string_append (buffer, "<body class=\"-e-web-view-background-color -e-web-view-text-color calpreview\">");
markup = g_markup_escape_text (text && e_cal_component_text_get_value (text) ? e_cal_component_text_get_value (text) : _("Untitled"), -1);
if (text && e_cal_component_text_get_value (text))
@ -488,44 +488,6 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_slist_free_full (attendees, e_cal_component_attendee_free);
}
/* write description and URL */
g_string_append (buffer, "<tr><td colspan=\"2\"><hr></td></tr>");
list = e_cal_component_get_descriptions (comp);
if (list) {
GSList *node;
markup = g_markup_escape_text (_("Description:"), -1);
g_string_append_printf (buffer, "<tr><th>%s</th>", markup);
g_free (markup);
g_string_append (buffer, "<td class=\"description\">");
for (node = list; node != NULL; node = node->next) {
gchar *html;
text = node->data;
if (!text || !e_cal_component_text_get_value (text))
continue;
html = camel_text_to_html (
e_cal_component_text_get_value (text),
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);
if (html)
g_string_append_printf (buffer, "%s", html);
g_free (html);
}
g_string_append (buffer, "</td></tr>");
g_slist_free_full (list, e_cal_component_text_free);
}
/* URL */
url = e_cal_component_get_url (comp);
if (url) {
@ -562,6 +524,48 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_free (url);
}
g_string_append (buffer, "<tr><td colspan=\"2\"><hr></td></tr>");
/* Write description as the last, using full width */
list = e_cal_component_get_descriptions (comp);
if (list) {
GSList *node;
gboolean has_header = FALSE;
for (node = list; node != NULL; node = node->next) {
gchar *html;
text = node->data;
if (!text || !e_cal_component_text_get_value (text))
continue;
html = camel_text_to_html (
e_cal_component_text_get_value (text),
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);
if (html) {
if (!has_header) {
has_header = TRUE;
g_string_append (buffer, "<tr><td colspan=\"2\" class=\"description\">");
}
g_string_append_printf (buffer, "%s", html);
}
g_free (html);
}
if (has_header)
g_string_append (buffer, "</td></tr>");
g_slist_free_full (list, e_cal_component_text_free);
}
g_string_append (buffer, "</table>");
/* close document */