-rw-r--r-- | korganizer/koagendaview.cpp | 3 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 29 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 30 | ||||
-rw-r--r-- | libkcal/todo.cpp | 6 |
4 files changed, 44 insertions, 24 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index bbc43e4..42a6f7c 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1140,49 +1140,48 @@ void KOAgendaView::fillAgenda() | |||
1140 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1140 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1141 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1141 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1142 | if (endY < startY) endY = startY; | 1142 | if (endY < startY) endY = startY; |
1143 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1143 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1144 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1144 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1145 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1145 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | // ---------- [display Todos -------------- | 1148 | // ---------- [display Todos -------------- |
1149 | unsigned int numTodo; | 1149 | unsigned int numTodo; |
1150 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1150 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1151 | Todo *todo = todos.at(numTodo); | 1151 | Todo *todo = todos.at(numTodo); |
1152 | 1152 | ||
1153 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date | 1153 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1154 | 1154 | ||
1155 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1155 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1156 | // Already completed items can be displayed on their original due date | 1156 | // Already completed items can be displayed on their original due date |
1157 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1157 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1158 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1158 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1159 | bool fillIn = false; | 1159 | bool fillIn = false; |
1160 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) | 1160 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) |
1161 | fillIn = true; | 1161 | fillIn = true; |
1162 | if ( ! fillIn && !todo->hasCompletedDate() ) | 1162 | if ( ! fillIn && !todo->hasCompletedDate() ) |
1163 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); | 1163 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); |
1164 | qDebug("refill todo "); | ||
1165 | if ( fillIn ) { | 1164 | if ( fillIn ) { |
1166 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue | 1165 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue |
1167 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1166 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1168 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1167 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1169 | } | 1168 | } |
1170 | else { | 1169 | else { |
1171 | QDateTime dt; | 1170 | QDateTime dt; |
1172 | if ( todo->hasCompletedDate() ) | 1171 | if ( todo->hasCompletedDate() ) |
1173 | dt = todo->completed(); | 1172 | dt = todo->completed(); |
1174 | else | 1173 | else |
1175 | dt = todo->dtDue();; | 1174 | dt = todo->dtDue();; |
1176 | 1175 | ||
1177 | 1176 | ||
1178 | int endY = mAgenda->timeToY(dt.time()) - 1; | 1177 | int endY = mAgenda->timeToY(dt.time()) - 1; |
1179 | int hi = (18/KOPrefs::instance()->mHourSize); | 1178 | int hi = (18/KOPrefs::instance()->mHourSize); |
1180 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); | 1179 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); |
1181 | int startY = endY -hi; | 1180 | int startY = endY -hi; |
1182 | 1181 | ||
1183 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); | 1182 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); |
1184 | 1183 | ||
1185 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1184 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1186 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1185 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1187 | } | 1186 | } |
1188 | } | 1187 | } |
@@ -1487,49 +1486,49 @@ void KOAgendaView::deleteSelectedDateTime() | |||
1487 | 1486 | ||
1488 | void KOAgendaView::keyPressEvent ( QKeyEvent * e ) | 1487 | void KOAgendaView::keyPressEvent ( QKeyEvent * e ) |
1489 | { | 1488 | { |
1490 | e->ignore(); | 1489 | e->ignore(); |
1491 | } | 1490 | } |
1492 | 1491 | ||
1493 | void KOAgendaView::scrollOneHourUp() | 1492 | void KOAgendaView::scrollOneHourUp() |
1494 | { | 1493 | { |
1495 | 1494 | ||
1496 | mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); | 1495 | mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); |
1497 | } | 1496 | } |
1498 | void KOAgendaView::scrollOneHourDown() | 1497 | void KOAgendaView::scrollOneHourDown() |
1499 | { | 1498 | { |
1500 | mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); | 1499 | mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); |
1501 | } | 1500 | } |
1502 | 1501 | ||
1503 | void KOAgendaView::setStartHour( int h ) | 1502 | void KOAgendaView::setStartHour( int h ) |
1504 | { | 1503 | { |
1505 | mAgenda->setStartHour( h ); | 1504 | mAgenda->setStartHour( h ); |
1506 | 1505 | ||
1507 | } | 1506 | } |
1508 | 1507 | ||
1509 | void KOAgendaView::updateTodo( Todo * t, int ) | 1508 | void KOAgendaView::updateTodo( Todo * t, int ) |
1510 | { | 1509 | { |
1511 | 1510 | ||
1512 | bool remove = false; | 1511 | bool remove = false; |
1513 | bool removeAD = false; | 1512 | bool removeAD = false; |
1514 | QDate da; | 1513 | QDate da; |
1515 | if ( t->hasCompletedDate() ) | 1514 | if ( t->hasCompletedDate() ) |
1516 | da = t->completed().date(); | 1515 | da = t->completed().date(); |
1517 | else | 1516 | else |
1518 | da = t->dtDue().date(); | 1517 | da = t->dtDue().date(); |
1519 | if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { | 1518 | if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { |
1520 | remove = true; | 1519 | remove = true; |
1521 | removeAD = true; | 1520 | removeAD = true; |
1522 | } | 1521 | } |
1523 | else { | 1522 | else { |
1524 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; | 1523 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; |
1525 | if ( overdue && | 1524 | if ( overdue && |
1526 | QDate::currentDate() >= mSelectedDates.first() && | 1525 | QDate::currentDate() >= mSelectedDates.first() && |
1527 | QDate::currentDate() <= mSelectedDates.last()) { | 1526 | QDate::currentDate() <= mSelectedDates.last()) { |
1528 | removeAD = false; | 1527 | removeAD = false; |
1529 | remove = true; | 1528 | remove = true; |
1530 | } | 1529 | } |
1531 | else { | 1530 | else { |
1532 | 1531 | ||
1533 | if ( da < mSelectedDates.first() || | 1532 | if ( da < mSelectedDates.first() || |
1534 | da > mSelectedDates.last() ) { | 1533 | da > mSelectedDates.last() ) { |
1535 | remove = true; | 1534 | remove = true; |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 14e8b5c..902f3f4 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -836,59 +836,68 @@ void KOTodoView::showTodo() | |||
836 | if (mActiveItem) { | 836 | if (mActiveItem) { |
837 | emit showTodoSignal(mActiveItem->todo()); | 837 | emit showTodoSignal(mActiveItem->todo()); |
838 | } | 838 | } |
839 | } | 839 | } |
840 | 840 | ||
841 | void KOTodoView::deleteTodo() | 841 | void KOTodoView::deleteTodo() |
842 | { | 842 | { |
843 | if (mActiveItem) { | 843 | if (mActiveItem) { |
844 | emit deleteTodoSignal(mActiveItem->todo()); | 844 | emit deleteTodoSignal(mActiveItem->todo()); |
845 | } | 845 | } |
846 | } | 846 | } |
847 | 847 | ||
848 | void KOTodoView::setNewPriority(int index) | 848 | void KOTodoView::setNewPriority(int index) |
849 | { | 849 | { |
850 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 850 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
851 | mActiveItem->todo()->setPriority(mPriority[index]); | 851 | mActiveItem->todo()->setPriority(mPriority[index]); |
852 | mActiveItem->construct(); | 852 | mActiveItem->construct(); |
853 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 853 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
854 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 854 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
855 | } | 855 | } |
856 | } | 856 | } |
857 | 857 | ||
858 | void KOTodoView::setNewPercentage(int index) | 858 | void KOTodoView::setNewPercentage(int index) |
859 | { | 859 | { |
860 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 860 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
861 | if (mPercentage[index] == 100) { | 861 | |
862 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 862 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
863 | } else { | 863 | mActiveItem->setOn( true ); |
864 | mActiveItem->todo()->setCompleted(false); | 864 | return; |
865 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | ||
866 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | ||
867 | if ( par && par->isOn() ) | ||
868 | par->setOn( false ); | ||
869 | } | ||
870 | if (mPercentage[index] == 100) { | ||
871 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | ||
872 | } else { | ||
873 | mActiveItem->todo()->setCompleted(false); | ||
874 | } | ||
875 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | ||
876 | mActiveItem->construct(); | ||
877 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | ||
878 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | ||
865 | } | 879 | } |
866 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | ||
867 | mActiveItem->construct(); | ||
868 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | ||
869 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | ||
870 | } | ||
871 | } | 880 | } |
872 | 881 | ||
873 | 882 | ||
874 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 883 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
875 | { | 884 | { |
876 | QPopupMenu* tempMenu = new QPopupMenu (this); | 885 | QPopupMenu* tempMenu = new QPopupMenu (this); |
877 | QStringList checkedCategories = todoItem->todo()->categories (); | 886 | QStringList checkedCategories = todoItem->todo()->categories (); |
878 | 887 | ||
879 | tempMenu->setCheckable (true); | 888 | tempMenu->setCheckable (true); |
880 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 889 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
881 | it != KOPrefs::instance()->mCustomCategories.end (); | 890 | it != KOPrefs::instance()->mCustomCategories.end (); |
882 | ++it) { | 891 | ++it) { |
883 | int index = tempMenu->insertItem (*it); | 892 | int index = tempMenu->insertItem (*it); |
884 | mCategory[index] = *it; | 893 | mCategory[index] = *it; |
885 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 894 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
886 | } | 895 | } |
887 | 896 | ||
888 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 897 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
889 | return tempMenu; | 898 | return tempMenu; |
890 | 899 | ||
891 | 900 | ||
892 | } | 901 | } |
893 | void KOTodoView::changedCategories(int index) | 902 | void KOTodoView::changedCategories(int index) |
894 | { | 903 | { |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 2822237..1edddac 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -182,91 +182,99 @@ void KOTodoViewItem::setMyPixmap() | |||
182 | p. drawPixmap ( 0, pixSize, pPix); | 182 | p. drawPixmap ( 0, pixSize, pPix); |
183 | p.end(); | 183 | p.end(); |
184 | pixSize += size; | 184 | pixSize += size; |
185 | } | 185 | } |
186 | if ( mTodo->isAlarmEnabled() ) { | 186 | if ( mTodo->isAlarmEnabled() ) { |
187 | pixi.resize(size, pixSize+size); | 187 | pixi.resize(size, pixSize+size); |
188 | pPix.fill( Qt::red ); | 188 | pPix.fill( Qt::red ); |
189 | p.begin( &pixi ); | 189 | p.begin( &pixi ); |
190 | p. drawPixmap ( 0, pixSize, pPix); | 190 | p. drawPixmap ( 0, pixSize, pPix); |
191 | p.end(); | 191 | p.end(); |
192 | pixSize += size; | 192 | pixSize += size; |
193 | } | 193 | } |
194 | // } | 194 | // } |
195 | if ( pixi.width() > 1 ) { | 195 | if ( pixi.width() > 1 ) { |
196 | setPixmap ( 0,pixi ) ; | 196 | setPixmap ( 0,pixi ) ; |
197 | } else { | 197 | } else { |
198 | setPixmap ( 0,QPixmap() ) ; | 198 | setPixmap ( 0,QPixmap() ) ; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | void KOTodoViewItem::stateChange(bool state) | 201 | void KOTodoViewItem::stateChange(bool state) |
202 | { | 202 | { |
203 | // qDebug("KOTodoViewItem::stateChange "); | 203 | // qDebug("KOTodoViewItem::stateChange "); |
204 | // do not change setting on startup | 204 | // do not change setting on startup |
205 | if ( m_init ) return; | 205 | if ( m_init ) return; |
206 | qDebug("KOTodoViewItem::stateChange "); | 206 | if (isOn()!=state) { |
207 | setOn(state); | ||
208 | //qDebug("SETON "); | ||
209 | return; | ||
210 | } | ||
207 | QString keyd = "=="; | 211 | QString keyd = "=="; |
208 | QString keyt = "=="; | 212 | QString keyt = "=="; |
209 | 213 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); | |
210 | mTodo->setCompleted(state); | 214 | mTodo->setCompleted(state); |
211 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); | 215 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); |
212 | if (isOn()!=state) { | ||
213 | setOn(state); | ||
214 | } | ||
215 | 216 | ||
216 | if (mTodo->hasDueDate()) { | 217 | if (mTodo->hasDueDate()) { |
217 | setText(3, mTodo->dtDueDateStr()); | 218 | setText(3, mTodo->dtDueDateStr()); |
218 | QDate d = mTodo->dtDue().date(); | 219 | QDate d = mTodo->dtDue().date(); |
219 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 220 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
220 | setSortKey(3,keyd); | 221 | setSortKey(3,keyd); |
221 | if (mTodo->doesFloat()) { | 222 | if (mTodo->doesFloat()) { |
222 | setText(4,""); | 223 | setText(4,""); |
223 | } | 224 | } |
224 | else { | 225 | else { |
225 | setText(4,mTodo->dtDueTimeStr()); | 226 | setText(4,mTodo->dtDueTimeStr()); |
226 | QTime t = mTodo->dtDue().time(); | 227 | QTime t = mTodo->dtDue().time(); |
227 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 228 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
228 | setSortKey(4,keyt); | 229 | setSortKey(4,keyt); |
229 | } | 230 | } |
230 | } | 231 | } |
231 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 232 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
232 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 233 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
233 | 234 | ||
234 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 235 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
235 | if (mTodo->percentComplete()<100) { | 236 | if (mTodo->percentComplete()<100) { |
236 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 237 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
237 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 238 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
238 | } | 239 | } |
239 | else { | 240 | else { |
240 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
241 | else setSortKey(2,QString::number(99)); | 242 | else setSortKey(2,QString::number(99)); |
242 | } | 243 | } |
243 | QListViewItem * myChild = firstChild(); | 244 | if ( state ) { |
244 | KOTodoViewItem *item; | 245 | QListViewItem * myChild = firstChild(); |
245 | while( myChild ) { | 246 | KOTodoViewItem *item; |
246 | item = static_cast<KOTodoViewItem*>(myChild); | 247 | while( myChild ) { |
247 | item->stateChange(state); | 248 | //qDebug("stateCH "); |
248 | myChild = myChild->nextSibling(); | 249 | item = static_cast<KOTodoViewItem*>(myChild); |
250 | item->stateChange(state); | ||
251 | myChild = myChild->nextSibling(); | ||
252 | } | ||
253 | } else { | ||
254 | QListViewItem * myChild = parent(); | ||
255 | if ( myChild ) | ||
256 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | ||
249 | } | 257 | } |
250 | mTodoView->modified(true); | 258 | mTodoView->modified(true); |
251 | setMyPixmap(); | 259 | setMyPixmap(); |
252 | mTodoView->setTodoModified( mTodo ); | 260 | mTodoView->setTodoModified( mTodo ); |
253 | } | 261 | } |
254 | 262 | ||
255 | bool KOTodoViewItem::isAlternate() | 263 | bool KOTodoViewItem::isAlternate() |
256 | { | 264 | { |
257 | #ifndef KORG_NOLVALTERNATION | 265 | #ifndef KORG_NOLVALTERNATION |
258 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 266 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
259 | if (lv && lv->alternateBackground().isValid()) | 267 | if (lv && lv->alternateBackground().isValid()) |
260 | { | 268 | { |
261 | KOTodoViewItem *above = 0; | 269 | KOTodoViewItem *above = 0; |
262 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); | 270 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); |
263 | m_known = above ? above->m_known : true; | 271 | m_known = above ? above->m_known : true; |
264 | if (m_known) | 272 | if (m_known) |
265 | { | 273 | { |
266 | m_odd = above ? !above->m_odd : false; | 274 | m_odd = above ? !above->m_odd : false; |
267 | } | 275 | } |
268 | else | 276 | else |
269 | { | 277 | { |
270 | KOTodoViewItem *item; | 278 | KOTodoViewItem *item; |
271 | bool previous = true; | 279 | bool previous = true; |
272 | if (QListViewItem::parent()) | 280 | if (QListViewItem::parent()) |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 7d04793..7f1de78 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -286,49 +286,53 @@ bool Todo::isCompleted() const | |||
286 | } | 286 | } |
287 | 287 | ||
288 | void Todo::setCompleted(bool completed) | 288 | void Todo::setCompleted(bool completed) |
289 | { | 289 | { |
290 | if (completed) mPercentComplete = 100; | 290 | if (completed) mPercentComplete = 100; |
291 | else { | 291 | else { |
292 | mPercentComplete = 0; | 292 | mPercentComplete = 0; |
293 | mHasCompletedDate = false; | 293 | mHasCompletedDate = false; |
294 | } | 294 | } |
295 | updated(); | 295 | updated(); |
296 | } | 296 | } |
297 | 297 | ||
298 | QDateTime Todo::completed() const | 298 | QDateTime Todo::completed() const |
299 | { | 299 | { |
300 | return mCompleted; | 300 | return mCompleted; |
301 | } | 301 | } |
302 | 302 | ||
303 | QString Todo::completedStr( bool shortF ) const | 303 | QString Todo::completedStr( bool shortF ) const |
304 | { | 304 | { |
305 | return KGlobal::locale()->formatDateTime(mCompleted, shortF); | 305 | return KGlobal::locale()->formatDateTime(mCompleted, shortF); |
306 | } | 306 | } |
307 | 307 | ||
308 | void Todo::setCompleted(const QDateTime &completed) | 308 | void Todo::setCompleted(const QDateTime &completed) |
309 | { | 309 | { |
310 | qDebug("Todo::setCompleted "); | 310 | //qDebug("Todo::setCompleted "); |
311 | if ( mHasCompletedDate ) { | ||
312 | // qDebug("has completed data - return "); | ||
313 | return; | ||
314 | } | ||
311 | mHasCompletedDate = true; | 315 | mHasCompletedDate = true; |
312 | mPercentComplete = 100; | 316 | mPercentComplete = 100; |
313 | mCompleted = getEvenTime(completed); | 317 | mCompleted = getEvenTime(completed); |
314 | updated(); | 318 | updated(); |
315 | } | 319 | } |
316 | 320 | ||
317 | bool Todo::hasCompletedDate() const | 321 | bool Todo::hasCompletedDate() const |
318 | { | 322 | { |
319 | return mHasCompletedDate; | 323 | return mHasCompletedDate; |
320 | } | 324 | } |
321 | 325 | ||
322 | int Todo::percentComplete() const | 326 | int Todo::percentComplete() const |
323 | { | 327 | { |
324 | return mPercentComplete; | 328 | return mPercentComplete; |
325 | } | 329 | } |
326 | 330 | ||
327 | void Todo::setPercentComplete(int v) | 331 | void Todo::setPercentComplete(int v) |
328 | { | 332 | { |
329 | mPercentComplete = v; | 333 | mPercentComplete = v; |
330 | if ( v != 100 ) | 334 | if ( v != 100 ) |
331 | mHasCompletedDate = false; | 335 | mHasCompletedDate = false; |
332 | updated(); | 336 | updated(); |
333 | } | 337 | } |
334 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const | 338 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const |