[evolution/wip/webkit-composer] EComposerPrivate: Quote composer content just in HTML mode



commit 32665b3e6f163f9af9a61472775d54129a89d11b
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Feb 6 09:40:01 2014 +0100

    EComposerPrivate: Quote composer content just in HTML mode

 composer/e-composer-private.c |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index d58180d..16706e1 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -794,22 +794,18 @@ insert_paragraph_with_input (WebKitDOMElement *paragraph,
 static void
 composer_move_caret (EMsgComposer *composer)
 {
-       GSettings *settings;
-       gboolean start_bottom;
-       gboolean top_signature;
-       gboolean has_paragraphs_in_body = TRUE;
        EEditor *editor;
        EEditorWidget *editor_widget;
        EEditorSelection *editor_selection;
+       GSettings *settings;
+       gboolean start_bottom, html_mode, top_signature;
+       gboolean has_paragraphs_in_body = TRUE;
        WebKitDOMDocument *document;
        WebKitDOMDOMWindow *window;
        WebKitDOMDOMSelection *dom_selection;
-       WebKitDOMElement *input_start;
-       WebKitDOMElement *element;
-       WebKitDOMElement *signature;
+       WebKitDOMElement *input_start, *element, *signature;
        WebKitDOMHTMLElement *body;
-       WebKitDOMNodeList *list;
-       WebKitDOMNodeList *blockquotes;
+       WebKitDOMNodeList *list, *blockquotes;
        WebKitDOMRange *new_range;
 
        /* When there is an option composer-reply-start-bottom set we have
@@ -826,6 +822,7 @@ composer_move_caret (EMsgComposer *composer)
        editor = e_msg_composer_get_editor (composer);
        editor_widget = e_editor_get_editor_widget (editor);
        editor_selection = e_editor_widget_get_selection (editor_widget);
+       html_mode = e_editor_widget_get_html_mode (editor_widget);
 
        document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (editor_widget));
        window = webkit_dom_document_get_default_view (document);
@@ -841,7 +838,7 @@ composer_move_caret (EMsgComposer *composer)
                /* We want to force spellcheck just in case that we switched to plain
                 * text mode (when switching to html mode, the underlined words are
                 * preserved */
-               if (!e_editor_widget_get_html_mode (editor_widget))
+               if (!html_mode)
                        e_editor_widget_force_spellcheck (editor_widget);
                return;
        }
@@ -849,7 +846,8 @@ composer_move_caret (EMsgComposer *composer)
        /* If editing message as new don't handle with caret */
        if (composer->priv->is_from_message) {
                e_editor_selection_restore_caret_position (editor_selection);
-               e_editor_widget_quote_plain_text (editor_widget);
+               if (!html_mode)
+                       e_editor_widget_quote_plain_text (editor_widget);
                e_editor_widget_force_spellcheck (editor_widget);
 
                return;
@@ -899,7 +897,8 @@ composer_move_caret (EMsgComposer *composer)
                        }
 
                        e_editor_selection_restore_caret_position (editor_selection);
-                       e_editor_widget_quote_plain_text (editor_widget);
+                       if (!html_mode)
+                               e_editor_widget_quote_plain_text (editor_widget);
                        e_editor_widget_force_spellcheck (editor_widget);
 
                        input_start = webkit_dom_document_get_element_by_id (document, "-x-evo-input-start");
@@ -929,7 +928,7 @@ composer_move_caret (EMsgComposer *composer)
                                element, WEBKIT_DOM_ELEMENT (body));
 
                        if (webkit_dom_node_list_get_length (blockquotes) != 0) {
-                               if (!e_editor_widget_get_html_mode (editor_widget)) {
+                               if (!html_mode) {
                                        WebKitDOMNode *blockquote;
 
                                        blockquote = webkit_dom_node_list_item (blockquotes, 0);
@@ -941,9 +940,9 @@ composer_move_caret (EMsgComposer *composer)
 
                                        e_editor_selection_restore_caret_position (editor_selection);
                                        e_editor_widget_quote_plain_text (editor_widget);
-                                       e_editor_widget_force_spellcheck (editor_widget);
                                        body = webkit_dom_document_get_body (document);
                                }
+                               e_editor_widget_force_spellcheck (editor_widget);
                        }
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]