Changeset View
Changeset View
Standalone View
Standalone View
src/akonadi/akonaditaskqueries.cpp
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Line(s) | 94 | { | |||
---|---|---|---|---|---|
102 | m_integrator->bind("TaskQueries::findInboxTopLevel", m_findInboxTopLevel, fetch, predicate); | 102 | m_integrator->bind("TaskQueries::findInboxTopLevel", m_findInboxTopLevel, fetch, predicate); | ||
103 | return m_findInboxTopLevel->result(); | 103 | return m_findInboxTopLevel->result(); | ||
104 | } | 104 | } | ||
105 | 105 | | |||
106 | TaskQueries::TaskResult::Ptr TaskQueries::findWorkdayTopLevel() const | 106 | TaskQueries::TaskResult::Ptr TaskQueries::findWorkdayTopLevel() const | ||
107 | { | 107 | { | ||
108 | if (!m_findWorkdayTopLevel) { | 108 | if (!m_findWorkdayTopLevel) { | ||
109 | m_workdayPollTimer->start(); | 109 | m_workdayPollTimer->start(); | ||
110 | m_today = Utils::DateTime::currentDateTime().date(); | 110 | m_today = Utils::DateTime::currentDate(); | ||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | auto fetch = m_helpers->fetchItems(StorageInterface::Tasks); | 113 | auto fetch = m_helpers->fetchItems(StorageInterface::Tasks); | ||
114 | auto isWorkdayItem = [this] (const Akonadi::Item &item) { | 114 | auto isWorkdayItem = [this] (const Akonadi::Item &item) { | ||
115 | if (!m_serializer->isTaskItem(item)) | 115 | if (!m_serializer->isTaskItem(item)) | ||
116 | return false; | 116 | return false; | ||
117 | 117 | | |||
118 | const Domain::Task::Ptr task = m_serializer->createTaskFromItem(item); | 118 | const Domain::Task::Ptr task = m_serializer->createTaskFromItem(item); | ||
119 | 119 | | |||
120 | const QDate doneDate = task->doneDate().date(); | 120 | const QDate doneDate = task->doneDate(); | ||
121 | const QDate startDate = task->startDate().date(); | 121 | const QDate startDate = task->startDate(); | ||
122 | const QDate dueDate = task->dueDate().date(); | 122 | const QDate dueDate = task->dueDate(); | ||
123 | const QDate today = Utils::DateTime::currentDateTime().date(); | 123 | const QDate today = Utils::DateTime::currentDate(); | ||
124 | 124 | | |||
125 | const bool pastStartDate = startDate.isValid() && startDate <= today; | 125 | const bool pastStartDate = startDate.isValid() && startDate <= today; | ||
126 | const bool pastDueDate = dueDate.isValid() && dueDate <= today; | 126 | const bool pastDueDate = dueDate.isValid() && dueDate <= today; | ||
127 | const bool todayDoneDate = doneDate == today; | 127 | const bool todayDoneDate = doneDate == today; | ||
128 | 128 | | |||
129 | if (task->isDone()) | 129 | if (task->isDone()) | ||
130 | return todayDoneDate; | 130 | return todayDoneDate; | ||
131 | else | 131 | else | ||
Show All 31 Lines | |||||
163 | { | 163 | { | ||
164 | qFatal("Not implemented yet"); | 164 | qFatal("Not implemented yet"); | ||
165 | Q_UNUSED(task); | 165 | Q_UNUSED(task); | ||
166 | return ContextResult::Ptr(); | 166 | return ContextResult::Ptr(); | ||
167 | } | 167 | } | ||
168 | 168 | | |||
169 | void TaskQueries::onWorkdayPollTimeout() | 169 | void TaskQueries::onWorkdayPollTimeout() | ||
170 | { | 170 | { | ||
171 | auto newDate = Utils::DateTime::currentDateTime().date(); | 171 | auto newDate = Utils::DateTime::currentDate(); | ||
172 | if (m_findWorkdayTopLevel && m_today != newDate) { | 172 | if (m_findWorkdayTopLevel && m_today != newDate) { | ||
173 | m_today = newDate; | 173 | m_today = newDate; | ||
174 | m_findWorkdayTopLevel->reset(); | 174 | m_findWorkdayTopLevel->reset(); | ||
175 | } | 175 | } | ||
176 | } | 176 | } |