[evolution/webkit-composer: 82/231] Initial attempt on signatures handling.
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit-composer: 82/231] Initial attempt on signatures handling.
- Date: Fri, 13 Sep 2013 14:12:53 +0000 (UTC)
commit 1e1312c55e6efba8e586422bad46b22c8393babe
Author: Dan Vrátil <dvratil redhat com>
Date: Thu Oct 11 01:07:27 2012 +0200
Initial attempt on signatures handling.
Still buggy, but we are on the right way
composer/e-composer-private.c | 231 +++++++++----------------
composer/e-msg-composer.c | 40 +++--
e-util/e-editor-selection.c | 99 +++++++++++-
e-util/e-editor-selection.h | 3 +
em-format/e-mail-formatter-quote-attachment.c | 11 +-
em-format/e-mail-formatter-quote.c | 6 +-
mail/em-composer-utils.c | 36 +----
mail/em-utils.c | 4 +
mail/em-utils.h | 1 +
9 files changed, 224 insertions(+), 207 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 66340e8..9f957ec 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -481,87 +481,6 @@ e_composer_get_default_charset (void)
return charset;
}
-gchar *
-e_composer_decode_clue_value (const gchar *encoded_value)
-{
- GString *buffer;
- const gchar *cp;
-
- /* Decode a GtkHtml "ClueFlow" value. */
-
- g_return_val_if_fail (encoded_value != NULL, NULL);
-
- buffer = g_string_sized_new (strlen (encoded_value));
-
- /* Copy the value, decoding escaped characters as we go. */
- cp = encoded_value;
- while (*cp != '\0') {
- if (*cp == '.') {
- cp++;
- switch (*cp) {
- case '.':
- g_string_append_c (buffer, '.');
- break;
- case '1':
- g_string_append_c (buffer, '"');
- break;
- case '2':
- g_string_append_c (buffer, '=');
- break;
- default:
- /* Invalid escape sequence. */
- g_string_free (buffer, TRUE);
- return NULL;
- }
- } else
- g_string_append_c (buffer, *cp);
- cp++;
- }
-
- return g_string_free (buffer, FALSE);
-}
-
-gchar *
-e_composer_encode_clue_value (const gchar *decoded_value)
-{
- gchar *encoded_value;
- gchar **strv;
-
- /* Encode a GtkHtml "ClueFlow" value. */
-
- g_return_val_if_fail (decoded_value != NULL, NULL);
-
- /* XXX This is inefficient but easy to understand. */
-
- encoded_value = g_strdup (decoded_value);
-
- /* Substitution: '.' --> '..' (do this first) */
- if (strchr (encoded_value, '.') != NULL) {
- strv = g_strsplit (encoded_value, ".", 0);
- g_free (encoded_value);
- encoded_value = g_strjoinv ("..", strv);
- g_strfreev (strv);
- }
-
- /* Substitution: '"' --> '.1' */
- if (strchr (encoded_value, '"') != NULL) {
- strv = g_strsplit (encoded_value, """", 0);
- g_free (encoded_value);
- encoded_value = g_strjoinv (".1", strv);
- g_strfreev (strv);
- }
-
- /* Substitution: '=' --> '.2' */
- if (strchr (encoded_value, '=') != NULL) {
- strv = g_strsplit (encoded_value, "=", 0);
- g_free (encoded_value);
- encoded_value = g_strjoinv (".2", strv);
- g_strfreev (strv);
- }
-
- return encoded_value;
-}
-
gboolean
e_composer_paste_html (EMsgComposer *composer,
GtkClipboard *clipboard)
@@ -835,30 +754,34 @@ composer_load_signature_cb (EMailSignatureComboBox *combo_box,
GAsyncResult *result,
EMsgComposer *composer)
{
- /* FIXME WEBKIT Uuuhm, yeah...we don't support signatures yet */
-#if 0
GString *html_buffer = NULL;
- GtkhtmlEditor *editor;
gchar *contents = NULL;
gsize length = 0;
const gchar *active_id;
- gchar *encoded_uid = NULL;
gboolean top_signature;
gboolean is_html;
GError *error = NULL;
+ EEditor *editor;
+ EEditorWidget *editor_widget;
+ EEditorSelection *selection;
+ WebKitDOMDocument *document;
+ WebKitDOMNodeList *signatures;
+ WebKitDOMDOMWindow *window;
+ WebKitDOMDOMSelection *dom_selection;
+ gulong list_length, ii;
e_mail_signature_combo_box_load_selected_finish (
combo_box, result, &contents, &length, &is_html, &error);
- // FIXME Use an EAlert here.
+ /* FIXME Use an EAlert here.*/
if (error != NULL) {
g_warning ("%s: %s", G_STRFUNC, error->message);
g_error_free (error);
goto exit;
}
- // "Edit as New Message" sets "priv->is_from_message".
- //Always put the signature at the bottom for that case.
+ /* "Edit as New Message" sets "priv->is_from_message".
+ Always put the signature at the bottom for that case. */
top_signature =
use_top_signature (composer) &&
!composer->priv->is_from_message;
@@ -882,31 +805,20 @@ composer_load_signature_cb (EMailSignatureComboBox *combo_box,
html_buffer = g_string_sized_new (1024);
- // The combo box active ID is the signature's ESource UID.
+ /* The combo box active ID is the signature's ESource UID. */
active_id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (combo_box));
- if (active_id != NULL && *active_id != '\0')
- encoded_uid = e_composer_encode_clue_value (active_id);
-
g_string_append_printf (
html_buffer,
- "<!--+GtkHTML:<DATA class=\"ClueFlow\" "
- " key=\"signature\" value=\"1\">-->"
- "<!--+GtkHTML:<DATA class=\"ClueFlow\" "
- " key=\"signature_name\" value=\"uid:%s\"-->",
- (encoded_uid != NULL) ? encoded_uid : "");
-
- g_string_append (
- html_buffer,
- "<TABLE WIDTH=\"100%%\" CELLSPACING=\"0\""
- " CELLPADDING=\"0\"><TR><TD>");
+ "<SPAN class=\"-x-evolution-signature\" id=\"1\" name=\"%s\">",
+ (active_id != NULL) ? active_id : "");
if (!is_html)
g_string_append (html_buffer, "<PRE>\n");
- // The signature dash convention ("-- \n") is specified
- //in the "Son of RFC 1036", section 4.3.2.
- //http://www.chemie.fu-berlin.de/outerspace/netnews/son-of-1036.html
+ /* The signature dash convention ("-- \n") is specified
+ in the "Son of RFC 1036", section 4.3.2.
+ http://www.chemie.fu-berlin.de/outerspace/netnews/son-of-1036.html */
if (add_signature_delimiter (composer)) {
const gchar *delim;
const gchar *delim_nl;
@@ -919,7 +831,7 @@ composer_load_signature_cb (EMailSignatureComboBox *combo_box,
delim_nl = "\n-- \n";
}
- // Skip the delimiter if the signature already has one.
+ /* Skip the delimiter if the signature already has one. */
if (g_ascii_strncasecmp (contents, delim, strlen (delim)) == 0)
; // skip
else if (e_util_strstrcase (contents, delim_nl) != NULL)
@@ -936,89 +848,106 @@ composer_load_signature_cb (EMailSignatureComboBox *combo_box,
if (top_signature)
g_string_append (html_buffer, "<BR>");
- g_string_append (html_buffer, "</TD></TR></TABLE>");
-
- g_free (encoded_uid);
+ g_string_append (html_buffer, "</SPAN>");
g_free (contents);
+ g_message ("Inserting signature: %s", html_buffer->str);
+
insert:
- // Remove the old signature and insert the new one.
+ /* Remove the old signature and insert the new one. */
+ editor = e_editor_window_get_editor (E_EDITOR_WINDOW (composer));
+ editor_widget = e_editor_get_editor_widget (editor);
+ selection = e_editor_widget_get_selection (editor_widget);
- editor = GTKHTML_EDITOR (composer);
+ e_editor_selection_save (selection);
- // This prevents our command before/after callbacks from
- screwing around with the signature as we insert it.
+ /* This prevents our command before/after callbacks from
+ screwing around with the signature as we insert it. */
composer->priv->in_signature_insert = TRUE;
- gtkhtml_editor_freeze (editor);
- gtkhtml_editor_run_command (editor, "cursor-position-save");
- gtkhtml_editor_undo_begin (editor, "Set signature", "Reset signature");
-
- gtkhtml_editor_run_command (editor, "block-selection");
- gtkhtml_editor_run_command (editor, "cursor-bod");
- if (gtkhtml_editor_search_by_data (editor, 1, "ClueFlow", "signature", "1")) {
- gtkhtml_editor_run_command (editor, "select-paragraph");
- gtkhtml_editor_run_command (editor, "delete");
- gtkhtml_editor_set_paragraph_data (editor, "signature", "0");
- gtkhtml_editor_run_command (editor, "delete-back");
+ document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (editor_widget));
+ window = webkit_dom_document_get_default_view (document);
+ dom_selection = webkit_dom_dom_window_get_selection (window);
+
+ signatures = webkit_dom_document_get_elements_by_class_name (document, "-x-evolution-signature");
+ list_length = webkit_dom_node_list_get_length (signatures);
+ for (ii = 0; ii < list_length; ii++) {
+ WebKitDOMNode *node;
+ gchar *id;
+
+ node = webkit_dom_node_list_item (signatures, ii);
+ id = webkit_dom_html_element_get_id (WEBKIT_DOM_HTML_ELEMENT (node));
+
+ if (id && (strlen (id) == 1) && (*id == '1')) {
+ webkit_dom_node_remove_child (
+ webkit_dom_node_get_parent_node (node), node, NULL);
+ g_free (id);
+ break;
+ }
+
+ g_free (id);
}
- gtkhtml_editor_run_command (editor, "unblock-selection");
- if (html_buffer != NULL) {
- gtkhtml_editor_run_command (editor, "insert-paragraph");
- if (!gtkhtml_editor_run_command (editor, "cursor-backward"))
- gtkhtml_editor_run_command (editor, "insert-paragraph");
- else
- gtkhtml_editor_run_command (editor, "cursor-forward");
+ if (top_signature) {
+ WebKitDOMElement *citation;
- gtkhtml_editor_set_paragraph_data (editor, "orig", "0");
- gtkhtml_editor_run_command (editor, "indent-zero");
- gtkhtml_editor_run_command (editor, "style-normal");
- gtkhtml_editor_insert_html (editor, html_buffer->str);
+ citation = webkit_dom_document_get_element_by_id (
+ document, "-x-evolution-reply-citation");
+ if (!citation) {
+ webkit_dom_dom_selection_modify (
+ dom_selection, "move", "forward", "documentBoundary");
+ } else {
+ webkit_dom_dom_selection_set_base_and_extent (
+ dom_selection, WEBKIT_DOM_NODE (citation), 0,
+ WEBKIT_DOM_NODE (citation), 0, NULL);
+ }
+ } else {
+ webkit_dom_dom_selection_modify (
+ dom_selection, "move", "forward", "documentBoundary");
+ }
- g_string_free (html_buffer, TRUE);
+ if (html_buffer != NULL) {
+ if (*html_buffer->str) {
+ webkit_dom_document_exec_command (
+ document, "insertParagraph", FALSE, "");
+ e_editor_selection_insert_html (selection, html_buffer->str);
+ webkit_dom_document_exec_command (
+ document, "insertParagraph", FALSE, "");
+ }
- } else if (top_signature) {
- // Insert paragraph after the signature ClueFlow stuff.
- if (gtkhtml_editor_run_command (editor, "cursor-forward"))
- gtkhtml_editor_run_command (editor, "insert-paragraph");
+ g_string_free (html_buffer, TRUE);
}
- gtkhtml_editor_undo_end (editor);
- gtkhtml_editor_run_command (editor, "cursor-position-restore");
- gtkhtml_editor_thaw (editor);
+ e_editor_selection_restore (selection);
composer->priv->in_signature_insert = FALSE;
exit:
g_object_unref (composer);
-#endif
}
void
e_composer_update_signature (EMsgComposer *composer)
{
- /* FIXME WEBKIT As said above...no signatures yet
EComposerHeaderTable *table;
EMailSignatureComboBox *combo_box;
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- // Do nothing if we're redirecting a message.
+ /* Do nothing if we're redirecting a message. */
if (composer->priv->redirect)
return;
table = e_msg_composer_get_header_table (composer);
combo_box = e_composer_header_table_get_signature_combo_box (table);
- //XXX Signature files should be local and therefore load quickly,
- // so while we do load them asynchronously we don't allow for
- // user cancellation and we keep the composer alive until the
- // asynchronous loading is complete.
+ /*XXX Signature files should be local and therefore load quickly,
+ so while we do load them asynchronously we don't allow for
+ user cancellation and we keep the composer alive until the
+ asynchronous loading is complete. */
e_mail_signature_combo_box_load_selected (
combo_box, G_PRIORITY_DEFAULT, NULL,
(GAsyncReadyCallback) composer_load_signature_cb,
g_object_ref (composer));
- */
}
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 2656dbf..a4edd18 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -2945,30 +2945,48 @@ handle_multipart (EMsgComposer *composer,
static void
set_signature_gui (EMsgComposer *composer)
{
- /*FIXME WEBKIT We don't support signatures yet....
- GtkhtmlEditor *editor;
+ EEditor *editor;
+ EEditorWidget *widget;
+ WebKitDOMDocument *document;
+ WebKitDOMNodeList *nodes;
EComposerHeaderTable *table;
EMailSignatureComboBox *combo_box;
- const gchar *data;
gchar *uid;
+ gulong ii, length;
- editor = GTKHTML_EDITOR (composer);
table = e_msg_composer_get_header_table (composer);
combo_box = e_composer_header_table_get_signature_combo_box (table);
- if (!gtkhtml_editor_search_by_data (editor, 1, "ClueFlow", "signature", "1"))
- return;
- data = gtkhtml_editor_get_paragraph_data (editor, "signature_name");
+ editor = e_editor_window_get_editor (E_EDITOR_WINDOW (composer));
+ widget = e_editor_get_editor_widget (editor);
+ document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (widget));
- if (!g_str_has_prefix (data, "uid:"))
+ uid = NULL;
+ nodes = webkit_dom_document_get_elements_by_class_name (
+ document, "-x-evolution-signature");
+ length = webkit_dom_node_list_get_length (nodes);
+ for (ii = 0; ii < length; ii++) {
+ WebKitDOMNode *node;
+ gchar *id;
+
+ node = webkit_dom_node_list_item (nodes, ii);
+ id = webkit_dom_html_element_get_id (WEBKIT_DOM_HTML_ELEMENT (node));
+ if (id && (strlen (id) == 1) && (*id == '1')) {
+ uid = webkit_dom_element_get_attribute (
+ WEBKIT_DOM_ELEMENT (node), "name");
+ g_free (id);
+ break;
+ }
+ g_free (id);
+ }
+ if (!uid) {
return;
+ }
// The combo box active ID is the signature's ESource UID.
- uid = e_composer_decode_clue_value (data + 4);
gtk_combo_box_set_active_id (GTK_COMBO_BOX (combo_box), uid);
g_free (uid);
- */
}
static void
@@ -4905,7 +4923,7 @@ void
e_msg_composer_reply_indent (EMsgComposer *composer)
{
/* FIXME WEBKIT We already have indentation implementation. Why
- * is this done?
+ * is this done?
GtkhtmlEditor *editor;
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index c48f966..d7c083c 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -47,6 +47,8 @@ struct _EEditorSelectionPrivate {
gchar *background_color;
gchar *font_color;
gchar *font_family;
+
+ gulong selection_offset;
};
G_DEFINE_TYPE (
@@ -1649,4 +1651,99 @@ e_editor_selection_wrap_lines (EEditorSelection *selection)
e_editor_selection_insert_html (selection, html);
g_free (html);
-}
\ No newline at end of file
+}
+
+void
+e_editor_selection_save (EEditorSelection* selection)
+{
+ WebKitDOMDocument *document;
+ WebKitDOMRange *range;
+ WebKitDOMNode *container, *split;
+ WebKitDOMElement *marker;
+
+
+ g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
+
+ document = webkit_web_view_get_dom_document (selection->priv->webview);
+
+ /* First remove all markers (if present) */
+ marker = webkit_dom_document_get_element_by_id (
+ document, "-x-evolution-selection-start-marker");
+ if (marker) {
+ webkit_dom_node_remove_child (
+ webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (marker)),
+ WEBKIT_DOM_NODE (marker), NULL);
+ }
+
+ marker = webkit_dom_document_get_element_by_id (
+ document, "-x-evolution-selection-end-marker");
+ if (marker) {
+ webkit_dom_node_remove_child (
+ webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (marker)),
+ WEBKIT_DOM_NODE (marker), NULL);
+ }
+
+ range = editor_selection_get_current_range (selection);
+
+ marker = webkit_dom_document_create_element (document, "SPAN", NULL);
+ webkit_dom_html_element_set_id (
+ WEBKIT_DOM_HTML_ELEMENT (marker), "-x-evolution-selection-start-marker");
+ container = webkit_dom_range_get_start_container (range, NULL);
+ if (!WEBKIT_DOM_IS_TEXT (container)) {
+ split = container;
+ } else {
+ split = WEBKIT_DOM_NODE (webkit_dom_text_split_text (
+ (WebKitDOMText *) container,
+ webkit_dom_range_get_start_offset (range, NULL),
+ NULL));
+ }
+ webkit_dom_node_insert_before (
+ webkit_dom_node_get_parent_node (container),
+ WEBKIT_DOM_NODE (marker), split, NULL);
+
+ marker = webkit_dom_document_create_element (document, "SPAN", NULL);
+ webkit_dom_html_element_set_id (
+ WEBKIT_DOM_HTML_ELEMENT (marker), "-x-evolution-selection-end-marker");
+ container = webkit_dom_range_get_end_container (range, NULL);
+ if (!WEBKIT_DOM_IS_TEXT (container)) {
+ split = container;
+ } else {
+ split = WEBKIT_DOM_NODE (webkit_dom_text_split_text (
+ (WebKitDOMText *) container,
+ webkit_dom_range_get_start_offset (range, NULL),
+ NULL));
+ }
+ webkit_dom_node_insert_before (
+ webkit_dom_node_get_parent_node (container),
+ WEBKIT_DOM_NODE (marker), split, NULL);
+}
+
+
+void
+e_editor_selection_restore (EEditorSelection* selection)
+{
+ WebKitDOMDocument *document;
+ WebKitDOMRange *range;
+ WebKitDOMElement *marker;
+
+ g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
+
+ document = webkit_web_view_get_dom_document (selection->priv->webview);
+ range = editor_selection_get_current_range (selection);
+
+ marker = webkit_dom_document_get_element_by_id (
+ document, "-x-evolution-selection-start-marker");
+ g_return_if_fail (marker != NULL);
+ webkit_dom_range_set_start_after (range, WEBKIT_DOM_NODE (marker), NULL);
+ webkit_dom_node_remove_child (
+ webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (marker)),
+ WEBKIT_DOM_NODE (marker), NULL);
+
+ marker = webkit_dom_document_get_element_by_id (
+ document, "-x-evolution-selection-end-marker");
+ g_return_if_fail (marker != NULL);
+ webkit_dom_range_set_end_before (range, WEBKIT_DOM_NODE (marker), NULL);
+ webkit_dom_node_remove_child (
+ webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (marker)),
+ WEBKIT_DOM_NODE (marker), NULL);
+}
diff --git a/e-util/e-editor-selection.h b/e-util/e-editor-selection.h
index c276cd3..93c41e4 100644
--- a/e-util/e-editor-selection.h
+++ b/e-util/e-editor-selection.h
@@ -206,6 +206,9 @@ void e_editor_selection_insert_text (EEditorSelection *selection,
const gchar *plain_text);
void e_editor_selection_wrap_lines (EEditorSelection *selection);
+void e_editor_selection_save (EEditorSelection *selection);
+void e_editor_selection_restore (EEditorSelection *selection);
+
G_END_DECLS
#endif /* E_EDITOR_SELECTION_H */
diff --git a/em-format/e-mail-formatter-quote-attachment.c b/em-format/e-mail-formatter-quote-attachment.c
index 1a6b194..08c8bf0 100644
--- a/em-format/e-mail-formatter-quote-attachment.c
+++ b/em-format/e-mail-formatter-quote-attachment.c
@@ -92,20 +92,13 @@ emfqe_attachment_format (EMailFormatterExtension *extension,
g_free (text);
camel_stream_write_string (
- stream,
- "<!--+GtkHTML:<DATA class=\"ClueFlow\" "
- "key=\"orig\" value=\"1\">-->\n"
- "<blockquote type=cite>\n", cancellable, NULL);
+ stream, "<blockquote type=cite>\n", cancellable, NULL);
e_mail_formatter_format_as (
formatter, context, attachment_view_part,
stream, NULL, cancellable);
- camel_stream_write_string (
- stream,
- "</blockquote><!--+GtkHTML:"
- "<DATA class=\"ClueFlow\" clear=\"orig\">-->",
- cancellable, NULL);
+ camel_stream_write_string (stream, "</blockquote>", cancellable, NULL);
g_object_unref (attachment_view_part);
diff --git a/em-format/e-mail-formatter-quote.c b/em-format/e-mail-formatter-quote.c
index 99c4de9..53ddbf0 100644
--- a/em-format/e-mail-formatter-quote.c
+++ b/em-format/e-mail-formatter-quote.c
@@ -93,8 +93,6 @@ mail_formatter_quote_run (EMailFormatter *formatter,
if (qf->priv->flags & E_MAIL_FORMATTER_QUOTE_FLAG_CITE) {
camel_stream_write_string (
stream,
- "<!--+GtkHTML:<DATA class=\"ClueFlow\" "
- "key=\"orig\" value=\"1\">-->\n"
"<blockquote type=cite>\n", cancellable, NULL);
}
@@ -134,9 +132,7 @@ mail_formatter_quote_run (EMailFormatter *formatter,
if (qf->priv->flags & E_MAIL_FORMATTER_QUOTE_FLAG_CITE) {
camel_stream_write_string (
- stream, "</blockquote><!--+GtkHTML:"
- "<DATA class=\"ClueFlow\" clear=\"orig\">-->",
- cancellable, NULL);
+ stream, "</blockquote>", cancellable, NULL);
}
}
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 0dc3729..eb5742c 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1684,7 +1684,7 @@ forward_non_attached (EMailBackend *backend,
forward = quoting_text (QUOTING_FORWARD);
text = em_utils_message_to_html (
CAMEL_SESSION (session), message,
- forward, flags, NULL, NULL, &validity_found);
+ forward, flags, NULL, NULL, NULL, &validity_found);
if (text != NULL) {
CamelDataWrapper *content;
@@ -2757,7 +2757,8 @@ composer_set_body (EMsgComposer *composer,
original = quoting_text (QUOTING_ORIGINAL);
text = em_utils_message_to_html (
session, message, original, E_MAIL_FORMATTER_QUOTE_FLAG_HEADERS,
- parts_list, start_bottom ? "<BR>" : NULL, &validity_found);
+ parts_list, "<span id=\"-x-evolution-reply-citation\">",
+ start_bottom ? "</span><br>" : "</span>", &validity_found);
e_msg_composer_set_body_text (composer, text, TRUE);
#if 0
has_body_text = text && *text;
@@ -2773,7 +2774,8 @@ composer_set_body (EMsgComposer *composer,
credits = attribution_format (message);
text = em_utils_message_to_html (
session, message, credits, E_MAIL_FORMATTER_QUOTE_FLAG_CITE,
- parts_list, start_bottom ? "<BR>" : NULL, &validity_found);
+ parts_list, "<span id=\"-x-evolution-reply-citation\">",
+ start_bottom ? "</span><br>" : "</span>", &validity_found);
g_free (credits);
e_msg_composer_set_body_text (composer, text, TRUE);
#if 0
@@ -2784,32 +2786,6 @@ composer_set_body (EMsgComposer *composer,
break;
}
- /* FIXME WEBKIT No signature yet...
- if (has_body_text && start_bottom) {
- GtkhtmlEditor *editor = GTKHTML_EDITOR (composer);
- gboolean move_cursor_to_end;
- gboolean top_signature;
-
- // If we are placing signature on top, then move cursor to the end,
- // otherwise try to find the signature place and place cursor just
- // before the signature. We added there an empty line already.
- gtkhtml_editor_run_command (editor, "block-selection");
- gtkhtml_editor_run_command (editor, "cursor-bod");
-
- top_signature = g_settings_get_boolean (settings, "composer-top-signature");
-
- move_cursor_to_end = top_signature ||
- !gtkhtml_editor_search_by_data (
- editor, 1, "ClueFlow", "signature", "1");
-
- if (move_cursor_to_end)
- gtkhtml_editor_run_command (editor, "cursor-eod");
- else
- gtkhtml_editor_run_command (editor, "selection-move-left");
- gtkhtml_editor_run_command (editor, "unblock-selection");
- }
- */
-
g_object_unref (settings);
g_object_unref (session);
@@ -2828,7 +2804,7 @@ em_utils_construct_composer_text (CamelSession *session,
credits = attribution_format (message);
text = em_utils_message_to_html (
session, message, credits, E_MAIL_FORMATTER_QUOTE_FLAG_CITE,
- parts_list, start_bottom ? "<BR>" : NULL, NULL);
+ parts_list, NULL, start_bottom ? "<BR>" : NULL, NULL);
g_free (credits);
return text;
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 749d3d1..bcb5784 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1196,6 +1196,7 @@ em_utils_message_to_html (CamelSession *session,
const gchar *credits,
guint32 flags,
EMailPartList *parts_list,
+ const gchar *prepend,
const gchar *append,
EMailPartValidityFlags *validity_found)
{
@@ -1272,6 +1273,9 @@ em_utils_message_to_html (CamelSession *session,
if (validity_found != NULL)
*validity_found = is_validity_found;
+ if (prepend != NULL && *prepend != '\0')
+ camel_stream_write_string (mem, prepend, NULL, NULL);
+
e_mail_formatter_format_sync (
formatter, parts_list, mem, 0,
E_MAIL_FORMATTER_MODE_PRINTING, NULL);
diff --git a/mail/em-utils.h b/mail/em-utils.h
index cb71f15..bfb3951 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -66,6 +66,7 @@ gchar * em_utils_message_to_html (CamelSession *session,
const gchar *credits,
guint32 flags,
struct _EMailPartList *parts_list,
+ const gchar *prepend,
const gchar *append,
EMailPartValidityFlags *validity_found);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]