summaryrefslogtreecommitdiffstats
path: root/libkcal/icalformatimpl.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2019-03-27 23:27:22 +0900
committerSlávek Banko <[email protected]>2019-04-01 18:36:29 +0200
commit9d6e89d4db97c351466d41b958605091075563b5 (patch)
tree801dd8129e47d87632adcbe4510b5467dc56d9cf /libkcal/icalformatimpl.cpp
parent77ffd0e710a5ea62b3c36e37cf82fd66df5b6512 (diff)
downloadtdepim-9d6e89d4db97c351466d41b958605091075563b5.tar.gz
tdepim-9d6e89d4db97c351466d41b958605091075563b5.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 <[email protected]> (cherry picked from commit 48af72cbe8a4f0cc22de3e2ceda5db47ca922759)
Diffstat (limited to 'libkcal/icalformatimpl.cpp')
-rw-r--r--libkcal/icalformatimpl.cpp36
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();
}