diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-03-28 22:56:13 +0900 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2019-04-01 18:36:29 +0200 |
commit | 27b2114fed33b52e9e4b1b03652ac345c354155f (patch) | |
tree | 69c778ce5e82191f6fe8cbfd2b4af21fada76e0d | |
parent | 9d6e89d4db97c351466d41b958605091075563b5 (diff) | |
download | tdepim-27b2114fed33b52e9e4b1b03652ac345c354155f.tar.gz tdepim-27b2114fed33b52e9e4b1b03652ac345c354155f.zip |
Fixed support for libical version prior to 3. This is required for libkcal tests to work fine on older distributions.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 858a7e560af13f2b6fe8849c717997c2238763fd)
-rw-r--r-- | libkcal/ConfigureChecks.cmake | 7 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 22 |
2 files changed, 27 insertions, 2 deletions
diff --git a/libkcal/ConfigureChecks.cmake b/libkcal/ConfigureChecks.cmake index b4485ec3f..3b325187b 100644 --- a/libkcal/ConfigureChecks.cmake +++ b/libkcal/ConfigureChecks.cmake @@ -12,8 +12,13 @@ # libical pkg_search_module( LIBICAL libical ) if( LIBICAL_FOUND ) + # check for libical >= 3.0 + if( NOT (LIBICAL_VERSION VERSION_LESS "3.0") ) + add_definitions(-DUSE_LIBICAL_3_0) + endif( ) + # check for libical >= 0.46 if( NOT (LIBICAL_VERSION VERSION_LESS "0.46") ) - set( USE_LIBICAL_0_46 1 CACHE INTERNAL "" FORCE ) + add_definitions(-DUSE_LIBICAL_0_46) endif( ) else( ) tde_message_fatal( "libical are required, but not found on your system" ) diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 0c7b40e25..e4296bcec 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp @@ -1932,6 +1932,9 @@ icaltimetype ICalFormatImpl::writeICalDate(const TQDate &date) t.second = 0; t.is_date = 1; +#ifndef USE_LIBICAL_3_0 + t.is_utc = 0; +#endif t.zone = 0; return t; @@ -1951,6 +1954,9 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const TQDateTime &datetime) t.is_date = 0; t.zone = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() ); +#ifndef USE_LIBICAL_3_0 + t.is_utc = 0; +#endif // _dumpIcaltime( t ); /* The TQDateTime we get passed in is to be considered in the timezone of @@ -1965,6 +1971,9 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const TQDateTime &datetime) t.zone = tz; t = icaltime_convert_to_zone( t, utc ); } else { +#ifndef USE_LIBICAL_3_0 + t.is_utc = 1; +#endif t.zone = utc; } } @@ -1976,7 +1985,12 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const TQDateTime &datetime) TQDateTime ICalFormatImpl::readICalDateTime( icalproperty *p, icaltimetype& t, icaltimezone* tz ) { // kdDebug(5800) << "ICalFormatImpl::readICalDateTime()" << endl; - if (!icaltime_is_utc(t)) { // Only use the TZ if time is not UTC. +#ifdef USE_LIBICAL_3_0 + bool time_is_utc = icaltime_is_utc(t); +#else + bool time_is_utc = t.is_utc; +#endif + if ( !time_is_utc ) { // Only use the TZ if time is not UTC.{ // FIXME: We'll need to make sure to apply the appropriate TZ, not just // the first one found. icalparameter *param = p ? icalproperty_get_first_parameter(p, ICAL_TZID_PARAMETER) : 0; @@ -1992,9 +2006,15 @@ TQDateTime ICalFormatImpl::readICalDateTime( icalproperty *p, icaltimetype& t, i } else { if (tz && tz != icaltimezone_get_utc_timezone()) { +#ifndef USE_LIBICAL_3_0 + t.is_utc = 0; +#endif t.zone = tz; } else { +#ifndef USE_LIBICAL_3_0 + t.is_utc = 1; +#endif t.zone = icaltimezone_get_utc_timezone(); } } |