summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 8d354c8..e2966f8 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -745,19 +745,18 @@ void KOTodoView::updateView()
return;
}
if ( !isVisible() ) {
mPendingUpdateBeforeRepaint = true;
return;
}
- storeCurrentItem();
//qDebug("KOTodoView::updateView() %x", this);
if ( isFlatDisplay ) {
displayAllFlat();
- resetCurrentItem();
return;
}
+ storeCurrentItem();
//qDebug("update ");
// kdDebug() << "KOTodoView::updateView()" << endl;
QFont fo = KOPrefs::instance()->mTodoViewFont;
mTodoListView->clear();
@@ -832,13 +831,12 @@ void KOTodoView::updateView()
}
// Restore opened/closed state
mTodoListView->blockSignals( true );
if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
mTodoListView->blockSignals( false );
resetCurrentItem();
- processSelectionChange();
}
void KOTodoView::storeCurrentItem()
{
mCurItem = 0;
mCurItemRootParent = 0;
@@ -857,13 +855,13 @@ void KOTodoView::storeCurrentItem()
}
mActiveItem = 0;
}
void KOTodoView::resetCurrentItem()
{
- mTodoListView->setFocus();
+ //mTodoListView->setFocus();
KOTodoViewItem* foundItem = 0;
KOTodoViewItem* foundItemRoot = 0;
KOTodoViewItem* foundItemParent = 0;
KOTodoViewItem* foundItemAbove = 0;
if ( mTodoListView->firstChild () ) {
if ( mCurItem ) {
@@ -893,18 +891,28 @@ void KOTodoView::resetCurrentItem()
else
foundItem = foundItemAbove;
}
}
}
if ( foundItem ) {
+ mTodoListView->setSelected ( foundItem, true );
mTodoListView->setCurrentItem( foundItem );
mTodoListView->ensureItemVisible( foundItem );
- } else {
- mTodoListView->setCurrentItem( mTodoListView->firstChild () );
+ } else {
+ if ( mTodoListView->firstChild () ) {
+ mTodoListView->setSelected ( mTodoListView->firstChild (), true );
+ mTodoListView->setCurrentItem( mTodoListView->firstChild () );
+ }
}
}
+ processSelectionChange();
+ QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
+}
+void KOTodoView::resetFocusToList()
+{
+ topLevelWidget()->setActiveWindow();
mTodoListView->setFocus();
}
//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
bool KOTodoView::checkTodo( Todo * todo )
{
@@ -1401,12 +1409,13 @@ void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
item = item->nextSibling();
}
}
void KOTodoView::displayAllFlat()
{
+ storeCurrentItem();
pendingSubtodo = 0;
if ( mBlockUpdate ) {
return;
}
mPopupMenu->setItemChecked( 8,true );
isFlatDisplay = true;
@@ -1415,27 +1424,24 @@ void KOTodoView::displayAllFlat()
mTodoListView->clear();
Todo *todo;
for(todo = todoList.first(); todo; todo = todoList.next()) {
KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
mTodoMap.insert(todo,todoItem);
}
- mTodoListView->setFocus();
- processSelectionChange();
+ resetCurrentItem();
}
void KOTodoView::setAllFlat()
{
if ( isFlatDisplay ) {
isFlatDisplay = false;
mPopupMenu->setItemChecked( 8,false );
updateView();
return;
}
- storeCurrentItem();
displayAllFlat();
- resetCurrentItem();
}
void KOTodoView::purgeCompleted()
{
emit purgeCompletedSignal();