-rw-r--r-- | korganizer/kotodoview.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 0a315cb..01cf0ff 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -217,12 +217,14 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) int X = p.x(); //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); if (X > header()->sectionPos(0) + treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + - itemMargin() || + itemMargin() +i->height()|| X < header()->sectionPos(0)) { rootClicked = false; } + } else { + rootClicked = false; } #ifndef KORG_NODND mMousePressed = false; if (! rootClicked ) { @@ -729,11 +731,11 @@ void KOTodoView::storeCurrentItem() mCurItem = mActiveItem->todo(); KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); if ( activeItemAbove ) mCurItemAbove = activeItemAbove->todo(); - while ( mActiveItem->parent() != 0 ) - mActiveItem = (KOTodoViewItem*)mActiveItem->parent(); - mCurItemRootParent = mActiveItem->todo(); + mCurItemRootParent = mCurItem; + while ( mCurItemRootParent->relatedTo() != 0 ) + mCurItemRootParent = mCurItemRootParent->relatedTo(); } mActiveItem = 0; } @@ -758,12 +760,12 @@ void KOTodoView::resetCurrentItem() } item = (KOTodoViewItem*)item->itemBelow(); } if ( ! foundItem ) { - if ( foundItemAbove ) - foundItem = foundItemAbove; - else + if ( foundItemRoot ) foundItem = foundItemRoot; + else + foundItem = foundItemAbove; } } if ( foundItem ) { mTodoListView->setCurrentItem( foundItem ); @@ -1204,19 +1206,25 @@ void KOTodoView::setAllOpen() if ( isFlatDisplay ) { isFlatDisplay = false; mPopupMenu->setItemChecked( 8,false ); updateView(); + } else { + storeCurrentItem(); } setOpen(mTodoListView->firstChild(), true); + resetCurrentItem(); } void KOTodoView::setAllClose() { if ( isFlatDisplay ) { isFlatDisplay = false; mPopupMenu->setItemChecked( 8,false ); updateView(); + } else { + storeCurrentItem(); } setOpen(mTodoListView->firstChild(), false); + resetCurrentItem(); } void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) { @@ -1253,10 +1261,12 @@ void KOTodoView::setAllFlat() isFlatDisplay = false; mPopupMenu->setItemChecked( 8,false ); updateView(); return; - } + } + storeCurrentItem(); displayAllFlat(); + resetCurrentItem(); } void KOTodoView::purgeCompleted() { |