-rw-r--r-- | core/pim/todo/tableview.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index f4b898f..34b8b3c 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp @@ -123,14 +123,16 @@ QString TableView::currentRepresentation() { void TableView::showOverDue( bool ) { clear(); updateView(); } void TableView::updateView( ) { + qWarning("update view"); m_row = false; - startTimer( 2000 ); + static int id; + id = startTimer(2000 ); /* FIXME we want one page to be read! * * Calculate that screensize */ todoWindow()->setReadAhead( 4 ); sort(); @@ -145,12 +147,14 @@ void TableView::updateView( ) { setUpdatesEnabled( false ); viewport()->setUpdatesEnabled( false ); QTime t; t.start(); setNumRows( it.count() ); + if ( it.count() == 0 ) + killTimer(id); int elc = time.elapsed(); qWarning("Adding took %d", elc/1000 ); setUpdatesEnabled( true ); viewport()->setUpdatesEnabled( true ); viewport()->update(); @@ -159,19 +163,18 @@ void TableView::updateView( ) { qWarning("adding took %d", el/1000 ); } void TableView::setTodo( int, const OTodo&) { sort(); /* repaint */ - QTable::update(); + repaint(); } void TableView::addEvent( const OTodo&) { - sort(); /* fix problems of not showing the 'Haken' */ - QTable::repaint(); + updateView(); } /* * find the event * and then replace the complete row */ void TableView::replaceEvent( const OTodo& ev) { @@ -425,12 +428,15 @@ void TableView::slotPriority() { * filled enough. * We will try to read ahead 4 items in both ways * up and down. On odd or even we will currentRow()+-4 or +-9 * */ void TableView::timerEvent( QTimerEvent* ev ) { + if (sorted().count() == 0 ) + return; + int row = currentRow(); qWarning("TimerEvent %d", row); if ( m_row ) { int ro = row-4; if (ro < 0 ) ro = 0; sorted()[ro]; |