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>
pull/18/head
Michele Calgaro 6 years ago
parent ce47e20ed3
commit 48af72cbe8
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -149,7 +149,7 @@ bool ICalFormat::fromRawString( Calendar *cal, const TQCString &text )
// TODO: Handle more than one VCALENDAR or non-VCALENDAR top components
icalcomponent *calendar;
// Let's defend const correctness until the very gates of hell^Wlibical
// Let's defend const correctness until the very gates of hell
calendar = icalcomponent_new_from_string( const_cast<char*>( (const char*)text ) );
// kdDebug(5800) << "Error: " << icalerror_perror() << endl;
if (!calendar) {

@ -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();
}

@ -59,13 +59,15 @@ add_custom_command(
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
# Compat tests are broken and have been in a disabled state since before TDE exited
set ( _test1 testrecurrence "next" ${CMAKE_CURRENT_SOURCE_DIR}/data/RecurrenceRule/*.ics )
set ( _test2 testrecurprevious "prev" ${CMAKE_CURRENT_SOURCE_DIR}/data/RecurrenceRule/*.ics )
set ( _test3 testrecurson "recurson" ${CMAKE_CURRENT_SOURCE_DIR}/data/RecurrenceRule/*.ics )
set ( _test4 readandwrite "ical" ${CMAKE_CURRENT_SOURCE_DIR}/data/Compat/*.ics )
#set ( _test4 readandwrite "ical" ${CMAKE_CURRENT_SOURCE_DIR}/data/Compat/*.ics )
set ( _test5 testvcalexport "vcal" ${CMAKE_CURRENT_SOURCE_DIR}/data/vCalendar/*.ics )
set ( _test6 readandwrite "ical" ${CMAKE_CURRENT_SOURCE_DIR}/data/vCalendar/*.vcs )
set ( _all_tests _test1 _test2 _test3 _test4 _test5 _test6 )
#set ( _all_tests _test1 _test2 _test3 _test4 _test5 _test6 )
set ( _all_tests _test1 _test2 _test3 _test5 _test6 )
foreach( _test_name ${_all_tests} )
list( GET ${_test_name} 0 _test_executable )
@ -74,7 +76,7 @@ foreach( _test_name ${_all_tests} )
file( GLOB_RECURSE _test_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${_test_search_filter} )
foreach( _test_file ${_test_files} )
add_test(
${_test_executable}__${_test_file}__
${_test_executable}__${_test_id}__${_test_file}__
${CMAKE_CURRENT_SOURCE_DIR}/runtestcase.pl ${_test_executable} ${_test_id} ${CMAKE_CURRENT_BINARY_DIR}/${_test_file}
)
endforeach( )

@ -1,13 +1,13 @@
2001-12-16T19:25:00
2001-12-18T19:25:00
2001-12-23T19:25:00
2001-12-25T19:25:00
2001-12-30T19:25:00
2002-01-01T19:25:00
2002-01-06T19:25:00
2002-01-08T19:25:00
2002-01-13T19:25:00
2002-01-15T19:25:00
2001-12-16T11:25:00
2001-12-18T11:25:00
2001-12-23T11:25:00
2001-12-25T11:25:00
2001-12-30T11:25:00
2002-01-01T11:25:00
2002-01-06T11:25:00
2002-01-08T11:25:00
2002-01-13T11:25:00
2002-01-15T11:25:00

@ -1,13 +1,13 @@
2002-01-15T19:25:00
2002-01-13T19:25:00
2002-01-08T19:25:00
2002-01-06T19:25:00
2002-01-01T19:25:00
2001-12-30T19:25:00
2001-12-25T19:25:00
2001-12-23T19:25:00
2001-12-18T19:25:00
2001-12-16T19:25:00
2002-01-15T11:25:00
2002-01-13T11:25:00
2002-01-08T11:25:00
2002-01-06T11:25:00
2002-01-01T11:25:00
2001-12-30T11:25:00
2001-12-25T11:25:00
2001-12-23T11:25:00
2001-12-18T11:25:00
2001-12-16T11:25:00

@ -1,6 +1,6 @@
2001-12-04T15:35:00
2002-01-01T15:35:00
2002-02-05T15:35:00
2001-12-04T07:35:00
2002-01-01T07:35:00
2002-02-05T07:35:00

@ -1,6 +1,6 @@
2002-02-05T15:35:00
2002-01-01T15:35:00
2001-12-04T15:35:00
2002-02-05T07:35:00
2002-01-01T07:35:00
2001-12-04T07:35:00

@ -1,9 +1,9 @@
2002-04-02T11:45:00
2002-04-03T11:45:00
2002-04-09T11:45:00
2002-04-10T11:45:00
2002-04-16T11:45:00
2002-04-17T11:45:00
2002-04-02T03:45:00
2002-04-03T03:45:00
2002-04-09T03:45:00
2002-04-10T03:45:00
2002-04-16T03:45:00
2002-04-17T03:45:00

@ -1,9 +1,9 @@
2002-04-17T11:45:00
2002-04-16T11:45:00
2002-04-10T11:45:00
2002-04-09T11:45:00
2002-04-03T11:45:00
2002-04-02T11:45:00
2002-04-17T03:45:00
2002-04-16T03:45:00
2002-04-10T03:45:00
2002-04-09T03:45:00
2002-04-03T03:45:00
2002-04-02T03:45:00

@ -1,9 +1,9 @@
2002-04-02T11:45:00
2002-04-03T11:45:00
2002-04-09T11:45:00
2002-04-10T11:45:00
2002-04-16T11:45:00
2002-04-17T11:45:00
2002-04-02T03:45:00
2002-04-03T03:45:00
2002-04-09T03:45:00
2002-04-10T03:45:00
2002-04-16T03:45:00
2002-04-17T03:45:00

@ -1,9 +1,9 @@
2002-04-17T11:45:00
2002-04-16T11:45:00
2002-04-10T11:45:00
2002-04-09T11:45:00
2002-04-03T11:45:00
2002-04-02T11:45:00
2002-04-17T03:45:00
2002-04-16T03:45:00
2002-04-10T03:45:00
2002-04-09T03:45:00
2002-04-03T03:45:00
2002-04-02T03:45:00

Loading…
Cancel
Save