summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <[email protected]>2017-09-13 12:14:35 +0200
committerDaniel Vrátil <[email protected]>2017-09-13 12:14:35 +0200
commit7fb2492c3289bd6ad52f19825b313ba9aa114a3f (patch)
tree80e00603b57936acffb42abe344f6f7f3d3a1734
parentc3baeee811317ee689a79d75ebe28b50b5cf2541 (diff)
Adapt to KCalCore API changes
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/alarmtext.cpp4
-rw-r--r--src/kaevent.cpp27
-rw-r--r--src/karecurrence.cpp6
4 files changed, 19 insertions, 19 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 78b9621..99220e9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -32,6 +32,7 @@ PUBLIC
KF5::CoreAddons
KF5::CalendarCore
KF5::AkonadiCore
+ KF5::KDELibs4Support
PRIVATE
)
diff --git a/src/alarmtext.cpp b/src/alarmtext.cpp
index c3ee23d..e9d25db 100644
--- a/src/alarmtext.cpp
+++ b/src/alarmtext.cpp
@@ -162,10 +162,10 @@ void AlarmText::setTodo(const KCalCore::Todo::Ptr &todo)
d->mBody = todo->description();
d->mTo = todo->location();
if (todo->hasDueDate()) {
- KDateTime due = todo->dtDue(false); // fetch the next due date
+ QDateTime due = todo->dtDue(false); // fetch the next due date
if (todo->hasStartDate() && todo->dtStart() != due) {
d->mTime = todo->allDay() ? QLocale().toString(due.date(), QLocale::ShortFormat)
- : QLocale().toString(due.dateTime(), QLocale::ShortFormat);
+ : QLocale().toString(due, QLocale::ShortFormat);
}
}
}
diff --git a/src/kaevent.cpp b/src/kaevent.cpp
index 48d09cb..1dd40de 100644
--- a/src/kaevent.cpp
+++ b/src/kaevent.cpp
@@ -1330,9 +1330,9 @@ bool KAEventPrivate::updateKCalEvent(const Event::Ptr &ev, KAEvent::UidAction ui
* UTC DATE-TIME value. So always use a time relative to DTSTART instead of
* an absolute time.
*/
- ev->setDtStart(mStartDateTime.calendarKDateTime());
+ ev->setDtStart(KCalCore::k2q(mStartDateTime.calendarKDateTime()));
ev->setAllDay(false);
- ev->setDtEnd(KDateTime());
+ ev->setDtEnd(QDateTime());
const DateTime dtMain = archived ? mStartDateTime : mNextMainDateTime;
int ancillaryType = 0; // 0 = invalid, 1 = time, 2 = offset
@@ -3840,7 +3840,7 @@ void KAEventPrivate::dumpDebug() const
*/
DateTime KAEventPrivate::readDateTime(const Event::Ptr &event, bool dateOnly, DateTime &start)
{
- start = event->dtStart();
+ start = KCalCore::q2k(event->dtStart());
if (dateOnly) {
// A date-only event is indicated by the X-KDE-KALARM-FLAGS:DATE property, not
// by a date-only start date/time (for the reasons given in updateKCalEvent()).
@@ -5075,19 +5075,18 @@ bool KAEvent::convertKCalEvents(const Calendar::Ptr &calendar, int calendarVersi
* Convert BEEP category into an audio alarm with no audio file.
*/
if (CalEvent::status(event) == CalEvent::ARCHIVED) {
- event->setCreated(KCalCore::k2q(event->dtEnd()));
+ event->setCreated(event->dtEnd());
}
- KDateTime start = event->dtStart();
+ QDateTime start = event->dtStart();
if (event->allDay()) {
- event->setAllDay(false);
start.setTime(QTime(0, 0));
flags += KAEventPrivate::DATE_ONLY_FLAG;
}
- event->setDtEnd(KDateTime());
+ event->setDtEnd(QDateTime());
for (int ai = 0, aend = alarms.count(); ai < aend; ++ai) {
Alarm::Ptr alarm = alarms[ai];
- alarm->setStartOffset(start.secsTo(KCalCore::q2k(alarm->time())));
+ alarm->setStartOffset(start.secsTo(alarm->time()));
}
if (!cats.isEmpty()) {
@@ -5107,14 +5106,14 @@ bool KAEvent::convertKCalEvents(const Calendar::Ptr &calendar, int calendarVersi
Alarm::Ptr alarm = event->newAlarm();
alarm->setEnabled(true);
alarm->setAudioAlarm();
- KDateTime dt = event->dtStart(); // default
+ QDateTime dt = event->dtStart(); // default
// Parse and order the alarms to know which one's date/time to use
KAEventPrivate::AlarmMap alarmMap;
KAEventPrivate::readAlarms(event, &alarmMap);
KAEventPrivate::AlarmMap::ConstIterator it = alarmMap.constBegin();
if (it != alarmMap.constEnd()) {
- dt = KCalCore::q2k(it.value().alarm->time());
+ dt = it.value().alarm->time();
break;
}
alarm->setStartOffset(start.secsTo(dt));
@@ -5245,7 +5244,7 @@ bool KAEvent::convertKCalEvents(const Calendar::Ptr &calendar, int calendarVersi
*/
const QStringList flags = event->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY).split(KAEventPrivate::SC, QString::SkipEmptyParts);
const bool dateOnly = flags.contains(KAEventPrivate::DATE_ONLY_FLAG);
- KDateTime startDateTime = event->dtStart();
+ KDateTime startDateTime = KCalCore::q2k(event->dtStart(), dateOnly);
if (dateOnly) {
startDateTime.setDateOnly(true);
}
@@ -5489,10 +5488,10 @@ bool KAEventPrivate::convertStartOfDay(const Event::Ptr &event)
const QStringList flags = event->customProperty(KACalendar::APPNAME, KAEventPrivate::FLAGS_PROPERTY).split(KAEventPrivate::SC, QString::SkipEmptyParts);
if (flags.indexOf(KAEventPrivate::DATE_ONLY_FLAG) >= 0) {
// It's an untimed event, so fix it
- const KDateTime oldDt = event->dtStart();
+ const KDateTime oldDt = KCalCore::q2k(event->dtStart());
const int adjustment = oldDt.time().secsTo(midnight);
if (adjustment) {
- event->setDtStart(KDateTime(oldDt.date(), midnight, oldDt.timeSpec()));
+ event->setDtStart(QDateTime(oldDt.date(), midnight, KCalCore::specToZone(oldDt.timeSpec())));
int deferralOffset = 0;
AlarmMap alarmMap;
readAlarms(event, &alarmMap);
@@ -5529,7 +5528,7 @@ bool KAEventPrivate::convertStartOfDay(const Event::Ptr &event)
}
if ((data.type & DEFERRED_ALARM) && !data.timedDeferral) {
// Found a date-only deferral alarm, so adjust its time
- KDateTime altime = KCalCore::q2k(data.alarm->startOffset().end(KCalCore::k2q(nextMainDateTime)));
+ QDateTime altime = data.alarm->startOffset().end(KCalCore::k2q(nextMainDateTime));
altime.setTime(midnight);
deferralOffset = data.alarm->startOffset().asSeconds();
newDeferralOffset = event->dtStart().secsTo(altime);
diff --git a/src/karecurrence.cpp b/src/karecurrence.cpp
index d45cf46..b4391bc 100644
--- a/src/karecurrence.cpp
+++ b/src/karecurrence.cpp
@@ -871,7 +871,7 @@ DateTimeList KARecurrence::timesInInterval(const KDateTime &start, const KDateTi
DateTimeList rv;
rv.reserve(l.size());
for (const auto &qdt : l) {
- rv << KCalCore::q2k(qdt);
+ rv << qdt;
}
return rv;
}
@@ -1199,7 +1199,7 @@ DateTimeList KARecurrence::exDateTimes() const
DateTimeList rv;
rv.reserve(l.size());
for (const auto &qdt : l) {
- rv << KCalCore::q2k(qdt);
+ rv << qdt;
}
return rv;
}
@@ -1214,7 +1214,7 @@ void KARecurrence::setExDateTimes(const DateTimeList &exdates)
SortableList<QDateTime> l;
l.reserve(exdates.size());
for (const auto &kdt : exdates) {
- l << KCalCore::k2q(kdt);
+ l << kdt;
}
d->mRecurrence.setExDateTimes(l);
}