diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-03-27 23:27:22 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-03-27 23:27:22 +0900 |
commit | 48af72cbe8a4f0cc22de3e2ceda5db47ca922759 (patch) | |
tree | 6640f79522e180b49d517aba75778b71b46b4d97 /libkcal/icalformatimpl.cpp | |
parent | ce47e20ed3f172bb04a2d4055a9326fec1c879b0 (diff) | |
download | tdepim-48af72cbe8a4f0cc22de3e2ceda5db47ca922759.tar.gz tdepim-48af72cbe8a4f0cc22de3e2ceda5db47ca922759.zip |
Fixed bug in libkcal related to timezones in DT field.
Fixed execution of libkcal tests.
This resolves bug 2719.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'libkcal/icalformatimpl.cpp')
-rw-r--r-- | libkcal/icalformatimpl.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 171fe8f82..0c7b40e25 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp @@ -1976,24 +1976,28 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const TQDateTime &datetime) TQDateTime ICalFormatImpl::readICalDateTime( icalproperty *p, icaltimetype& t, icaltimezone* tz ) { // kdDebug(5800) << "ICalFormatImpl::readICalDateTime()" << endl; - if (tz && !icaltime_is_utc(t)) { // Only use the TZ if time is not UTC. + if (!icaltime_is_utc(t)) { // 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. - if (tz != icaltimezone_get_utc_timezone()) { - icalparameter *param = p ? icalproperty_get_first_parameter(p, ICAL_TZID_PARAMETER) : 0; - const char *tzid = param ? icalparameter_get_tzid(param) : 0; - if ( !tzid ) - t.zone = tz; - else { - icaltimezone* icaltz; - // Try to match the ID with the libical time zone's location property - icaltz = icaltimezone_get_builtin_timezone( tzid ); - if ( icaltz ) { -// kdDebug(5800) << "ICalFormatImpl::readICalDateTime(): time zone '" << tzid << "' read from libical database" << endl; - } - t.zone = icaltz; - } - } + icalparameter *param = p ? icalproperty_get_first_parameter(p, ICAL_TZID_PARAMETER) : 0; + const char *tzid = param ? icalparameter_get_tzid(param) : 0; + if ( tzid ) { + icaltimezone* icaltz; + // Try to match the ID with the libical time zone's location property + icaltz = icaltimezone_get_builtin_timezone( tzid ); + if ( icaltz ) { + //kdDebug(5800) << "ICalFormatImpl::readICalDateTime(): time zone '" << tzid << "' read from libical database" << endl; + } + t.zone = icaltz; + } + else { + if (tz && tz != icaltimezone_get_utc_timezone()) { + t.zone = tz; + } + else { + t.zone = icaltimezone_get_utc_timezone(); + } + } } else { t.zone = icaltimezone_get_utc_timezone(); } |