-rw-r--r-- | korganizer/kotodoview.cpp | 21 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 2 |
2 files changed, 17 insertions, 6 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 395325c..935a5f5 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -728,52 +728,63 @@ void KOTodoView::updateView() } 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 { diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 39976cf..d0788a9 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -254,10 +254,10 @@ class KOTodoView : public KOrg::BaseView bool mBlockUpdate; void keyPressEvent ( QKeyEvent * ) ; KOTodoViewItem * pendingSubtodo; DateNavigator* mNavigator; void storeCurrentItem(); void resetCurrentItem(); - Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; + Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove; }; #endif |