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



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
> 
> Plain text document attachment (patch_for_55056.diff)
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
> retrieving revision 1.1613
> diff -u -r1.1613 ChangeLog
> --- ChangeLog	15 Mar 2004 06:13:55 -0000	1.1613
> +++ ChangeLog	16 Mar 2004 05:46:38 -0000
> @@ -1,3 +1,12 @@
> +2004-03-16  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-15  Hao Sheng  <hao sheng sun com>
>  
>  	* gui/component/Makefile.am : build a11y/addressbook dir
> Index: gui/widgets/e-minicard.c
> ===================================================================
> RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard.c,v
> retrieving revision 1.111
> diff -u -r1.111 e-minicard.c
> --- gui/widgets/e-minicard.c	15 Mar 2004 06:14:03 -0000	1.111
> +++ gui/widgets/e-minicard.c	16 Mar 2004 05:46:38 -0000
> @@ -518,6 +518,48 @@
>  	minicard->editor = NULL;
>  }
>  
> +
> +static gboolean
> +activiate_editor(GnomeCanvasItem *item)
> +{
> +	EMinicard *e_minicard;
> +	e_minicard = E_MINICARD (item);
> +	
> +	if (e_minicard->editor) {
> +		if (GPOINTER_TO_INT (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)))
> +			e_contact_list_editor_raise (E_CONTACT_LIST_EDITOR(e_minicard->editor));
> +		else
> +			e_contact_editor_raise(E_CONTACT_EDITOR(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)
>  {
> @@ -601,41 +643,64 @@
>  		break;
>  	case GDK_2BUTTON_PRESS:
>  		if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) {
> -			if (e_minicard->editor) {
> -				if (GPOINTER_TO_INT (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)))
> -					e_contact_list_editor_raise (E_CONTACT_LIST_EDITOR(e_minicard->editor));
> -				else
> -					e_contact_editor_raise(E_CONTACT_EDITOR(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);
> +			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--;
>  					}
> -					else {
> -						EContactEditor *editor = eab_show_contact_editor (book, e_minicard->contact,
> -												  FALSE, e_minicard->editable);
> -						e_minicard->editor = G_OBJECT (editor);
> +					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++;
>  					}
> -					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);
> +					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);
>  			}
> -			return TRUE;
> -		}
>  		break;
> +
>  	default:
>  		break;
>  	}



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