Skip to content

Commit 27eaa21

Browse files
committed
icalformat_p.cpp, icaltimezones.cpp - follow API changes in libical3
1 parent 16e86a5 commit 27eaa21

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

Diff for: src/icalformat_p.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -2318,7 +2318,6 @@ icaltimetype ICalFormatImpl::writeICalDate(const QDate &date)
23182318
t.second = 0;
23192319

23202320
t.is_date = 1;
2321-
t.is_utc = 0;
23222321
t.zone = nullptr;
23232322

23242323
return t;
@@ -2340,8 +2339,10 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const QDateTime &datetime, bool d
23402339
t.second = datetime.time().second();
23412340
}
23422341
t.zone = nullptr; // zone is NOT set
2343-
t.is_utc = datetime.timeSpec() == Qt::UTC ||
2344-
(datetime.timeSpec() == Qt::OffsetFromUTC && datetime.offsetFromUtc() == 0);
2342+
if (datetime.timeSpec() == Qt::UTC ||
2343+
(datetime.timeSpec() == Qt::OffsetFromUTC && datetime.offsetFromUtc() == 0)) {
2344+
t = icaltime_convert_to_zone(t, icaltimezone_get_utc_timezone());
2345+
}
23452346

23462347
return t;
23472348
}
@@ -2411,7 +2412,7 @@ icalproperty *ICalFormatImpl::writeICalDateTimeProperty(const icalproperty_kind
24112412
}
24122413

24132414
QTimeZone qtz;
2414-
if (!t.is_utc) {
2415+
if (!icaltime_is_utc(t)) {
24152416
qtz = dt.timeZone();
24162417
}
24172418

@@ -2433,7 +2434,7 @@ QDateTime ICalFormatImpl::readICalDateTime(icalproperty *p, const icaltimetype &
24332434
// _dumpIcaltime( t );
24342435

24352436
QTimeZone timeZone;
2436-
if (t.is_utc || t.zone == icaltimezone_get_utc_timezone()) {
2437+
if (icaltime_is_utc(t) || t.zone == icaltimezone_get_utc_timezone()) {
24372438
timeZone = QTimeZone::utc(); // the time zone is UTC
24382439
utc = false; // no need to convert to UTC
24392440
} else {

Diff for: src/icaltimezones.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static QDateTime toQDateTime(const icaltimetype &t)
4747
{
4848
return QDateTime(QDate(t.year, t.month, t.day),
4949
QTime(t.hour, t.minute, t.second),
50-
(t.is_utc ? Qt::UTC : Qt::LocalTime));
50+
(icaltime_is_utc(t) ? Qt::UTC : Qt::LocalTime));
5151
}
5252

5353
// Maximum date for time zone data.
@@ -74,7 +74,6 @@ static icaltimetype writeLocalICalDateTime(const QDateTime &utc, int offset)
7474
t.second = local.time().second();
7575
t.is_date = 0;
7676
t.zone = nullptr;
77-
t.is_utc = 0;
7877
return t;
7978
}
8079

@@ -632,7 +631,7 @@ bool ICalTimeZoneParser::parsePhase(icalcomponent *c, ICalTimeZonePhase &phase)
632631
// Convert DTSTART to QDateTime, and from local time to UTC
633632
const QDateTime localStart = toQDateTime(dtstart); // local time
634633
dtstart.second -= prevOffset;
635-
dtstart.is_utc = 1;
634+
dtstart = icaltime_convert_to_zone(dtstart, icaltimezone_get_utc_timezone());
636635
const QDateTime utcStart = toQDateTime(icaltime_normalize(dtstart)); // UTC
637636

638637
phase.abbrevs.unite(abbrevs);
@@ -661,13 +660,12 @@ bool ICalTimeZoneParser::parsePhase(icalcomponent *c, ICalTimeZonePhase &phase)
661660
t.minute = dtstart.minute;
662661
t.second = dtstart.second;
663662
t.is_date = 0;
664-
t.is_utc = 0; // dtstart is in local time
665663
}
666664
// RFC2445 states that RDATE must be in local time,
667665
// but we support UTC as well to be safe.
668-
if (!t.is_utc) {
666+
if (!icaltime_is_utc(t)) {
669667
t.second -= prevOffset; // convert to UTC
670-
t.is_utc = 1;
668+
t = icaltime_convert_to_zone(t, icaltimezone_get_utc_timezone());
671669
t = icaltime_normalize(t);
672670
}
673671
phase.transitions += toQDateTime(t);

0 commit comments

Comments
 (0)