[evolution-patches] Fix for the bug #64062 [calendar]



Hi,
      Have added the support for the allday event in groupwise. While generating recurrence instances for the alldayevents e_cal_recur_generate_instances converts the date values to datetime values using the default time zone and it must be converted back to default zone to get the proper dates. So instead of sending the default zone we can send the utc time zone so that we get the date values correctly in get_recur_instances (e-cal-backend-groupwise-utils.c), since it needs only the utc timezone values.

thanks, chenthill.
Index: servers/groupwise/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.64
diff -u -p -r1.64 ChangeLog
--- servers/groupwise/ChangeLog	27 Aug 2004 05:28:06 -0000	1.64
+++ servers/groupwise/ChangeLog	7 Sep 2004 05:56:05 -0000
@@ -1,3 +1,14 @@
+2004-08-29  Chenthill Palanisamy <pchenthill novell com>
+	
+	Fixes #64062
+	* e-gw-item[ch]
+	(e_gw_item_set_is_allday_event), (e_gw_item_get_is_allday_event):
+	Added functions to handle the allday events for Appointments.
+	* e-gw-item.c 
+	(e_gw_item_append_to_soap_message),(append_event_changes_to_soap_message)
+	(e_gw_item_new_from_soap_parameter): Added the support for allDay events
+	in appointments.
+
 2004-08-27  Chenthill Palanisamy <pchenthill novell com>
 
 	* e-gw-item.h:
