Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into 'master'
[kcalcore] Remove deprecated libical API . Fixes MER#1941

See merge request mer-core/kcalcore!6
  • Loading branch information
pvuorela committed Aug 14, 2018
2 parents cfea852 + e5ba2a7 commit 59a1de4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
8 changes: 3 additions & 5 deletions kcalcore/icalformat_p.cpp
Expand Up @@ -2215,7 +2215,6 @@ icaltimetype ICalFormatImpl::writeICalDate( const QDate &date )
t.second = 0;

t.is_date = 1;
t.is_utc = 0;
t.zone = 0;

return t;
Expand All @@ -2236,8 +2235,7 @@ icaltimetype ICalFormatImpl::writeICalDateTime( const KDateTime &datetime )
t.minute = datetime.time().minute();
t.second = datetime.time().second();
}
t.zone = 0; // zone is NOT set
t.is_utc = datetime.isUtc() ? 1 : 0;
t.zone = datetime.isUtc() ? icaltimezone_get_utc_timezone() : 0;

// _dumpIcaltime( t );

Expand Down Expand Up @@ -2312,7 +2310,7 @@ icalproperty *ICalFormatImpl::writeICalDateTimeProperty( const icalproperty_kind
}

KTimeZone ktz;
if ( !t.is_utc ) {
if ( !icaltime_is_utc(t)) {
ktz = dt.timeZone();
}

Expand Down Expand Up @@ -2345,7 +2343,7 @@ KDateTime ICalFormatImpl::readICalDateTime( icalproperty *p,
// _dumpIcaltime( t );

KDateTime::Spec timeSpec;
if ( t.is_utc || t.zone == icaltimezone_get_utc_timezone() ) {
if ( icaltime_is_utc(t) ) {
timeSpec = KDateTime::UTC; // the time zone is UTC
utc = false; // no need to convert to UTC
} else {
Expand Down
13 changes: 6 additions & 7 deletions kcalcore/icaltimezones.cpp
Expand Up @@ -57,7 +57,7 @@ static QDateTime toQDateTime( const icaltimetype &t )
{
return QDateTime( QDate( t.year, t.month, t.day ),
QTime( t.hour, t.minute, t.second ),
( t.is_utc ? Qt::UTC : Qt::LocalTime ) );
( icaltime_is_utc(t) ? Qt::UTC : Qt::LocalTime ) );
}

// Maximum date for time zone data.
Expand All @@ -84,7 +84,6 @@ static icaltimetype writeLocalICalDateTime( const QDateTime &utc, int offset )
t.second = local.time().second();
t.is_date = 0;
t.zone = 0;
t.is_utc = 0;
return t;
}

Expand Down Expand Up @@ -942,7 +941,7 @@ ICalTimeZone ICalTimeZoneSource::parse( icalcomponent *vtimezone )
case ICAL_LASTMODIFIED_PROPERTY:
{
const icaltimetype t = icalproperty_get_lastmodified(p);
if ( t.is_utc ) {
if ( icaltime_is_utc(t) ) {
data->d->lastModified = toQDateTime( t );
} else {
kDebug() << "LAST-MODIFIED not UTC";
Expand Down Expand Up @@ -1314,7 +1313,7 @@ QList<QDateTime> ICalTimeZoneSourcePrivate::parsePhase( icalcomponent *c,

// Convert DTSTART to QDateTime, and from local time to UTC
dtstart.second -= prevOffset;
dtstart.is_utc = 1;
dtstart.zone = icaltimezone_get_utc_timezone();
const QDateTime utcStart = toQDateTime( icaltime_normalize( dtstart ) ); // UTC

transitions += utcStart;
Expand All @@ -1340,13 +1339,13 @@ QList<QDateTime> ICalTimeZoneSourcePrivate::parsePhase( icalcomponent *c,
t.minute = dtstart.minute;
t.second = dtstart.second;
t.is_date = 0;
t.is_utc = 0; // dtstart is in local time
t.zone = 0; // dtstart is in local time
}
// RFC2445 states that RDATE must be in local time,
// but we support UTC as well to be safe.
if ( !t.is_utc ) {
if ( !icaltime_is_utc(t) ) {
t.second -= prevOffset; // convert to UTC
t.is_utc = 1;
t.zone = icaltimezone_get_utc_timezone();
t = icaltime_normalize( t );
}
transitions += toQDateTime( t );
Expand Down

0 comments on commit 59a1de4

Please sign in to comment.