-rw-r--r-- | korganizer/koagendaview.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index e0a1a21..1864e22 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1140,40 +1140,46 @@ void KOAgendaView::fillAgenda() | |||
1140 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1140 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1141 | if (endY < startY) endY = startY; | 1141 | if (endY < startY) endY = startY; |
1142 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1142 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1143 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1143 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1144 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1144 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1145 | } | 1145 | } |
1146 | } | 1146 | } |
1147 | // ---------- [display Todos -------------- | 1147 | // ---------- [display Todos -------------- |
1148 | unsigned int numTodo; | 1148 | unsigned int numTodo; |
1149 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1149 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1150 | Todo *todo = todos.at(numTodo); | 1150 | Todo *todo = todos.at(numTodo); |
1151 | 1151 | ||
1152 | if ( ! todo->hasDueDate() ) continue; // todo shall not be displayed if it has no date | 1152 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1153 | 1153 | ||
1154 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1154 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1155 | // Already completed items can be displayed on their original due date | 1155 | // Already completed items can be displayed on their original due date |
1156 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1156 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1157 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1157 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1158 | 1158 | ||
1159 | if ( ((todo->dtDue().date() == currentDate) && !overdue) || | 1159 | if ( ((todo->dtDue().date() == currentDate) && !overdue) || ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| |
1160 | ((currentDate == today) && overdue) ) { | 1160 | ((currentDate == today) && overdue) ) { |
1161 | if ( todo->doesFloat() || overdue ) { // Todo has no due-time set or is already overdue | 1161 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue |
1162 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1162 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1163 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1163 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1164 | } | 1164 | } |
1165 | else { | 1165 | else { |
1166 | QDateTime dt; | ||
1167 | if ( todo->hasCompletedDate() ) | ||
1168 | dt = todo->completed(); | ||
1169 | else | ||
1170 | dt = todo->dtDue();; | ||
1171 | |||
1166 | 1172 | ||
1167 | int endY = mAgenda->timeToY(todo->dtDue().time()) - 1; | 1173 | int endY = mAgenda->timeToY(dt.time()) - 1; |
1168 | int hi = (18/KOPrefs::instance()->mHourSize); | 1174 | int hi = (18/KOPrefs::instance()->mHourSize); |
1169 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); | 1175 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); |
1170 | int startY = endY -hi; | 1176 | int startY = endY -hi; |
1171 | 1177 | ||
1172 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); | 1178 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); |
1173 | 1179 | ||
1174 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1180 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1175 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1181 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1176 | } | 1182 | } |
1177 | } | 1183 | } |
1178 | } | 1184 | } |
1179 | // ---------- display Todos] -------------- | 1185 | // ---------- display Todos] -------------- |