author | zautrix <zautrix> | 2005-04-08 11:36:36 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-08 11:36:36 (UTC) |
commit | ba04f6a4b6b651dcff11ca17103cba42330e52be (patch) (side-by-side diff) | |
tree | c8c02a1327abbd87cf5f019399e8e7bf1940a2bc /korganizer/kotodoview.cpp | |
parent | 59fb8a0ac35bf3b81f1c4e2e4fc6b61356d064ef (diff) | |
download | kdepimpi-ba04f6a4b6b651dcff11ca17103cba42330e52be.zip kdepimpi-ba04f6a4b6b651dcff11ca17103cba42330e52be.tar.gz kdepimpi-ba04f6a4b6b651dcff11ca17103cba42330e52be.tar.bz2 |
fix
-rw-r--r-- | korganizer/kotodoview.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 395325c..935a5f5 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -718,72 +718,83 @@ void KOTodoView::updateView() insertTodoItem(todo); } } //qDebug("for end "); // Restore opened/closed state mTodoListView->blockSignals( true ); if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); mTodoListView->blockSignals( false ); resetCurrentItem(); processSelectionChange(); } void KOTodoView::storeCurrentItem() { mCurItem = 0; mCurItemRootParent = 0; + mCurItemParent = 0; mCurItemAbove = 0; mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); if (mActiveItem) { mCurItem = mActiveItem->todo(); KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); if ( activeItemAbove ) mCurItemAbove = activeItemAbove->todo(); mCurItemRootParent = mCurItem; + mCurItemParent = mCurItemRootParent->relatedTo(); while ( mCurItemRootParent->relatedTo() != 0 ) mCurItemRootParent = mCurItemRootParent->relatedTo(); } mActiveItem = 0; } void KOTodoView::resetCurrentItem() { mTodoListView->setFocus(); KOTodoViewItem* foundItem = 0; KOTodoViewItem* foundItemRoot = 0; + KOTodoViewItem* foundItemParent = 0; KOTodoViewItem* foundItemAbove = 0; if ( mTodoListView->firstChild () ) { if ( mCurItem ) { KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); while ( item ) { if ( item->todo() == mCurItem ) { foundItem = item; break; } else if ( item->todo() == mCurItemAbove ) { foundItemAbove = item; - } else if ( item->todo() == mCurItemRootParent ) { + } + if ( item->todo() == mCurItemRootParent ) { foundItemRoot = item; } + if ( item->todo() == mCurItemParent ) { + foundItemParent = item; + } item = (KOTodoViewItem*)item->itemBelow(); } if ( ! foundItem ) { - if ( foundItemRoot ) - foundItem = foundItemRoot; - else - foundItem = foundItemAbove; + if ( foundItemParent ) { + foundItem = foundItemParent; + } else { + if ( foundItemRoot ) + foundItem = foundItemRoot; + else + foundItem = foundItemAbove; + } } } if ( foundItem ) { mTodoListView->setCurrentItem( foundItem ); mTodoListView->ensureItemVisible( foundItem ); } else { mTodoListView->setCurrentItem( mTodoListView->firstChild () ); } } mTodoListView->setFocus(); } //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; bool KOTodoView::checkTodo( Todo * todo ) { if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |