[evolution-patches] Patch for bug #48116



Hello,

 Here is a patch for easy_fix bug #48116. I rename icaltime as
icalcomplete, add icaltoday and test that complete is not after today.

Thanks,

Iván Frade.
-- 
Ivan Frade <frade asturlinux org>
? gui/apps_evolution_calendar-2.0.schemas
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2500.2.18
diff -u -p -r1.2500.2.18 ChangeLog
--- ChangeLog	29 Sep 2004 16:44:27 -0000	1.2500.2.18
+++ ChangeLog	2 Oct 2004 13:01:05 -0000
@@ -1,3 +1,10 @@
+2004-10-02  Iván Frade <frade asturlinux org>
+
+	Fixes #48116
+
+	* gui/dialogs/task-details.page.c (task_details_page_fill_component):
+	Validation: completed date is not a future date.
+	
 2004-09-29  Rodrigo Moya <rodrigo novell com>
 
 	Fixes #64683
Index: gui/dialogs/task-details-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/task-details-page.c,v
retrieving revision 1.42
diff -u -p -r1.42 task-details-page.c
--- gui/dialogs/task-details-page.c	22 Jul 2004 13:02:55 -0000	1.42
+++ gui/dialogs/task-details-page.c	2 Oct 2004 13:01:10 -0000
@@ -393,12 +393,13 @@ task_details_page_fill_component (CompEd
 {
 	TaskDetailsPage *tdpage;
 	TaskDetailsPagePrivate *priv;
-	struct icaltimetype icaltime;
+	struct icaltimetype icalcomplete, icaltoday;
 	icalproperty_status status;
 	TaskEditorPriority priority;
 	int priority_value, percent;
 	char *url;
 	gboolean date_set;
+	icaltimezone *zone = calendar_config_get_icaltimezone ();
 	
 	tdpage = TASK_DETAILS_PAGE (page);
 	priv = tdpage->priv;
@@ -416,10 +417,10 @@ task_details_page_fill_component (CompEd
 	priority_value = priority_index_to_value (priority);
 	e_cal_component_set_priority (comp, &priority_value);
 
-	icaltime = icaltime_null_time ();
+	icalcomplete = icaltime_null_time ();
 
 	/* COMPLETED must be in UTC. */
-	icaltime.is_utc = 1;
+	icalcomplete.is_utc = 1;
 
 	/* Completed Date. */
 	if (!e_date_edit_date_is_valid (E_DATE_EDIT (priv->completed_date)) ||
@@ -429,12 +430,24 @@ task_details_page_fill_component (CompEd
 	}
 
 	date_set = e_date_edit_get_date (E_DATE_EDIT (priv->completed_date),
-					 &icaltime.year,
-					 &icaltime.month,
-					 &icaltime.day);
+					 &icalcomplete.year,
+					 &icalcomplete.month,
+					 &icalcomplete.day);
+
 	e_date_edit_get_time_of_day (E_DATE_EDIT (priv->completed_date),
-				     &icaltime.hour,
-				     &icaltime.minute);
+				     &icalcomplete.hour,
+				     &icalcomplete.minute);
+
+	/* COMPLETED today or before */
+	icaltoday = icaltime_current_time_with_zone (zone);
+	icaltimezone_convert_time (&icaltoday, zone,
+				    icaltimezone_get_utc_timezone());
+
+	if (icaltime_compare_date_only(icalcomplete, icaltoday) > 0) { 
+		comp_editor_page_display_validation_error (page, _("Completed date is wrong"), priv->completed_date);
+		return FALSE;
+	}
+
 	if (date_set) {
 		/* COMPLETED must be in UTC, so we assume that the date in the
 		   dialog is in the current timezone, and we now convert it
@@ -442,10 +455,9 @@ task_details_page_fill_component (CompEd
 		   entire time the dialog is shown. Otherwise if the user
 		   changes the timezone, the COMPLETED date may get changed
 		   as well. */
-		icaltimezone *zone = calendar_config_get_icaltimezone ();
-		icaltimezone_convert_time (&icaltime, zone,
+		icaltimezone_convert_time (&icalcomplete, zone,
 					   icaltimezone_get_utc_timezone ());
-		e_cal_component_set_completed (comp, &icaltime);
+		e_cal_component_set_completed (comp, &icalcomplete);
 	} else {
 		e_cal_component_set_completed (comp, NULL);
 	}


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