Index: servers/groupwise/e-gw-item.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-item.h,v
retrieving revision 1.19
diff -u -p -r1.19 e-gw-item.h
--- servers/groupwise/e-gw-item.h	27 Aug 2004 05:28:06 -0000	1.19
+++ servers/groupwise/e-gw-item.h	7 Sep 2004 05:56:05 -0000
@@ -131,6 +131,8 @@ const char *e_gw_item_get_place (EGwItem
 void        e_gw_item_set_place (EGwItem *item, const char *new_place);
 gboolean    e_gw_item_get_completed (EGwItem *item);
 void        e_gw_item_set_completed (EGwItem *item, gboolean new_completed);
+gboolean    e_gw_item_get_is_allday_event (EGwItem *item);
+void	    e_gw_item_set_is_allday_event (EGwItem *item, gboolean is_allday);	
 char*       e_gw_item_get_field_value (EGwItem *item, char *field_name);
 void        e_gw_item_set_field_value (EGwItem *item, char *field_name, char* field_value);
 GList*      e_gw_item_get_email_list (EGwItem *item);
Index: servers/groupwise/e-gw-item.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-item.c,v
retrieving revision 1.45
diff -u -p -r1.45 e-gw-item.c
--- servers/groupwise/e-gw-item.c	19 Aug 2004 10:20:03 -0000	1.45
+++ servers/groupwise/e-gw-item.c	7 Sep 2004 05:56:06 -0000
@@ -43,6 +43,7 @@ struct _EGwItemPrivate {
 	char *end_date;
 	char *due_date;
 	gboolean completed;
+	gboolean is_allday_event;
 	char *subject;
 	char *message;
 	char *classification;
@@ -332,6 +333,7 @@ e_gw_item_init (EGwItem *item, EGwItemCl
 	priv->organizer = NULL;
 	priv->recurrence_dates = NULL;
 	priv->completed = FALSE;
+	priv->is_allday_event = FALSE;
 	priv->im_list = NULL;
 	priv->email_list = NULL;
 	priv->member_list = NULL;
@@ -1350,6 +1352,14 @@ e_gw_item_new_from_soap_parameter (const
 				item->priv->completed = FALSE;
 			g_free (value);
 
+		} else if (!g_ascii_strcasecmp (name, "allDayEvent")) {
+			value = soup_soap_parameter_get_string_value (child);
+			if (!g_ascii_strcasecmp (value, "1"))
+				item->priv->is_allday_event = TRUE;
+			else
+				item->priv->is_allday_event = FALSE;
+			g_free (value);	
+
 		} else if (!g_ascii_strcasecmp (name, "status")) {
 			if (soup_soap_parameter_get_first_child_by_name (child, "deleted"))
 				item->priv->self_status = E_GW_ITEM_STAT_DECLINED;
@@ -1723,6 +1733,22 @@ e_gw_item_set_completed (EGwItem *item, 
 	item->priv->completed = new_completed;
 }
 
+gboolean 
+e_gw_item_get_is_allday_event (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
+
+	return item->priv->is_allday_event;
+}
+
+void 
+e_gw_item_set_is_allday_event (EGwItem *item, gboolean allday_event)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->is_allday_event = allday_event;
+}
+
 const char *
 e_gw_item_get_accept_level (EGwItem *item)
 {
@@ -1972,6 +1998,12 @@ e_gw_item_append_to_soap_message (EGwIte
 			e_gw_message_write_string_parameter (msg, "endDate", NULL, "");
 
 		e_gw_message_write_string_parameter (msg, "acceptLevel", NULL, priv->accept_level ? priv->accept_level : "");
+		if (priv->is_allday_event)
+			e_gw_message_write_string_parameter (msg, "allDayEvent", NULL, "1");
+		else
+			e_gw_message_write_string_parameter (msg, "allDayEvent", NULL ,"0");
+
+
 		if (priv->trigger != 0) {
 			alarm = g_strdup_printf ("%d", priv->trigger);
 			e_gw_message_write_string_parameter_with_attribute (msg, "alarm", NULL, alarm, "enabled", "true");
@@ -2146,6 +2178,8 @@ append_event_changes_to_soap_message (EG
 			e_gw_message_write_string_parameter (msg, "endDate", NULL, priv->end_date);
 		}
 	}
+	if (g_hash_table_lookup (changes, "allDayEvent"))
+		e_gw_message_write_string_parameter (msg, "allDayEvent", NULL, priv->is_allday_event ? "1" : "0");
 	if (g_hash_table_lookup (changes, "message")) {
 		soup_soap_message_start_element (msg, "message", NULL, NULL);
 		if (priv->message) {
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.326
diff -u -p -r1.326 ChangeLog
--- calendar/ChangeLog	5 Sep 2004 13:04:19 -0000	1.326
+++ calendar/ChangeLog	7 Sep 2004 05:56:07 -0000
@@ -1,3 +1,9 @@
+2004-09-07  Chenthill Palanisamy <pchenthill novell com>
+
+	* backends/groupwise/e-cal-backend-groupwise-utils.c
+	(set_properties_from_cal_component), (e_gw_item_to_cal_component),
+	(e_gw_item_set_changes): Added the support for allday events.
+	
 2004-09-05  Chenthill Palanisamy <pchenthill novell com>
 	
 	* libecal/e-cal-utils.h:
Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c,v
retrieving revision 1.31
diff -u -p -r1.31 e-cal-backend-groupwise-utils.c
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	27 Aug 2004 05:39:52 -0000	1.31
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	7 Sep 2004 05:56:08 -0000
@@ -265,7 +265,11 @@ set_properties_from_cal_component (EGwIt
 		g_object_unref (item);
 		return NULL;
 	}
-
+	
+	/* all day event */
+	if (!dt.tzid && e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT)
+		e_gw_item_set_is_allday_event (item, TRUE);
+	
 	/* creation date */
 	e_cal_component_get_created (comp, &dt.value);
 	if (dt.value) {
@@ -346,10 +350,11 @@ set_properties_from_cal_component (EGwIt
 
 		GSList *recur_dates = NULL;
 		
+		if (dt.tzid)
+			e_cal_recur_generate_instances (comp, -1, -1,get_recur_instance, &recur_dates, resolve_tzid_cb, NULL, (icaltimezone *) default_zone);		
+		else 
+			e_cal_recur_generate_instances (comp, -1, -1,get_recur_instance, &recur_dates, resolve_tzid_cb, NULL, icaltimezone_get_utc_timezone());		
 
-		e_cal_recur_generate_instances (comp, -1, -1,
-				get_recur_instance, &recur_dates, resolve_tzid_cb, NULL, 
-				(icaltimezone *) default_zone);		
 		recur_dates = g_slist_delete_link (recur_dates, recur_dates);
 		
 		e_gw_item_set_recurrence_dates (item, recur_dates);
@@ -381,6 +386,7 @@ e_gw_item_to_cal_component (EGwItem *ite
 	char *t, *name;
 	GList *category_ids, *categories;
 	GHashTable *categories_by_id;
+	gboolean is_allday;
 	icaltimezone *default_zone;
 
 	struct icaltimetype itt, itt_utc;
@@ -472,7 +478,10 @@ e_gw_item_to_cal_component (EGwItem *ite
 			e_cal_component_set_categories_list (comp,categories);
 			g_list_free (categories);
 		}
-	}	
+	}
+
+	/* all day event */
+	is_allday = e_gw_item_get_is_allday_event (item);	
 
 	/* start date */
 	/* should i duplicate here ? */
@@ -490,6 +499,10 @@ e_gw_item_to_cal_component (EGwItem *ite
 			dt.value = &itt_utc;
 			dt.tzid = g_strdup ("UTC");
 		}
+		if (is_allday) {
+			dt.value->is_date = 1;
+			dt.tzid = NULL;
+		}
 		e_cal_component_set_dtstart (comp, &dt);
 		g_free (t);
 	}
@@ -584,7 +597,10 @@ e_gw_item_to_cal_component (EGwItem *ite
 				dt.value = &itt_utc;
 				dt.tzid = g_strdup ("UTC");
 			}
-		
+			if (is_allday) {
+				dt.value->is_date = 1;
+				dt.tzid = NULL;
+			}	
 			e_cal_component_set_dtend (comp, &dt);
 		}
 		
@@ -1092,6 +1108,7 @@ e_gw_item_set_changes (EGwItem *item, EG
 	char *due_date, *cache_due_date;
 	char *start_date, *cache_start_date;
 	char *end_date, *cache_end_date;
+	gboolean is_allday, cache_is_allday;
 
 	/* TODO assert the types of the items are the same */
 
@@ -1119,6 +1136,11 @@ e_gw_item_set_changes (EGwItem *item, EG
 		}                                                                                                 
 		else if (trigger)                                                                               
 			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_ADD, "alarm", &trigger);
+		is_allday = e_gw_item_get_is_allday_event (item);
+		cache_is_allday = e_gw_item_get_is_allday_event (cache_item);
+
+		if ((is_allday && !cache_is_allday) || (!is_allday && cache_is_allday))
+			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "allDayEvent", &is_allday);
 	}
 	else if ( e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_TASK) {
 		SET_DELTA(due_date);


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