I#2480 - Mail: Add option to auto-show insecure parts
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/2480
This commit is contained in:
@ -942,6 +942,11 @@
|
||||
<_summary>Show unread count in folder tree</_summary>
|
||||
<_description>Show unread count beside the folder name in the folder tree.</_description>
|
||||
</key>
|
||||
<key name="show-insecure-parts" type="b">
|
||||
<default>false</default>
|
||||
<_summary>Show insecure parts by default</_summary>
|
||||
<_description>Set whether not signed/encrypted parts beside signed/encrypted parts should be shown after mail open. The default is to hide these possibly insecure parts.</_description>
|
||||
</key>
|
||||
|
||||
<!-- The following keys are deprecated. -->
|
||||
|
||||
|
||||
@ -699,6 +699,8 @@ e_mail_formatter_format_security_header (EMailFormatter *formatter,
|
||||
|
||||
if (tmp->len > 0) {
|
||||
if (is_partial && context && context->mode == E_MAIL_FORMATTER_MODE_NORMAL) {
|
||||
GSettings *settings;
|
||||
gboolean show_parts;
|
||||
gint icon_width, icon_height;
|
||||
gchar *escaped;
|
||||
|
||||
@ -711,14 +713,18 @@ e_mail_formatter_format_security_header (EMailFormatter *formatter,
|
||||
g_string_assign (tmp, escaped);
|
||||
g_free (escaped);
|
||||
|
||||
settings = e_util_ref_settings ("org.gnome.evolution.mail");
|
||||
show_parts = g_settings_get_boolean (settings, "show-insecure-parts");
|
||||
g_object_unref (settings);
|
||||
|
||||
e_util_markup_append_escaped (tmp,
|
||||
" (<img src=\"gtk-stock://dialog-warning?size=%d\" width=\"%dpx\" height=\"%dpx\" style=\"vertical-align:middle;\"/> "
|
||||
"<a class=\"manage-insecure-parts\" id=\"show:%s\" value=\"%s\" style=\"cursor:pointer;\">%s</a>"
|
||||
"<a class=\"manage-insecure-parts\" id=\"hide:%s\" value=\"%s\" style=\"cursor:pointer;\" hidden>%s</a>"
|
||||
"<a class=\"manage-insecure-parts\" id=\"show:%s\" value=\"%s\" style=\"cursor:pointer;\"%s>%s</a>"
|
||||
"<a class=\"manage-insecure-parts\" id=\"hide:%s\" value=\"%s\" style=\"cursor:pointer;\"%s>%s</a>"
|
||||
")",
|
||||
GTK_ICON_SIZE_BUTTON, icon_width, icon_height,
|
||||
part_id_prefix, part_id_prefix, _("Show parts not being secured"),
|
||||
part_id_prefix, part_id_prefix, _("Hide parts not being secured"));
|
||||
part_id_prefix, part_id_prefix, show_parts ? " hidden" : "", _("Show parts not being secured"),
|
||||
part_id_prefix, part_id_prefix, show_parts ? "" : " hidden", _("Hide parts not being secured"));
|
||||
|
||||
flags |= E_MAIL_FORMATTER_HEADER_FLAG_HTML;
|
||||
}
|
||||
|
||||
@ -1470,7 +1470,8 @@ mail_display_content_loaded_cb (EWebView *web_view,
|
||||
g_clear_object (&part);
|
||||
}
|
||||
|
||||
if (mail_display->priv->has_secured_parts) {
|
||||
if (mail_display->priv->has_secured_parts &&
|
||||
mail_display->priv->skip_insecure_parts) {
|
||||
GSList *link;
|
||||
|
||||
for (link = mail_display->priv->insecure_part_ids; link; link = g_slist_next (link)) {
|
||||
@ -2796,6 +2797,7 @@ e_mail_display_init (EMailDisplay *display)
|
||||
GtkUIManager *ui_manager;
|
||||
GtkActionGroup *actions;
|
||||
GList *acts_list, *link;
|
||||
GSettings *settings;
|
||||
|
||||
display->priv = E_MAIL_DISPLAY_GET_PRIVATE (display);
|
||||
|
||||
@ -2805,7 +2807,10 @@ e_mail_display_init (EMailDisplay *display)
|
||||
display->priv->attachment_inline_group = gtk_action_group_new ("e-mail-display-attachment-inline");
|
||||
display->priv->attachment_accel_action_group = gtk_action_group_new ("e-mail-display-attachment-accel");
|
||||
display->priv->attachment_accel_group = gtk_accel_group_new ();
|
||||
display->priv->skip_insecure_parts = TRUE;
|
||||
|
||||
settings = e_util_ref_settings ("org.gnome.evolution.mail");
|
||||
display->priv->skip_insecure_parts = !g_settings_get_boolean (settings, "show-insecure-parts");
|
||||
g_object_unref (settings);
|
||||
|
||||
gtk_action_group_add_actions (
|
||||
display->priv->attachment_inline_group, attachment_inline_entries,
|
||||
@ -3118,6 +3123,7 @@ void
|
||||
e_mail_display_set_part_list (EMailDisplay *display,
|
||||
EMailPartList *part_list)
|
||||
{
|
||||
GSettings *settings;
|
||||
GSList *insecure_part_ids = NULL;
|
||||
gboolean has_secured_parts = FALSE;
|
||||
|
||||
@ -3180,7 +3186,10 @@ e_mail_display_set_part_list (EMailDisplay *display,
|
||||
g_slist_free_full (display->priv->insecure_part_ids, g_free);
|
||||
display->priv->insecure_part_ids = insecure_part_ids;
|
||||
display->priv->has_secured_parts = has_secured_parts;
|
||||
display->priv->skip_insecure_parts = TRUE;
|
||||
|
||||
settings = e_util_ref_settings ("org.gnome.evolution.mail");
|
||||
display->priv->skip_insecure_parts = !g_settings_get_boolean (settings, "show-insecure-parts");
|
||||
g_object_unref (settings);
|
||||
|
||||
g_object_notify (G_OBJECT (display), "part-list");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user