[evolution-patches] A patch for calendar based on trunk



Hi,

This patch is aimed for trunk. We have found a bug in calendar which can be reproduced as follows:
1. Invoke your evolution
2. Create a new task
3. Set the start time of the new task

As you can see, the setting of step 3 is not allowed. This is because it is checked whether the due time is before the start time of a task whenever the start time or the due time is set. However, the due time is
null when we create a new task. Therefore the check will always fail.

Enclosed is a patch to fix the problem. Would you like to spend a little time to review it?

Best regards
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2273
diff -u -r1.2273 ChangeLog
--- calendar/ChangeLog	23 Apr 2004 19:13:11 -0000	1.2273
+++ calendar/ChangeLog	26 Apr 2004 09:50:10 -0000
@@ -1,3 +1,8 @@
+2004-04-26  Kidd Wang  <kidd wang sun com>
+
+	* gui/e-cal-model-tasks.c: (ecmt_set_value_at): compare the start
+	time and the due time only when both are not null.
+
 2004-04-23  Rodney Dawes  <dobey ximian com>
 
 	* gui/alarm-notify/notify-main.c (main): Call e_icon_factory_init ()
Index: calendar/gui/e-cal-model-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model-tasks.c,v
retrieving revision 1.17
diff -u -r1.17 e-cal-model-tasks.c
--- calendar/gui/e-cal-model-tasks.c	16 Apr 2004 01:26:55 -0000	1.17
+++ calendar/gui/e-cal-model-tasks.c	26 Apr 2004 09:50:11 -0000
@@ -733,10 +733,15 @@
 	if (col < E_CAL_MODEL_FIELD_LAST) {
 		if (col == E_CAL_MODEL_FIELD_DTSTART) {
 			dv = (ECellDateEditValue *) value;
-			start_tt = dv->tt;
+			if (dv)
+				start_tt = dv->tt;
+			else
+				start_tt = icaltime_null_time();
 			due_tt = icalcomponent_get_due (comp_data->icalcomp);
 
-			if (icaltime_compare (start_tt, due_tt) > 0) {
+			if (!icaltime_is_null_time(start_tt) &&
+			    !icaltime_is_null_time(due_tt) &&
+			    icaltime_compare (start_tt, due_tt) > 0) {
 				dialog = gtk_message_dialog_new (NULL, 0,
 						GTK_MESSAGE_ERROR,
 						GTK_BUTTONS_OK,
@@ -762,9 +767,14 @@
 	case E_CAL_MODEL_TASKS_FIELD_DUE :
 		dv = (ECellDateEditValue *) value;
 		start_tt = icalcomponent_get_dtstart (comp_data->icalcomp);
-		due_tt = dv->tt;
+		if (dv)
+			due_tt = dv->tt;
+		else
+			due_tt = icaltime_null_time();
 		
-		if (icaltime_compare (start_tt, due_tt) > 0) {
+		if (!icaltime_is_null_time(start_tt) &&
+		    !icaltime_is_null_time(due_tt) &&
+		    icaltime_compare (start_tt, due_tt) > 0) {
 			dialog = gtk_message_dialog_new (NULL, 0,
 					GTK_MESSAGE_ERROR,
 					GTK_BUTTONS_OK,


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