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



hi,
   Resending the patch to support allday events for the 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	31 Aug 2004 07:12:48 -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	31 Aug 2004 07:12:48 -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	31 Aug 2004 07:12:49 -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	31 Aug 2004 07:12:49 -0000
@@ -1,3 +1,16 @@
+2004-08-29  Chenthill Palanisamy <pchenthill novell com>
+
+	Fixes #64062 and #64688
+	* 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.
+	(connect_to_server): load the default_zone before populating
+	the cache.
+	* 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.
+	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-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	31 Aug 2004 07:12:50 -0000
@@ -174,7 +174,16 @@
 		if (dt.value) {
 			if (!icaltime_get_timezone (*dt.value))
 				icaltime_set_timezone (dt.value, default_zone);
-			itt_utc = icaltime_convert_to_zone (*dt.value, icaltimezone_get_utc_timezone ());
+			/* it is an all day event */
+			if (!dt.tzid) {
+				char *t;
+				
+				t = isodate_from_time_t(icaltime_as_timet_with_zone (*dt.value, default_zone));
+				itt_utc = icaltime_from_string (t);
+
+				g_free (t);
+			} else
+				itt_utc = icaltime_convert_to_zone (*dt.value, icaltimezone_get_utc_timezone ());
 			e_gw_item_set_end_date (item, icaltime_as_ical_string (itt_utc));
 		}
 
@@ -252,19 +261,33 @@
 		g_string_free (str, TRUE);
 		e_cal_component_free_text_list (slist);
 	}
-
+	
 	/* start date */
 	e_cal_component_get_dtstart (comp, &dt);
 	if (dt.value) {
 		if (!icaltime_get_timezone (*dt.value))
 			icaltime_set_timezone (dt.value, default_zone);
-		itt_utc = icaltime_convert_to_zone (*dt.value, icaltimezone_get_utc_timezone ());
+		/* it is an all day event */
+		if (!dt.tzid) {
+		       	char *t;	
+
+			t = isodate_from_time_t(icaltime_as_timet_with_zone (*dt.value, default_zone));
+			itt_utc = icaltime_from_string (t);
+			
+			g_free (t);
+		} else			
+			itt_utc = icaltime_convert_to_zone (*dt.value, icaltimezone_get_utc_timezone ());
 		e_gw_item_set_start_date (item, icaltime_as_ical_string (itt_utc));
 	} else if (e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT) {
 		/* appointments need the start date property */
 		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 +410,7 @@
 	int priority;
 	int percent;
 	int alarm_duration;
+	gboolean is_allday;
 	GSList *recipient_list, *rl, *attendee_list = NULL;
 	EGwItemOrganizer *organizer;
 	EGwItemType item_type;
@@ -474,6 +498,9 @@
 		}
 	}	
 
+	/* 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);
@@ -490,6 +517,10 @@
 			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 +615,10 @@
 				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);
 		}
 		
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	31 Aug 2004 07:12:50 -0000
@@ -329,6 +329,9 @@
 					e_cal_backend_notify_error (E_CAL_BACKEND (cbgw), _("Could not create cache file"));
 					return GNOME_Evolution_Calendar_OtherError;
 				}
+			
+			/* read the default timezone*/
+			priv->default_zone = e_cal_backend_cache_get_default_timezone (priv->cache);
 
 			/* Clear the cache before populating it */
 			e_file_cache_clean (E_FILE_CACHE (priv->cache));
@@ -346,8 +349,6 @@
 				g_object_ref (priv->cache);
 				g_timeout_add (CACHE_REFRESH_INTERVAL, (GSourceFunc) get_deltas, (gpointer) cbgw);
 				priv->mode = CAL_MODE_REMOTE;
-				/* read the default timezone*/
-				priv->default_zone = e_cal_backend_cache_get_default_timezone (priv->cache);
 				return GNOME_Evolution_Calendar_Success;
 			}
 		} else {
@@ -1193,6 +1194,23 @@
 			}
 		}
 		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;
+				
+			 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);


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