Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e1f2c268 authored by Volker Krause's avatar Volker Krause

Port EventView range API to QDateTime

parent 9da2e1ad
cmake_minimum_required(VERSION 3.0)
set(PIM_VERSION "5.6.41")
set(PIM_VERSION "5.6.42")
project(eventviews VERSION ${PIM_VERSION})
......
......@@ -280,7 +280,7 @@ bool EventView::hasConfigurationDialog() const
return false;
}
void EventView::setDateRange(const KDateTime &start, const KDateTime &end,
void EventView::setDateRange(const QDateTime &start, const QDateTime &end,
const QDate &preferredMonth)
{
Q_D(EventView);
......@@ -288,30 +288,30 @@ void EventView::setDateRange(const KDateTime &start, const KDateTime &end,
d->startDateTime = start;
d->endDateTime = end;
showDates(start.date(), end.date(), preferredMonth);
const QPair<KDateTime, KDateTime> adjusted = actualDateRange(start, end, preferredMonth);
const QPair<QDateTime, QDateTime> adjusted = actualDateRange(start, end, preferredMonth);
d->actualStartDateTime = adjusted.first;
d->actualEndDateTime = adjusted.second;
}
KDateTime EventView::startDateTime() const
QDateTime EventView::startDateTime() const
{
Q_D(const EventView);
return d->startDateTime;
}
KDateTime EventView::endDateTime() const
QDateTime EventView::endDateTime() const
{
Q_D(const EventView);
return d->endDateTime;
}
KDateTime EventView::actualStartDateTime() const
QDateTime EventView::actualStartDateTime() const
{
Q_D(const EventView);
return d->actualStartDateTime;
}
KDateTime EventView::actualEndDateTime() const
QDateTime EventView::actualEndDateTime() const
{
Q_D(const EventView);
return d->actualEndDateTime;
......@@ -462,8 +462,8 @@ void EventView::doSaveConfig(KConfigGroup &)
{
}
QPair<KDateTime, KDateTime> EventView::actualDateRange(const KDateTime &start,
const KDateTime &end,
QPair<QDateTime, QDateTime> EventView::actualDateRange(const QDateTime &start,
const QDateTime &end,
const QDate &preferredMonth) const
{
Q_UNUSED(preferredMonth);
......
......@@ -267,14 +267,14 @@ public:
* month to show when the week crosses months. It's a QDate instead
* of uint so it can be easily fed to KCalendarSystem's functions.
*/
virtual void setDateRange(const KDateTime &start, const KDateTime &end,
virtual void setDateRange(const QDateTime &start, const QDateTime &end,
const QDate &preferredMonth = QDate());
KDateTime startDateTime() const;
KDateTime endDateTime() const;
QDateTime startDateTime() const;
QDateTime endDateTime() const;
KDateTime actualStartDateTime() const;
KDateTime actualEndDateTime() const;
QDateTime actualStartDateTime() const;
QDateTime actualEndDateTime() const;
int showMoveRecurDialog(const KCalCore::Incidence::Ptr &incidence, const QDate &date);
......@@ -516,8 +516,8 @@ protected:
* month to show when the week crosses months. It's a QDate instead of
* uint so it can be easily fed to KCalendarSystem's functions.
*/
virtual QPair<KDateTime, KDateTime> actualDateRange(
const KDateTime &start, const KDateTime &end, const QDate &preferredMonth = QDate()) const;
virtual QPair<QDateTime, QDateTime> actualDateRange(
const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate()) const;
/*
virtual void incidencesAdded( const Akonadi::Item::List &incidences );
virtual void incidencesAboutToBeRemoved( const Akonadi::Item::List &incidences );
......
......@@ -28,7 +28,7 @@
#include "eventview.h"
#include <KDateTime>
#include <QDateTime>
class KCheckableProxyModel;
......@@ -56,10 +56,10 @@ public: /// Members
KCheckableProxyModel *collectionSelectionModel;
QByteArray identifier;
KDateTime startDateTime;
KDateTime endDateTime;
KDateTime actualStartDateTime;
KDateTime actualEndDateTime;
QDateTime startDateTime;
QDateTime endDateTime;
QDateTime actualStartDateTime;
QDateTime actualEndDateTime;
/* When we receive a QEvent with a key_Return release
* we will only show a new event dialog if we previously received a
......
......@@ -105,8 +105,8 @@ void MonthViewPrivate::addIncidence(const Akonadi::Item &incidence)
void MonthViewPrivate::moveStartDate(int weeks, int months)
{
KDateTime start = q->startDateTime();
KDateTime end = q->endDateTime();
auto start = q->startDateTime();
auto end = q->endDateTime();
start = start.addDays(weeks * 7);
end = end.addDays(weeks * 7);
start = start.addMonths(months);
......@@ -314,7 +314,7 @@ QDateTime MonthView::selectionEnd() const
return selectionStart();
}
void MonthView::setDateRange(const KDateTime &start, const KDateTime &end,
void MonthView::setDateRange(const QDateTime &start, const QDateTime &end,
const QDate &preferredMonth)
{
EventView::setDateRange(start, end, preferredMonth);
......@@ -446,16 +446,16 @@ void MonthView::showDates(const QDate &start, const QDate &end, const QDate &pre
d->triggerDelayedReload(DatesChanged);
}
QPair<KDateTime, KDateTime> MonthView::actualDateRange(const KDateTime &start,
const KDateTime &,
QPair<QDateTime, QDateTime> MonthView::actualDateRange(const QDateTime &start,
const QDateTime &,
const QDate &preferredMonth) const
{
KDateTime dayOne = preferredMonth.isValid() ? KDateTime(preferredMonth) : start;
QDateTime dayOne = preferredMonth.isValid() ? QDateTime(preferredMonth) : start;
dayOne.setDate(QDate(dayOne.date().year(), dayOne.date().month(), 1));
const int weekdayCol = (dayOne.date().dayOfWeek() + 7 - QLocale().firstDayOfWeek()) % 7;
KDateTime actualStart = dayOne.addDays(-weekdayCol);
QDateTime actualStart = dayOne.addDays(-weekdayCol);
actualStart.setTime(QTime(0, 0, 0, 0));
KDateTime actualEnd = actualStart.addDays(6 * 7 - 1);
QDateTime actualEnd = actualStart.addDays(6 * 7 - 1);
actualEnd.setTime(QTime(23, 59, 59, 99));
return qMakePair(actualStart, actualEnd);
}
......@@ -506,7 +506,7 @@ void MonthView::reloadIncidences()
// build global event list
const bool colorMonthBusyDays = preferences()->colorMonthBusyDays();
KCalCore::OccurrenceIterator occurIter(*calendar(), actualStartDateTime(), actualEndDateTime());
KCalCore::OccurrenceIterator occurIter(*calendar(), KDateTime(actualStartDateTime()), KDateTime(actualEndDateTime()));
while (occurIter.hasNext()) {
occurIter.next();
......
......@@ -63,7 +63,7 @@ public:
QDateTime selectionEnd() const override;
virtual void setDateRange(const KDateTime &start, const KDateTime &end,
virtual void setDateRange(const QDateTime &start, const QDateTime &end,
const QDate &preferredMonth = QDate()) override;
bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay) const override;
......@@ -116,8 +116,8 @@ protected:
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
QPair<KDateTime, KDateTime> actualDateRange(
const KDateTime &start, const KDateTime &end, const QDate &preferredMonth = QDate()) const override;
QPair<QDateTime, QDateTime> actualDateRange(
const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate()) const override;
// Compute and update the whole view
void reloadIncidences();
......
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