summaryrefslogtreecommitdiff
path: root/core/pim/todo/tableview.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/tableview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/todo/tableview.cpp14
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() {
123void TableView::showOverDue( bool ) { 123void TableView::showOverDue( bool ) {
124 clear(); 124 clear();
125 updateView(); 125 updateView();
126} 126}
127 127
128void TableView::updateView( ) { 128void TableView::updateView( ) {
129 qWarning("update view");
129 m_row = false; 130 m_row = false;
130 startTimer( 2000 ); 131 static int id;
132 id = startTimer(2000 );
131 /* FIXME we want one page to be read! 133 /* FIXME we want one page to be read!
132 * 134 *
133 * Calculate that screensize 135 * Calculate that screensize
134 */ 136 */
135 todoWindow()->setReadAhead( 4 ); 137 todoWindow()->setReadAhead( 4 );
136 sort(); 138 sort();
@@ -145,12 +147,14 @@ void TableView::updateView( ) {
145 setUpdatesEnabled( false ); 147 setUpdatesEnabled( false );
146 viewport()->setUpdatesEnabled( false ); 148 viewport()->setUpdatesEnabled( false );
147 149
148 QTime t; 150 QTime t;
149 t.start(); 151 t.start();
150 setNumRows( it.count() ); 152 setNumRows( it.count() );
153 if ( it.count() == 0 )
154 killTimer(id);
151 int elc = time.elapsed(); 155 int elc = time.elapsed();
152 qWarning("Adding took %d", elc/1000 ); 156 qWarning("Adding took %d", elc/1000 );
153 setUpdatesEnabled( true ); 157 setUpdatesEnabled( true );
154 viewport()->setUpdatesEnabled( true ); 158 viewport()->setUpdatesEnabled( true );
155 viewport()->update(); 159 viewport()->update();
156 160
@@ -159,19 +163,18 @@ void TableView::updateView( ) {
159 qWarning("adding took %d", el/1000 ); 163 qWarning("adding took %d", el/1000 );
160} 164}
161void TableView::setTodo( int, const OTodo&) { 165void TableView::setTodo( int, const OTodo&) {
162 sort(); 166 sort();
163 167
164 /* repaint */ 168 /* repaint */
165 QTable::update(); 169 repaint();
166} 170}
167void TableView::addEvent( const OTodo&) { 171void TableView::addEvent( const OTodo&) {
168 sort();
169 172
170 /* fix problems of not showing the 'Haken' */ 173 /* fix problems of not showing the 'Haken' */
171 QTable::repaint(); 174 updateView();
172} 175}
173/* 176/*
174 * find the event 177 * find the event
175 * and then replace the complete row 178 * and then replace the complete row
176 */ 179 */
177void TableView::replaceEvent( const OTodo& ev) { 180void TableView::replaceEvent( const OTodo& ev) {
@@ -425,12 +428,15 @@ void TableView::slotPriority() {
425 * filled enough. 428 * filled enough.
426 * We will try to read ahead 4 items in both ways 429 * We will try to read ahead 4 items in both ways
427 * up and down. On odd or even we will currentRow()+-4 or +-9 430 * up and down. On odd or even we will currentRow()+-4 or +-9
428 * 431 *
429 */ 432 */
430void TableView::timerEvent( QTimerEvent* ev ) { 433void TableView::timerEvent( QTimerEvent* ev ) {
434 if (sorted().count() == 0 )
435 return;
436
431 int row = currentRow(); 437 int row = currentRow();
432 qWarning("TimerEvent %d", row); 438 qWarning("TimerEvent %d", row);
433 if ( m_row ) { 439 if ( m_row ) {
434 int ro = row-4; 440 int ro = row-4;
435 if (ro < 0 ) ro = 0; 441 if (ro < 0 ) ro = 0;
436 sorted()[ro]; 442 sorted()[ro];