summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index a12c43e..d79a9b9 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -500,33 +500,33 @@ void KOQuickTodo::focusInEvent(QFocusEvent *ev)
500 if ( text()==i18n("Click to add new Todo") ) 500 if ( text()==i18n("Click to add new Todo") )
501 setText(""); 501 setText("");
502 QLineEdit::focusInEvent(ev); 502 QLineEdit::focusInEvent(ev);
503} 503}
504 504
505void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 505void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
506{ 506{
507 setText(i18n("Click to add new Todo")); 507 setText(i18n("Click to add new Todo"));
508 QLineEdit::focusOutEvent(ev); 508 QLineEdit::focusOutEvent(ev);
509} 509}
510 510
511///////////////////////////////////////////////////////////////////////////// 511/////////////////////////////////////////////////////////////////////////////
512 512
513KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 513KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
514 KOrg::BaseView(calendar,parent,name) 514 KOrg::BaseView(calendar,parent,name)
515{ 515{
516 516 mIsActiveWindow = false;
517 mCurItem = 0; 517 mCurItem = 0;
518 mCurItemRootParent = 0; 518 mCurItemRootParent = 0;
519 mCurItemParent = 0; 519 mCurItemParent = 0;
520 mCurItemAbove = 0; 520 mCurItemAbove = 0;
521 mActiveItem = 0; 521 mActiveItem = 0;
522 mCategoryPopupMenu = 0; 522 mCategoryPopupMenu = 0;
523 mPendingUpdateBeforeRepaint = false; 523 mPendingUpdateBeforeRepaint = false;
524 isFlatDisplay = false; 524 isFlatDisplay = false;
525 mNavigator = 0; 525 mNavigator = 0;
526 QBoxLayout *topLayout = new QVBoxLayout(this); 526 QBoxLayout *topLayout = new QVBoxLayout(this);
527 mName = QString ( name ); 527 mName = QString ( name );
528 mBlockUpdate = false; 528 mBlockUpdate = false;
529 mQuickBar = new QWidget( this ); 529 mQuickBar = new QWidget( this );
530 topLayout->addWidget(mQuickBar); 530 topLayout->addWidget(mQuickBar);
531 531
532 mQuickAdd = new KOQuickTodo(mQuickBar); 532 mQuickAdd = new KOQuickTodo(mQuickBar);
@@ -937,32 +937,33 @@ void KOTodoView::updateView()
937 insertTodoItem(todo); 937 insertTodoItem(todo);
938 } 938 }
939 } 939 }
940 // Restore opened/closed state 940 // Restore opened/closed state
941 mTodoListView->blockSignals( true ); 941 mTodoListView->blockSignals( true );
942 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 942 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
943 mTodoListView->blockSignals( false ); 943 mTodoListView->blockSignals( false );
944 resetCurrentItem(); 944 resetCurrentItem();
945} 945}
946 946
947void KOTodoView::storeCurrentItem() 947void KOTodoView::storeCurrentItem()
948{ 948{
949 mCurItem = 0; 949 mCurItem = 0;
950 mCurItemRootParent = 0; 950 mCurItemRootParent = 0;
951 mCurItemParent = 0; 951 mCurItemParent = 0;
952 mCurItemAbove = 0; 952 mCurItemAbove = 0;
953 mIsActiveWindow = topLevelWidget()->isActiveWindow();
953 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 954 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
954 if (mActiveItem) { 955 if (mActiveItem) {
955 mCurItem = mActiveItem->todo(); 956 mCurItem = mActiveItem->todo();
956 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 957 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
957 if ( activeItemAbove ) 958 if ( activeItemAbove )
958 mCurItemAbove = activeItemAbove->todo(); 959 mCurItemAbove = activeItemAbove->todo();
959 mCurItemRootParent = mCurItem; 960 mCurItemRootParent = mCurItem;
960 mCurItemParent = mCurItemRootParent->relatedTo(); 961 mCurItemParent = mCurItemRootParent->relatedTo();
961 while ( mCurItemRootParent->relatedTo() != 0 ) 962 while ( mCurItemRootParent->relatedTo() != 0 )
962 mCurItemRootParent = mCurItemRootParent->relatedTo(); 963 mCurItemRootParent = mCurItemRootParent->relatedTo();
963 } 964 }
964 mActiveItem = 0; 965 mActiveItem = 0;
965} 966}
966 967
967void KOTodoView::resetCurrentItem() 968void KOTodoView::resetCurrentItem()
968{ 969{
@@ -1005,33 +1006,34 @@ void KOTodoView::resetCurrentItem()
1005 mTodoListView->setSelected ( foundItem, true ); 1006 mTodoListView->setSelected ( foundItem, true );
1006 mTodoListView->setCurrentItem( foundItem ); 1007 mTodoListView->setCurrentItem( foundItem );
1007 mTodoListView->ensureItemVisible( foundItem ); 1008 mTodoListView->ensureItemVisible( foundItem );
1008 } else { 1009 } else {
1009 if ( mTodoListView->firstChild () ) { 1010 if ( mTodoListView->firstChild () ) {
1010 mTodoListView->setSelected ( mTodoListView->firstChild (), true ); 1011 mTodoListView->setSelected ( mTodoListView->firstChild (), true );
1011 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 1012 mTodoListView->setCurrentItem( mTodoListView->firstChild () );
1012 } 1013 }
1013 } 1014 }
1014 } 1015 }
1015 processSelectionChange(); 1016 processSelectionChange();
1016 if ( mName != "todolistsmall" ) 1017 if ( mName != "todolistsmall" )
1017 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); 1018 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
1018} 1019}
1019void KOTodoView::resetFocusToList() 1020void KOTodoView::resetFocusToList()
1020{ 1021{
1021 topLevelWidget()->setActiveWindow(); 1022 if ( mIsActiveWindow )
1023 topLevelWidget()->setActiveWindow();
1022 mTodoListView->setFocus(); 1024 mTodoListView->setFocus();
1023} 1025}
1024//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 1026//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
1025bool KOTodoView::checkTodo( Todo * todo ) 1027bool KOTodoView::checkTodo( Todo * todo )
1026{ 1028{
1027 1029
1028 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 1030 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
1029 return false; 1031 return false;
1030 if ( !todo->isCompleted() ) { 1032 if ( !todo->isCompleted() ) {
1031 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) 1033 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
1032 return true; 1034 return true;
1033 } 1035 }
1034 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 1036 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
1035 if ( todo->hasStartDate() ) 1037 if ( todo->hasStartDate() )
1036 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 1038 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
1037 return false; 1039 return false;