-rw-r--r-- | korganizer/kotodoview.cpp | 13 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 395325c..935a5f5 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -718,74 +718,85 @@ void KOTodoView::updateView() | |||
718 | insertTodoItem(todo); | 718 | insertTodoItem(todo); |
719 | } | 719 | } |
720 | } | 720 | } |
721 | //qDebug("for end "); | 721 | //qDebug("for end "); |
722 | // Restore opened/closed state | 722 | // Restore opened/closed state |
723 | mTodoListView->blockSignals( true ); | 723 | mTodoListView->blockSignals( true ); |
724 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 724 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
725 | mTodoListView->blockSignals( false ); | 725 | mTodoListView->blockSignals( false ); |
726 | resetCurrentItem(); | 726 | resetCurrentItem(); |
727 | processSelectionChange(); | 727 | processSelectionChange(); |
728 | } | 728 | } |
729 | 729 | ||
730 | void KOTodoView::storeCurrentItem() | 730 | void KOTodoView::storeCurrentItem() |
731 | { | 731 | { |
732 | mCurItem = 0; | 732 | mCurItem = 0; |
733 | mCurItemRootParent = 0; | 733 | mCurItemRootParent = 0; |
734 | mCurItemParent = 0; | ||
734 | mCurItemAbove = 0; | 735 | mCurItemAbove = 0; |
735 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 736 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
736 | if (mActiveItem) { | 737 | if (mActiveItem) { |
737 | mCurItem = mActiveItem->todo(); | 738 | mCurItem = mActiveItem->todo(); |
738 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); | 739 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); |
739 | if ( activeItemAbove ) | 740 | if ( activeItemAbove ) |
740 | mCurItemAbove = activeItemAbove->todo(); | 741 | mCurItemAbove = activeItemAbove->todo(); |
741 | mCurItemRootParent = mCurItem; | 742 | mCurItemRootParent = mCurItem; |
743 | mCurItemParent = mCurItemRootParent->relatedTo(); | ||
742 | while ( mCurItemRootParent->relatedTo() != 0 ) | 744 | while ( mCurItemRootParent->relatedTo() != 0 ) |
743 | mCurItemRootParent = mCurItemRootParent->relatedTo(); | 745 | mCurItemRootParent = mCurItemRootParent->relatedTo(); |
744 | } | 746 | } |
745 | mActiveItem = 0; | 747 | mActiveItem = 0; |
746 | } | 748 | } |
747 | 749 | ||
748 | void KOTodoView::resetCurrentItem() | 750 | void KOTodoView::resetCurrentItem() |
749 | { | 751 | { |
750 | mTodoListView->setFocus(); | 752 | mTodoListView->setFocus(); |
751 | KOTodoViewItem* foundItem = 0; | 753 | KOTodoViewItem* foundItem = 0; |
752 | KOTodoViewItem* foundItemRoot = 0; | 754 | KOTodoViewItem* foundItemRoot = 0; |
755 | KOTodoViewItem* foundItemParent = 0; | ||
753 | KOTodoViewItem* foundItemAbove = 0; | 756 | KOTodoViewItem* foundItemAbove = 0; |
754 | if ( mTodoListView->firstChild () ) { | 757 | if ( mTodoListView->firstChild () ) { |
755 | if ( mCurItem ) { | 758 | if ( mCurItem ) { |
756 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); | 759 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); |
757 | while ( item ) { | 760 | while ( item ) { |
758 | if ( item->todo() == mCurItem ) { | 761 | if ( item->todo() == mCurItem ) { |
759 | foundItem = item; | 762 | foundItem = item; |
760 | break; | 763 | break; |
761 | } else if ( item->todo() == mCurItemAbove ) { | 764 | } else if ( item->todo() == mCurItemAbove ) { |
762 | foundItemAbove = item; | 765 | foundItemAbove = item; |
763 | 766 | ||
764 | } else if ( item->todo() == mCurItemRootParent ) { | 767 | } |
768 | if ( item->todo() == mCurItemRootParent ) { | ||
765 | foundItemRoot = item; | 769 | foundItemRoot = item; |
766 | } | 770 | } |
771 | if ( item->todo() == mCurItemParent ) { | ||
772 | foundItemParent = item; | ||
773 | } | ||
767 | item = (KOTodoViewItem*)item->itemBelow(); | 774 | item = (KOTodoViewItem*)item->itemBelow(); |
768 | } | 775 | } |
769 | if ( ! foundItem ) { | 776 | if ( ! foundItem ) { |
777 | if ( foundItemParent ) { | ||
778 | foundItem = foundItemParent; | ||
779 | } else { | ||
770 | if ( foundItemRoot ) | 780 | if ( foundItemRoot ) |
771 | foundItem = foundItemRoot; | 781 | foundItem = foundItemRoot; |
772 | else | 782 | else |
773 | foundItem = foundItemAbove; | 783 | foundItem = foundItemAbove; |
774 | } | 784 | } |
775 | } | 785 | } |
786 | } | ||
776 | if ( foundItem ) { | 787 | if ( foundItem ) { |
777 | mTodoListView->setCurrentItem( foundItem ); | 788 | mTodoListView->setCurrentItem( foundItem ); |
778 | mTodoListView->ensureItemVisible( foundItem ); | 789 | mTodoListView->ensureItemVisible( foundItem ); |
779 | } else { | 790 | } else { |
780 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | 791 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); |
781 | } | 792 | } |
782 | } | 793 | } |
783 | mTodoListView->setFocus(); | 794 | mTodoListView->setFocus(); |
784 | } | 795 | } |
785 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 796 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; |
786 | bool KOTodoView::checkTodo( Todo * todo ) | 797 | bool KOTodoView::checkTodo( Todo * todo ) |
787 | { | 798 | { |
788 | 799 | ||
789 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 800 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
790 | return false; | 801 | return false; |
791 | if ( !todo->isCompleted() ) { | 802 | if ( !todo->isCompleted() ) { |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 39976cf..d0788a9 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -244,20 +244,20 @@ class KOTodoView : public KOrg::BaseView | |||
244 | QMap<int, int> mPriority; | 244 | QMap<int, int> mPriority; |
245 | QMap<int, QString> mCategory; | 245 | QMap<int, QString> mCategory; |
246 | KOTodoViewItem *mActiveItem; | 246 | KOTodoViewItem *mActiveItem; |
247 | 247 | ||
248 | QMap<Todo *,KOTodoViewItem *> mTodoMap; | 248 | QMap<Todo *,KOTodoViewItem *> mTodoMap; |
249 | QString mName; | 249 | QString mName; |
250 | 250 | ||
251 | DocPrefs *mDocPrefs; | 251 | DocPrefs *mDocPrefs; |
252 | QString mCurrentDoc; | 252 | QString mCurrentDoc; |
253 | KOQuickTodo *mQuickAdd; | 253 | KOQuickTodo *mQuickAdd; |
254 | bool mBlockUpdate; | 254 | bool mBlockUpdate; |
255 | void keyPressEvent ( QKeyEvent * ) ; | 255 | void keyPressEvent ( QKeyEvent * ) ; |
256 | KOTodoViewItem * pendingSubtodo; | 256 | KOTodoViewItem * pendingSubtodo; |
257 | DateNavigator* mNavigator; | 257 | DateNavigator* mNavigator; |
258 | void storeCurrentItem(); | 258 | void storeCurrentItem(); |
259 | void resetCurrentItem(); | 259 | void resetCurrentItem(); |
260 | Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 260 | Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove; |
261 | }; | 261 | }; |
262 | 262 | ||
263 | #endif | 263 | #endif |