-rw-r--r-- | korganizer/kotodoview.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
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) void KOTodoView::setNewPercentage(int index) { - if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { - if (mPercentage[index] == 100) { - mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); - } else { - mActiveItem->todo()->setCompleted(false); + if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { + + if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { + mActiveItem->setOn( true ); + return; + } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { + KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); + if ( par && par->isOn() ) + par->setOn( false ); + } + if (mPercentage[index] == 100) { + mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); + } else { + mActiveItem->todo()->setCompleted(false); + } + mActiveItem->todo()->setPercentComplete(mPercentage[index]); + mActiveItem->construct(); + todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); + mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); } - mActiveItem->todo()->setPercentComplete(mPercentage[index]); - mActiveItem->construct(); - todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); - mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); - } } |