[evolution/wip/webkit2] Bug 758383 - Composer should save both HTML and text when saving drafts
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Bug 758383 - Composer should save both HTML and text when saving drafts
- Date: Wed, 2 Mar 2016 17:54:03 +0000 (UTC)
commit 84e7f168027f5c8b8e7354344b53c90fccb0c7f0
Author: Tomas Popela <tpopela redhat com>
Date: Wed Mar 2 17:59:54 2016 +0100
Bug 758383 - Composer should save both HTML and text when saving drafts
composer/e-msg-composer.c | 82 +++++++++++++++++++-------------------------
1 files changed, 35 insertions(+), 47 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index c87a866..adcefd9 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1232,50 +1232,6 @@ composer_build_message (EMsgComposer *composer,
g_free (encoded_organization);
}
- if (flags & COMPOSER_FLAG_SAVE_DRAFT) {
- gboolean selection_saved;
- gchar *text;
- EHTMLEditor *editor;
- EHTMLEditorView *view;
-
- editor = e_msg_composer_get_editor (composer);
- view = e_html_editor_get_view (editor);
-
- /* X-Evolution-Format */
- composer_add_evolution_format_header (
- CAMEL_MEDIUM (context->message), flags);
-
- /* X-Evolution-Composer-Mode */
- composer_add_evolution_composer_mode_header (
- CAMEL_MEDIUM (context->message), composer);
-
- data = g_byte_array_new ();
-
- e_html_editor_view_embed_styles (view);
- selection_saved = e_html_editor_view_is_selection_saved (view);
- if (!selection_saved)
- e_html_editor_view_save_selection (view);
-
- text = e_html_editor_view_get_text_html_for_drafts (view);
-
- e_html_editor_view_remove_embed_styles (view);
- e_html_editor_view_restore_selection (view);
- e_html_editor_view_force_spell_check (view);
-
- if (selection_saved)
- e_html_editor_view_save_selection (view);
-
- g_byte_array_append (data, (guint8 *) text, strlen (text));
-
- g_free (text);
-
- type = camel_content_type_new ("text", "html");
- camel_content_type_set_param (type, "charset", "utf-8");
- iconv_charset = camel_iconv_charset_name ("utf-8");
-
- goto wrap_drafts_html;
- }
-
/* Build the text/plain part. */
if (priv->mime_body) {
@@ -1321,7 +1277,6 @@ composer_build_message (EMsgComposer *composer,
}
}
- wrap_drafts_html:
mem_stream = camel_stream_mem_new_with_byte_array (data);
stream = camel_stream_filter_new (mem_stream);
g_object_unref (mem_stream);
@@ -1382,8 +1337,41 @@ composer_build_message (EMsgComposer *composer,
view = e_html_editor_get_view (editor);
data = g_byte_array_new ();
- text = e_html_editor_view_get_text_html (view, from_domain, &inline_images);
- length = strlen (text);
+ if ((flags & COMPOSER_FLAG_SAVE_DRAFT) != 0) {
+ gboolean selection_saved;
+ EHTMLEditor *editor;
+ EHTMLEditorView *html_view;
+
+ editor = e_msg_composer_get_editor (composer);
+ html_view = e_html_editor_get_view (editor);
+
+ /* X-Evolution-Format */
+ composer_add_evolution_format_header (
+ CAMEL_MEDIUM (context->message), flags);
+
+ /* X-Evolution-Composer-Mode */
+ composer_add_evolution_composer_mode_header (
+ CAMEL_MEDIUM (context->message), composer);
+
+ e_html_editor_view_embed_styles (html_view);
+ selection_saved = e_html_editor_view_is_selection_saved (html_view);
+ if (!selection_saved)
+ e_html_editor_view_save_selection (html_view);
+
+ text = e_html_editor_view_get_text_html_for_drafts (html_view);
+
+ e_html_editor_view_remove_embed_styles (html_view);
+ e_html_editor_view_restore_selection (html_view);
+ e_html_editor_view_force_spell_check (html_view);
+
+ if (selection_saved)
+ e_html_editor_view_save_selection (html_view);
+
+ length = strlen (text);
+ } else {
+ text = e_html_editor_view_get_text_html (view, from_domain, &inline_images);
+ length = strlen (text);
+ }
g_byte_array_append (data, (guint8 *) text, (guint) length);
pre_encode = text_requires_quoted_printable (text, length);
g_free (text);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]