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



Hi,
   Added the support for the allday events in groupwise appointments.

thanks, chenthill.
Index: servers/groupwise/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.64
diff -u -r1.64 ChangeLog
--- servers/groupwise/ChangeLog	27 Aug 2004 05:28:06 -0000	1.64
+++ servers/groupwise/ChangeLog	29 Aug 2004 14:37:28 -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 -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	29 Aug 2004 14:37:29 -0000
@@ -131,6 +131,8 @@
 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 -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	29 Aug 2004 14:37:29 -0000
@@ -43,6 +43,7 @@
 	char *end_date;
 	char *due_date;
 	gboolean completed;
+	gboolean is_allday_event;
 	char *subject;
 	char *message;
 	char *classification;
@@ -332,6 +333,7 @@
 	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 @@
 				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 @@
 	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_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 @@
 			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.324
diff -u -r1.324 ChangeLog
--- calendar/ChangeLog	27 Aug 2004 18:09:58 -0000	1.324
+++ calendar/ChangeLog	29 Aug 2004 14:37:30 -0000
@@ -1,3 +1,15 @@
+2004-08-29  Chenthill Palanisamy <pchenthill novell com>
+
+	Fixes #64062
+	* backends/groupwise/e-cal-backend-groupwise.c
+	(e_cal_backend_groupwise_modify_object): Handle the changes 
+	from allday events to non-allday events and vice versa.
+	* backends/groupwise/e-cal-backend-groupwise-utils.c
+	(set_properties_from_cal_component),(e_gw_item_to_cal_component):
+	Added the support for the allday events in appointments.
+	(get_recur_instance): get the rdates from the endate so that
+	they appear correctly for the allday events.
+	
 2004-08-27  Rodrigo Moya <rodrigo novell com>
 
 	* libedata-cal/e-cal-backend-sexp.c (func_has_alarms_in_range): new
Index: calendar/backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.89
diff -u -r1.89 e-cal-backend-groupwise.c
--- calendar/backends/groupwise/e-cal-backend-groupwise.c	25 Aug 2004 15:12:12 -0000	1.89
+++ calendar/backends/groupwise/e-cal-backend-groupwise.c	29 Aug 2004 14:37:30 -0000
@@ -1193,6 +1193,26 @@
 			}
 		}
 		e_gw_item_set_changes (item, cache_item); 
+		
+		if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_EVENT) {
+			ECalComponentDateTime s_dt, cache_s_dt;
+			gboolean is_allday;
+
+			e_cal_component_get_dtstart (comp, &s_dt);
+			e_cal_component_get_dtstart (cache_comp, &cache_s_dt);
+
+			if (s_dt.tzid && !cache_s_dt.tzid) {
+				is_allday = FALSE;
+				
+				e_gw_item_set_is_allday_event (item, is_allday);
+				e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "allDayEvent", &is_allday);
+			} else if (!s_dt.tzid && cache_s_dt.tzid) {
+				is_allday = TRUE;
+				
+				e_gw_item_set_is_allday_event (item, is_allday);
+				e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "allDayEvent", &is_allday);
+			}
+		}
 
 		/* the second argument is redundant */
 		status = e_gw_connection_modify_item (priv->cnc, e_gw_item_get_id (item), item);
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 -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	29 Aug 2004 14:37:31 -0000
@@ -34,7 +34,7 @@
 	GSList **recur_dates = (GSList **) data;
 	char *rdate;
 
-	rdate = isodate_from_time_t (instance_start);
+	rdate = isodate_from_time_t (instance_end);
 	/* convert this into a date */
 	rdate[8] ='\0';
 	*recur_dates = g_slist_append (*recur_dates, rdate);
@@ -265,6 +265,11 @@
 		g_object_unref (item);
 		return NULL;
 	}
+	
+	if (!dt.tzid && e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_EVENT) 
+	       e_gw_item_set_is_allday_event (item, TRUE);	
+	else 
+		e_gw_item_set_is_allday_event (item, FALSE);
 
 	/* creation date */
 	e_cal_component_get_created (comp, &dt.value);
@@ -387,6 +392,7 @@
 	int priority;
 	int percent;
 	int alarm_duration;
+	gboolean is_allday;
 	GSList *recipient_list, *rl, *attendee_list = NULL;
 	EGwItemOrganizer *organizer;
 	EGwItemType item_type;
@@ -474,10 +480,20 @@
 		}
 	}	
 
+	/* all day event */
+	is_allday = e_gw_item_get_is_allday_event (item);
+
 	/* start date */
 	/* should i duplicate here ? */
 	t = e_gw_item_get_start_date (item);
 	if (t) {
+		if (is_allday) {
+			char **temp = g_strsplit (t, "T", -1);
+			
+			if (temp [0])
+				t = g_strdup (temp [0]);
+			g_strfreev (temp);
+		}
 		itt_utc = icaltime_from_string (t);
 		if (!icaltime_get_timezone (itt_utc))
 			icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone());
@@ -490,6 +506,8 @@
 			dt.value = &itt_utc;
 			dt.tzid = g_strdup ("UTC");
 		}
+		if (is_allday)
+			dt.tzid = NULL;
 		e_cal_component_set_dtstart (comp, &dt);
 		g_free (t);
 	}
@@ -572,6 +590,13 @@
 		/* end date */
 		t = e_gw_item_get_end_date (item);
 		if (t) {
+			if (is_allday) {
+				char **temp = g_strsplit (t, "T", -1);
+				
+				if (temp [0])
+					t = g_strdup (temp [0]);
+				g_strfreev (temp);
+			}
 			itt_utc = icaltime_from_string (t);
 			if (!icaltime_get_timezone (itt_utc))
 				icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone());
@@ -584,7 +609,8 @@
 				dt.value = &itt_utc;
 				dt.tzid = g_strdup ("UTC");
 			}
-		
+			if (is_allday)	
+				dt.tzid = NULL;
 			e_cal_component_set_dtend (comp, &dt);
 		}
 		


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