[evolution] Bug 731507 - [webkit-composer] paste does not work, shift-ins or CTRL-V works



commit 04bdc935dfa2df5006ca2d8f19b4aa83901506f1
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Jun 25 11:41:04 2014 +0200

    Bug 731507 - [webkit-composer] paste does not work, shift-ins or CTRL-V works
    
    Together with previous commit that removes the usage of deprecated
    gtk-stock items and unregistering the Ctrl+v shorcut this solves the
    issue. When the action is triggered and WebView doesn't have focus we have
    to focus it to insert the clipboard content there.

 composer/e-msg-composer.c      |    6 ++++--
 e-util/e-html-editor-actions.c |   20 +++++++++-----------
 2 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index b81a764..2489a2e 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -2422,8 +2422,10 @@ msg_composer_key_press_event (GtkWidget *widget,
                        return TRUE;
                }
 
-               if (((event)->state & GDK_SHIFT_MASK) &&
-                   ((event)->keyval == GDK_KEY_Insert)) {
+               if ((((event)->state & GDK_SHIFT_MASK) &&
+                   ((event)->keyval == GDK_KEY_Insert)) ||
+                   (((event)->state & GDK_CONTROL_MASK) &&
+                   ((event)->keyval == GDK_KEY_v))) {
                        g_signal_emit_by_name (
                                WEBKIT_WEB_VIEW (view), "paste-clipboard");
                        return TRUE;
diff --git a/e-util/e-html-editor-actions.c b/e-util/e-html-editor-actions.c
index 94f2493..4d1751e 100644
--- a/e-util/e-html-editor-actions.c
+++ b/e-util/e-html-editor-actions.c
@@ -696,24 +696,22 @@ action_paste_cb (GtkAction *action,
 {
        EHTMLEditorView *view = e_html_editor_get_view (editor);
 
-       /* Paste only if WebView has focus */
-       if (gtk_widget_has_focus (GTK_WIDGET (view))) {
-               webkit_web_view_paste_clipboard (
-                       WEBKIT_WEB_VIEW (view));
+       /* If WebView doesn't have focus, focus it */
+       if (gtk_widget_has_focus (GTK_WIDGET (view)))
+               gtk_widget_grab_focus (GTK_WIDGET (view));
 
-               e_html_editor_view_force_spell_check (view);
-       }
+       webkit_web_view_paste_clipboard (WEBKIT_WEB_VIEW (view));
+       e_html_editor_view_force_spell_check (view);
 }
 
 static void
 action_paste_quote_cb (GtkAction *action,
                        EHTMLEditor *editor)
 {
-       e_html_editor_view_paste_clipboard_quoted (
-               e_html_editor_get_view (editor));
+       EHTMLEditorView *view = e_html_editor_get_view (editor);
 
-       e_html_editor_view_force_spell_check (
-               e_html_editor_get_view (editor));
+       e_html_editor_view_paste_clipboard_quoted (view);
+       e_html_editor_view_force_spell_check (view);
 }
 
 static void
@@ -961,7 +959,7 @@ static GtkActionEntry core_entries[] = {
        { "paste",
          "edit-paste",
          N_("_Paste"),
-         "<Control>v",
+         NULL, /* Widgets are treating Ctrl + v shortcut themselves */
          N_("Paste text from the clipboard"),
          G_CALLBACK (action_paste_cb) },
 


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