From 8650fb139a9143f04615de74ff569bce3e0c4ce3 Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Mon, 9 Jun 2014 16:32:25 +0200 Subject: Bug 540362: [webkit-composer] Use webkit for composer Merge wip/webkit-composer branch into master. --- em-format/e-mail-formatter-quote.c | 54 ++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'em-format/e-mail-formatter-quote.c') 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 = "
\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 = "\n" - "
\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 + *
CREDITSMESSAGE_CODE WebKit parsed it like + *
CREDITSMESSAGE_CODE. 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 ( + "
%s
", 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 = "
"; + string = ""; g_output_stream_write_all ( stream, string, strlen (string), NULL, cancellable, NULL); -- cgit v1.2.3