-rw-r--r-- | core/pim/todo/tableview.cpp | 14 | ||||
-rw-r--r-- | core/pim/todo/tableview.h | 2 | ||||
-rw-r--r-- | core/pim/todo/todoview.cpp | 4 |
3 files changed, 17 insertions, 3 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 6299113..743deb7 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp @@ -17,42 +17,51 @@ ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdlib.h> +#include <cmath> #include <qlineedit.h> #include <qtimer.h> #include <qpoint.h> #include <qpopupmenu.h> +#include <qpe/config.h> + #include "mainwindow.h" //#include "tableitems.h" #include "tableview.h" using namespace Todo; namespace { static const int BoxSize = 14; static const int RowHeight = 20; } +void TableView::initConfig() { + Config config( "todo" ); + config.setGroup( "Options" ); + m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); +} + TableView::TableView( MainWindow* window, QWidget* wid ) : QTable( wid ), TodoView( window ) { setUpdatesEnabled( false ); viewport()->setUpdatesEnabled( false ); m_enablePaint = false; setNumRows(0); setNumCols(4); setSorting( TRUE ); setSelectionMode( NoSelection ); // setColumnStretchable( 2, TRUE ); setColumnStretchable( 3, FALSE ); @@ -87,24 +96,27 @@ TableView::TableView( MainWindow* window, QWidget* wid ) m_menuTimer = new QTimer( this ); connect( m_menuTimer, SIGNAL(timeout()), this, SLOT(slotShowMenu()) ); m_enablePaint = true; setUpdatesEnabled( true ); viewport()->setUpdatesEnabled( true ); viewport()->update(); setSortOrder( 0 ); setAscending( TRUE ); m_first = true; + + /* now let's init the config */ + initConfig(); } /* a new day has started * update the day */ void TableView::newDay() { clear(); updateView(); } TableView::~TableView() { } void TableView::slotShowMenu() { @@ -479,25 +491,25 @@ void TableView::timerEvent( QTimerEvent* ev ) { * 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() ) && row != -1 ) { - if ( abs( m_prevP.x() - e->x() ) >= 8 ) { + if ( ::abs( m_prevP.x() - e->x() ) >= m_completeStrokeWidth ) { qWarning("current row %d", row ); 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(); diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index 0c3e865..e47b38f 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h @@ -89,18 +89,20 @@ namespace Todo { void setCellContentFromEditor( int row, int col ); private slots: void slotShowMenu(); void slotClicked(int, int, int, const QPoint& ); void slotPressed(int, int, int, const QPoint& ); void slotValueChanged(int, int); void slotCurrentChanged(int, int ); void slotPriority(); private: + void initConfig(); + int m_completeStrokeWidth; bool m_row : 1; QPoint m_prevP; }; }; #endif diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp index 639fa66..4cf7d30 100644 --- a/core/pim/todo/todoview.cpp +++ b/core/pim/todo/todoview.cpp @@ -62,18 +62,18 @@ void TodoView::sort() { qWarning("m_sort.count() = %d", m_sort.count() ); } void TodoView::sort(int sort) { m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); } void TodoView::setSortOrder( int order ) { m_sortOrder = order; } void TodoView::setAscending( bool b ) { qWarning("setAscending %d", b ); m_asc = b; } -void TodoView::update(int uid, const SmallTodo& to ) { +void TodoView::update(int, const SmallTodo& ) { //m_main->slotUpate1( uid, to ); } -void TodoView::update(int uid, const OTodo& ev ) { +void TodoView::update(int , const OTodo& ev ) { m_main->updateTodo( ev ); } |