evolution-data-server r8552 - in trunk/calendar: . backends/caldav backends/file backends/google backends/groupwise backends/http backends/weather libedata-cal



Author: mcrha
Date: Mon Mar  3 13:10:20 2008
New Revision: 8552
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8552&view=rev

Log:
2008-03-03  Milan Crha  <mcrha redhat com>

	** Fix for bug #327851

	* libedata-cal/e-cal-backend-sync.c: (_e_cal_backend_get_timezone),
	  (_e_cal_backend_internal_get_timezone), (e_cal_backend_sync_class_init):
	Try find timezone if entered only as a location name.
	* backends/file/e-cal-backend-file.c: (e_cal_backend_file_internal_get_timezone):
	* backends/http/e-cal-backend-http.c: (e_cal_backend_http_internal_get_timezone):
	* backends/weather/e-cal-backend-weather.c: (e_cal_backend_weather_internal_get_timezone):
	* backends/groupwise/e-cal-backend-groupwise.c: (e_cal_backend_groupwise_internal_get_timezone):
	* backends/caldav/e-cal-backend-caldav.c: (caldav_internal_get_timezone):
	* backends/google/e-cal-backend-google.c: (e_cal_backend_google_internal_get_timezone):
	Ask parent class for internal time zone resolve, if we do not know.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/backends/caldav/e-cal-backend-caldav.c
   trunk/calendar/backends/file/e-cal-backend-file.c
   trunk/calendar/backends/google/e-cal-backend-google.c
   trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c
   trunk/calendar/backends/http/e-cal-backend-http.c
   trunk/calendar/backends/weather/e-cal-backend-weather.c
   trunk/calendar/libedata-cal/e-cal-backend-sync.c

Modified: trunk/calendar/backends/caldav/e-cal-backend-caldav.c
==============================================================================
--- trunk/calendar/backends/caldav/e-cal-backend-caldav.c	(original)
+++ trunk/calendar/backends/caldav/e-cal-backend-caldav.c	Mon Mar  3 13:10:20 2008
@@ -2513,6 +2513,9 @@
 
 	zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
 
+	if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
+		zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
+
 	if (!zone) {
 		zone = icaltimezone_get_utc_timezone ();
 	}

Modified: trunk/calendar/backends/file/e-cal-backend-file.c
==============================================================================
--- trunk/calendar/backends/file/e-cal-backend-file.c	(original)
+++ trunk/calendar/backends/file/e-cal-backend-file.c	Mon Mar  3 13:10:20 2008
@@ -1723,6 +1723,9 @@
 		zone = icalcomponent_get_timezone (priv->icalcomp, tzid);
 		if (!zone)
 			zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+
+		if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
+			zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
 	}
 
 	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);

Modified: trunk/calendar/backends/google/e-cal-backend-google.c
==============================================================================
--- trunk/calendar/backends/google/e-cal-backend-google.c	(original)
+++ trunk/calendar/backends/google/e-cal-backend-google.c	Mon Mar  3 13:10:20 2008
@@ -116,6 +116,10 @@
 	icaltimezone *zone;
 
 	zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+
+	if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
+		zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
+
 	if (!zone)
 		return icaltimezone_get_utc_timezone ();
 

Modified: trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c
==============================================================================
--- trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c	(original)
+++ trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c	Mon Mar  3 13:10:20 2008
@@ -1879,6 +1879,10 @@
 	icaltimezone *zone;
 
 	zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+
+	if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
+		zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
+
 	if (!zone)
 		return icaltimezone_get_utc_timezone();
 

Modified: trunk/calendar/backends/http/e-cal-backend-http.c
==============================================================================
--- trunk/calendar/backends/http/e-cal-backend-http.c	(original)
+++ trunk/calendar/backends/http/e-cal-backend-http.c	Mon Mar  3 13:10:20 2008
@@ -1213,6 +1213,9 @@
 	        zone = icaltimezone_get_utc_timezone ();
 	else {
 		zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+
+		if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
+			zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
 	}
 
 	return zone;

Modified: trunk/calendar/backends/weather/e-cal-backend-weather.c
==============================================================================
--- trunk/calendar/backends/weather/e-cal-backend-weather.c	(original)
+++ trunk/calendar/backends/weather/e-cal-backend-weather.c	Mon Mar  3 13:10:20 2008
@@ -809,6 +809,10 @@
 		zone = icaltimezone_get_utc_timezone ();
 	else
 		zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+
+	if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
+		zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
+
 	return zone;
 }
 

Modified: trunk/calendar/libedata-cal/e-cal-backend-sync.c
==============================================================================
--- trunk/calendar/libedata-cal/e-cal-backend-sync.c	(original)
+++ trunk/calendar/libedata-cal/e-cal-backend-sync.c	Mon Mar  3 13:10:20 2008
@@ -882,6 +882,42 @@
 
 	status = e_cal_backend_sync_get_timezone (E_CAL_BACKEND_SYNC (backend), cal, tzid, &object);
 
+	if (!object && tzid) {
+		/* fallback if tzid contains only the location of timezone */
+		int i, slashes = 0;
+
+		for (i = 0; tzid [i]; i++) {
+			if (tzid [i] == '/')
+				slashes++;
+		}
+
+		if (slashes == 1) {
+			icaltimezone *zone = icaltimezone_get_builtin_timezone (tzid);
+
+			if (zone) {
+				icalcomponent *icalcomp = icaltimezone_get_component (zone);
+
+				if (icalcomp) {
+					icalcomponent *clone = icalcomponent_new_clone (icalcomp);
+					icalproperty *prop;
+
+					prop = icalcomponent_get_first_property (clone, ICAL_TZID_PROPERTY);
+					if (prop) {
+						/* change tzid to our, because the component has the buildin tzid */
+						icalproperty_set_tzid (prop, tzid);
+
+						object = icalcomponent_as_ical_string (clone);
+					}
+					icalcomponent_free (clone);
+				}
+			}
+		}
+
+		/* also cache this timezone to backend */
+		if (object)
+			e_cal_backend_sync_add_timezone (E_CAL_BACKEND_SYNC (backend), cal, object);
+	}
+
 	e_data_cal_notify_timezone_requested (cal, status, object);
 
 	g_free (object);
@@ -897,6 +933,23 @@
 	e_data_cal_notify_timezone_added (cal, status, tzobj);
 }
 
+static icaltimezone *
+_e_cal_backend_internal_get_timezone (ECalBackend *backend, const char *tzid)
+{
+	int i, slashes = 0;
+
+	if (!tzid || !*tzid)
+		return NULL;
+
+	for (i = 0; tzid [i]; i++) {
+		if (tzid [i] == '/')
+			slashes++;
+	}
+
+	/* try if it contains only location of the timezone */
+	return slashes == 1 ? icaltimezone_get_builtin_timezone (tzid) : NULL;
+}
+
 static void
 _e_cal_backend_set_default_zone (ECalBackend *backend, EDataCal *cal, const char *tz)
 {
@@ -1017,6 +1070,7 @@
 	backend_class->set_default_zone = _e_cal_backend_set_default_zone;
  	backend_class->get_changes = _e_cal_backend_get_changes;
  	backend_class->get_free_busy = _e_cal_backend_get_free_busy;
+ 	backend_class->internal_get_timezone = _e_cal_backend_internal_get_timezone;
 
 	object_class->dispose = e_cal_backend_sync_dispose;
 }



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