File indexing completed on 2024-11-24 04:50:39
0001 // SPDX-FileCopyrightText: 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0002 // SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu> 0003 // SPDX-FileCopyrightText: 2021 Claudio Cambra <claudio.cambra@gmail.com> 0004 // SPDX-License-Identifier: LGPL-3.0-or-later 0005 0006 #pragma once 0007 #include "abstractapplication.h" 0008 #include "calendarconfig.h" 0009 0010 #include <Akonadi/ETMCalendar> 0011 #include <KActionCollection> 0012 #include <QActionGroup> 0013 #include <QObject> 0014 #include <QWindow> 0015 0016 class QQuickWindow; 0017 class QSortFilterProxyModel; 0018 0019 class CalendarApplication : public AbstractApplication 0020 { 0021 Q_OBJECT 0022 0023 Q_PROPERTY(QWindow *window READ window WRITE setWindow NOTIFY windowChanged) 0024 Q_PROPERTY(Akonadi::ETMCalendar::Ptr calendar MEMBER m_calendar NOTIFY calendarChanged) 0025 0026 public: 0027 enum Mode { 0028 Month = 1, 0029 Week = 2, 0030 ThreeDay = 4, 0031 Day = 8, 0032 Schedule = 16, 0033 Event = Month | Week | ThreeDay | Day | Schedule, 0034 Todo = 32, 0035 }; 0036 Q_ENUM(Mode) 0037 0038 explicit CalendarApplication(QObject *parent = nullptr); 0039 ~CalendarApplication() override; 0040 0041 QList<KActionCollection *> actionCollections() const override; 0042 0043 Q_INVOKABLE void saveWindowGeometry(QQuickWindow *window); 0044 QWindow *window() const; 0045 void setWindow(QWindow *window); 0046 0047 // D-Bus interface 0048 void showIncidenceByUid(const QString &uid, const QDateTime &occurrence, const QString &xdgActivationToken); 0049 0050 Q_SIGNALS: 0051 void openMonthView(); 0052 void openWeekView(); 0053 void openThreeDayView(); 0054 void openDayView(); 0055 void openScheduleView(); 0056 void openTodoView(); 0057 void moveViewForwards(); 0058 void moveViewBackwards(); 0059 void moveViewToToday(); 0060 void openDateChanger(); 0061 void createNewEvent(); 0062 void createNewTodo(); 0063 void windowChanged(); 0064 void importCalendar(); 0065 void configureSchedule(); 0066 void openLanguageSwitcher(); 0067 void undo(); 0068 void redo(); 0069 void todoViewSortAlphabetically(); 0070 void todoViewSortByDueDate(); 0071 void todoViewSortByPriority(); 0072 void todoViewOrderAscending(); 0073 void todoViewOrderDescending(); 0074 void todoViewShowCompleted(); 0075 void refreshAll(); 0076 void openIncidence(const QVariantMap incidenceData, const QDateTime occurrence); 0077 void calendarChanged(); 0078 0079 private Q_SLOTS: 0080 void handleMouseViewNavButtons(const Qt::MouseButton pressedButton); 0081 0082 private: 0083 void setupActions() override; 0084 void toggleMenubar(); 0085 bool showMenubar() const; 0086 0087 KActionCollection *mSortCollection = nullptr; 0088 QWindow *m_window = nullptr; 0089 QActionGroup *const m_viewGroup; 0090 QActionGroup *m_todoViewOrderGroup = nullptr; 0091 QActionGroup *m_todoViewSortGroup = nullptr; 0092 CalendarConfig *m_config = nullptr; 0093 Akonadi::ETMCalendar::Ptr m_calendar; 0094 };