[evolution] Bug #687442 - Magic spacebar avoids iTip formatter comment write



commit 94eb069ea357d00826c5a99a181f8a7fe86c15cd
Author: Milan Crha <mcrha redhat com>
Date:   Fri Nov 2 15:18:10 2012 +0100

    Bug #687442 - Magic spacebar avoids iTip formatter comment write

 modules/itip-formatter/itip-view.c       |   12 +++++-----
 modules/mail/e-mail-shell-view-private.c |   34 +++++++++++++++++++++++++++++-
 2 files changed, 39 insertions(+), 7 deletions(-)
---
diff --git a/modules/itip-formatter/itip-view.c b/modules/itip-formatter/itip-view.c
index 0b2565c..9bf9296 100644
--- a/modules/itip-formatter/itip-view.c
+++ b/modules/itip-formatter/itip-view.c
@@ -995,7 +995,7 @@ buttons_table_write_button (GString *buffer,
 
 	g_string_append_printf (
 		buffer,
-		"<td><button type=\"button\" name=\"%s\" value=\"%d\" id=\"%s\" accesskey=\"%s\" hidden>"
+		"<td><button type=\"button\" name=\"%s\" value=\"%d\" id=\"%s\" accesskey=\"%s\" hidden disabled>"
 		"<div><img src=\"gtk-stock://%s?size=%d\"> <span>%s</span></div>"
 		"</button></td>\n",
 		name, response, name, access_key ? access_key : "" , icon,
@@ -1019,7 +1019,7 @@ append_buttons_table (GString *buffer)
 
         /* Everything gets the open button */
 	buttons_table_write_button (
-		buffer, BUTTON_OPEN_CALENDAR, _("_Open Calendar"),
+		buffer, BUTTON_OPEN_CALENDAR, _("Ope_n Calendar"),
 		GTK_STOCK_JUMP_TO, ITIP_VIEW_RESPONSE_OPEN);
 	buttons_table_write_button (
 		buffer, BUTTON_DECLINE_ALL, _("_Decline all"),
@@ -1034,13 +1034,13 @@ append_buttons_table (GString *buffer)
 		buffer, BUTTON_TENTATIVE, _("_Tentative"),
 		GTK_STOCK_DIALOG_QUESTION, ITIP_VIEW_RESPONSE_TENTATIVE);
 	buttons_table_write_button (
-		buffer, BUTTON_ACCEPT_ALL, _("A_ccept all"),
+		buffer, BUTTON_ACCEPT_ALL, _("Acce_pt all"),
 		GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT);
 	buttons_table_write_button (
-		buffer, BUTTON_ACCEPT, _("A_ccept"),
+		buffer, BUTTON_ACCEPT, _("Acce_pt"),
 		GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT);
 	buttons_table_write_button (
-		buffer, BUTTON_SEND_INFORMATION, _("_Send Information"),
+		buffer, BUTTON_SEND_INFORMATION, _("Send _Information"),
 		GTK_STOCK_REFRESH, ITIP_VIEW_RESPONSE_REFRESH);
 	buttons_table_write_button (
 		buffer, BUTTON_UPDATE_ATTENDEE_STATUS, _("_Update Attendee Status"),
@@ -3091,7 +3091,7 @@ itip_view_set_error (ItipView *view,
 			"<tr width=\"100%\" id=\"" TABLE_ROW_BUTTONS "\">");
 
 		buttons_table_write_button (
-			str, BUTTON_SAVE, _("_Save"),
+			str, BUTTON_SAVE, _("Sa_ve"),
 			GTK_STOCK_SAVE, ITIP_VIEW_RESPONSE_SAVE);
 
 		g_string_append (str, "</tr></table>");
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index f51f8f1..6cf83b9 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -262,12 +262,16 @@ mail_shell_view_key_press_event_cb (EMailShellView *mail_shell_view,
 {
 	EShellView *shell_view;
 	EShellWindow *shell_window;
+	EShellContent *shell_content;
+	EMailView *mail_view;
+	EMailReader *reader;
+	EMailDisplay *mail_display;
 	GtkAction *action;
 
 	shell_view = E_SHELL_VIEW (mail_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
 
-	if ((event->state & GDK_CONTROL_MASK) != 0)
+	if ((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)) != 0)
 		return FALSE;
 
 	switch (event->keyval) {
@@ -283,6 +287,34 @@ mail_shell_view_key_press_event_cb (EMailShellView *mail_shell_view,
 			return FALSE;
 	}
 
+	shell_content = e_shell_view_get_shell_content (shell_view);
+	mail_view = e_mail_shell_content_get_mail_view (E_MAIL_SHELL_CONTENT (shell_content));
+	reader = E_MAIL_READER (mail_view);
+	mail_display = e_mail_reader_get_mail_display (reader);
+
+	if (gtk_widget_has_focus (GTK_WIDGET (mail_display))) {
+		WebKitWebFrame *frame;
+		WebKitDOMDocument *dom;
+		WebKitDOMElement *element;
+		gchar *name = NULL;
+
+		frame = webkit_web_view_get_focused_frame (WEBKIT_WEB_VIEW (mail_display));
+		dom = webkit_web_frame_get_dom_document (frame);
+		/* intentionally used "static_cast" */
+		element = webkit_dom_html_document_get_active_element ((WebKitDOMHTMLDocument *) dom);
+
+		if (element)
+			name = webkit_dom_node_get_node_name (WEBKIT_DOM_NODE (element));
+
+		/* if INPUT or TEXTAREA has focus, then any key press should go there */
+		if (name && (g_ascii_strcasecmp (name, "INPUT") == 0 || g_ascii_strcasecmp (name, "TEXTAREA") == 0)) {
+			g_free (name);
+			return FALSE;
+		}
+
+		g_free (name);
+	}
+
 	gtk_action_activate (action);
 
 	return TRUE;



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