summaryrefslogtreecommitdiffstats
path: root/libkcal/icalformatimpl.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2019-03-28 22:56:13 +0900
committerMichele Calgaro <[email protected]>2019-03-28 22:56:13 +0900
commit858a7e560af13f2b6fe8849c717997c2238763fd (patch)
treedc2c3c96f3a591f8a2b21a94ca8cc4a4e63c3084 /libkcal/icalformatimpl.cpp
parent48af72cbe8a4f0cc22de3e2ceda5db47ca922759 (diff)
downloadtdepim-858a7e560af13f2b6fe8849c717997c2238763fd.tar.gz
tdepim-858a7e560af13f2b6fe8849c717997c2238763fd.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 <[email protected]>
Diffstat (limited to 'libkcal/icalformatimpl.cpp')
-rw-r--r--libkcal/icalformatimpl.cpp22
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();
}
}