-rw-r--r-- | core/pim/todo/mainwindow.cpp | 4 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 1 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 54 | ||||
-rw-r--r-- | core/pim/todo/tableview.h | 3 |
4 files changed, 60 insertions, 2 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 2994915..a6d657c 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -677,3 +677,7 @@ void MainWindow::slotUpdate3( QWidget* ) { | |||
677 | void MainWindow::updateList() { | 677 | void MainWindow::updateList() { |
678 | m_todoMgr.updateList(); | 678 | m_todoMgr.updateList(); |
679 | } | 679 | } |
680 | void MainWindow::setReadAhead( uint count ) { | ||
681 | if (m_todoMgr.todoDB() ) | ||
682 | m_todoMgr.todoDB()->setReadAhead( count ); | ||
683 | } | ||
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index 8d0c29f..5a18e64 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -87,6 +87,7 @@ namespace Todo { | |||
87 | void updateTodo( const OTodo& ); | 87 | void updateTodo( const OTodo& ); |
88 | void populateTemplates(); | 88 | void populateTemplates(); |
89 | Editor* currentEditor(); | 89 | Editor* currentEditor(); |
90 | void setReadAhead(uint count ); | ||
90 | private slots: | 91 | private slots: |
91 | void populateCategories(); | 92 | void populateCategories(); |
92 | void slotReload(); | 93 | void slotReload(); |
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 5d82eb2..f4b898f 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -126,6 +126,13 @@ void TableView::showOverDue( bool ) { | |||
126 | } | 126 | } |
127 | 127 | ||
128 | void TableView::updateView( ) { | 128 | void TableView::updateView( ) { |
129 | m_row = false; | ||
130 | startTimer( 2000 ); | ||
131 | /* FIXME we want one page to be read! | ||
132 | * | ||
133 | * Calculate that screensize | ||
134 | */ | ||
135 | todoWindow()->setReadAhead( 4 ); | ||
129 | sort(); | 136 | sort(); |
130 | OTodoAccess::List::Iterator it, end; | 137 | OTodoAccess::List::Iterator it, end; |
131 | it = sorted().begin(); | 138 | it = sorted().begin(); |
@@ -160,7 +167,8 @@ void TableView::setTodo( int, const OTodo&) { | |||
160 | void TableView::addEvent( const OTodo&) { | 167 | void TableView::addEvent( const OTodo&) { |
161 | sort(); | 168 | sort(); |
162 | 169 | ||
163 | QTable::update(); | 170 | /* fix problems of not showing the 'Haken' */ |
171 | QTable::repaint(); | ||
164 | } | 172 | } |
165 | /* | 173 | /* |
166 | * find the event | 174 | * find the event |
@@ -353,7 +361,21 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool | |||
353 | { | 361 | { |
354 | QString text; | 362 | QString text; |
355 | if (task.hasDueDate()) { | 363 | if (task.hasDueDate()) { |
356 | text = "HAS"; | 364 | int off = QDate::currentDate().daysTo( task.dueDate() ); |
365 | text = QString::number(off) + tr(" day(s)"); | ||
366 | /* | ||
367 | * set color if not completed | ||
368 | */ | ||
369 | if (!task.isCompleted() ) { | ||
370 | QColor color = Qt::black; | ||
371 | if ( off < 0 ) | ||
372 | color = Qt::red; | ||
373 | else if ( off == 0 ) | ||
374 | color = Qt::yellow; | ||
375 | else if ( off > 0 ) | ||
376 | color = Qt::green; | ||
377 | p->setPen(color ); | ||
378 | } | ||
357 | } else { | 379 | } else { |
358 | text = tr("None"); | 380 | text = tr("None"); |
359 | } | 381 | } |
@@ -398,3 +420,31 @@ void TableView::setCellContentFromEditor(int row, int col ) { | |||
398 | void TableView::slotPriority() { | 420 | void TableView::slotPriority() { |
399 | setCellContentFromEditor( currentRow(), currentColumn() ); | 421 | setCellContentFromEditor( currentRow(), currentColumn() ); |
400 | } | 422 | } |
423 | /* | ||
424 | * We'll use the TimerEvent to read ahead or to keep the cahce always | ||
425 | * filled enough. | ||
426 | * 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 | ||
428 | * | ||
429 | */ | ||
430 | void TableView::timerEvent( QTimerEvent* ev ) { | ||
431 | int row = currentRow(); | ||
432 | qWarning("TimerEvent %d", row); | ||
433 | if ( m_row ) { | ||
434 | int ro = row-4; | ||
435 | if (ro < 0 ) ro = 0; | ||
436 | sorted()[ro]; | ||
437 | |||
438 | ro = row+4; | ||
439 | sorted()[ro]; | ||
440 | } else { | ||
441 | int ro = row + 8; | ||
442 | sorted()[ro]; | ||
443 | |||
444 | ro = row-8; | ||
445 | if (ro < 0 ) ro = 0; | ||
446 | sorted()[ro]; | ||
447 | } | ||
448 | |||
449 | m_row = !m_row; | ||
450 | } | ||
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index bf41aea..fe65ca9 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h | |||
@@ -82,6 +82,7 @@ namespace Todo { | |||
82 | bool m_first : 1; | 82 | bool m_first : 1; |
83 | 83 | ||
84 | protected: | 84 | protected: |
85 | void timerEvent( QTimerEvent* e ); | ||
85 | QWidget* createEditor(int row, int col, bool initFromCell )const; | 86 | QWidget* createEditor(int row, int col, bool initFromCell )const; |
86 | void setCellContentFromEditor( int row, int col ); | 87 | void setCellContentFromEditor( int row, int col ); |
87 | 88 | ||
@@ -94,6 +95,8 @@ private slots: | |||
94 | void slotValueChanged(int, int); | 95 | void slotValueChanged(int, int); |
95 | void slotCurrentChanged(int, int ); | 96 | void slotCurrentChanged(int, int ); |
96 | void slotPriority(); | 97 | void slotPriority(); |
98 | private: | ||
99 | bool m_row : 1; | ||
97 | }; | 100 | }; |
98 | }; | 101 | }; |
99 | 102 | ||