-rw-r--r-- | korganizer/kotodoview.cpp | 26 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 |
2 files changed, 17 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 | |||
@@ -747,15 +747,14 @@ void KOTodoView::updateView() | |||
747 | if ( !isVisible() ) { | 747 | if ( !isVisible() ) { |
748 | mPendingUpdateBeforeRepaint = true; | 748 | mPendingUpdateBeforeRepaint = true; |
749 | return; | 749 | return; |
750 | } | 750 | } |
751 | storeCurrentItem(); | ||
752 | //qDebug("KOTodoView::updateView() %x", this); | 751 | //qDebug("KOTodoView::updateView() %x", this); |
753 | if ( isFlatDisplay ) { | 752 | if ( isFlatDisplay ) { |
754 | displayAllFlat(); | 753 | displayAllFlat(); |
755 | resetCurrentItem(); | ||
756 | return; | 754 | return; |
757 | } | 755 | } |
756 | storeCurrentItem(); | ||
758 | //qDebug("update "); | 757 | //qDebug("update "); |
759 | // kdDebug() << "KOTodoView::updateView()" << endl; | 758 | // kdDebug() << "KOTodoView::updateView()" << endl; |
760 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 759 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
761 | 760 | ||
@@ -834,9 +833,8 @@ void KOTodoView::updateView() | |||
834 | mTodoListView->blockSignals( true ); | 833 | mTodoListView->blockSignals( true ); |
835 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 834 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
836 | mTodoListView->blockSignals( false ); | 835 | mTodoListView->blockSignals( false ); |
837 | resetCurrentItem(); | 836 | resetCurrentItem(); |
838 | processSelectionChange(); | ||
839 | } | 837 | } |
840 | 838 | ||
841 | void KOTodoView::storeCurrentItem() | 839 | void KOTodoView::storeCurrentItem() |
842 | { | 840 | { |
@@ -859,9 +857,9 @@ void KOTodoView::storeCurrentItem() | |||
859 | } | 857 | } |
860 | 858 | ||
861 | void KOTodoView::resetCurrentItem() | 859 | void KOTodoView::resetCurrentItem() |
862 | { | 860 | { |
863 | mTodoListView->setFocus(); | 861 | //mTodoListView->setFocus(); |
864 | KOTodoViewItem* foundItem = 0; | 862 | KOTodoViewItem* foundItem = 0; |
865 | KOTodoViewItem* foundItemRoot = 0; | 863 | KOTodoViewItem* foundItemRoot = 0; |
866 | KOTodoViewItem* foundItemParent = 0; | 864 | KOTodoViewItem* foundItemParent = 0; |
867 | KOTodoViewItem* foundItemAbove = 0; | 865 | KOTodoViewItem* foundItemAbove = 0; |
@@ -895,14 +893,24 @@ void KOTodoView::resetCurrentItem() | |||
895 | } | 893 | } |
896 | } | 894 | } |
897 | } | 895 | } |
898 | if ( foundItem ) { | 896 | if ( foundItem ) { |
897 | mTodoListView->setSelected ( foundItem, true ); | ||
899 | mTodoListView->setCurrentItem( foundItem ); | 898 | mTodoListView->setCurrentItem( foundItem ); |
900 | mTodoListView->ensureItemVisible( foundItem ); | 899 | mTodoListView->ensureItemVisible( foundItem ); |
901 | } else { | 900 | } else { |
902 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | 901 | if ( mTodoListView->firstChild () ) { |
902 | mTodoListView->setSelected ( mTodoListView->firstChild (), true ); | ||
903 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | ||
904 | } | ||
903 | } | 905 | } |
904 | } | 906 | } |
907 | processSelectionChange(); | ||
908 | QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); | ||
909 | } | ||
910 | void KOTodoView::resetFocusToList() | ||
911 | { | ||
912 | topLevelWidget()->setActiveWindow(); | ||
905 | mTodoListView->setFocus(); | 913 | mTodoListView->setFocus(); |
906 | } | 914 | } |
907 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 915 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; |
908 | bool KOTodoView::checkTodo( Todo * todo ) | 916 | bool KOTodoView::checkTodo( Todo * todo ) |
@@ -1403,8 +1411,9 @@ void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | |||
1403 | } | 1411 | } |
1404 | 1412 | ||
1405 | void KOTodoView::displayAllFlat() | 1413 | void KOTodoView::displayAllFlat() |
1406 | { | 1414 | { |
1415 | storeCurrentItem(); | ||
1407 | pendingSubtodo = 0; | 1416 | pendingSubtodo = 0; |
1408 | if ( mBlockUpdate ) { | 1417 | if ( mBlockUpdate ) { |
1409 | return; | 1418 | return; |
1410 | } | 1419 | } |
@@ -1417,10 +1426,9 @@ void KOTodoView::displayAllFlat() | |||
1417 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1426 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1418 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1427 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1419 | mTodoMap.insert(todo,todoItem); | 1428 | mTodoMap.insert(todo,todoItem); |
1420 | } | 1429 | } |
1421 | mTodoListView->setFocus(); | 1430 | resetCurrentItem(); |
1422 | processSelectionChange(); | ||
1423 | } | 1431 | } |
1424 | 1432 | ||
1425 | void KOTodoView::setAllFlat() | 1433 | void KOTodoView::setAllFlat() |
1426 | { | 1434 | { |
@@ -1429,11 +1437,9 @@ void KOTodoView::setAllFlat() | |||
1429 | mPopupMenu->setItemChecked( 8,false ); | 1437 | mPopupMenu->setItemChecked( 8,false ); |
1430 | updateView(); | 1438 | updateView(); |
1431 | return; | 1439 | return; |
1432 | } | 1440 | } |
1433 | storeCurrentItem(); | ||
1434 | displayAllFlat(); | 1441 | displayAllFlat(); |
1435 | resetCurrentItem(); | ||
1436 | } | 1442 | } |
1437 | 1443 | ||
1438 | void KOTodoView::purgeCompleted() | 1444 | void KOTodoView::purgeCompleted() |
1439 | { | 1445 | { |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 1b31d0d..9ae7f53 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -223,8 +223,9 @@ class KOTodoView : public KOrg::BaseView | |||
223 | void itemClicked(QListViewItem *); | 223 | void itemClicked(QListViewItem *); |
224 | void itemStateChanged(QListViewItem *); | 224 | void itemStateChanged(QListViewItem *); |
225 | void modified(bool); | 225 | void modified(bool); |
226 | void itemDoubleClicked(QListViewItem *item); | 226 | void itemDoubleClicked(QListViewItem *item); |
227 | void resetFocusToList(); | ||
227 | 228 | ||
228 | signals: | 229 | signals: |
229 | void newTodoSignal(); | 230 | void newTodoSignal(); |
230 | void newSubTodoSignal(Todo *); | 231 | void newSubTodoSignal(Todo *); |