From 31f24d21cd23bb7e4033e7ffa000e6c979133ce7 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 23 Feb 2005 18:47:45 +0000 Subject: many focus fixes --- (limited to 'korganizer/kotodoview.cpp') diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 3483e95..5e8ea27 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -605,6 +605,11 @@ void KOTodoView::updateView() //qDebug("update "); // kdDebug() << "KOTodoView::updateView()" << endl; QFont fo = KOPrefs::instance()->mTodoViewFont; + Incidence* oldInc = 0; + mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); + if (mActiveItem) + oldInc = mActiveItem->todo(); + mTodoListView->clear(); if ( mName == "todolistsmall" ) { if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { @@ -686,6 +691,23 @@ void KOTodoView::updateView() if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); mTodoListView->blockSignals( false ); mTodoListView->setFocus(); + if ( mTodoListView->firstChild () ) { + if ( oldInc ) { + KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); + while ( item ) { + if ( item->todo() == oldInc ) { + mTodoListView->setCurrentItem( item ); + mTodoListView->ensureItemVisible( item ); + break; + } + item = (KOTodoViewItem*)item->itemBelow(); + } + if ( ! item ) + mTodoListView->setCurrentItem( mTodoListView->firstChild () ); + } else { + mTodoListView->setCurrentItem( mTodoListView->firstChild () ); + } + } processSelectionChange(); } -- cgit v0.9.0.2