diff options
author | Milan Crha <mcrha@redhat.com> | 2009-04-27 17:52:30 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-04-28 20:06:00 +0800 |
commit | e887df9a554e452c7c1bb2bae3739cb43ddf73bc (patch) | |
tree | 53814d7dd5c4f6d482253be4dbf00a9a89ed4877 /composer | |
parent | 3e2ea94186a231bfdd2f3cb33085b8442a7b6b1e (diff) | |
download | gsoc2013-evolution-e887df9a554e452c7c1bb2bae3739cb43ddf73bc.tar gsoc2013-evolution-e887df9a554e452c7c1bb2bae3739cb43ddf73bc.tar.gz gsoc2013-evolution-e887df9a554e452c7c1bb2bae3739cb43ddf73bc.tar.bz2 gsoc2013-evolution-e887df9a554e452c7c1bb2bae3739cb43ddf73bc.tar.lz gsoc2013-evolution-e887df9a554e452c7c1bb2bae3739cb43ddf73bc.tar.xz gsoc2013-evolution-e887df9a554e452c7c1bb2bae3739cb43ddf73bc.tar.zst gsoc2013-evolution-e887df9a554e452c7c1bb2bae3739cb43ddf73bc.zip |
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.
Diffstat (limited to 'composer')
-rw-r--r-- | composer/ChangeLog | 10 | ||||
-rw-r--r-- | 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 <mcrha@redhat.com> + + ** 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 <mcrha@redhat.com> ** 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 \ + "<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature\" value=\"1\">-->" \ + "<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature_name\" value=\"uid:Noname\">--><BR>" static gchar * get_signature_html (EMsgComposer *composer) @@ -1105,14 +1108,15 @@ get_signature_html (EMsgComposer *composer) */ html = g_strdup_printf ("<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature\" value=\"1\">-->" "<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature_name\" value=\"uid:%s\">-->" - "<TABLE WIDTH=\"100%%\" CELLSPACING=\"0\" CELLPADDING=\"0\"><TR><TD>" + "<TABLE WIDTH=\"100%%\" CELLSPACING=\"0\" CELLPADDING=\"0\"><TR><TD><BR>" "%s%s%s%s" - "</TD></TR></TABLE>", + "%s</TD></TR></TABLE>", encoded_uid ? encoded_uid : "", format_html ? "" : "<PRE>\n", format_html || (!strncmp ("-- \n", text, 4) || strstr (text, "\n-- \n")) ? "" : "-- \n", text, - format_html ? "" : "</PRE>\n"); + format_html ? "" : "</PRE>\n", + is_top_signature () ? "<BR>" : ""); g_free (text); g_free (encoded_uid); text = html; @@ -1176,12 +1180,13 @@ set_editor_text (EMsgComposer *composer, "<TABLE WIDTH=\"100%%\" CELLSPACING=\"0\" CELLPADDING=\"0\"><TR><TD> </TD></TR></TABLE>%s", text); } } else { - body = g_strdup (text); + /* no marker => to the bottom */ + body = g_strdup_printf ("%s<BR>", 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); |