File indexing completed on 2024-06-16 04:57:15
0001 /* 0002 This file is part of KOrganizer. 0003 0004 SPDX-FileCopyrightText: 2000, 2001, 2003 Cornelius Schumacher <schumacher@kde.org> 0005 SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0008 */ 0009 0010 #pragma once 0011 0012 #include "koeventview.h" 0013 0014 #include <CalendarSupport/CalPrinter> 0015 0016 #include <memory> 0017 0018 class KOAgendaViewPrivate; 0019 0020 /** 0021 KOAgendaView is the agenda-like view that displays events in a single 0022 or multi-day view. 0023 */ 0024 class KOAgendaView : public KOEventView 0025 { 0026 Q_OBJECT 0027 public: 0028 explicit KOAgendaView(QWidget *parent = nullptr, bool isSideBySide = false); 0029 ~KOAgendaView() override; 0030 0031 /** Returns maximum number of days supported by the koagendaview */ 0032 [[nodiscard]] int maxDatesHint() const override; 0033 0034 /** Returns number of currently shown dates. */ 0035 [[nodiscard]] int currentDateCount() const override; 0036 0037 /** returns the currently selected events */ 0038 [[nodiscard]] Akonadi::Item::List selectedIncidences() override; 0039 0040 /** returns the currently selected incidence's dates */ 0041 [[nodiscard]] KCalendarCore::DateList selectedIncidenceDates() override; 0042 0043 /** return the default start/end date/time for new events */ 0044 [[nodiscard]] bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay) override; 0045 0046 [[nodiscard]] CalendarSupport::CalPrinter::PrintType printType() const override; 0047 0048 /** start-datetime of selection */ 0049 [[nodiscard]] QDateTime selectionStart() override; 0050 0051 /** end-datetime of selection */ 0052 [[nodiscard]] QDateTime selectionEnd() override; 0053 0054 /** returns true if selection is for whole day */ 0055 [[nodiscard]] bool selectedIsAllDay(); 0056 /** make selected start/end invalid */ 0057 void deleteSelectedDateTime(); 0058 /** returns if only a single cell is selected, or a range of cells */ 0059 [[nodiscard]] bool selectedIsSingleCell(); 0060 0061 /* reimp from BaseView */ 0062 void setModel(QAbstractItemModel *model) override; 0063 0064 void setTypeAheadReceiver(QObject *o) override; 0065 0066 void setChanges(EventViews::EventView::Changes changes) override; 0067 0068 void setDateRange(const QDateTime &start, const QDateTime &end, const QDate &preferredMonth = QDate()) override; 0069 0070 public Q_SLOTS: 0071 void updateView() override; 0072 void updateConfig() override; 0073 void showDates(const QDate &start, const QDate &end, const QDate &preferredMonth = QDate()) override; 0074 void showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date) override; 0075 0076 void changeIncidenceDisplayAdded(const Akonadi::Item &incidence); 0077 void changeIncidenceDisplay(const Akonadi::Item &incidence, Akonadi::IncidenceChanger::ChangeType) override; 0078 0079 void clearSelection() override; 0080 0081 void readSettings(); 0082 void readSettings(KConfig *); 0083 void writeSettings(KConfig *); 0084 0085 void enableAgendaUpdate(bool enable); 0086 void setIncidenceChanger(Akonadi::IncidenceChanger *changer) override; 0087 0088 void zoomInHorizontally(QDate date = QDate()); 0089 void zoomOutHorizontally(QDate date = QDate()); 0090 0091 void zoomInVertically(); 0092 void zoomOutVertically(); 0093 0094 void zoomView(const int delta, const QPoint &pos, const Qt::Orientation orient = Qt::Horizontal); 0095 0096 void calendarAdded(const Akonadi::CollectionCalendar::Ptr &calendar) override; 0097 void calendarRemoved(const Akonadi::CollectionCalendar::Ptr &calendar) override; 0098 0099 Q_SIGNALS: 0100 void zoomViewHorizontally(const QDate &, int count); 0101 void timeSpanSelectionChanged(); 0102 0103 private: 0104 std::unique_ptr<KOAgendaViewPrivate> const d; 0105 };