Commit 2fc7a519 authored by Volker Krause's avatar Volker Krause
Browse files

Adapt to CalendarSupport changes

parent 68bf6724
......@@ -44,7 +44,7 @@ set(KCALENDARCORE_LIB_VERSION "5.6.40")
set(AKONADICALENDAR_LIB_VERSION "5.6.40")
set(KMIME_LIB_VERSION "5.6.40")
set(LIBKDEPIM_LIB_VERSION "5.6.40")
set(CALENDARSUPPORT_LIB_VERSION "5.6.41")
set(CALENDARSUPPORT_LIB_VERSION "5.6.42")
find_package(KF5Akonadi ${AKONADI_LIB_VERSION} CONFIG REQUIRED)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets UiTools)
......
......@@ -1020,7 +1020,7 @@ void AgendaItem::paintEvent(QPaintEvent *ev)
longH.clear();
if (const KCalCore::Event::Ptr event = CalendarSupport::event(mIncidence)) {
if (event->isMultiDay(mEventView->preferences()->timeSpec())) {
if (event->isMultiDay(KDateTime::LocalZone)) {
// multi-day, all-day event
shortH =
i18n("%1 - %2",
......
......@@ -589,7 +589,6 @@ void AgendaView::Private::insertIncidence(const KCalCore::Incidence::Ptr &incide
return;
}
const KDateTime::Spec timeSpec = q->preferences()->timeSpec();
const QDate today = QDateTime::currentDateTime().date();
if (todo && todo->isOverdue() && today >= insertAtDate) {
mAllDayAgenda->insertAllDayItem(incidence, recurrenceId, curCol, curCol,
......@@ -597,7 +596,7 @@ void AgendaView::Private::insertIncidence(const KCalCore::Incidence::Ptr &incide
} else if (incidence->allDay()) {
mAllDayAgenda->insertAllDayItem(incidence, recurrenceId, beginX, endX,
createSelected);
} else if (event && event->isMultiDay(timeSpec)) {
} else if (event && event->isMultiDay(KDateTime::LocalZone)) {
// TODO: We need a better isMultiDay(), one that receives the occurrence.
// In the single-day handling code there's a neat comment on why
......@@ -1812,10 +1811,8 @@ bool AgendaView::displayIncidence(const KCalCore::Incidence::Ptr &incidence, bo
const QDate today = QDate::currentDate();
KCalCore::DateTimeList::iterator t;
const KDateTime::Spec timeSpec = preferences()->timeSpec();
KDateTime firstVisibleDateTime(d->mSelectedDates.first(), timeSpec);
KDateTime lastVisibleDateTime(d->mSelectedDates.last(), timeSpec);
KDateTime firstVisibleDateTime(d->mSelectedDates.first(), KDateTime::LocalZone);
KDateTime lastVisibleDateTime(d->mSelectedDates.last(), KDateTime::LocalZone);
// Optimization, very cheap operation that discards incidences that aren't in the timespan
if (!d->mightBeVisible(incidence)) {
......@@ -1894,7 +1891,7 @@ bool AgendaView::displayIncidence(const KCalCore::Incidence::Ptr &incidence, bo
}
// ToDo items shall be displayed today if they are overdue
const KDateTime dateTimeToday = KDateTime(today, timeSpec);
const KDateTime dateTimeToday = KDateTime(today, KDateTime::LocalZone);
if (todo &&
todo->isOverdue() &&
dateTimeToday >= firstVisibleDateTime &&
......@@ -2003,7 +2000,7 @@ void AgendaView::slotIncidencesDropped(const KCalCore::Incidence::List &incidenc
const QDate day = d->mSelectedDates[gpos.x()];
const QTime time = d->mAgenda->gyToTime(gpos.y());
KDateTime newTime(day, time, preferences()->timeSpec());
KDateTime newTime(day, KDateTime::LocalZone);
newTime.setDateOnly(allDay);
Q_FOREACH (const KCalCore::Incidence::Ptr &incidence, incidences) {
......
......@@ -204,11 +204,6 @@ QString AkonadiViewCalendar::iconForIncidence(const KCalCore::Incidence::Ptr &in
return mAgendaView->iconForItem(item(incidence));
}
KDateTime::Spec AkonadiViewCalendar::timeSpec() const
{
return mCalendar->timeSpec();
}
KCalCore::Calendar::Ptr AkonadiViewCalendar::getCalendar() const
{
return mCalendar;
......
......@@ -71,8 +71,6 @@ public:
KCalCore::Calendar::Ptr getCalendar() const override;
KDateTime::Spec timeSpec() const;
Akonadi::ETMCalendar::Ptr mCalendar;
AgendaView *mAgendaView = nullptr;
};
......
......@@ -115,7 +115,7 @@ void EventView::setHolidayRegion(const KHolidays::HolidayRegionPtr &holidayRegio
int EventView::showMoveRecurDialog(const Incidence::Ptr &inc, const QDate &date)
{
KDateTime dateTime(date, preferences()->timeSpec());
KDateTime dateTime(date, KDateTime::LocalZone);
int availableOccurrences = KCalUtils::RecurrenceActions::availableOccurrences(inc, dateTime);
......
......@@ -27,8 +27,6 @@
#include "eventview.h"
#include <KDateTime>
class QModelIndex;
namespace EventViews
......
......@@ -26,7 +26,6 @@
#include "prefs.h"
#include "prefs_base.h"
#include <KSystemTimeZone>
#include "calendarview_debug.h"
#include <QFontDatabase>
......@@ -833,11 +832,6 @@ QFont Prefs::agendaTimeLabelsFont() const
return d->getFont(d->mBaseConfig.agendaTimeLabelsFontItem());
}
KDateTime::Spec Prefs::timeSpec() const
{
return KSystemTimeZones::local();
}
QTimeZone Prefs::timeZone() const
{
return QTimeZone::systemTimeZone();
......
......@@ -29,7 +29,6 @@
#include "eventview.h"
#include <KConfigSkeleton>
#include <KDateTime>
#include <QTimeZone>
namespace EventViews
......@@ -154,7 +153,6 @@ public:
QColor resourceColor(const QString &);
QColor resourceColorKnown(const QString &) const;
KDateTime::Spec timeSpec() const;
QTimeZone timeZone() const;
QStringList timeScaleTimezones() const;
......
......@@ -21,7 +21,6 @@
#include "timelineitem.h"
#include <KGantt/KGanttGlobal>
#include <CalendarSupport/KCalPrefs>
#include <CalendarSupport/Utils>
......
......@@ -37,7 +37,6 @@
#include <Akonadi/Calendar/ETMCalendar>
#include <CalendarSupport/CollectionSelection>
#include <CalendarSupport/Utils>
#include <CalendarSupport/KCalPrefs>
#include <Akonadi/Calendar/IncidenceChanger>
#include "calendarview_debug.h"
......@@ -404,9 +403,8 @@ void TimelineView::showDates(const QDate &start, const QDate &end, const QDate &
d->mGantt->setModel(nullptr);
KCalCore::Event::List events;
KDateTime::Spec timeSpec = CalendarSupport::KCalPrefs::instance()->timeSpec();
for (QDate day = start; day <= end; day = day.addDays(1)) {
events = calendar()->events(day, timeSpec,
events = calendar()->events(day, KDateTime::LocalZone,
KCalCore::EventSortStartDate,
KCalCore::SortDirectionAscending);
Q_FOREACH (const KCalCore::Event::Ptr &event, events) {
......
......@@ -30,7 +30,6 @@
#include <Akonadi/Calendar/ETMCalendar>
#include <CalendarSupport/CollectionSelection>
#include <CalendarSupport/Utils>
#include <CalendarSupport/KCalPrefs>
#include <Akonadi/Calendar/IncidenceChanger>
#include <KCalCore/OccurrenceIterator>
......@@ -152,10 +151,9 @@ void TimelineView::Private::insertIncidence(const Akonadi::Item &incidence)
insertIncidence(incidence, QDate());
}
KDateTime::Spec timeSpec = CalendarSupport::KCalPrefs::instance()->timeSpec();
for (QDate day = mStartDate; day <= mEndDate; day = day.addDays(1)) {
KCalCore::Event::List events = q->calendar()->events(day,
timeSpec,
KDateTime::LocalZone,
KCalCore::EventSortStartDate,
KCalCore::SortDirectionAscending);
if (events.contains(event)) {
......
......@@ -257,8 +257,7 @@ void TimeSpentView::updateView()
text+="</h2>\n";
*/
KDateTime::Spec timeSpec = CalendarSupport::KCalPrefs::instance()->timeSpec();
mView->mEventList = calendar()->events(mStartDate, mEndDate, timeSpec);
mView->mEventList = calendar()->events(mStartDate, mEndDate, KDateTime::LocalZone);
mView->repaint();
}
......@@ -28,7 +28,6 @@
#include <Akonadi/Calendar/ETMCalendar>
#include <CalendarSupport/CategoryConfig>
#include <CalendarSupport/KCalPrefs>
#include <CalendarSupport/CategoryHierarchyReader>
#include <LibkdepimAkonadi/TagSelectionCombo>
......
......@@ -108,9 +108,7 @@ void WhatsNextView::updateView()
mText += QLatin1String("</h2>\n");
KCalCore::Event::List events;
KDateTime::Spec timeSpec = CalendarSupport::KCalPrefs::instance()->timeSpec();
events = calendar()->events(mStartDate, mEndDate, timeSpec, false);
events = calendar()->events(mStartDate, mEndDate, KDateTime::LocalZone, false);
events = calendar()->sortEvents(events, KCalCore::EventSortStartDate,
KCalCore::SortDirectionAscending);
......@@ -129,9 +127,9 @@ void WhatsNextView::updateView()
} else {
KCalCore::Recurrence *recur = ev->recurrence();
int duration = ev->dtStart().secsTo(ev->dtEnd());
KDateTime start = recur->getPreviousDateTime(KDateTime(mStartDate, QTime(), timeSpec));
KDateTime start = recur->getPreviousDateTime(KDateTime(mStartDate, QTime(), KDateTime::LocalZone));
KDateTime end = start.addSecs(duration);
KDateTime endDate(mEndDate, QTime(23, 59, 59), timeSpec);
KDateTime endDate(mEndDate, QTime(23, 59, 59), KDateTime::LocalZone);
if (end.date() >= mStartDate) {
appendEvent(ev, start.toLocalZone().dateTime(), end.toLocalZone().dateTime());
}
......@@ -190,7 +188,7 @@ void WhatsNextView::updateView()
QStringList myEmails(CalendarSupport::KCalPrefs::instance()->allEmails());
int replies = 0;
events = calendar()->events(QDate::currentDate(), QDate(2975, 12, 6), timeSpec);
events = calendar()->events(QDate::currentDate(), QDate(2975, 12, 6), KDateTime::LocalZone);
Q_FOREACH (const KCalCore::Event::Ptr &ev, events) {
KCalCore::Attendee::Ptr me = ev->attendeeByMails(myEmails);
if (me != nullptr) {
......
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