summaryrefslogtreecommitdiffstats
path: root/libkcal/icalformatimpl.cpp
diff options
context:
space:
mode:
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();
}