author | zecke <zecke> | 2002-10-20 12:10:31 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-20 12:10:31 (UTC) |
commit | 7948b5910a098d05f4cc7d0fb14b0f216bf41358 (patch) (unidiff) | |
tree | c7765042be7eb4373ea90145f1e218fee0cd1c3a | |
parent | 940ba90ed4375f79b6a4934d290abf83980b77ad (diff) | |
download | opie-7948b5910a098d05f4cc7d0fb14b0f216bf41358.zip opie-7948b5910a098d05f4cc7d0fb14b0f216bf41358.tar.gz opie-7948b5910a098d05f4cc7d0fb14b0f216bf41358.tar.bz2 |
Strike through a row to complete the Record ;)^
-rw-r--r-- | core/pim/todo/tableview.cpp | 39 | ||||
-rw-r--r-- | core/pim/todo/tableview.h | 3 |
2 files changed, 36 insertions, 6 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 34b8b3c..c4165db 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -25,6 +25,7 @@ | |||
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | #include <stdlib.h> | ||
28 | 29 | ||
29 | #include <qtimer.h> | 30 | #include <qtimer.h> |
30 | #include <qpoint.h> | 31 | #include <qpoint.h> |
@@ -147,20 +148,17 @@ void TableView::updateView( ) { | |||
147 | setUpdatesEnabled( false ); | 148 | setUpdatesEnabled( false ); |
148 | viewport()->setUpdatesEnabled( false ); | 149 | viewport()->setUpdatesEnabled( false ); |
149 | 150 | ||
150 | QTime t; | ||
151 | t.start(); | ||
152 | setNumRows( it.count() ); | 151 | setNumRows( it.count() ); |
153 | if ( it.count() == 0 ) | 152 | if ( it.count() == 0 ) |
154 | killTimer(id); | 153 | killTimer(id); |
154 | |||
155 | int elc = time.elapsed(); | 155 | int elc = time.elapsed(); |
156 | qWarning("Adding took %d", elc/1000 ); | ||
157 | setUpdatesEnabled( true ); | 156 | setUpdatesEnabled( true ); |
158 | viewport()->setUpdatesEnabled( true ); | 157 | viewport()->setUpdatesEnabled( true ); |
159 | viewport()->update(); | 158 | viewport()->update(); |
160 | 159 | ||
161 | m_enablePaint = true; | 160 | m_enablePaint = true; |
162 | int el = time.elapsed(); | 161 | int el = time.elapsed(); |
163 | qWarning("adding took %d", el/1000 ); | ||
164 | } | 162 | } |
165 | void TableView::setTodo( int, const OTodo&) { | 163 | void TableView::setTodo( int, const OTodo&) { |
166 | sort(); | 164 | sort(); |
@@ -257,6 +255,7 @@ void TableView::slotClicked(int row, int col, int, | |||
257 | void TableView::slotPressed(int row, int col, int, | 255 | void TableView::slotPressed(int row, int col, int, |
258 | const QPoint& point) { | 256 | const QPoint& point) { |
259 | 257 | ||
258 | m_prevP = point; | ||
260 | /* TextColumn column */ | 259 | /* TextColumn column */ |
261 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) | 260 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) |
262 | m_menuTimer->start( 750, TRUE ); | 261 | m_menuTimer->start( 750, TRUE ); |
@@ -284,7 +283,6 @@ void TableView::sortColumn( int col, bool asc, bool ) { | |||
284 | updateView(); | 283 | updateView(); |
285 | } | 284 | } |
286 | void TableView::viewportPaintEvent( QPaintEvent* e) { | 285 | void TableView::viewportPaintEvent( QPaintEvent* e) { |
287 | qWarning("Paint event" ); | ||
288 | if (m_enablePaint ) | 286 | if (m_enablePaint ) |
289 | QTable::viewportPaintEvent( e ); | 287 | QTable::viewportPaintEvent( e ); |
290 | } | 288 | } |
@@ -435,7 +433,6 @@ void TableView::timerEvent( QTimerEvent* ev ) { | |||
435 | return; | 433 | return; |
436 | 434 | ||
437 | int row = currentRow(); | 435 | int row = currentRow(); |
438 | qWarning("TimerEvent %d", row); | ||
439 | if ( m_row ) { | 436 | if ( m_row ) { |
440 | int ro = row-4; | 437 | int ro = row-4; |
441 | if (ro < 0 ) ro = 0; | 438 | if (ro < 0 ) ro = 0; |
@@ -454,3 +451,33 @@ void TableView::timerEvent( QTimerEvent* ev ) { | |||
454 | 451 | ||
455 | m_row = !m_row; | 452 | m_row = !m_row; |
456 | } | 453 | } |
454 | |||
455 | // We want a strike through completed ;) | ||
456 | // durchstreichen to complete | ||
457 | /* | ||
458 | * MouseTracking is off this mean we only receive | ||
459 | * these events if the mouse button is pressed | ||
460 | * We've the previous point saved | ||
461 | * We check if the previous and current Point are | ||
462 | * in the same row. | ||
463 | * Then we check if they're some pixel horizontal away | ||
464 | * if the distance between the two points is greater than | ||
465 | * 8 we mark the underlying todo as completed and do a repaint | ||
466 | */ | ||
467 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { | ||
468 | int row = rowAt(m_prevP.y()); | ||
469 | if ( row == rowAt( e->y() ) ) { | ||
470 | if ( abs( m_prevP.x() - e->x() ) >= 8 ) { | ||
471 | OTodo todo = sorted()[row]; | ||
472 | todo.setCompleted( !todo.isCompleted() ); | ||
473 | TodoView::update( todo.uid(), todo ); | ||
474 | updateView(); | ||
475 | return; | ||
476 | } | ||
477 | } | ||
478 | QTable::contentsMouseReleaseEvent( e ); | ||
479 | } | ||
480 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { | ||
481 | m_menuTimer->stop(); | ||
482 | QTable::contentsMouseMoveEvent( e ); | ||
483 | } | ||
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index fe65ca9..0c3e865 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h | |||
@@ -82,6 +82,8 @@ namespace Todo { | |||
82 | bool m_first : 1; | 82 | bool m_first : 1; |
83 | 83 | ||
84 | protected: | 84 | protected: |
85 | void contentsMouseReleaseEvent( QMouseEvent* ); | ||
86 | void contentsMouseMoveEvent( QMouseEvent* ); | ||
85 | void timerEvent( QTimerEvent* e ); | 87 | void timerEvent( QTimerEvent* e ); |
86 | QWidget* createEditor(int row, int col, bool initFromCell )const; | 88 | QWidget* createEditor(int row, int col, bool initFromCell )const; |
87 | void setCellContentFromEditor( int row, int col ); | 89 | void setCellContentFromEditor( int row, int col ); |
@@ -97,6 +99,7 @@ private slots: | |||
97 | void slotPriority(); | 99 | void slotPriority(); |
98 | private: | 100 | private: |
99 | bool m_row : 1; | 101 | bool m_row : 1; |
102 | QPoint m_prevP; | ||
100 | }; | 103 | }; |
101 | }; | 104 | }; |
102 | 105 | ||