6#include <Akonadi/CalendarUtils>
7#include <Akonadi/ETMCalendar>
8#include <Akonadi/IncidenceTreeModel>
9#include <Akonadi/TodoModel>
10#include <KConfigWatcher>
12#include <KSharedConfig>
14#include <QSortFilterProxyModel>
22 Q_PROPERTY(Akonadi::IncidenceChanger *incidenceChanger READ incidenceChanger WRITE setIncidenceChanger NOTIFY incidenceChangerChanged)
24 Q_PROPERTY(
Filter *filterObject READ filterObject WRITE setFilterObject NOTIFY filterObjectChanged)
25 Q_PROPERTY(
int showCompleted READ showCompleted WRITE setShowCompleted NOTIFY showCompletedChanged)
26 Q_PROPERTY(
int sortBy READ sortBy WRITE setSortBy NOTIFY sortByChanged)
27 Q_PROPERTY(
bool sortAscending READ sortAscending WRITE setSortAscending NOTIFY sortAscendingChanged)
28 Q_PROPERTY(
bool showCompletedSubtodosInIncomplete READ showCompletedSubtodosInIncomplete WRITE setShowCompletedSubtodosInIncomplete NOTIFY
29 showCompletedSubtodosInIncompleteChanged)
33 StartTimeRole = Akonadi::TodoModel::CalendarRole + 1,
48 IncidenceTypeIconRole,
53 CategoriesDisplayRole,
55 TopMostParentSummaryRole,
56 TopMostParentDueDateRole,
57 TopMostParentPriorityRole,
61 enum BaseTodoModelColumns {
62 SummaryColumn = Akonadi::TodoModel::SummaryColumn,
63 PriorityColumn = Akonadi::TodoModel::PriorityColumn,
64 PercentColumn = Akonadi::TodoModel::PercentColumn,
65 StartDateColumn = Akonadi::TodoModel::StartDateColumn,
66 DueDateColumn = Akonadi::TodoModel::DueDateColumn,
67 CategoriesColumn = Akonadi::TodoModel::CategoriesColumn,
68 DescriptionColumn = Akonadi::TodoModel::DescriptionColumn,
69 CalendarColumn = Akonadi::TodoModel::CalendarColumn,
71 Q_ENUM(BaseTodoModelColumns)
80 enum DueDateDisplayFormat {
82 DisplayDateTimeAndIfOverdue,
84 Q_ENUM(DueDateDisplayFormat)
87 ~TodoSortFilterProxyModel() =
default;
92 bool filterAcceptsRow(
int row,
const QModelIndex &sourceParent)
const override;
94 bool filterAcceptsRowCheck(
int row,
const QModelIndex &sourceParent)
const;
95 bool hasAcceptedChildren(
int row,
const QModelIndex &sourceParent)
const;
98 Akonadi::IncidenceChanger *incidenceChanger()
const;
99 int showCompleted()
const;
100 Filter *filterObject()
const;
102 bool sortAscending()
const;
103 bool showCompletedSubtodosInIncomplete()
const;
106 void calendarChanged();
107 void filterObjectAboutToChange();
108 void filterObjectChanged();
109 void showCompletedChanged();
110 void sortByChanged();
111 void sortAscendingChanged();
112 void showCompletedSubtodosInIncompleteChanged();
113 void incidenceChangerChanged();
117 void setIncidenceChanger(Akonadi::IncidenceChanger *changer);
118 void setFilterObject(
Filter *filterObject);
119 void setShowCompleted(
const int showCompleted);
120 void setSortBy(
const int sortBy);
121 void setSortAscending(
const bool sortAscending);
122 void setShowCompletedSubtodosInIncomplete(
const bool showCompletedSubtodosInIncomplete);
124 void sortTodoModel();
125 void filterTodoName(
const QString &name,
const int showCompleted = ShowAll);
134 void updateDateLabels();
150 Akonadi::IncidenceChanger *m_lastSetChanger =
nullptr;
152 KConfigWatcher::Ptr m_colorWatcher;
153 int m_showCompleted = ShowComplete::ShowAll;
154 int m_showCompletedStore;
155 Filter *m_filterObject =
nullptr;
156 int m_sortColumn = DueDateColumn;
157 bool m_sortAscending =
false;
158 bool m_showCompletedSubtodosInIncomplete =
true;
160 QTimer m_dateRefreshTimer;
161 int m_dateRefreshTimerInterval = 60000;
QObject * parent() const const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override