File indexing completed on 2024-11-17 04:42:44

0001 /*
0002   SPDX-FileCopyrightText: 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
0003   SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
0004   SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0005   SPDX-FileContributor: Kevin Krammer <krake@kdab.com>
0006   SPDX-FileContributor: Sergio Martins <sergio@kdab.com>
0007 
0008   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0009 */
0010 #pragma once
0011 
0012 #include "eventview.h"
0013 
0014 #include <Akonadi/CollectionCalendar>
0015 
0016 #include <memory>
0017 
0018 namespace KHolidays
0019 {
0020 class HolidayRegion;
0021 }
0022 
0023 class KCheckableProxyModel;
0024 
0025 #include <QDateTime>
0026 
0027 namespace EventViews
0028 {
0029 class EventView;
0030 
0031 class EventViewPrivate
0032 {
0033 public: /// Methods
0034     EventViewPrivate(EventView *qq);
0035     ~EventViewPrivate();
0036 
0037     /**
0038       This is called when the new event dialog is shown. It sends
0039       all events in mTypeAheadEvents to the receiver.
0040      */
0041     void finishTypeAhead();
0042 
0043     void setEtm(QAbstractItemModel *model);
0044 
0045 public: // virtual functions
0046     void setUpModels();
0047 
0048 private:
0049     EventView *const q;
0050 
0051 public: /// Members
0052     QAbstractItemModel *model = nullptr;
0053     Akonadi::EntityTreeModel *etm = nullptr;
0054     std::unique_ptr<CalendarSupport::CollectionSelection> customCollectionSelection;
0055     KCheckableProxyModel *collectionSelectionModel = nullptr;
0056 
0057     QByteArray identifier;
0058     QDateTime startDateTime;
0059     QDateTime endDateTime;
0060     QDateTime actualStartDateTime;
0061     QDateTime actualEndDateTime;
0062 
0063     /* When we receive a QEvent with a key_Return release
0064      * we will only show a new event dialog if we previously received a
0065      * key_Return press, otherwise a new event dialog appears when
0066      * you hit return in some yes/no dialog */
0067     bool mReturnPressed = false;
0068     bool mDateRangeSelectionEnabled = true;
0069     bool mTypeAhead = false;
0070     QObject *mTypeAheadReceiver = nullptr;
0071     QList<QEvent *> mTypeAheadEvents;
0072     static CalendarSupport::CollectionSelection *sGlobalCollectionSelection;
0073     QList<Akonadi::CollectionCalendar::Ptr> mCalendars;
0074 
0075     std::vector<std::unique_ptr<KHolidays::HolidayRegion>> mHolidayRegions;
0076     PrefsPtr mPrefs;
0077     KCalPrefsPtr mKCalPrefs;
0078 
0079     Akonadi::IncidenceChanger *mChanger = nullptr;
0080     EventView::Changes mChanges = EventView::DatesChanged;
0081 };
0082 } // EventViews