Fix for the bug #317422 [exchange calendar]

"P Chenthill" <[email protected]>
Newsgroups gmane.comp.gnome.evolution.patches
Message-ID <[email protected]>
Hi,
   Have attached the fix for the bug. Get the timezone from the backend
if its not present.

thanks, Chenthill.

_______________________________________________
Evolution-patches mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-patches
317422.diff (text/plain, 4.1 KB)
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.3028
diff -u -p -r1.3028 ChangeLog
--- ChangeLog	10 Apr 2006 10:12:33 -0000	1.3028
+++ ChangeLog	20 Apr 2006 07:20:13 -0000
@@ -1,3 +1,11 @@
+2006-04-20  Chenthill Palanisamy  <[email protected]>
+
+	Fixes #317422
+	* gui/e-cal-model.c: (e_cal_model_set_instance_times):
+	* gui/e-calendar-view.c: (get_label),
+	(e_calendar_view_get_tooltips): Get the timezone from the backend
+	using the tzid if its not present in the icalcomponent.
+
 2006-04-10  Chenthill Palanisamy  <[email protected]>
 
 	Fixes #163039
Index: gui/e-cal-model.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model.c,v
retrieving revision 1.73
diff -u -p -r1.73 e-cal-model.c
--- gui/e-cal-model.c	4 Apr 2006 02:42:59 -0000	1.73
+++ gui/e-cal-model.c	20 Apr 2006 07:20:13 -0000
@@ -2107,6 +2107,25 @@ e_cal_model_set_instance_times (ECalMode
 
 	if (start_time.zone)
 		zone = start_time.zone;
+	else {
+		icalparameter *param = NULL;
+		icalproperty *prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DTSTART_PROPERTY);
+		
+	       if (prop)	{
+			param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
+
+			if (param) {
+				const char *tzid = NULL;
+				icaltimezone *st_zone = NULL;
+
+				tzid = icalparameter_get_tzid (param);
+				e_cal_get_timezone (comp_data->client, tzid, &st_zone, NULL);
+
+				if (st_zone)
+					zone = st_zone;
+			}
+	       }
+	}
 	
 	comp_data->instance_start = icaltime_as_timet_with_zone (start_time, zone);
 
Index: gui/e-calendar-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-view.c,v
retrieving revision 1.118
diff -u -p -r1.118 e-calendar-view.c
--- gui/e-calendar-view.c	3 Apr 2006 08:36:50 -0000	1.118
+++ gui/e-calendar-view.c	20 Apr 2006 07:20:14 -0000
@@ -2054,12 +2054,12 @@ tooltip_grab (GtkWidget *tooltip, GdkEve
 }
 
 static char *
-get_label (struct icaltimetype *tt)
+get_label (struct icaltimetype *tt, icaltimezone *f_zone, icaltimezone *t_zone)
 {
         char buffer[1000];
         struct tm tmp_tm;
 
-	tmp_tm = icaltimetype_to_tm (tt);
+	tmp_tm = icaltimetype_to_tm_with_zone (tt, f_zone, t_zone);
         e_time_format_date_and_time (&tmp_tm,
                                      calendar_config_get_24_hour_format (),
                                      FALSE, FALSE,
@@ -2091,13 +2091,16 @@ e_calendar_view_get_tooltips (ECalendarV
 	GtkStyle *style = gtk_widget_get_default_style ();
 	GtkWidget *widget = (GtkWidget *) g_object_get_data (G_OBJECT (data->cal_view), "tooltip-window");
 	ECalComponent *newcomp = e_cal_component_new ();
-	icaltimezone *zone;	
+	icaltimezone *zone, *default_zone;	
+	ECal *client = NULL;
 
 	/* Delete any stray tooltip if left */
 	if (widget)
 		gtk_widget_destroy (widget);
 
 	pevent = data->get_view_event (data->cal_view, data->day, data->event_num);
+	client = pevent->comp_data->client;
+	default_zone = e_calendar_view_get_timezone  (data->cal_view);
 
 	clone_comp = icalcomponent_new_clone (pevent->comp_data->icalcomp);
 	if (!e_cal_component_set_icalcomponent (newcomp, clone_comp))
@@ -2173,19 +2176,19 @@ e_calendar_view_get_tooltips (ECalendarV
 			
 	if (dtstart.tzid) {
 		zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (newcomp), dtstart.tzid);
-	} else {
-		zone = NULL;
-	}
-	t_start = icaltime_as_timet_with_zone (*dtstart.value, zone);
+		if (!zone) 
+			e_cal_get_timezone (client, dtstart.tzid, &zone, NULL);
+
+		if (!zone)
+			zone = default_zone;
 		
-	if (dtend.tzid) {
-		zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (newcomp), dtend.tzid);
 	} else {
 		zone = NULL;
 	}
+	t_start = icaltime_as_timet_with_zone (*dtstart.value, zone);
 	t_end = icaltime_as_timet_with_zone (*dtend.value, zone);
 		
-	tmp1 = get_label(dtstart.value);
+	tmp1 = get_label(dtstart.value, zone, default_zone);
 	tmp = calculate_time (t_start, t_end);
 	
 	/* To Translators: It will display "Time: ActualStartDateAndTime (DurationOfTheMeeting)"*/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.