[evolution/wip/webkit2] EHTMLEditorActions - Actions from context menu don't work



commit 5804261b87051a5eacd32ed9aaf4216aed256255
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Mar 2 09:10:03 2015 +0100

    EHTMLEditorActions - Actions from context menu don't work
    
    When the context menu is activated the view itself loses the focus, so
    we can't check if the view is focused before doing the action
    
    Conflicts:
        e-util/e-html-editor-actions.c

 e-util/e-html-editor-actions.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/e-util/e-html-editor-actions.c b/e-util/e-html-editor-actions.c
index 5c77516..7dd4e11 100644
--- a/e-util/e-html-editor-actions.c
+++ b/e-util/e-html-editor-actions.c
@@ -253,9 +253,8 @@ action_copy_cb (GtkAction *action,
 {
        EHTMLEditorView *view = e_html_editor_get_view (editor);
 
-       if (gtk_widget_has_focus (GTK_WIDGET (view)))
-               webkit_web_view_execute_editing_command (
-                       WEBKIT_WEB_VIEW (view), WEBKIT_EDITING_COMMAND_COPY);
+       webkit_web_view_execute_editing_command (
+               WEBKIT_WEB_VIEW (view), WEBKIT_EDITING_COMMAND_COPY);
 }
 
 static void
@@ -264,9 +263,11 @@ action_cut_cb (GtkAction *action,
 {
        EHTMLEditorView *view = e_html_editor_get_view (editor);
 
-       if (gtk_widget_has_focus (GTK_WIDGET (view)))
-               webkit_web_view_execute_editing_command (
-                       WEBKIT_WEB_VIEW (view), WEBKIT_EDITING_COMMAND_CUT);
+       if (!gtk_widget_has_focus (GTK_WIDGET (view)))
+               gtk_widget_grab_focus (GTK_WIDGET (view));
+
+       webkit_web_view_execute_editing_command (
+               WEBKIT_WEB_VIEW (view), WEBKIT_EDITING_COMMAND_CUT);
 }
 
 static void
@@ -531,10 +532,9 @@ action_paste_cb (GtkAction *action,
 {
        EHTMLEditorView *view = e_html_editor_get_view (editor);
 
-       /* Only paste if WebView is focused. */
-       if (gtk_widget_has_focus (GTK_WIDGET (view)))
-               webkit_web_view_execute_editing_command (
-                       WEBKIT_WEB_VIEW (view), WEBKIT_EDITING_COMMAND_PASTE);
+       webkit_web_view_execute_editing_command (
+               WEBKIT_WEB_VIEW (view), WEBKIT_EDITING_COMMAND_PASTE);
+       e_html_editor_view_force_spell_check (view);
 }
 
 static void


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