Eventviews

monthview.h
1/*
2 SPDX-FileCopyrightText: 2008 Bruno Virlet <bruno.virlet@gmail.com>
3 SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
4 SPDX-FileContributor: Bertjan Broeksema <broeksema@kde.org>
5
6 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
7*/
8
9#pragma once
10
11#include "eventview.h"
12
13#include <KHolidays/HolidayRegion>
14
15#include <memory>
16
17class QModelIndex;
18
19namespace EventViews
20{
21class MonthViewPrivate;
22
23/**
24 New month view.
25*/
26class EVENTVIEWS_EXPORT MonthView : public EventView
27{
29public:
30 enum NavButtonsVisibility {
31 Visible,
32 Hidden
33 };
34
35 explicit MonthView(NavButtonsVisibility visibility = Visible, QWidget *parent = nullptr);
36 ~MonthView() override;
37
38 void addCalendar(const Akonadi::CollectionCalendar::Ptr &calendar) override;
39 void removeCalendar(const Akonadi::CollectionCalendar::Ptr &calendar) override;
40
41 [[nodiscard]] int currentDateCount() const override;
42 [[nodiscard]] int currentMonth() const;
43
44 [[nodiscard]] Akonadi::Item::List selectedIncidences() const override;
45
46 /** Returns dates of the currently selected events */
47 [[nodiscard]] KCalendarCore::DateList selectedIncidenceDates() const override;
48
49 [[nodiscard]] QDateTime selectionStart() const override;
50
51 [[nodiscard]] QDateTime selectionEnd() const override;
52
53 void setDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate()) override;
54
55 [[nodiscard]] bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay) const override;
56
57 /**
58 * Returns the average date in the view
59 */
60 [[nodiscard]] QDate averageDate() const;
61
62 [[nodiscard]] bool usesFullWindow();
63
64 [[nodiscard]] bool supportsDateRangeSelection() const
65 {
66 return false;
67 }
68
69 [[nodiscard]] bool isBusyDay(QDate day) const;
70
72 void showIncidencePopupSignal(const Akonadi::CollectionCalendar::Ptr &calendar, const Akonadi::Item &item, const QDate &date);
73 void showNewEventPopupSignal();
74 void fullViewChanged(bool enabled);
75
76public Q_SLOTS:
77 void updateConfig() override;
78 void updateView() override;
79 void showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date) override;
80
81 void changeIncidenceDisplay(const Akonadi::Item &, int);
82 void changeFullView(); /// Display in full window mode
83 void moveBackMonth(); /// Shift the view one month back
84 void moveBackWeek(); /// Shift the view one week back
85 void moveFwdWeek(); /// Shift the view one week forward
86 void moveFwdMonth(); /// Shift the view one month forward
87
88protected Q_SLOTS:
89 void calendarReset() override;
90
91protected:
92#ifndef QT_NO_WHEELEVENT
93 void wheelEvent(QWheelEvent *event) override;
94#endif
95 void keyPressEvent(QKeyEvent *event) override;
96 void keyReleaseEvent(QKeyEvent *event) override;
97
98 QPair<QDateTime, QDateTime> actualDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate()) const override;
99
100 KHolidays::Holiday::List holidays(QDate startDate, QDate endDate);
101
102 // Compute and update the whole view
103 void reloadIncidences();
104
105protected:
106 /**
107 * @deprecated
108 */
109 void showDates(const QDate &start, const QDate &end, const QDate &preferedMonth = QDate()) override;
110
111private:
112 std::unique_ptr<MonthViewPrivate> const d;
113 friend class MonthViewPrivate;
114 friend class MonthScene;
115};
116}
QList< Item > List
EventView(QWidget *parent=nullptr)
Constructs a view.
Definition eventview.cpp:54
QDateTime selectionStart() const override
Returns the start of the selection, or an invalid QDateTime if there is no selection or the view does...
void moveBackWeek()
Shift the view one month back.
void moveFwdMonth()
Shift the view one week forward.
void setDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth=QDate()) override
void calendarReset() override
Shift the view one month forward.
MonthView(NavButtonsVisibility visibility=Visible, QWidget *parent=nullptr)
MonthView.
QDate averageDate() const
Returns the average date in the view.
Akonadi::Item::List selectedIncidences() const override
void moveFwdWeek()
Shift the view one week back.
bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay) const override
Sets the default start/end date/time for new events.
void showDates(const QDate &start, const QDate &end, const QDate &preferedMonth=QDate()) override
QPair< QDateTime, QDateTime > actualDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth=QDate()) const override
from the requested date range (passed via setDateRange()), calculates the adjusted date range actuall...
QDateTime selectionEnd() const override
Returns the end of the selection, or an invalid QDateTime if there is no selection or the view doesn'...
int currentDateCount() const override
Returns the number of currently shown dates.
void moveBackMonth()
Display in full window mode.
KCalendarCore::DateList selectedIncidenceDates() const override
Returns dates of the currently selected events.
QSharedPointer< Calendar > Ptr
QList< Holiday > List
Q_SCRIPTABLE QString start(QString train="")
Namespace EventViews provides facilities for displaying incidences, including events,...
Definition agenda.h:33
QList< QDate > DateList
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
QWidget(QWidget *parent, Qt::WindowFlags f)
virtual bool event(QEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:47:03 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.