[evolution-patches] Patch for week_view keyboard navigation



Hi,

We find some problem about keyboard navigation. An all-day event can't be moved from Tuesday to Monday in week view. That's because the original code calculates the offset of a day in the week without respect to the time zone settings of the calendar. Enclosed is a patch adopting a more straightforward way to calculate the offset.

Regards
Kidd
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2349
diff -u -r1.2349 ChangeLog
--- calendar/ChangeLog	26 May 2004 09:20:59 -0000	1.2349
+++ calendar/ChangeLog	26 May 2004 10:17:38 -0000
@@ -1,6 +1,12 @@
 2004-05-26  Kidd Wang  <kidd wang sun com>
 
 	* gui/e-week-view.c: (e_week_view_event_move),
+	(e_week_view_get_day_offset_of_event): a more straightforward way
+	to calculate the offset of a day within the week.
+
+2004-05-26  Kidd Wang  <kidd wang sun com>
+
+	* gui/e-week-view.c: (e_week_view_event_move),
 	(e_week_view_change_event_time): In week view all-day events should
 	keep all-dayness when moved around.
 
Index: calendar/gui/e-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.211
diff -u -r1.211 e-week-view.c
--- calendar/gui/e-week-view.c	26 May 2004 09:21:00 -0000	1.211
+++ calendar/gui/e-week-view.c	26 May 2004 10:17:38 -0000
@@ -3174,12 +3174,14 @@
 
 	current_start_day = e_week_view_get_day_offset_of_event (week_view,start_dt);
 	current_end_day = e_week_view_get_day_offset_of_event (week_view,end_dt);
+	if (is_all_day)
+		current_end_day--;
 
 	if (current_start_day < 0) {
 		return TRUE;
 	}
 	if (week_view->multi_week_view) {
-		if (current_end_day > week_view->weeks_shown * 7) {
+		if (current_end_day >= week_view->weeks_shown * 7) {
 			return TRUE;
 		}
 	}else {
@@ -3195,14 +3197,12 @@
 static gint
 e_week_view_get_day_offset_of_event (EWeekView *week_view, time_t event_time)
 {
-	struct tm first_day_shown_tm = {0};
-	struct tm *event_time_tm;
-
-	event_time_tm = NULL;
-
-	g_date_to_struct_tm (&(week_view->first_day_shown), &first_day_shown_tm);
-	event_time_tm = gmtime (&event_time);
-	return (event_time_tm->tm_yday - first_day_shown_tm.tm_yday);
+	time_t first_day = week_view->day_starts[0];
+	
+	if (event_time - first_day < 0)
+		return -1;
+	else
+		return (event_time - first_day) / (24 * 60 * 60);
 }
 
 static void


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