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 /libkcal/icalformatimpl.cpp | |
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)
Diffstat (limited to 'libkcal/icalformatimpl.cpp')
-rw-r--r-- | libkcal/icalformatimpl.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
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(); } } |