From e887df9a554e452c7c1bb2bae3739cb43ddf73bc Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 27 Apr 2009 11:52:30 +0200 Subject: Do not delete text lines on signature set in composer ** Fix for bug #553535 * e-msg-composer.c: (is_top_signature), (get_signature_html), (set_editor_text), (e_msg_composer_show_sig_file): Do not eat lines of text when changing signature at top of the message. Add one extra empty line between the signature and the body of the mail when placing signature to the bottom. --- composer/ChangeLog | 10 ++++++++++ composer/e-msg-composer.c | 23 ++++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index 9f1f34f09e..5a38c77178 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,13 @@ +2009-04-27 Milan Crha + + ** Fix for bug #553535 + + * e-msg-composer.c: (is_top_signature), (get_signature_html), + (set_editor_text), (e_msg_composer_show_sig_file): Do not eat + lines of text when changing signature at top of the message. + Add one extra empty line between the signature and the body + of the mail when placing signature to the bottom. + 2009-03-19 Milan Crha ** Fix for bug #574680 diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 927c08aae3..4e1cb626ee 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1034,6 +1034,9 @@ decode_signature_name (const gchar *name) } #define CONVERT_SPACES CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES +#define NO_SIGNATURE_TEXT \ + "" \ + "
" static gchar * get_signature_html (EMsgComposer *composer) @@ -1105,14 +1108,15 @@ get_signature_html (EMsgComposer *composer) */ html = g_strdup_printf ("" "" - "
" + "

" "%s%s%s%s" - "
", + "%s
", encoded_uid ? encoded_uid : "", format_html ? "" : "
\n",
 					format_html || (!strncmp ("-- \n", text, 4) || strstr (text, "\n-- \n")) ? "" : "-- \n",
 					text,
-					format_html ? "" : "
\n"); + format_html ? "" : "\n", + is_top_signature () ? "
" : ""); g_free (text); g_free (encoded_uid); text = html; @@ -1176,12 +1180,13 @@ set_editor_text (EMsgComposer *composer, "
%s", text); } } else { - body = g_strdup (text); + /* no marker => to the bottom */ + body = g_strdup_printf ("%s
", text); } gtkhtml_editor_set_text_html (GTKHTML_EDITOR (composer), body, -1); - if (set_signature && !reply_signature_on_top) + if (set_signature) e_msg_composer_show_sig_file (composer); } @@ -3969,6 +3974,7 @@ e_msg_composer_show_sig_file (EMsgComposer *composer) GtkhtmlEditor *editor; GtkHTML *html; gchar *html_text; + gboolean top_signature; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); @@ -3995,6 +4001,8 @@ e_msg_composer_show_sig_file (EMsgComposer *composer) } gtkhtml_editor_run_command (editor, "unblock-selection"); + top_signature = is_top_signature (); + html_text = get_signature_html (composer); if (html_text) { gtkhtml_editor_run_command (editor, "insert-paragraph"); @@ -4002,11 +4010,16 @@ e_msg_composer_show_sig_file (EMsgComposer *composer) gtkhtml_editor_run_command (editor, "insert-paragraph"); else gtkhtml_editor_run_command (editor, "cursor-forward"); + 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_text); g_free (html_text); + } else if (top_signature) { + /* insert paragraph after the signature ClueFlow things */ + gtkhtml_editor_run_command (editor, "cursor-forward"); + gtkhtml_editor_run_command (editor, "insert-paragraph"); } gtkhtml_editor_undo_end (editor); -- cgit v1.2.3