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{
28 Q_OBJECT
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
71Q_SIGNALS:
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}
EventView is the abstract base class from which all other calendar views for event data are derived.
Definition eventview.h:69
New month view.
Definition monthview.h:27
Q_SCRIPTABLE Q_NOREPLY void start()
Namespace EventViews provides facilities for displaying incidences, including events,...
Definition agenda.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.