From 1bcef8b3f53419e7155e0862ad61e3e419763d70 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 30 Jan 2005 12:08:19 +0000 Subject: fixes --- (limited to 'korganizer/kotodoview.cpp') 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(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 ); - } } -- cgit v0.9.0.2