Commit 04c82ec2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compile without deprecated methods

parent 428eb61c
......@@ -213,9 +213,13 @@ int MonthItem::daySpan() const
if (isMoving() || isResizing()) {
return mOverrideDaySpan;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QDateTime start(startDate());
QDateTime end(endDate());
#else
QDateTime start(startDate().startOfDay());
QDateTime end(endDate().startOfDay());
#endif
if (start.isValid() && end.isValid()) {
return start.daysTo(end);
......
......@@ -300,7 +300,11 @@ KCalendarCore::DateList MonthView::selectedIncidenceDates() const
QDateTime MonthView::selectionStart() const
{
if (d->scene->selectedCell()) {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
return QDateTime(d->scene->selectedCell()->date());
#else
return QDateTime(d->scene->selectedCell()->date().startOfDay());
#endif
} else {
return QDateTime();
}
......@@ -446,7 +450,12 @@ void MonthView::showDates(const QDate &start, const QDate &end, const QDate &pre
QPair<QDateTime, QDateTime> MonthView::actualDateRange(const QDateTime &start, const QDateTime &, const QDate &preferredMonth) const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QDateTime dayOne = preferredMonth.isValid() ? QDateTime(preferredMonth) : start;
#else
QDateTime dayOne = preferredMonth.isValid() ? QDateTime(preferredMonth.startOfDay()) : start;
#endif
dayOne.setDate(QDate(dayOne.date().year(), dayOne.date().month(), 1));
const int weekdayCol = (dayOne.date().dayOfWeek() + 7 - preferences()->firstDayOfWeek()) % 7;
QDateTime actualStart = dayOne.addDays(-weekdayCol);
......
......@@ -302,7 +302,11 @@ void TimelineView::showDates(const QDate &start, const QDate &end, const QDate &
d->mHintDate = QDateTime();
KGantt::DateTimeGrid *grid = static_cast<KGantt::DateTimeGrid *>(d->mGantt->grid());
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
grid->setStartDateTime(QDateTime(start));
#else
grid->setStartDateTime(QDateTime(start.startOfDay()));
#endif
d->mLeftView->clear();
uint index = 0;
// item for every calendar
......
......@@ -207,7 +207,11 @@ void TimelineView::Private::itemChanged(QStandardItem *item)
QDateTime newStart(tlit->startTime());
if (inc->allDay()) {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
newStart = QDateTime(newStart.date());
#else
newStart = QDateTime(newStart.date().startOfDay());
#endif
}
int delta = tlit->originalStart().secsTo(newStart);
......
......@@ -962,8 +962,11 @@ void TodoView::setNewDate(const QDate &date)
if (calendar()->hasRight(todoItem, Akonadi::Collection::CanChangeItem)) {
KCalendarCore::Todo::Ptr oldTodo(todo->clone());
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QDateTime dt(date);
#else
QDateTime dt(date.startOfDay());
#endif
if (!todo->allDay()) {
dt.setTime(todo->dtDue().time());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment