Eventviews

todoview.h
1/*
2 This file is part of KOrganizer.
3
4 SPDX-FileCopyrightText: 2000, 2001, 2003 Cornelius Schumacher <schumacher@kde.org>
5 SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
7 SPDX-FileCopyrightText: 2008 Thomas Thrainer <tom_t@gmx.at>
8
9 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
10*/
11#pragma once
12
13#include "eventview.h"
14#include <Akonadi/IncidenceChanger>
15
16#include <QPointer>
17#include <akonadi/collectioncalendar.h>
18
19class KJob;
21class TodoViewQuickAddLine;
22class TodoViewQuickSearch;
23class TodoViewSortFilterProxyModel;
24class TodoViewView;
25
26namespace Akonadi
27{
28class ETMViewStateSaver;
29}
30
31class QItemSelection;
32class QMenu;
33class QModelIndex;
34class QToolButton;
35class QTimer;
36class KConfig;
38namespace EventViews
39{
40
41class CalendarFilterModel;
42
43/**
44 * This class provides a view for Todo items.
45
46 * @short View for Todo components.
47 * @author Cornelius Schumacher <schumacher@kde.org>, Reinhold Kainhofer <reinhold@kainhofer.com>
48 * @see EventView
49 */
50class EVENTVIEWS_EXPORT TodoView : public EventViews::EventView
51{
52 Q_OBJECT
53 friend class ModelStack;
54
55public:
56 TodoView(const EventViews::PrefsPtr &preferences, bool sidebarView, QWidget *parent);
57 ~TodoView() override;
58
59 void setModel(QAbstractItemModel *model) override;
60 void addCalendar(const Akonadi::CollectionCalendar::Ptr &calendar) override;
61 void removeCalendar(const Akonadi::CollectionCalendar::Ptr &calendar) override;
62
63 [[nodiscard]] Akonadi::Item::List selectedIncidences() const override;
64 [[nodiscard]] KCalendarCore::DateList selectedIncidenceDates() const override;
65 [[nodiscard]] int currentDateCount() const override
66 {
67 return 0;
68 }
69
70 void setDocumentId(const QString &)
71 {
72 }
73
74 void saveLayout(KConfig *config, const QString &group) const;
75
76 void restoreLayout(KConfig *config, const QString &group, bool minimalDefaults);
77
78 /** documentation in baseview.h */
79 void getHighlightMode(bool &highlightEvents, bool &highlightTodos, bool &highlightJournals);
80
81 [[nodiscard]] bool usesFullWindow();
82
83 [[nodiscard]] bool supportsDateRangeSelection() const
84 {
85 return false;
86 }
87
88public Q_SLOTS:
89 void setIncidenceChanger(Akonadi::IncidenceChanger *changer) override;
90 void showDates(const QDate &start, const QDate &end, const QDate &preferredMonth = QDate()) override;
91 void showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date) override;
92 void updateView() override;
93 virtual void changeIncidenceDisplay(const Akonadi::Item &incidence, Akonadi::IncidenceChanger::ChangeType changeType);
94 void updateConfig() override;
95 void clearSelection() override;
96 void expandIndex(const QModelIndex &index);
97 void restoreViewState();
98 void saveViewState();
99
100 void createEvent();
101
102protected Q_SLOTS:
103 void resizeEvent(QResizeEvent *) override;
104 void addQuickTodo(Qt::KeyboardModifiers modifier);
105
106 void contextMenu(QPoint pos);
107
108 void currentChanged(const QModelIndex &current, const QModelIndex &previous);
109
110 // slots used by popup-menus
111 void showTodo();
112 void editTodo();
113 void deleteTodo();
114 void newTodo();
115 void newSubTodo();
116 void copyTodoToDate(QDate date);
117
118private Q_SLOTS:
119 EVENTVIEWS_NO_EXPORT void scheduleResizeColumns();
120 EVENTVIEWS_NO_EXPORT void resizeColumns();
121 EVENTVIEWS_NO_EXPORT void itemDoubleClicked(const QModelIndex &index);
122 EVENTVIEWS_NO_EXPORT void setNewDate(QDate date);
123 EVENTVIEWS_NO_EXPORT void setStartDate(QDate date);
124 EVENTVIEWS_NO_EXPORT void setNewPercentage(QAction *action);
125 EVENTVIEWS_NO_EXPORT void setNewPriority(QAction *action);
126 EVENTVIEWS_NO_EXPORT void changedCategories(QAction *action);
127 EVENTVIEWS_NO_EXPORT void setFullView(bool fullView);
128
129 EVENTVIEWS_NO_EXPORT void setFlatView(bool flatView, bool notifyOtherViews = true);
130
131 EVENTVIEWS_NO_EXPORT void onRowsInserted(const QModelIndex &parent, int start, int end);
132 EVENTVIEWS_NO_EXPORT void onTagsFetched(KJob *);
133
134Q_SIGNALS:
135 void purgeCompletedSignal();
136 void unSubTodoSignal();
137 void unAllSubTodoSignal();
138 void configChanged();
139 void fullViewChanged(bool enabled);
140 void printPreviewTodo();
141 void printTodo();
142
143 void createEvent(const Akonadi::Item &item);
144
145private:
146 EVENTVIEWS_NO_EXPORT QMenu *createCategoryPopupMenu();
147 EVENTVIEWS_NO_EXPORT QString stateSaverGroup() const;
148
149 /** Creates a new todo with the given text as summary under the given parent */
150 void addTodo(const QString &summary, const Akonadi::Item &parentItem, const QStringList &categories = QStringList());
151
152 TodoViewView *mView = nullptr;
153 TodoViewSortFilterProxyModel *mProxyModel = nullptr;
154 TodoCategoriesDelegate *mCategoriesDelegate = nullptr;
155 std::unique_ptr<CalendarFilterModel> mCalendarFilterModel;
156
157 TodoViewQuickSearch *mQuickSearch = nullptr;
158 TodoViewQuickAddLine *mQuickAdd = nullptr;
159 QToolButton *mFullViewButton = nullptr;
160 QToolButton *mFlatViewButton = nullptr;
161
162 QMenu *mItemPopupMenu = nullptr;
163 KDatePickerPopup *mCopyPopupMenu = nullptr;
164 KDatePickerPopup *mMovePopupMenu = nullptr;
165 QMenu *mPriorityPopupMenu = nullptr;
166 QMenu *mPercentageCompletedPopupMenu = nullptr;
167 QList<QAction *> mItemPopupMenuItemOnlyEntries;
168 QList<QAction *> mItemPopupMenuReadWriteEntries;
169
170 QAction *mMakeTodoIndependent = nullptr;
171 QAction *mMakeSubtodosIndependent = nullptr;
172
173 QPointer<Akonadi::ETMViewStateSaver> mTreeStateRestorer;
174
175 QMap<QAction *, int> mPercentage;
176 QMap<QAction *, int> mPriority;
177 bool mSidebarView;
178 bool mResizeColumnsScheduled;
179 QTimer *mResizeColumnsTimer = nullptr;
180};
181}
EventView is the abstract base class from which all other calendar views for event data are derived.
Definition eventview.h:69
This class provides a view for Todo items.
Definition todoview.h:51
int currentDateCount() const override
Returns the number of currently shown dates.
Definition todoview.h:65
This delegate is responsible for displaying the categories of todos.
Q_SCRIPTABLE Q_NOREPLY void start()
Namespace EventViews provides facilities for displaying incidences, including events,...
Definition agenda.h:33
typedef KeyboardModifiers
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:05:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.