-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 @@ -218,10 +218,12 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) //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; @@ -730,9 +732,9 @@ void KOTodoView::storeCurrentItem() 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; } @@ -759,10 +761,10 @@ void KOTodoView::resetCurrentItem() item = (KOTodoViewItem*)item->itemBelow(); } if ( ! foundItem ) { - if ( foundItemAbove ) - foundItem = foundItemAbove; - else + if ( foundItemRoot ) foundItem = foundItemRoot; + else + foundItem = foundItemAbove; } } if ( foundItem ) { @@ -1205,8 +1207,11 @@ void KOTodoView::setAllOpen() isFlatDisplay = false; mPopupMenu->setItemChecked( 8,false ); updateView(); + } else { + storeCurrentItem(); } setOpen(mTodoListView->firstChild(), true); + resetCurrentItem(); } void KOTodoView::setAllClose() { @@ -1214,8 +1219,11 @@ void KOTodoView::setAllClose() isFlatDisplay = false; mPopupMenu->setItemChecked( 8,false ); updateView(); + } else { + storeCurrentItem(); } setOpen(mTodoListView->firstChild(), false); + resetCurrentItem(); } void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) { @@ -1254,8 +1262,10 @@ void KOTodoView::setAllFlat() mPopupMenu->setItemChecked( 8,false ); updateView(); return; - } + } + storeCurrentItem(); displayAllFlat(); + resetCurrentItem(); } void KOTodoView::purgeCompleted() |