[evolution] Bug 794204 - Links in mailto: body not detected when composing in HTML



commit 6d8e52201f5a0a04b4bd6af5762d28e282c4d8ae
Author: Milan Crha <mcrha redhat com>
Date:   Wed Mar 14 15:30:55 2018 +0100

    Bug 794204 - Links in mailto: body not detected when composing in HTML

 data/org.gnome.evolution.mail.gschema.xml.in       |    4 ++++
 src/composer/e-msg-composer.c                      |   17 ++++++++++++++++-
 .../web-extension/e-editor-dom-functions.c         |    2 +-
 3 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index 4712824..c64ddd3 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -770,6 +770,10 @@
       <default>false</default>
       <_summary>Whether preserve original message subject when applying template for Alternative 
Reply</_summary>
     </key>
+    <key name="composer-mailto-body-in-pre" type="b">
+      <default>true</default>
+      <_summary>Whether set “body” in mailto: URI as Preformatted paragraph style. If set to “false”, then 
Normal paragraph style will be used.</_summary>
+    </key>
     <!-- The following keys are deprecated. -->
 
     <key name="forward-style" type="i">
diff --git a/src/composer/e-msg-composer.c b/src/composer/e-msg-composer.c
index f77c56d..dd29675 100644
--- a/src/composer/e-msg-composer.c
+++ b/src/composer/e-msg-composer.c
@@ -4612,9 +4612,24 @@ handle_mailto (EMsgComposer *composer,
        g_free (subject);
 
        if (body) {
+               GSettings *settings;
                gchar *html_body;
+               guint32 flags = 0;
+
+               settings = e_util_ref_settings ("org.gnome.evolution.mail");
+
+               if (g_settings_get_boolean (settings, "composer-magic-links")) {
+                       flags |= CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | 
CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
+               }
+
+               if (g_settings_get_boolean (settings, "composer-mailto-body-in-pre"))
+                       flags |= CAMEL_MIME_FILTER_TOHTML_PRE;
+               else
+                       flags |= CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | 
CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
+
+               g_clear_object (&settings);
 
-               html_body = camel_text_to_html (body, CAMEL_MIME_FILTER_TOHTML_PRE, 0);
+               html_body = camel_text_to_html (body, flags, 0);
                set_editor_text (composer, html_body, TRUE, TRUE);
                g_free (html_body);
        }
diff --git a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c 
b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index 961a1f6..ca78200 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -8833,7 +8833,7 @@ e_editor_dom_process_content_after_load (EEditorPage *editor_page)
                                                }
 
                                                if (*(strv[jj])) {
-                                                       webkit_dom_html_element_set_inner_text 
(WEBKIT_DOM_HTML_ELEMENT (pre), strv[jj], NULL);
+                                                       webkit_dom_html_element_set_inner_html 
(WEBKIT_DOM_HTML_ELEMENT (pre), strv[jj], NULL);
                                                } else {
                                                        WebKitDOMElement *br;
 


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