diff options
author | Milan Crha <mcrha@redhat.com> | 2008-06-09 19:09:01 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-06-09 19:09:01 +0800 |
commit | 22dc0c949c909394889c9b56d63240ad271eb3f8 (patch) | |
tree | c66112101dc8756973eba70b241218e4ca590c47 | |
parent | f1cfc8c031380ebd6f4c5fcd681ba1cc4e77f967 (diff) | |
download | gsoc2013-evolution-22dc0c949c909394889c9b56d63240ad271eb3f8.tar gsoc2013-evolution-22dc0c949c909394889c9b56d63240ad271eb3f8.tar.gz gsoc2013-evolution-22dc0c949c909394889c9b56d63240ad271eb3f8.tar.bz2 gsoc2013-evolution-22dc0c949c909394889c9b56d63240ad271eb3f8.tar.lz gsoc2013-evolution-22dc0c949c909394889c9b56d63240ad271eb3f8.tar.xz 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
-rw-r--r-- | mail/ChangeLog | 13 | ||||
-rw-r--r-- | mail/em-composer-prefs.c | 6 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 26 | ||||
-rw-r--r-- | mail/em-utils.c | 6 | ||||
-rw-r--r-- | mail/em-utils.h | 2 | ||||
-rw-r--r-- | mail/mail-config.glade | 19 |
6 files changed, 66 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 5a1331c77c..88ebea6dc9 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,18 @@ 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. + +2008-06-09 Milan Crha <mcrha@redhat.com> + ** Fix for bug #201011 * em-filter-editor.c: (em_filter_editor_construct): diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c index 41975589ef..87cdd0d4de 100644 --- a/mail/em-composer-prefs.c +++ b/mail/em-composer-prefs.c @@ -939,6 +939,12 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) gtk_widget_set_sensitive (widget, FALSE); gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + key = "/apps/evolution/mail/composer/reply_start_bottom"; + widget = glade_xml_get_widget (gui, "chkReplyStartBottom"); + if (!gconf_client_key_is_writable (client, key, NULL)) + gtk_widget_set_sensitive (widget, FALSE); + gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + key = "/apps/evolution/mail/composer/top_signature"; widget = glade_xml_get_widget (gui, "chkTopSignature"); if (!gconf_client_key_is_writable (client, key, NULL)) 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 { diff --git a/mail/em-utils.c b/mail/em-utils.c index 799ff9c339..50b56aa453 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1645,6 +1645,7 @@ em_utils_part_to_html(CamelMimePart *part, ssize_t *len, EMFormat *source) * @flags: EMFormatQuote flags * @len: * @source: + * @append: Text to append, can be NULL. * * Convert a message to html, quoting if the @credits attribution * string is given. @@ -1652,7 +1653,7 @@ em_utils_part_to_html(CamelMimePart *part, ssize_t *len, EMFormat *source) * Return value: The html version. **/ char * -em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 flags, ssize_t *len, EMFormat *source) +em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 flags, ssize_t *len, EMFormat *source, const char *append) { EMFormatQuote *emfq; CamelStreamMem *mem; @@ -1682,6 +1683,9 @@ em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 em_format_format_clone((EMFormat *)emfq, NULL, NULL, message, source); g_object_unref (emfq); + if (append && *append) + camel_stream_write ((CamelStream*)mem, append, strlen (append)); + camel_stream_write((CamelStream *)mem, "", 1); camel_object_unref(mem); diff --git a/mail/em-utils.h b/mail/em-utils.h index 8f2cc83985..6e5733eaef 100644 --- a/mail/em-utils.h +++ b/mail/em-utils.h @@ -91,7 +91,7 @@ char *em_utils_get_proxy_uri(void); /* FIXME: should this have an override charset? */ char *em_utils_part_to_html(struct _CamelMimePart *part, ssize_t *len, struct _EMFormat *source); -char *em_utils_message_to_html(struct _CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len, struct _EMFormat *source); +char *em_utils_message_to_html(struct _CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len, struct _EMFormat *source, const char *append); void em_utils_expunge_folder (struct _GtkWidget *parent, struct _CamelFolder *folder); void em_utils_empty_trash (struct _GtkWidget *parent); diff --git a/mail/mail-config.glade b/mail/mail-config.glade index f73eaae09c..867f786f9f 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -7105,6 +7105,25 @@ For example: "Work" or "Personal"</property> </child> <child> + <widget class="GtkCheckButton" id="chkReplyStartBottom"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Start _typing at the bottom on replying</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> <widget class="GtkTable" id="tableForwardsReplies"> <property name="visible">True</property> <property name="n_rows">3</property> |