Add option to unset colors provided in HTML mails for preview into Preferences
It's located in Edit->Preferences->Mail Preferences->HTML Messages->Unset colors provided in HTML mails in message preview. Related to https://gitlab.gnome.org/GNOME/evolution/issues/695
This commit is contained in:
@ -1069,10 +1069,10 @@ Evo.unsetHTMLColors = function(doc)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (rule.style.color)
|
if (rule.style.color)
|
||||||
rule.style.color = "inherit";
|
rule.style.removeProperty("color");
|
||||||
|
|
||||||
if (rule.style.backgroundColor)
|
if (rule.style.backgroundColor)
|
||||||
rule.style.backgroundColor = "inherit";
|
rule.style.removeProperty("background-color");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1086,10 +1086,13 @@ Evo.unsetHTMLColors = function(doc)
|
|||||||
if (elem.tagName != "HTML" && elem.tagName != "IFRAME" && elem.tagName != "INPUT" && elem.tagName != "BUTTON" && elem.tagName != "IMG") {
|
if (elem.tagName != "HTML" && elem.tagName != "IFRAME" && elem.tagName != "INPUT" && elem.tagName != "BUTTON" && elem.tagName != "IMG") {
|
||||||
if (elem.style) {
|
if (elem.style) {
|
||||||
if (elem.style.color)
|
if (elem.style.color)
|
||||||
elem.style.color = "inherit";
|
elem.style.removeProperty("color");
|
||||||
|
|
||||||
if (elem.style.backgroundColor)
|
if (elem.style.backgroundColor)
|
||||||
elem.style.backgroundColor = "inherit";
|
elem.style.removeProperty("background-color");
|
||||||
|
|
||||||
|
if (!elem.style.length)
|
||||||
|
elem.removeAttribute("style");
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.removeAttribute("color");
|
elem.removeAttribute("color");
|
||||||
|
@ -2108,12 +2108,13 @@ mail_display_drag_data_get (GtkWidget *widget,
|
|||||||
g_free (uri);
|
g_free (uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
e_mail_display_test_change_and_update_fonts_cb (EMailDisplay *mail_display,
|
e_mail_display_test_key_changed (EMailDisplay *mail_display,
|
||||||
const gchar *key,
|
const gchar *key,
|
||||||
GSettings *settings)
|
GSettings *settings)
|
||||||
{
|
{
|
||||||
GVariant *new_value, *old_value;
|
GVariant *new_value, *old_value;
|
||||||
|
gboolean changed = FALSE;
|
||||||
|
|
||||||
new_value = g_settings_get_value (settings, key);
|
new_value = g_settings_get_value (settings, key);
|
||||||
old_value = g_hash_table_lookup (mail_display->priv->old_settings, key);
|
old_value = g_hash_table_lookup (mail_display->priv->old_settings, key);
|
||||||
@ -2124,10 +2125,30 @@ e_mail_display_test_change_and_update_fonts_cb (EMailDisplay *mail_display,
|
|||||||
else
|
else
|
||||||
g_hash_table_remove (mail_display->priv->old_settings, key);
|
g_hash_table_remove (mail_display->priv->old_settings, key);
|
||||||
|
|
||||||
e_web_view_update_fonts (E_WEB_VIEW (mail_display));
|
changed = TRUE;
|
||||||
} else if (new_value) {
|
} else if (new_value) {
|
||||||
g_variant_unref (new_value);
|
g_variant_unref (new_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
e_mail_display_test_change_and_update_fonts_cb (EMailDisplay *mail_display,
|
||||||
|
const gchar *key,
|
||||||
|
GSettings *settings)
|
||||||
|
{
|
||||||
|
if (e_mail_display_test_key_changed (mail_display, key, settings))
|
||||||
|
e_web_view_update_fonts (E_WEB_VIEW (mail_display));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
e_mail_display_test_change_and_reload_cb (EMailDisplay *mail_display,
|
||||||
|
const gchar *key,
|
||||||
|
GSettings *settings)
|
||||||
|
{
|
||||||
|
if (e_mail_display_test_key_changed (mail_display, key, settings))
|
||||||
|
e_mail_display_reload (mail_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2408,6 +2429,9 @@ e_mail_display_init (EMailDisplay *display)
|
|||||||
g_signal_connect_swapped (
|
g_signal_connect_swapped (
|
||||||
display->priv->settings , "changed::use-custom-font",
|
display->priv->settings , "changed::use-custom-font",
|
||||||
G_CALLBACK (e_mail_display_test_change_and_update_fonts_cb), display);
|
G_CALLBACK (e_mail_display_test_change_and_update_fonts_cb), display);
|
||||||
|
g_signal_connect_swapped (
|
||||||
|
display->priv->settings , "changed::preview-unset-html-colors",
|
||||||
|
G_CALLBACK (e_mail_display_test_change_and_reload_cb), display);
|
||||||
|
|
||||||
g_signal_connect (
|
g_signal_connect (
|
||||||
display, "load-changed",
|
display, "load-changed",
|
||||||
|
@ -2407,6 +2407,22 @@
|
|||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="chkUnsetHTMLColors">
|
||||||
|
<property name="label" translatable="yes">Unset colors provided in HTML mails in message previe_w</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="chkPromptWantHTML">
|
<object class="GtkCheckButton" id="chkPromptWantHTML">
|
||||||
<property name="label" translatable="yes">_Prompt on sending HTML mail to contacts that do not want them</property>
|
<property name="label" translatable="yes">_Prompt on sending HTML mail to contacts that do not want them</property>
|
||||||
@ -2420,7 +2436,7 @@
|
|||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
<property name="position">1</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -1786,6 +1786,12 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
|
|||||||
widget, "active",
|
widget, "active",
|
||||||
G_SETTINGS_BIND_DEFAULT);
|
G_SETTINGS_BIND_DEFAULT);
|
||||||
|
|
||||||
|
widget = e_builder_get_widget (prefs->priv->builder, "chkUnsetHTMLColors");
|
||||||
|
g_settings_bind (
|
||||||
|
settings, "preview-unset-html-colors",
|
||||||
|
widget, "active",
|
||||||
|
G_SETTINGS_BIND_DEFAULT);
|
||||||
|
|
||||||
widget = e_builder_get_widget (prefs->priv->builder, "chkPromptWantHTML");
|
widget = e_builder_get_widget (prefs->priv->builder, "chkPromptWantHTML");
|
||||||
g_settings_bind (
|
g_settings_bind (
|
||||||
settings, "prompt-on-unwanted-html",
|
settings, "prompt-on-unwanted-html",
|
||||||
|
Reference in New Issue
Block a user