committing the recurrence fix from harry lu.
authorChenthill Palanisamy <pchen@src.gnome.org>
Sat, 1 Oct 2005 11:28:58 +0000 (11:28 +0000)
committerChenthill Palanisamy <pchen@src.gnome.org>
Sat, 1 Oct 2005 11:28:58 +0000 (11:28 +0000)
calendar/ChangeLog
calendar/libecal/e-cal.c

index 1f2b22c..d4aba4d 100644 (file)
@@ -1,3 +1,9 @@
+2005-10-01  Harry Lu <harry.lu@sun.com>
+
+       * libecal/e-cal.c: (generate_instances): use the same logic as in
+       e_cal_recur_generate_instances_of_rule() to get the instance's
+       start and end time.
+
 2005-09-13  dinesh layek  <ldinesh@novell.com>
 
        fixes #316195
index e3a942c..1d0547a 100644 (file)
@@ -3572,23 +3572,45 @@ generate_instances (ECal *ecal, time_t start, time_t end, const char *uid,
                comp = l->data;
                if (e_cal_component_is_instance (comp)) {
                        struct comp_instance *ci;
-                       struct icaltimetype start_time, end_time;
+                       ECalComponentDateTime dtstart, dtend;
+                       icaltimezone *start_zone = NULL, *end_zone = NULL;
 
                        /* keep the detached instances apart */
                        ci = g_new0 (struct comp_instance, 1);
                        ci->comp = comp;
-       
-                       start_time = icalcomponent_get_dtstart (e_cal_component_get_icalcomponent (comp));
-                       end_time = icalcomponent_get_dtend (e_cal_component_get_icalcomponent (comp));
 
-                       if (icaltime_is_date (start_time))
-                               start_time.zone = default_zone;
-                       if (icaltime_is_date (end_time))
-                               end_time.zone = default_zone;
+                       e_cal_component_get_dtstart (comp, &dtstart);
+                       e_cal_component_get_dtend (comp, &dtend);
+
+                       /* For DATE-TIME values with a TZID, we use 
+                       e_cal_resolve_tzid_cb to resolve the TZID. 
+                       For DATE values and DATE-TIME values without a
+                       TZID (i.e. floating times) we use the default 
+                       timezone. */
+                       if (dtstart.tzid && !dtstart.value->is_date) {
+                               start_zone = e_cal_resolve_tzid_cb (dtstart.tzid, ecal);
+                               if (!start_zone)
+                                       start_zone = default_zone;
+                       } else {
+                               start_zone = default_zone;
+                       }
 
-                       ci->start = icaltime_as_timet_with_zone (start_time, start_time.zone);
-                       ci->end = icaltime_as_timet_with_zone (end_time, end_time.zone);
-                       
+                       if (dtend.tzid && !dtend.value->is_date) {
+                               end_zone = e_cal_resolve_tzid_cb (dtend.tzid, ecal);
+                               if (!end_zone)
+                                       end_zone = default_zone;
+                       } else {
+                               end_zone = default_zone;
+                       }
+
+                       ci->start = icaltime_as_timet_with_zone (*dtstart.value,
+                                                       start_zone);
+                       ci->end = icaltime_as_timet_with_zone (*dtend.value,
+                                                       end_zone);
+
+                       e_cal_component_free_datetime (&dtstart);
+                       e_cal_component_free_datetime (&dtend);
                        detached_instances = g_list_prepend (detached_instances, ci);
                } else {
                        e_cal_recur_generate_instances (comp, start, end, add_instance, &instances,