-rw-r--r-- | korganizer/koagendaview.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index e0a1a21..1864e22 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1104,112 +1104,118 @@ void KOAgendaView::fillAgenda() | |||
1104 | int count = 0; | 1104 | int count = 0; |
1105 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1105 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1106 | while (! event->recursOn( dateit ) && count <= max ) { | 1106 | while (! event->recursOn( dateit ) && count <= max ) { |
1107 | ++count; | 1107 | ++count; |
1108 | dateit = dateit.addDays( -1 ); | 1108 | dateit = dateit.addDays( -1 ); |
1109 | } | 1109 | } |
1110 | bool ok; | 1110 | bool ok; |
1111 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1111 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1112 | if ( ok ) | 1112 | if ( ok ) |
1113 | { | 1113 | { |
1114 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1114 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1115 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1115 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1116 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1116 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1117 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1117 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1118 | 1118 | ||
1119 | } | 1119 | } |
1120 | } | 1120 | } |
1121 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1121 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1122 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1122 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1123 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1123 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1124 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1124 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1125 | //qDebug("insert!!! "); | 1125 | //qDebug("insert!!! "); |
1126 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1126 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1127 | } | 1127 | } |
1128 | if (beginX == curCol) { | 1128 | if (beginX == curCol) { |
1129 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1129 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1130 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1130 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1131 | } else if (endX == curCol) { | 1131 | } else if (endX == curCol) { |
1132 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1132 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1133 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1133 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1134 | } else { | 1134 | } else { |
1135 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1135 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1136 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1136 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1137 | } | 1137 | } |
1138 | } else { | 1138 | } else { |
1139 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1139 | int startY = mAgenda->timeToY(event->dtStart().time()); |
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 | 1166 | QDateTime dt; | |
1167 | int endY = mAgenda->timeToY(todo->dtDue().time()) - 1; | 1167 | if ( todo->hasCompletedDate() ) |
1168 | dt = todo->completed(); | ||
1169 | else | ||
1170 | dt = todo->dtDue();; | ||
1171 | |||
1172 | |||
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] -------------- |
1180 | 1186 | ||
1181 | ++curCol; | 1187 | ++curCol; |
1182 | } | 1188 | } |
1183 | mAgenda->hideUnused(); | 1189 | mAgenda->hideUnused(); |
1184 | mAllDayAgenda->hideUnused(); | 1190 | mAllDayAgenda->hideUnused(); |
1185 | mAgenda->checkScrollBoundaries(); | 1191 | mAgenda->checkScrollBoundaries(); |
1186 | 1192 | ||
1187 | deleteSelectedDateTime(); | 1193 | deleteSelectedDateTime(); |
1188 | 1194 | ||
1189 | createDayLabels(); | 1195 | createDayLabels(); |
1190 | emit incidenceSelected( 0 ); | 1196 | emit incidenceSelected( 0 ); |
1191 | 1197 | ||
1192 | if ( globalFlagBlockAgenda == 2 ) { | 1198 | if ( globalFlagBlockAgenda == 2 ) { |
1193 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 1199 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
1194 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1200 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1195 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1201 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1196 | setStartHour( QTime::currentTime ().hour() ); | 1202 | setStartHour( QTime::currentTime ().hour() ); |
1197 | // qApp->processEvents(); | 1203 | // qApp->processEvents(); |
1198 | } | 1204 | } |
1199 | qApp->processEvents(); | 1205 | qApp->processEvents(); |
1200 | //qDebug("qApp->processEvents(); END "); | 1206 | //qDebug("qApp->processEvents(); END "); |
1201 | globalFlagBlockAgenda = 0; | 1207 | globalFlagBlockAgenda = 0; |
1202 | 1208 | ||
1203 | // mAgenda->hideUnused(); | 1209 | // mAgenda->hideUnused(); |
1204 | //mAllDayAgenda->hideUnused(); | 1210 | //mAllDayAgenda->hideUnused(); |
1205 | mAllDayAgenda->drawContentsToPainter(); | 1211 | mAllDayAgenda->drawContentsToPainter(); |
1206 | mAgenda->drawContentsToPainter(); | 1212 | mAgenda->drawContentsToPainter(); |
1207 | repaintAgenda(); | 1213 | repaintAgenda(); |
1208 | // mAgenda->finishUpdate(); | 1214 | // mAgenda->finishUpdate(); |
1209 | //mAllDayAgenda->finishUpdate(); | 1215 | //mAllDayAgenda->finishUpdate(); |
1210 | 1216 | ||
1211 | // repaintAgenda(); | 1217 | // repaintAgenda(); |
1212 | //qApp->processEvents(); | 1218 | //qApp->processEvents(); |
1213 | // globalFlagBlockAgenda = 0; | 1219 | // globalFlagBlockAgenda = 0; |
1214 | } | 1220 | } |
1215 | void KOAgendaView::repaintAgenda() | 1221 | void KOAgendaView::repaintAgenda() |