author | zecke <zecke> | 2002-10-20 12:10:31 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-20 12:10:31 (UTC) |
commit | 7948b5910a098d05f4cc7d0fb14b0f216bf41358 (patch) (side-by-side diff) | |
tree | c7765042be7eb4373ea90145f1e218fee0cd1c3a /core | |
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 @@ -27,2 +27,3 @@ */ +#include <stdlib.h> @@ -149,4 +150,2 @@ void TableView::updateView( ) { - QTime t; - t.start(); setNumRows( it.count() ); @@ -154,4 +153,4 @@ void TableView::updateView( ) { killTimer(id); + int elc = time.elapsed(); - qWarning("Adding took %d", elc/1000 ); setUpdatesEnabled( true ); @@ -162,3 +161,2 @@ void TableView::updateView( ) { int el = time.elapsed(); - qWarning("adding took %d", el/1000 ); } @@ -259,2 +257,3 @@ void TableView::slotPressed(int row, int col, int, + m_prevP = point; /* TextColumn column */ @@ -286,3 +285,2 @@ void TableView::sortColumn( int col, bool asc, bool ) { void TableView::viewportPaintEvent( QPaintEvent* e) { - qWarning("Paint event" ); if (m_enablePaint ) @@ -437,3 +435,2 @@ void TableView::timerEvent( QTimerEvent* ev ) { int row = currentRow(); - qWarning("TimerEvent %d", row); if ( m_row ) { @@ -456 +453,31 @@ void TableView::timerEvent( QTimerEvent* ev ) { } + +// We want a strike through completed ;) +// durchstreichen to complete +/* + * MouseTracking is off this mean we only receive + * these events if the mouse button is pressed + * We've the previous point saved + * We check if the previous and current Point are + * in the same row. + * Then we check if they're some pixel horizontal away + * if the distance between the two points is greater than + * 8 we mark the underlying todo as completed and do a repaint + */ +void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { + int row = rowAt(m_prevP.y()); + if ( row == rowAt( e->y() ) ) { + if ( abs( m_prevP.x() - e->x() ) >= 8 ) { + OTodo todo = sorted()[row]; + todo.setCompleted( !todo.isCompleted() ); + TodoView::update( todo.uid(), todo ); + updateView(); + return; + } + } + QTable::contentsMouseReleaseEvent( e ); +} +void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { + m_menuTimer->stop(); + QTable::contentsMouseMoveEvent( e ); +} 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 @@ -84,2 +84,4 @@ namespace Todo { protected: + void contentsMouseReleaseEvent( QMouseEvent* ); + void contentsMouseMoveEvent( QMouseEvent* ); void timerEvent( QTimerEvent* e ); @@ -99,2 +101,3 @@ private slots: bool m_row : 1; + QPoint m_prevP; }; |