File indexing completed on 2025-03-09 04:51:39

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   SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
0007   SPDX-FileCopyrightText: 2008 Thomas Thrainer <tom_t@gmx.at>
0008 
0009   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0010 */
0011 #pragma once
0012 
0013 #include "baseview.h"
0014 
0015 #include <CalendarSupport/Utils>
0016 
0017 #include <EventViews/TodoView>
0018 
0019 using namespace KOrg;
0020 
0021 class KOTodoView : public BaseView
0022 {
0023     Q_OBJECT
0024 public:
0025     KOTodoView(bool sidebarView, QWidget *parent);
0026     ~KOTodoView() override;
0027 
0028     void setModel(QAbstractItemModel *model) override;
0029     void calendarAdded(const Akonadi::CollectionCalendar::Ptr &calendar) override;
0030     void calendarRemoved(const Akonadi::CollectionCalendar::Ptr &calendar) override;
0031 
0032     [[nodiscard]] Akonadi::Item::List selectedIncidences() override;
0033     [[nodiscard]] KCalendarCore::DateList selectedIncidenceDates() override;
0034     [[nodiscard]] int currentDateCount() const override
0035     {
0036         return 0;
0037     }
0038 
0039     void setDocumentId(const QString &)
0040     {
0041     }
0042 
0043     void saveLayout(KConfig *config, const QString &group) const;
0044     void restoreLayout(KConfig *config, const QString &group, bool minimalDefaults);
0045 
0046     /** documentation in baseview.h */
0047     void getHighlightMode(bool &highlightEvents, bool &highlightTodos, bool &highlightJournals) override;
0048 
0049     [[nodiscard]] bool usesFullWindow() override;
0050 
0051     void saveViewState();
0052     void restoreViewState();
0053 
0054     [[nodiscard]] bool supportsDateRangeSelection() override
0055     {
0056         return false;
0057     }
0058 
0059     [[nodiscard]] CalendarSupport::CalPrinterBase::PrintType printType() const override;
0060 
0061 public Q_SLOTS:
0062     void setIncidenceChanger(Akonadi::IncidenceChanger *changer) override;
0063     void showDates(const QDate &start, const QDate &end, const QDate &preferredMonth = QDate()) override;
0064     void showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date) override;
0065     void updateView() override;
0066     void changeIncidenceDisplay(const Akonadi::Item &incidence, Akonadi::IncidenceChanger::ChangeType changeType) override;
0067     void updateConfig() override;
0068     void clearSelection() override;
0069 
0070 private Q_SLOTS:
0071     void printTodo(bool);
0072     void printTodo();
0073     void printPreviewTodo();
0074 
0075 Q_SIGNALS:
0076     void purgeCompletedSignal();
0077     void unSubTodoSignal();
0078     void unAllSubTodoSignal();
0079     void configChanged();
0080     void fullViewChanged(bool enabled);
0081 
0082 private:
0083     EventViews::TodoView *mView = nullptr;
0084 };