author | zautrix <zautrix> | 2005-08-06 09:54:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-06 09:54:42 (UTC) |
commit | b841f4f2d54ac531c1f9ec88852d31307b9145f2 (patch) (side-by-side diff) | |
tree | c334106e75e73bbc3fc33cd3c0d6480314a42774 /korganizer | |
parent | cd215c243d0636cabbc73006652b9b6783319de1 (diff) | |
download | kdepimpi-b841f4f2d54ac531c1f9ec88852d31307b9145f2.zip kdepimpi-b841f4f2d54ac531c1f9ec88852d31307b9145f2.tar.gz kdepimpi-b841f4f2d54ac531c1f9ec88852d31307b9145f2.tar.bz2 |
fixes
-rw-r--r-- | korganizer/kotodoview.cpp | 30 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 2 |
2 files changed, 23 insertions, 9 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 00c2d97..27d755e 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -503,6 +503,7 @@ void KOQuickTodo::focusOutEvent(QFocusEvent *ev) KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : KOrg::BaseView(calendar,parent,name) { + mActiveItem = 0; mCategoryPopupMenu = 0; mPendingUpdateBeforeRepaint = false; isFlatDisplay = false; @@ -807,13 +808,24 @@ void KOTodoView::paintEvent(QPaintEvent * pevent) KOrg::BaseView::paintEvent( pevent); } +void KOTodoView::clearList( bool saveCurrentItem ) // default true +{ + if ( mTodoListView->childCount() ) { + if ( saveCurrentItem ) + storeCurrentItem(); + mTodoListView->clear(); + mTodoMap.clear(); + } +} void KOTodoView::updateView() { + mActiveItem = 0; pendingSubtodo = 0; if ( mBlockUpdate ) { return; } if ( !isVisible() ) { + clearList (); mPendingUpdateBeforeRepaint = true; return; } @@ -822,13 +834,12 @@ void KOTodoView::updateView() displayAllFlat(); return; } - storeCurrentItem(); //qDebug("update "); // kdDebug() << "KOTodoView::updateView()" << endl; QFont fo = KOPrefs::instance()->mTodoViewFont; + clearList (); - mTodoListView->clear(); if ( mName == "todolistsmall" ) { if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { int ps = fo.pointSize() -2; @@ -864,7 +875,6 @@ void KOTodoView::updateView() // Put for each Event a KOTodoViewItem in the list view. Don't rely on a // specific order of events. That means that we have to generate parent items // recursively for proper hierarchical display of Todos. - mTodoMap.clear(); Todo *todo; todo = todoList.first();// todo; todo = todoList.next()) { while ( todo ) { @@ -974,6 +984,7 @@ void KOTodoView::resetCurrentItem() } } processSelectionChange(); + if ( mName != "todolistsmall" ) QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); } void KOTodoView::resetFocusToList() @@ -1100,11 +1111,13 @@ void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, void KOTodoView::editItem(QListViewItem *item ) { + if ( item ) emit editTodoSignal(((KOTodoViewItem *)item)->todo()); } void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) { + if ( item ) emit showTodoSignal(((KOTodoViewItem *)item)->todo()); } @@ -1357,7 +1370,7 @@ void KOTodoView::toggleRunningItem() tp.setGeometry( xx,yy,wid,hei ); } tp.exec(); - updateTodo ( t, 0 ); + updateTodo ( t, KOGlobals::EVENTEDITED ); } else { KOStartTodoPrefs tp ( t->summary(), this ); if (QApplication::desktop()->width() <= 800 ){ @@ -1374,7 +1387,7 @@ void KOTodoView::toggleRunningItem() updateView(); } else { t->setRunning( true ); - updateTodo ( t, 0 ); + updateTodo ( t, KOGlobals::EVENTEDITED ); } } } @@ -1505,16 +1518,16 @@ void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) void KOTodoView::displayAllFlat() { - storeCurrentItem(); + + mActiveItem = 0; pendingSubtodo = 0; if ( mBlockUpdate ) { return; } + clearList (); mPopupMenu->setItemChecked( 8,true ); isFlatDisplay = true; QPtrList<Todo> todoList = calendar()->todos(); - mTodoMap.clear(); - mTodoListView->clear(); Todo *todo; for(todo = todoList.first(); todo; todo = todoList.next()) { if ( checkTodo( todo ) ) { @@ -1696,6 +1709,7 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e ) } } } + void KOTodoView::updateTodo( Todo * t, int type ) { if ( mBlockUpdate) diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index a8e90e2..9180015 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -174,7 +174,7 @@ class KOTodoView : public KOrg::BaseView void restoreLayout(KConfig *config, const QString &group); void setNavigator( DateNavigator* nav ) {mNavigator = nav;} QString getWhatsThisText(QPoint p); - void clearList() {mTodoListView->clear(); } + void clearList( bool saveCurrentItem = true ); public slots: void updateView(); |