summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp46
1 files changed, 30 insertions, 16 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 00c2d97..27d755e 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -503,5 +503,6 @@ void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
503KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 503KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
504 KOrg::BaseView(calendar,parent,name) 504 KOrg::BaseView(calendar,parent,name)
505{ 505{
506 mActiveItem = 0;
506 mCategoryPopupMenu = 0; 507 mCategoryPopupMenu = 0;
507 mPendingUpdateBeforeRepaint = false; 508 mPendingUpdateBeforeRepaint = false;
@@ -808,6 +809,16 @@ void KOTodoView::paintEvent(QPaintEvent * pevent)
808} 809}
809 810
811void KOTodoView::clearList( bool saveCurrentItem ) // default true
812{
813 if ( mTodoListView->childCount() ) {
814 if ( saveCurrentItem )
815 storeCurrentItem();
816 mTodoListView->clear();
817 mTodoMap.clear();
818 }
819}
810void KOTodoView::updateView() 820void KOTodoView::updateView()
811{ 821{
822 mActiveItem = 0;
812 pendingSubtodo = 0; 823 pendingSubtodo = 0;
813 if ( mBlockUpdate ) { 824 if ( mBlockUpdate ) {
@@ -815,6 +826,7 @@ void KOTodoView::updateView()
815 } 826 }
816 if ( !isVisible() ) { 827 if ( !isVisible() ) {
817 mPendingUpdateBeforeRepaint = true; 828 clearList ();
818 return; 829 mPendingUpdateBeforeRepaint = true;
830 return;
819 } 831 }
820 //qDebug("KOTodoView::updateView() %x", this); 832 //qDebug("KOTodoView::updateView() %x", this);
@@ -823,11 +835,10 @@ void KOTodoView::updateView()
823 return; 835 return;
824 } 836 }
825 storeCurrentItem();
826 //qDebug("update "); 837 //qDebug("update ");
827// kdDebug() << "KOTodoView::updateView()" << endl; 838// kdDebug() << "KOTodoView::updateView()" << endl;
828 QFont fo = KOPrefs::instance()->mTodoViewFont; 839 QFont fo = KOPrefs::instance()->mTodoViewFont;
829 840
830 841 clearList ();
831 mTodoListView->clear(); 842
832 if ( mName == "todolistsmall" ) { 843 if ( mName == "todolistsmall" ) {
833 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 844 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
@@ -865,5 +876,4 @@ void KOTodoView::updateView()
865 // specific order of events. That means that we have to generate parent items 876 // specific order of events. That means that we have to generate parent items
866 // recursively for proper hierarchical display of Todos. 877 // recursively for proper hierarchical display of Todos.
867 mTodoMap.clear();
868 Todo *todo; 878 Todo *todo;
869 todo = todoList.first();// todo; todo = todoList.next()) { 879 todo = todoList.first();// todo; todo = todoList.next()) {
@@ -975,5 +985,6 @@ void KOTodoView::resetCurrentItem()
975 } 985 }
976 processSelectionChange(); 986 processSelectionChange();
977 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); 987 if ( mName != "todolistsmall" )
988 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
978} 989}
979void KOTodoView::resetFocusToList() 990void KOTodoView::resetFocusToList()
@@ -1101,10 +1112,12 @@ void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1101void KOTodoView::editItem(QListViewItem *item ) 1112void KOTodoView::editItem(QListViewItem *item )
1102{ 1113{
1103 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 1114 if ( item )
1115 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
1104} 1116}
1105 1117
1106void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 1118void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
1107{ 1119{
1108 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 1120 if ( item )
1121 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
1109} 1122}
1110 1123
@@ -1358,5 +1371,5 @@ void KOTodoView::toggleRunningItem()
1358 } 1371 }
1359 tp.exec(); 1372 tp.exec();
1360 updateTodo ( t, 0 ); 1373 updateTodo ( t, KOGlobals::EVENTEDITED );
1361 } else { 1374 } else {
1362 KOStartTodoPrefs tp ( t->summary(), this ); 1375 KOStartTodoPrefs tp ( t->summary(), this );
@@ -1375,5 +1388,5 @@ void KOTodoView::toggleRunningItem()
1375 } else { 1388 } else {
1376 t->setRunning( true ); 1389 t->setRunning( true );
1377 updateTodo ( t, 0 ); 1390 updateTodo ( t, KOGlobals::EVENTEDITED );
1378 } 1391 }
1379 } 1392 }
@@ -1506,14 +1519,14 @@ void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
1506void KOTodoView::displayAllFlat() 1519void KOTodoView::displayAllFlat()
1507{ 1520{
1508 storeCurrentItem(); 1521
1522 mActiveItem = 0;
1509 pendingSubtodo = 0; 1523 pendingSubtodo = 0;
1510 if ( mBlockUpdate ) { 1524 if ( mBlockUpdate ) {
1511 return; 1525 return;
1512 } 1526 }
1527 clearList ();
1513 mPopupMenu->setItemChecked( 8,true ); 1528 mPopupMenu->setItemChecked( 8,true );
1514 isFlatDisplay = true; 1529 isFlatDisplay = true;
1515 QPtrList<Todo> todoList = calendar()->todos(); 1530 QPtrList<Todo> todoList = calendar()->todos();
1516 mTodoMap.clear();
1517 mTodoListView->clear();
1518 Todo *todo; 1531 Todo *todo;
1519 for(todo = todoList.first(); todo; todo = todoList.next()) { 1532 for(todo = todoList.first(); todo; todo = todoList.next()) {
@@ -1697,7 +1710,8 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e )
1697 } 1710 }
1698} 1711}
1712
1699void KOTodoView::updateTodo( Todo * t, int type ) 1713void KOTodoView::updateTodo( Todo * t, int type )
1700{ 1714{
1701 if ( mBlockUpdate) 1715 if ( mBlockUpdate )
1702 return; 1716 return;
1703 1717