[evolution-patches] A patch for calendar to keep alldayness in week view



Hi Rodrigo,

A revised version according to your opinions. Please review.

Thanks
Kidd
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2345
diff -u -r1.2345 ChangeLog
--- calendar/ChangeLog	25 May 2004 21:20:47 -0000	1.2345
+++ calendar/ChangeLog	26 May 2004 05:30:49 -0000
@@ -1,3 +1,9 @@
+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.
+
 2004-05-25  Jeffrey Stedfast  <fejj novell com>
 
 	* gui/dialogs/url-editor-dialog.c (init_widgets): Use
Index: calendar/gui/e-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.210
diff -u -r1.210 e-week-view.c
--- calendar/gui/e-week-view.c	18 May 2004 06:59:35 -0000	1.210
+++ calendar/gui/e-week-view.c	26 May 2004 05:30:51 -0000
@@ -181,7 +181,7 @@
 static gboolean e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction);
 static gint e_week_view_get_day_offset_of_event (EWeekView *week_view, time_t event_time);
 static void e_week_view_scroll_a_step (EWeekView *week_view, ECalViewMoveDirection direction);
-static void e_week_view_change_event_time (EWeekView *week_view, time_t start_dt, time_t end_dt);
+static void e_week_view_change_event_time (EWeekView *week_view, time_t start_dt, time_t end_dt, gboolean is_all_day);
 static gboolean e_week_view_on_jump_button_event (GnomeCanvasItem *item,
 						  GdkEvent *event,
 						  EWeekView *week_view);
@@ -3126,6 +3126,7 @@
 	time_t start_dt, end_dt;
 	struct icaltimetype start_time,end_time;
 	EWeekView *week_view = E_WEEK_VIEW (cal_view);
+	gboolean is_all_day = FALSE;
 
 	event_num = week_view->editing_event_num;
 	span_num = week_view->editing_span_num;
@@ -3136,10 +3137,13 @@
 		return FALSE;
 
 	event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
-	start_dt = event->start;
-	end_dt = event->end;
-	start_time = icaltime_from_timet (start_dt, 0);
-	end_time = icaltime_from_timet (end_dt, 0);
+
+	start_time = icalcomponent_get_dtstart (event->comp_data->icalcomp);
+	end_time = icalcomponent_get_dtend (event->comp_data->icalcomp);
+
+	if (start_time.is_date && end_time.is_date)
+		is_all_day = TRUE;
+
 	current_end_day = e_week_view_get_day_offset_of_event (week_view,end_dt); 
 
 	switch (direction) {
@@ -3161,8 +3165,10 @@
 	
 	icaltime_adjust	(&start_time ,adjust_days,0,0,0);
 	icaltime_adjust	(&end_time ,adjust_days,0,0,0);
-	start_dt = icaltime_as_timet (start_time);
-	end_dt = icaltime_as_timet (end_time);
+	start_dt = icaltime_as_timet_with_zone (start_time,
+		e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
+	end_dt = icaltime_as_timet_with_zone (end_time,
+		e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
 
 	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);
@@ -3180,7 +3186,7 @@
 		}
 	}
 	
-	e_week_view_change_event_time (week_view, start_dt, end_dt);
+	e_week_view_change_event_time (week_view, start_dt, end_dt, is_all_day);
 	return TRUE;
 }
 
@@ -3219,7 +3225,7 @@
 }
 
 static void
-e_week_view_change_event_time (EWeekView *week_view, time_t start_dt, time_t end_dt)
+e_week_view_change_event_time (EWeekView *week_view, time_t start_dt, time_t end_dt, gboolean is_all_day)
 {
 	EWeekViewEvent *event;
 	gint event_num;
@@ -3249,10 +3255,10 @@
 	   and end times. */
 	date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
 	
-	*date.value = icaltime_from_timet_with_zone (start_dt, FALSE,
+	*date.value = icaltime_from_timet_with_zone (start_dt, is_all_day,
 						     e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
 	e_cal_component_set_dtstart (comp, &date);
-	*date.value = icaltime_from_timet_with_zone (end_dt, FALSE,
+	*date.value = icaltime_from_timet_with_zone (end_dt, is_all_day,
 						     e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
 	e_cal_component_set_dtend (comp, &date);
 


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