Fixed FTBFS caused by migration to libical 3. The changes

are compatible with previous versions of libical.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/1/head
Michele Calgaro 7 years ago
parent 4767f333ca
commit 8996740084

@ -1932,9 +1932,6 @@ icaltimetype ICalFormatImpl::writeICalDate(const TQDate &date)
t.second = 0; t.second = 0;
t.is_date = 1; t.is_date = 1;
t.is_utc = 0;
t.zone = 0; t.zone = 0;
return t; return t;
@ -1954,7 +1951,6 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const TQDateTime &datetime)
t.is_date = 0; t.is_date = 0;
t.zone = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() ); t.zone = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() );
t.is_utc = 0;
// _dumpIcaltime( t ); // _dumpIcaltime( t );
/* The TQDateTime we get passed in is to be considered in the timezone of /* The TQDateTime we get passed in is to be considered in the timezone of
@ -1969,7 +1965,6 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const TQDateTime &datetime)
t.zone = tz; t.zone = tz;
t = icaltime_convert_to_zone( t, utc ); t = icaltime_convert_to_zone( t, utc );
} else { } else {
t.is_utc = 1;
t.zone = utc; t.zone = utc;
} }
} }
@ -1981,11 +1976,10 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const TQDateTime &datetime)
TQDateTime ICalFormatImpl::readICalDateTime( icalproperty *p, icaltimetype& t, icaltimezone* tz ) TQDateTime ICalFormatImpl::readICalDateTime( icalproperty *p, icaltimetype& t, icaltimezone* tz )
{ {
// kdDebug(5800) << "ICalFormatImpl::readICalDateTime()" << endl; // kdDebug(5800) << "ICalFormatImpl::readICalDateTime()" << endl;
if ( tz && t.is_utc == 0 ) { // Only use the TZ if time is not UTC. if (tz && !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 // FIXME: We'll need to make sure to apply the appropriate TZ, not just
// the first one found. // the first one found.
t.is_utc = (tz == icaltimezone_get_utc_timezone())?1:0; if (tz != icaltimezone_get_utc_timezone()) {
if (t.is_utc == 0) {
icalparameter *param = p ? icalproperty_get_first_parameter(p, ICAL_TZID_PARAMETER) : 0; icalparameter *param = p ? icalproperty_get_first_parameter(p, ICAL_TZID_PARAMETER) : 0;
const char *tzid = param ? icalparameter_get_tzid(param) : 0; const char *tzid = param ? icalparameter_get_tzid(param) : 0;
if ( !tzid ) if ( !tzid )

@ -1341,9 +1341,7 @@ int vcaltime_utc_offset( TQDateTime ictt, TQString tzid )
// struct icaltimetype tt = icaltime_from_timet( ictt.toTime_t(), false ); // struct icaltimetype tt = icaltime_from_timet( ictt.toTime_t(), false );
// return icaltime_utc_offset( tt, tzid.latin1() ); // return icaltime_utc_offset( tt, tzid.latin1() );
int daylight; int daylight;
struct icaltimetype tt = icaltime_from_timet( ictt.toTime_t(), false ); struct icaltimetype tt = icaltime_from_timet_with_zone( ictt.toTime_t(), false, NULL);
//source says this is DEPRECATED, but it doesn't say what to use instead
//how to handle failure from icaltimezone_get_builtin_timezone_from_tzid()?
return icaltimezone_get_utc_offset( return icaltimezone_get_utc_offset(
icaltimezone_get_builtin_timezone( tzid.latin1() ), icaltimezone_get_builtin_timezone( tzid.latin1() ),
&tt, &daylight ); &tt, &daylight );

@ -56,7 +56,7 @@ TQDateTime utcAsZone( const TQDateTime& utc, const TQString& timeZoneId )
TQDateTime epoch; TQDateTime epoch;
epoch.setTime_t( 0 ); epoch.setTime_t( 0 );
time_t v = epoch.secsTo( utc ); time_t v = epoch.secsTo( utc );
struct icaltimetype tt = icaltime_from_timet( v, 0 ); // 0: is_date=false struct icaltimetype tt = icaltime_from_timet_with_zone( v, 0, NULL );
int offset = icaltimezone_get_utc_offset( int offset = icaltimezone_get_utc_offset(
icaltimezone_get_builtin_timezone( timeZoneId.latin1() ), icaltimezone_get_builtin_timezone( timeZoneId.latin1() ),
&tt, &daylight ); &tt, &daylight );
@ -72,7 +72,7 @@ TQDateTime zoneAsUtc( const TQDateTime& zone, const TQString& timeZoneId )
TQDateTime epoch; TQDateTime epoch;
epoch.setTime_t( 0 ); epoch.setTime_t( 0 );
time_t v = epoch.secsTo( zone ); time_t v = epoch.secsTo( zone );
struct icaltimetype tt = icaltime_from_timet( v, 0 ); // 0: is_date=false struct icaltimetype tt = icaltime_from_timet_with_zone( v, 0, NULL );
int offset = icaltimezone_get_utc_offset( int offset = icaltimezone_get_utc_offset(
icaltimezone_get_builtin_timezone( timeZoneId.latin1() ), icaltimezone_get_builtin_timezone( timeZoneId.latin1() ),
&tt, &daylight ); &tt, &daylight );

@ -186,7 +186,7 @@ TQDateTime WebdavHandler::zoneAsUtc( const TQDateTime& zone, const TQString& tim
TQDateTime epoch; TQDateTime epoch;
epoch.setTime_t( 0 ); epoch.setTime_t( 0 );
time_t v = epoch.secsTo( zone ); time_t v = epoch.secsTo( zone );
struct icaltimetype tt = icaltime_from_timet( v, 0 ); // 0: is_date=false struct icaltimetype tt = icaltime_from_timet_with_zone( v, 0, NULL );
int offset = icaltimezone_get_utc_offset( int offset = icaltimezone_get_utc_offset(
icaltimezone_get_builtin_timezone( timeZoneId.latin1() ), icaltimezone_get_builtin_timezone( timeZoneId.latin1() ),
&tt, &daylight ); &tt, &daylight );

Loading…
Cancel
Save