-rw-r--r-- | bin/kdepim/WhatsNew.txt | 4 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 30 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 2 |
3 files changed, 26 insertions, 10 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index f4b3ddb..201f863 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -1,12 +1,14 @@ Info about the changes in new versions of KDE-Pim/Pi ********** VERSION 2.1.19 ************ -Fixed a crash in journal view and a crash in setting a todo to stopped when KO/Pi saved the file when "stop todo" dialog was shown. +Fixed a crash in journal view. +Fixed a crash at setting a todo to stopped if KO/Pi saved the file while "stop todo" dialog was shown. Fixed a minor problem with the marcus bains line (whatever that is). +Fixed a crash when setting a todo to complete from the show dialog which was called from the What's Next View. ********** VERSION 2.1.18 ************ Pi-Sync mode: The "Write back file" status dialog was updated too often such that writing back the file on the Z was very slow. Fixed. diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 00c2d97..27d755e 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -500,12 +500,13 @@ 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; mNavigator = 0; QBoxLayout *topLayout = new QVBoxLayout(this); mName = QString ( name ); @@ -804,34 +805,44 @@ void KOTodoView::paintEvent(QPaintEvent * pevent) updateView(); mPendingUpdateBeforeRepaint = false; } 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; } //qDebug("KOTodoView::updateView() %x", this); if ( isFlatDisplay ) { 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; if ( ps > 12 ) ps -= 2; fo.setPointSize( ps ); @@ -861,13 +872,12 @@ 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 ) { bool next = true; // qDebug("todo %s ", todo->summary().latin1()); Incidence *incidence = todo->relatedTo(); @@ -971,12 +981,13 @@ void KOTodoView::resetCurrentItem() mTodoListView->setSelected ( mTodoListView->firstChild (), true ); mTodoListView->setCurrentItem( mTodoListView->firstChild () ); } } } processSelectionChange(); + if ( mName != "todolistsmall" ) QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); } void KOTodoView::resetFocusToList() { topLevelWidget()->setActiveWindow(); mTodoListView->setFocus(); @@ -1097,17 +1108,19 @@ void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, calPrinter->preview(CalPrinter::Todolist, fd, td); #endif } 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()); } void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) { pendingSubtodo = 0; @@ -1354,13 +1367,13 @@ void KOTodoView::toggleRunningItem() int hei = tp.height(); int xx = (QApplication::desktop()->width()-wid)/2; int yy = (QApplication::desktop()->height()-hei)/2; 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 ){ int wid = tp.width(); int hei = tp.height(); int xx = (QApplication::desktop()->width()-wid)/2; @@ -1371,13 +1384,13 @@ void KOTodoView::toggleRunningItem() if ( tp.stopAll() ) { mCalendar->stopAllTodos(); t->setRunning( true ); updateView(); } else { t->setRunning( true ); - updateTodo ( t, 0 ); + updateTodo ( t, KOGlobals::EVENTEDITED ); } } } void KOTodoView::itemClicked(QListViewItem *item) { @@ -1502,22 +1515,22 @@ void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) item = item->nextSibling(); } } 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 ) ) { KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); mTodoMap.insert(todo,todoItem); } @@ -1693,12 +1706,13 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e ) } } e->accept(); } } } + void KOTodoView::updateTodo( Todo * t, int type ) { if ( mBlockUpdate) return; QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index a8e90e2..9180015 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -171,13 +171,13 @@ class KOTodoView : public KOrg::BaseView void setDocumentId( const QString & ); void saveLayout(KConfig *config, const QString &group) const; 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(); void updateConfig(); void changeEventDisplay(Event *, int); |