aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-composer-utils.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-06-09 19:09:01 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-06-09 19:09:01 +0800
commit22dc0c949c909394889c9b56d63240ad271eb3f8 (patch)
treec66112101dc8756973eba70b241218e4ca590c47 /mail/em-composer-utils.c
parentf1cfc8c031380ebd6f4c5fcd681ba1cc4e77f967 (diff)
downloadgsoc2013-evolution-22dc0c949c909394889c9b56d63240ad271eb3f8.tar.gz
gsoc2013-evolution-22dc0c949c909394889c9b56d63240ad271eb3f8.tar.zst
gsoc2013-evolution-22dc0c949c909394889c9b56d63240ad271eb3f8.zip
** Fix for bug #535791
2008-06-09 Milan Crha <mcrha@redhat.com> ** Fix for bug #535791 * mail-config.glade: * em-composer-prefs.c: (em_composer_prefs_construct): New UI option to let uset choose whether start typing at the bottom of the document or not on replying. * em-utils.h: (em_utils_message_to_html): * em-utils.c: (em_utils_message_to_html): * em-composer-utils.c: (forward_non_attached), (composer_set_body): Take care of /apps/evolution/mail/composer/reply_start_bottom. svn path=/trunk/; revision=35621
Diffstat (limited to 'mail/em-composer-utils.c')
-rw-r--r--mail/em-composer-utils.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 90b2b579be..ef72fd6e4a 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1005,7 +1005,7 @@ forward_non_attached (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages,
message = messages->pdata[i];
subject = mail_tool_generate_forward_subject (message);
- text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len, NULL);
+ text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len, NULL, NULL);
if (text) {
composer = create_new_composer (subject, fromuri, !uids || !uids->pdata [i]);
@@ -1990,9 +1990,11 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat *
char *text, *credits;
CamelMimePart *part;
GConfClient *gconf;
- ssize_t len;
+ ssize_t len = 0;
+ gboolean start_bottom;
gconf = mail_config_get_gconf_client ();
+ start_bottom = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/reply_start_bottom", NULL);
switch (gconf_client_get_int (gconf, "/apps/evolution/mail/format/reply_style", NULL)) {
case MAIL_CONFIG_REPLY_DO_NOT_QUOTE:
@@ -2005,7 +2007,7 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat *
camel_object_unref (part);
break;
case MAIL_CONFIG_REPLY_OUTLOOK:
- text = em_utils_message_to_html(message, _("-----Original Message-----"), EM_FORMAT_QUOTE_HEADERS, &len, source);
+ text = em_utils_message_to_html (message, _("-----Original Message-----"), EM_FORMAT_QUOTE_HEADERS, &len, source, start_bottom ? "<BR>" : NULL);
e_msg_composer_set_body_text(composer, text, len);
g_free (text);
break;
@@ -2014,12 +2016,28 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat *
default:
/* do what any sane user would want when replying... */
credits = attribution_format (ATTRIBUTION, message);
- text = em_utils_message_to_html(message, credits, EM_FORMAT_QUOTE_CITE, &len, source);
+ text = em_utils_message_to_html (message, credits, EM_FORMAT_QUOTE_CITE, &len, source, start_bottom ? "<BR>" : NULL);
g_free (credits);
e_msg_composer_set_body_text(composer, text, len);
g_free (text);
break;
}
+
+ if (len > 0 && start_bottom) {
+ GtkhtmlEditor *editor = GTKHTML_EDITOR (composer);
+
+ /* 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");
+ if (gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/top_signature", NULL)
+ || !gtkhtml_editor_search_by_data (editor, 1, "ClueFlow", "signature", "1"))
+ gtkhtml_editor_run_command (editor, "cursor-eod");
+ else
+ gtkhtml_editor_run_command (editor, "selection-move-left");
+ gtkhtml_editor_run_command (editor, "unblock-selection");
+ }
}
struct _reply_data {