-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 | |||
@@ -1161,7 +1161,6 @@ void KOAgendaView::fillAgenda() | |||
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 ) |
@@ -1508,7 +1507,7 @@ void KOAgendaView::setStartHour( int h ) | |||
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; |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 14e8b5c..902f3f4 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -857,17 +857,26 @@ void KOTodoView::setNewPriority(int index) | |||
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 | ||
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 2822237..1edddac 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -203,15 +203,16 @@ void KOTodoViewItem::stateChange(bool state) | |||
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()); |
@@ -240,12 +241,19 @@ void KOTodoViewItem::stateChange(bool state) | |||
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(); |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 7d04793..7f1de78 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -307,7 +307,11 @@ QString Todo::completedStr( bool shortF ) const | |||
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); |