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 { Visible, Hidden };
31
32 explicit MonthView(NavButtonsVisibility visibility = Visible, QWidget *parent = nullptr);
33 ~MonthView() override;
34
35 void addCalendar(const Akonadi::CollectionCalendar::Ptr &calendar) override;
36 void removeCalendar(const Akonadi::CollectionCalendar::Ptr &calendar) override;
37
38 [[nodiscard]] int currentDateCount() const override;
39 [[nodiscard]] int currentMonth() const;
40
41 [[nodiscard]] Akonadi::Item::List selectedIncidences() const override;
42
43 /** Returns dates of the currently selected events */
44 [[nodiscard]] KCalendarCore::DateList selectedIncidenceDates() const override;
45
46 [[nodiscard]] QDateTime selectionStart() const override;
47
48 [[nodiscard]] QDateTime selectionEnd() const override;
49
50 void setDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate()) override;
51
52 [[nodiscard]] bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay) const override;
53
54 /**
55 * Returns the average date in the view
56 */
57 [[nodiscard]] QDate averageDate() const;
58
59 [[nodiscard]] bool usesFullWindow();
60
61 [[nodiscard]] bool supportsDateRangeSelection() const
62 {
63 return false;
64 }
65
66 [[nodiscard]] bool isBusyDay(QDate day) const;
67
68Q_SIGNALS:
69 void showIncidencePopupSignal(const Akonadi::CollectionCalendar::Ptr &calendar, const Akonadi::Item &item, const QDate &date);
70 void showNewEventPopupSignal();
71 void fullViewChanged(bool enabled);
72
73public Q_SLOTS:
74 void updateConfig() override;
75 void updateView() override;
76 void showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date) override;
77
78 void changeIncidenceDisplay(const Akonadi::Item &, int);
79 void changeFullView(); /// Display in full window mode
80 void moveBackMonth(); /// Shift the view one month back
81 void moveBackWeek(); /// Shift the view one week back
82 void moveFwdWeek(); /// Shift the view one week forward
83 void moveFwdMonth(); /// Shift the view one month forward
84
85protected Q_SLOTS:
86 void calendarReset() override;
87
88protected:
89#ifndef QT_NO_WHEELEVENT
90 void wheelEvent(QWheelEvent *event) override;
91#endif
92 void keyPressEvent(QKeyEvent *event) override;
93 void keyReleaseEvent(QKeyEvent *event) override;
94
95 QPair<QDateTime, QDateTime> actualDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate()) const override;
96
97 KHolidays::Holiday::List holidays(QDate startDate, QDate endDate);
98
99 // Compute and update the whole view
100 void reloadIncidences();
101
102protected:
103 /**
104 * @deprecated
105 */
106 void showDates(const QDate &start, const QDate &end, const QDate &preferedMonth = QDate()) override;
107
108private:
109 std::unique_ptr<MonthViewPrivate> const d;
110 friend class MonthViewPrivate;
111 friend class MonthScene;
112};
113}
EventView is the abstract base class from which all other calendar views for event data are derived.
Definition eventview.h:67
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 Tue Mar 26 2024 11:12:29 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.