diff options
author | Tomas Popela <tpopela@redhat.com> | 2014-06-09 22:32:25 +0800 |
---|---|---|
committer | Tomas Popela <tpopela@redhat.com> | 2014-06-09 22:32:25 +0800 |
commit | 8650fb139a9143f04615de74ff569bce3e0c4ce3 (patch) | |
tree | 89a41d08f179a5359b8eaee0c9344b8a5bf07cb3 /em-format/e-mail-formatter-quote.c | |
parent | 04b7c97275ae420dca43f3e65c2ef54d02f01bdd (diff) | |
download | gsoc2013-evolution-8650fb139a9143f04615de74ff569bce3e0c4ce3.tar gsoc2013-evolution-8650fb139a9143f04615de74ff569bce3e0c4ce3.tar.gz gsoc2013-evolution-8650fb139a9143f04615de74ff569bce3e0c4ce3.tar.bz2 gsoc2013-evolution-8650fb139a9143f04615de74ff569bce3e0c4ce3.tar.lz gsoc2013-evolution-8650fb139a9143f04615de74ff569bce3e0c4ce3.tar.xz gsoc2013-evolution-8650fb139a9143f04615de74ff569bce3e0c4ce3.tar.zst gsoc2013-evolution-8650fb139a9143f04615de74ff569bce3e0c4ce3.zip |
Bug 540362: [webkit-composer] Use webkit for composer
Merge wip/webkit-composer branch into master.
Diffstat (limited to 'em-format/e-mail-formatter-quote.c')
-rw-r--r-- | em-format/e-mail-formatter-quote.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/em-format/e-mail-formatter-quote.c b/em-format/e-mail-formatter-quote.c index 8eda05fa9b..b402eda29c 100644 --- a/em-format/e-mail-formatter-quote.c +++ b/em-format/e-mail-formatter-quote.c @@ -57,7 +57,6 @@ mail_formatter_quote_run (EMailFormatter *formatter, { EMailFormatterQuote *qf; EMailFormatterQuoteContext *qf_context; - GSettings *settings; GQueue queue = G_QUEUE_INIT; GList *head, *link; const gchar *string; @@ -74,31 +73,6 @@ mail_formatter_quote_run (EMailFormatter *formatter, G_SEEKABLE (stream), 0, G_SEEK_SET, NULL, NULL); - settings = g_settings_new ("org.gnome.evolution.mail"); - if (g_settings_get_boolean (settings, "composer-top-signature")) { - string = "<br>\n"; - g_output_stream_write_all ( - stream, string, strlen (string), - NULL, cancellable, NULL); - } - g_object_unref (settings); - - if (qf->priv->credits != NULL && *qf->priv->credits != '\0') { - g_output_stream_write_all ( - stream, qf->priv->credits, - strlen (qf->priv->credits), - NULL, cancellable, NULL); - } - - if (qf->priv->flags & E_MAIL_FORMATTER_QUOTE_FLAG_CITE) { - string = "<!--+GtkHTML:<DATA class=\"ClueFlow\" " - "key=\"orig\" value=\"1\">-->\n" - "<blockquote type=cite>\n"; - g_output_stream_write_all ( - stream, string, strlen (string), - NULL, cancellable, NULL); - } - e_mail_part_list_queue_parts (context->part_list, NULL, &queue); head = g_queue_peek_head_link (&queue); @@ -133,9 +107,33 @@ mail_formatter_quote_run (EMailFormatter *formatter, while (!g_queue_is_empty (&queue)) g_object_unref (g_queue_pop_head (&queue)); + /* Before we were inserting the BR elements and the credits in front of + * the actual HTML code of the message. But this was wrong as when WebKit + * was loading the given HTML code that looked like + * <br>CREDITS<html>MESSAGE_CODE</html> WebKit parsed it like + * <html><br>CREDITS</html><html>MESSAGE_CODE</html>. As no elements are + * allowed outside of the HTML root element WebKit wrapped them into + * another HTML root element. Afterwards the first root element was + * treated as the primary one and all the elements from the second's root + * HEAD and BODY elements were moved to the first one. + * Thus the HTML that was loaded into composer contained the i.e. META + * or STYLE definitions in the body. + * So if we want to put something into the message we have to put it into + * the special span element and it will be moved to body in EHTMLEditorView */ + if (qf->priv->credits && *qf->priv->credits) { + gchar *credits = g_strdup_printf ( + "<span class=\"-x-evo-to-body\"><pre>%s</pre></span>", qf->priv->credits); + g_output_stream_write_all ( + stream, credits, strlen (credits), + NULL, cancellable, NULL); + g_free (credits); + } + + /* If we want to cite the message we have to append the special span element + * after the message and cite it in EHTMLEditorView because of reasons + * mentioned above */ if (qf->priv->flags & E_MAIL_FORMATTER_QUOTE_FLAG_CITE) { - string = "</blockquote><!--+GtkHTML:" - "<DATA class=\"ClueFlow\" clear=\"orig\">-->"; + string = "<span class=\"-x-evo-cite-body\"><span>"; g_output_stream_write_all ( stream, string, strlen (string), NULL, cancellable, NULL); |