-rw-r--r-- | core/pim/todo/tableview.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index c4165db..6299113 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | 29 | ||
30 | #include <qlineedit.h> | ||
30 | #include <qtimer.h> | 31 | #include <qtimer.h> |
31 | #include <qpoint.h> | 32 | #include <qpoint.h> |
32 | #include <qpopupmenu.h> | 33 | #include <qpopupmenu.h> |
@@ -53,9 +54,11 @@ TableView::TableView( MainWindow* window, QWidget* wid ) | |||
53 | 54 | ||
54 | setSorting( TRUE ); | 55 | setSorting( TRUE ); |
55 | setSelectionMode( NoSelection ); | 56 | setSelectionMode( NoSelection ); |
56 | setColumnStretchable( 2, TRUE ); | 57 | // setColumnStretchable( 2, TRUE ); |
58 | setColumnStretchable( 3, FALSE ); | ||
57 | setColumnWidth(0, 20 ); | 59 | setColumnWidth(0, 20 ); |
58 | setColumnWidth(1, 35 ); | 60 | setColumnWidth(1, 35 ); |
61 | setColumnWidth(3, 18 ); | ||
59 | 62 | ||
60 | setLeftMargin( 0 ); | 63 | setLeftMargin( 0 ); |
61 | verticalHeader()->hide(); | 64 | verticalHeader()->hide(); |
@@ -64,8 +67,8 @@ TableView::TableView( MainWindow* window, QWidget* wid ) | |||
64 | horizontalHeader()->setLabel(1, tr("Prior.") ); | 67 | horizontalHeader()->setLabel(1, tr("Prior.") ); |
65 | horizontalHeader()->setLabel(2, tr("Description" ) ); | 68 | horizontalHeader()->setLabel(2, tr("Description" ) ); |
66 | 69 | ||
67 | setColumnStretchable(3, FALSE ); | 70 | // setColumnStretchable(3, FALSE ); |
68 | setColumnWidth(3, 20 ); | 71 | |
69 | horizontalHeader()->setLabel(3, tr("Deadline") ); | 72 | horizontalHeader()->setLabel(3, tr("Deadline") ); |
70 | 73 | ||
71 | if ( todoWindow()->showDeadline() ) | 74 | if ( todoWindow()->showDeadline() ) |
@@ -399,6 +402,12 @@ QWidget* TableView::createEditor(int row, int col, bool )const { | |||
399 | combo->setCurrentItem( sorted()[row].priority()-1 ); | 402 | combo->setCurrentItem( sorted()[row].priority()-1 ); |
400 | return combo; | 403 | return combo; |
401 | } | 404 | } |
405 | /* summary */ | ||
406 | case 2:{ | ||
407 | QLineEdit* edit = new QLineEdit( viewport() ); | ||
408 | edit->setText( sorted()[row].summary() ); | ||
409 | return edit; | ||
410 | } | ||
402 | case 0: | 411 | case 0: |
403 | default: | 412 | default: |
404 | return 0l; | 413 | return 0l; |
@@ -416,6 +425,17 @@ void TableView::setCellContentFromEditor(int row, int col ) { | |||
416 | updateView(); | 425 | updateView(); |
417 | } | 426 | } |
418 | } | 427 | } |
428 | }else if ( col == 2) { | ||
429 | QWidget* wid = cellWidget(row, 2); | ||
430 | if ( wid->inherits("QLineEdit") ) { | ||
431 | QString text = ((QLineEdit*)wid)->text(); | ||
432 | OTodo todo = sorted()[row]; | ||
433 | if ( todo.summary() != text ) { | ||
434 | todo.setSummary( text ); | ||
435 | TodoView::update( todo.uid(), todo ); | ||
436 | updateView(); | ||
437 | } | ||
438 | } | ||
419 | } | 439 | } |
420 | } | 440 | } |
421 | void TableView::slotPriority() { | 441 | void TableView::slotPriority() { |
@@ -429,6 +449,7 @@ void TableView::slotPriority() { | |||
429 | * | 449 | * |
430 | */ | 450 | */ |
431 | void TableView::timerEvent( QTimerEvent* ev ) { | 451 | void TableView::timerEvent( QTimerEvent* ev ) { |
452 | qWarning("sorted %d", sorted().count() ); | ||
432 | if (sorted().count() == 0 ) | 453 | if (sorted().count() == 0 ) |
433 | return; | 454 | return; |
434 | 455 | ||
@@ -466,8 +487,9 @@ void TableView::timerEvent( QTimerEvent* ev ) { | |||
466 | */ | 487 | */ |
467 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { | 488 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { |
468 | int row = rowAt(m_prevP.y()); | 489 | int row = rowAt(m_prevP.y()); |
469 | if ( row == rowAt( e->y() ) ) { | 490 | if ( row == rowAt( e->y() ) && row != -1 ) { |
470 | if ( abs( m_prevP.x() - e->x() ) >= 8 ) { | 491 | if ( abs( m_prevP.x() - e->x() ) >= 8 ) { |
492 | qWarning("current row %d", row ); | ||
471 | OTodo todo = sorted()[row]; | 493 | OTodo todo = sorted()[row]; |
472 | todo.setCompleted( !todo.isCompleted() ); | 494 | todo.setCompleted( !todo.isCompleted() ); |
473 | TodoView::update( todo.uid(), todo ); | 495 | TodoView::update( todo.uid(), todo ); |