-rw-r--r-- | core/pim/todo/tableview.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 39f0d72..8cd2e7e 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp @@ -90,145 +90,146 @@ TableView::TableView( MainWindow* window, QWidget* wid ) */ void TableView::newDay() { clear(); setTodos( begin(),end() ); } TableView::~TableView() { } void TableView::slotShowMenu() { QPopupMenu *menu = todoWindow()->contextMenu( current() ); menu->exec(QCursor::pos() ); delete menu; } OTodo TableView::find(int uid ) { OTodo ev = TodoView::event( uid ); return ev; } void TableView::updateFromTable( const OTodo& ev, CheckItem* item ) { TodoView::update( ev.uid(), ev ); /* update the other columns */ /* if completed or not we need to update * the table * * We've two cases * either item or !item * this makes cases more easy */ if ( !item ) { item = m_cache[ev.uid()]; } DueTextItem *due = dueItem( item->row() ); due->setCompleted( ev.isCompleted() ); } QString TableView::type() const { return QString::fromLatin1( tr("Table View") ); } int TableView::current() { int cur = 0; CheckItem* i = checkItem( currentRow() ); if (i ) cur = i->uid(); return cur; } QString TableView::currentRepresentation() { return text( currentRow(), 2); } /* show overdue */ void TableView::showOverDue( bool ) { clear(); setTodos( begin(), end() ); } void TableView::setTodos( OTodoAccess::List::Iterator it, OTodoAccess::List::Iterator end ) { qWarning("setTodos"); QTime time; time.start(); m_enablePaint = false; setUpdatesEnabled( false ); viewport()->setUpdatesEnabled( false ); clear(); QString currentCat = todoWindow()->currentCategory(); - bool showCompleted = todoWindow()->currentCatId(); + bool showCompleted = todoWindow()->showCompleted(); bool showOverDue = todoWindow()->showOverDue(); qWarning( "Current Category:" + todoWindow()->currentCategory() ); int id = todoWindow()->currentCatId(); QTime t; t.start(); setNumRows( it.count() ); uint i = 0; for (; it != end; ++it ) { OTodo todo = (*it); /* test if the categories match */ if ( !currentCat.isEmpty() && !todo.categories().contains( id ) ) { continue; } /* the item is completed but we shouldn't show it */ if ( !showCompleted && todo.isCompleted() ) { + qWarning("isCompleted "); continue; } /* the item is not overdue but we should only show overdue */ if ( showOverDue && !todo.isOverdue() ) { continue; } /* now it's fine to add it */ insertTodo( todo, i ); i++; } setNumRows( i ); int elc = time.elapsed(); qWarning("Adding took %d", elc/1000 ); setUpdatesEnabled( true ); viewport()->setUpdatesEnabled( true ); viewport()->update(); m_enablePaint = true; int el = time.elapsed(); qWarning("adding took %d", el/1000 ); } void TableView::setTodo( int uid, const OTodo& ev ) { QMap<int, CheckItem*>::Iterator it = m_cache.find( uid ); if ( it != m_cache.end() ) { int row = it.data()->row(); /* update checked */ CheckItem* check = checkItem(row ); if (check) check->setChecked( ev.isCompleted() ); /* update the text */ QString sum = ev.summary(); setText(row, 2, sum.isEmpty() ? ev.description().left(40).simplifyWhiteSpace() : sum ); /* update priority */ setText(row, 1, QString::number( ev.priority() ) ); /* update DueDate */ DueTextItem *due = dueItem( row ); due->setToDoEvent( ev ); } } void TableView::addEvent( const OTodo& ev) { int row= numRows(); setNumRows( row + 1 ); insertTodo( ev, row ); } /* * find the event * and then replace the complete row */ void TableView::replaceEvent( const OTodo& ev) { setTodo( ev.uid(), ev ); } /* * re aligning table can be slow too * FIXME: look what performs better * either this or the old align table */ void TableView::removeEvent( int ) { clear(); |