Re: [evolution-patches] Addressbook patch to fix #55056 (Summary:keyboard navigation is disable )



Hi, Chris

Thank you for your  review my patch.
I have used the new function (eab_editor_raise) to instead of the old
functions.

Would you like to spend a little time to review it again?

Best regards
Hao.sheng



Chris Toshok wrote:

This actually doesn't compile against HEAD anymore.

I added in the EABEditor superclass for both EContactEditor and
EContactListEditor, which defines eab_editor_raise.  You should use this
instead of calling each of the (now removed)
e_contact{_list}_editor_raise functions.

Chris

On Sun, 2004-03-28 at 16:20 -0500, sh wrote:
Hi,
This patch is aimed for Head.

Fix the Bug #55056 on http://bugzilla.ximian.com.
(Summary: keyboard navigation is disable )
Attach is a patch to fix that.Would you like to spend a little time to review it?

Best regards
hao.sheng



Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1630
diff -u -r1.1630 ChangeLog
--- ChangeLog	31 Mar 2004 03:36:50 -0000	1.1630
+++ ChangeLog	31 Mar 2004 09:38:44 -0000
@@ -1,3 +1,12 @@
+2004-03-31  Hao Sheng  <hao sheng sun com>
+
+	* gui/widgets/e-minicard.c :
+	(e_minicard_event) : implement keyboard navigation(TAB/shift+TAB)
+	(activaite_editor) : add a new function to activiate contact editor
+	for support "Enter" key
+
+	Fixes #55056
+
 2004-03-30  Chris Toshok  <toshok ximian com>
 
 	[ fixes bug #34777 ]
Index: gui/widgets/e-minicard.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard.c,v
retrieving revision 1.112
diff -u -r1.112 e-minicard.c
--- gui/widgets/e-minicard.c	24 Mar 2004 20:18:49 -0000	1.112
+++ gui/widgets/e-minicard.c	31 Mar 2004 09:38:44 -0000
@@ -519,6 +519,46 @@
 }
 
 static gboolean
+activiate_editor(GnomeCanvasItem *item)
+{
+	EMinicard *e_minicard;
+	e_minicard = E_MINICARD (item);
+
+	if (e_minicard->editor) {
+		 eab_editor_raise (e_minicard->editor);
+	} else {
+		EBook *book = NULL;
+		if (E_IS_MINICARD_VIEW(item->parent)) {
+			g_object_get(item->parent, "book", &book, NULL);
+		}
+                                
+		if (book != NULL) {
+			if (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)) {
+				EContactListEditor *editor = eab_show_contact_list_editor (book, e_minicard->contact,
+											   FALSE, e_minicard->editable);
+				e_minicard->editor = G_OBJECT (editor);
+			}
+			else {
+				EContactEditor *editor = eab_show_contact_editor (book, e_minicard->contact,
+										  FALSE, e_minicard->editable);
+				e_minicard->editor = G_OBJECT (editor);
+			}
+			g_object_ref (e_minicard->editor);
+
+			g_signal_connect (e_minicard->editor, "editor_closed",
+					  G_CALLBACK (editor_closed_cb), e_minicard);
+
+			g_object_unref (book);
+		}
+	}
+
+	return TRUE;
+}
+
+
+
+
+static gboolean
 e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
 {
 	EMinicard *e_minicard;
@@ -601,38 +641,63 @@
 		break;
 	case GDK_2BUTTON_PRESS:
 		if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) {
-			if (e_minicard->editor) {
-				eab_editor_raise (e_minicard->editor);
-			} else {
-				EBook *book = NULL;
-				if (E_IS_MINICARD_VIEW(item->parent)) {
-					g_object_get(item->parent,
-						     "book", &book,
-						     NULL);
-				}
-
-				if (book != NULL) {
-					if (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)) {
-						EContactListEditor *editor = eab_show_contact_list_editor (book, e_minicard->contact,
-													   FALSE, e_minicard->editable);
-						e_minicard->editor = EAB_EDITOR (editor);
-					}
-					else {
-						EContactEditor *editor = eab_show_contact_editor (book, e_minicard->contact,
-												  FALSE, e_minicard->editable);
-						e_minicard->editor = EAB_EDITOR (editor);
-					}
-					g_object_ref (e_minicard->editor);
-
-					g_signal_connect (e_minicard->editor, "editor_closed",
-							  G_CALLBACK (editor_closed_cb), e_minicard);
-
-					g_object_unref (book);
-				}
-			}
-			return TRUE;
+		return activiate_editor(item);
 		}
 		break;
+	case GDK_KEY_PRESS:
+		 if (event->key.keyval == GDK_Tab ||
+			event->key.keyval == GDK_KP_Tab ||
+			event->key.keyval == GDK_ISO_Left_Tab) {
+			
+			GList *list, *focus_list;
+			EFocus has_focus = E_FOCUS_NONE;
+			EMinicardView *view = E_MINICARD_VIEW(item->parent);
+			EReflow *reflow = E_REFLOW(view);
+      
+			if (reflow == NULL) {
+				return FALSE;
+			}
+		                 
+			if (event->key.state & GDK_SHIFT_MASK) {
+				if (event->key.state & GDK_CONTROL_MASK) {
+					return FALSE;
+				} else {
+					int row_count = e_selection_model_row_count(reflow->selection);
+					int model_index = e_selection_model_cursor_row (reflow->selection);
+					int view_index = e_sorter_model_to_sorted (reflow->selection->sorter, model_index);
+					
+					if (view_index == 0) {
+						view_index = row_count-1;
+					} else {
+						view_index--;
+  					}
+					model_index = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), view_index);
+					e_canvas_item_grab_focus(reflow->items[model_index], FALSE);
+					return TRUE;
+				}
+			} else {
+				if (event->key.state & GDK_CONTROL_MASK) {
+					return FALSE;
+				} else {
+					int row_count = e_selection_model_row_count(reflow->selection);
+					int model_index = e_selection_model_cursor_row (reflow->selection);
+					int view_index = e_sorter_model_to_sorted (reflow->selection->sorter, model_index);
+
+					if (view_index == row_count-1) {
+						view_index = 0;
+					} else {
+						view_index++;
+ 					}
+					model_index = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), view_index);
+					e_canvas_item_grab_focus(reflow->items[model_index], FALSE);
+					return TRUE;
+ 				}
+			}                                                                                                    
+		} else if (event->key.keyval == GDK_Return ||
+				event->key.keyval == GDK_KP_Enter) {
+				return activiate_editor(item);
+ 			}
+ 		break;
 	default:
 		break;
 	}


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