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.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index b7458d8..221faca 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -135,13 +135,13 @@ TableView::TableView( MainWindow* window, QWidget* wid )
135 135
136 136
137 m_enablePaint = true; 137 m_enablePaint = true;
138 setUpdatesEnabled( true ); 138 setUpdatesEnabled( true );
139 viewport()->setUpdatesEnabled( true ); 139 viewport()->setUpdatesEnabled( true );
140 viewport()->update(); 140 viewport()->update();
141 setSortOrder( 0 ); 141 setSortOrder( Opie::OPimTodoAccess::Completed );
142 setAscending( TRUE ); 142 setAscending( TRUE );
143 m_first = true; 143 m_first = true;
144 144
145 145
146} 146}
147/* a new day has started 147/* a new day has started
@@ -192,13 +192,12 @@ QString TableView::currentRepresentation() {
192void TableView::showOverDue( bool ) { 192void TableView::showOverDue( bool ) {
193 clear(); 193 clear();
194 updateView(); 194 updateView();
195} 195}
196 196
197void TableView::updateView( ) { 197void TableView::updateView( ) {
198 owarn << "update view" << oendl;
199 m_row = false; 198 m_row = false;
200 static int id; 199 static int id;
201 id = startTimer(4000 ); 200 id = startTimer(4000 );
202 /* FIXME we want one page to be read! 201 /* FIXME we want one page to be read!
203 * 202 *
204 * Calculate that screensize 203 * Calculate that screensize
@@ -206,13 +205,12 @@ void TableView::updateView( ) {
206 todoWindow()->setReadAhead( 4 ); 205 todoWindow()->setReadAhead( 4 );
207 sort(); 206 sort();
208 OPimTodoAccess::List::Iterator it, end; 207 OPimTodoAccess::List::Iterator it, end;
209 it = sorted().begin(); 208 it = sorted().begin();
210 end = sorted().end(); 209 end = sorted().end();
211 210
212 owarn << "setTodos" << oendl;
213 QTime time; 211 QTime time;
214 time.start(); 212 time.start();
215 m_enablePaint = false; 213 m_enablePaint = false;
216 setUpdatesEnabled( false ); 214 setUpdatesEnabled( false );
217 viewport()->setUpdatesEnabled( false ); 215 viewport()->setUpdatesEnabled( false );
218 216
@@ -251,18 +249,16 @@ void TableView::replaceEvent( const OPimTodo& ev) {
251 * FIXME: look what performs better 249 * FIXME: look what performs better
252 * either this or the old align table 250 * either this or the old align table
253 */ 251 */
254void TableView::removeEvent( int ) { 252void TableView::removeEvent( int ) {
255 updateView(); 253 updateView();
256} 254}
257void TableView::setShowCompleted( bool b) { 255void TableView::setShowCompleted( bool ) {
258 owarn << "Show Completed " << b << oendl;
259 updateView(); 256 updateView();
260} 257}
261void TableView::setShowDeadline( bool b ) { 258void TableView::setShowDeadline( bool b ) {
262 owarn << "Show Deadline " << b << oendl;
263 if ( b ) 259 if ( b )
264 showColumn( 3 ); 260 showColumn( 3 );
265 else 261 else
266 hideColumn( 3 ); 262 hideColumn( 3 );
267 263
268 // Try to intelligently size columns 264 // Try to intelligently size columns
@@ -279,13 +275,12 @@ void TableView::setShowDeadline( bool b ) {
279 setColumnWidth( 3, width ); 275 setColumnWidth( 3, width );
280 col2width -= width; 276 col2width -= width;
281 } 277 }
282 setColumnWidth( 2, col2width ); 278 setColumnWidth( 2, col2width );
283} 279}
284void TableView::setShowCategory( const QString& str) { 280void TableView::setShowCategory( const QString& str) {
285 owarn << "setShowCategory" << oendl;
286 if ( str != m_oleCat || m_first ) 281 if ( str != m_oleCat || m_first )
287 updateView(); 282 updateView();
288 283
289 m_oleCat = str; 284 m_oleCat = str;
290 m_first = false; 285 m_first = false;
291 286
@@ -344,21 +339,18 @@ void TableView::slotClicked(int row, int col, int,
344 339
345 340
346} 341}
347void TableView::slotPressed(int row, int col, int, 342void TableView::slotPressed(int row, int col, int,
348 const QPoint& point) { 343 const QPoint& point) {
349 344
350 owarn << "pressed row " << row << " col " << col << " x:" << point.x()
351 << "+y:" << point.y() << oendl;
352 m_prevP = point; 345 m_prevP = point;
353 /* TextColumn column */ 346 /* TextColumn column */
354 if ( col == 2 && cellGeometry( row, col ).contains( point ) ) 347 if ( col == 2 && cellGeometry( row, col ).contains( point ) )
355 m_menuTimer->start( 750, TRUE ); 348 m_menuTimer->start( 750, TRUE );
356} 349}
357void TableView::slotValueChanged( int, int ) { 350void TableView::slotValueChanged( int, int ) {
358 owarn << "Value Changed" << oendl;
359} 351}
360void TableView::slotCurrentChanged(int, int ) { 352void TableView::slotCurrentChanged(int, int ) {
361 m_menuTimer->stop(); 353 m_menuTimer->stop();
362} 354}
363QWidget* TableView::widget() { 355QWidget* TableView::widget() {
364 return this; 356 return this;
@@ -368,13 +360,28 @@ QWidget* TableView::widget() {
368 * because we want to sort whole row 360 * because we want to sort whole row
369 * based 361 * based
370 * We event want to set the setOrder 362 * We event want to set the setOrder
371 * to a sort() and update() 363 * to a sort() and update()
372 */ 364 */
373void TableView::sortColumn( int col, bool asc, bool ) { 365void TableView::sortColumn( int col, bool asc, bool ) {
374 owarn << "bool " << asc << oendl; 366 switch(col) {
367 case 1:
368 col = Opie::OPimTodoAccess::Priority;
369 break;
370 case 2:
371 col = Opie::OPimTodoAccess::SortSummary;
372 break;
373 case 3:
374 col = Opie::OPimTodoAccess::Deadline;
375 break;
376 case 0:
377 default:
378 col = Opie::OPimTodoAccess::Completed;
379 break;
380 }
381
375 setSortOrder( col ); 382 setSortOrder( col );
376 setAscending( asc ); 383 setAscending( asc );
377 updateView(); 384 updateView();
378} 385}
379void TableView::viewportPaintEvent( QPaintEvent* e) { 386void TableView::viewportPaintEvent( QPaintEvent* e) {
380 if (m_enablePaint ) 387 if (m_enablePaint )
@@ -491,13 +498,12 @@ QWidget* TableView::createEditor(int row, int col, bool )const {
491 case 0: 498 case 0:
492 default: 499 default:
493 return 0l; 500 return 0l;
494 } 501 }
495} 502}
496void TableView::setCellContentFromEditor(int row, int col ) { 503void TableView::setCellContentFromEditor(int row, int col ) {
497 owarn << "set cell content from editor" << oendl;
498 if ( col == 1 ) { 504 if ( col == 1 ) {
499 QWidget* wid = cellWidget(row, 1 ); 505 QWidget* wid = cellWidget(row, 1 );
500 if ( wid->inherits("QComboBox") ) { 506 if ( wid->inherits("QComboBox") ) {
501 int pri = ((QComboBox*)wid)->currentItem() + 1; 507 int pri = ((QComboBox*)wid)->currentItem() + 1;
502 OPimTodo todo = sorted()[row]; 508 OPimTodo todo = sorted()[row];
503 if ( todo.priority() != pri ) { 509 if ( todo.priority() != pri ) {
@@ -527,13 +533,12 @@ void TableView::slotPriority() {
527 * filled enough. 533 * filled enough.
528 * We will try to read ahead 4 items in both ways 534 * We will try to read ahead 4 items in both ways
529 * up and down. On odd or even we will currentRow()+-4 or +-9 535 * up and down. On odd or even we will currentRow()+-4 or +-9
530 * 536 *
531 */ 537 */
532void TableView::timerEvent( QTimerEvent* ) { 538void TableView::timerEvent( QTimerEvent* ) {
533// Opie::Core::owarn << "sorted " << sorted().count() << oendl;
534 if (sorted().count() == 0 ) 539 if (sorted().count() == 0 )
535 return; 540 return;
536 541
537 int row = currentRow(); 542 int row = currentRow();
538 if ( m_row ) { 543 if ( m_row ) {
539 int ro = row-4; 544 int ro = row-4;
@@ -575,13 +580,12 @@ void TableView::timerEvent( QTimerEvent* ) {
575 * row and two columns! 580 * row and two columns!
576 */ 581 */
577void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { 582void TableView::contentsMouseReleaseEvent( QMouseEvent* e) {
578 int row = rowAt(m_prevP.y()); 583 int row = rowAt(m_prevP.y());
579 int colOld = columnAt(m_prevP.x() ); 584 int colOld = columnAt(m_prevP.x() );
580 int colNew = columnAt(e->x() ); 585 int colNew = columnAt(e->x() );
581 owarn << "colNew: " << colNew << " colOld: " << colOld << oendl;
582 if ( row == rowAt( e->y() ) && row != -1 && 586 if ( row == rowAt( e->y() ) && row != -1 &&
583 colOld != colNew ) { 587 colOld != colNew ) {
584 TodoView::complete( sorted()[row] ); 588 TodoView::complete( sorted()[row] );
585 return; 589 return;
586 } 590 }
587 QTable::contentsMouseReleaseEvent( e ); 591 QTable::contentsMouseReleaseEvent( e );