author | zecke <zecke> | 2004-11-18 21:55:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-11-18 21:55:17 (UTC) |
commit | fdef8103e849b674c95d01785259e072bcfb5a4b (patch) (side-by-side diff) | |
tree | 411432edf236f8858094598617383dea95c14c3a /core/pim/todo/tableview.cpp | |
parent | c94afa23120bb72709973ae4711106e6e502fe65 (diff) | |
download | opie-fdef8103e849b674c95d01785259e072bcfb5a4b.zip opie-fdef8103e849b674c95d01785259e072bcfb5a4b.tar.gz opie-fdef8103e849b674c95d01785259e072bcfb5a4b.tar.bz2 |
-Kill owarn statements from the code
-Kill magic numbers and use enum values
-rw-r--r-- | core/pim/todo/tableview.cpp | 32 |
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 ) m_enablePaint = true; setUpdatesEnabled( true ); viewport()->setUpdatesEnabled( true ); viewport()->update(); - setSortOrder( 0 ); + setSortOrder( Opie::OPimTodoAccess::Completed ); setAscending( TRUE ); m_first = true; } /* a new day has started @@ -192,13 +192,12 @@ QString TableView::currentRepresentation() { void TableView::showOverDue( bool ) { clear(); updateView(); } void TableView::updateView( ) { - owarn << "update view" << oendl; m_row = false; static int id; id = startTimer(4000 ); /* FIXME we want one page to be read! * * Calculate that screensize @@ -206,13 +205,12 @@ void TableView::updateView( ) { todoWindow()->setReadAhead( 4 ); sort(); OPimTodoAccess::List::Iterator it, end; it = sorted().begin(); end = sorted().end(); - owarn << "setTodos" << oendl; QTime time; time.start(); m_enablePaint = false; setUpdatesEnabled( false ); viewport()->setUpdatesEnabled( false ); @@ -251,18 +249,16 @@ void TableView::replaceEvent( const OPimTodo& ev) { * FIXME: look what performs better * either this or the old align table */ void TableView::removeEvent( int ) { updateView(); } -void TableView::setShowCompleted( bool b) { - owarn << "Show Completed " << b << oendl; +void TableView::setShowCompleted( bool ) { updateView(); } void TableView::setShowDeadline( bool b ) { - owarn << "Show Deadline " << b << oendl; if ( b ) showColumn( 3 ); else hideColumn( 3 ); // Try to intelligently size columns @@ -279,13 +275,12 @@ void TableView::setShowDeadline( bool b ) { setColumnWidth( 3, width ); col2width -= width; } setColumnWidth( 2, col2width ); } void TableView::setShowCategory( const QString& str) { - owarn << "setShowCategory" << oendl; if ( str != m_oleCat || m_first ) updateView(); m_oleCat = str; m_first = false; @@ -344,21 +339,18 @@ void TableView::slotClicked(int row, int col, int, } void TableView::slotPressed(int row, int col, int, const QPoint& point) { - owarn << "pressed row " << row << " col " << col << " x:" << point.x() - << "+y:" << point.y() << oendl; m_prevP = point; /* TextColumn column */ if ( col == 2 && cellGeometry( row, col ).contains( point ) ) m_menuTimer->start( 750, TRUE ); } void TableView::slotValueChanged( int, int ) { - owarn << "Value Changed" << oendl; } void TableView::slotCurrentChanged(int, int ) { m_menuTimer->stop(); } QWidget* TableView::widget() { return this; @@ -368,13 +360,28 @@ QWidget* TableView::widget() { * because we want to sort whole row * based * We event want to set the setOrder * to a sort() and update() */ void TableView::sortColumn( int col, bool asc, bool ) { - owarn << "bool " << asc << oendl; + switch(col) { + case 1: + col = Opie::OPimTodoAccess::Priority; + break; + case 2: + col = Opie::OPimTodoAccess::SortSummary; + break; + case 3: + col = Opie::OPimTodoAccess::Deadline; + break; + case 0: + default: + col = Opie::OPimTodoAccess::Completed; + break; + } + setSortOrder( col ); setAscending( asc ); updateView(); } void TableView::viewportPaintEvent( QPaintEvent* e) { if (m_enablePaint ) @@ -491,13 +498,12 @@ QWidget* TableView::createEditor(int row, int col, bool )const { case 0: default: return 0l; } } void TableView::setCellContentFromEditor(int row, int col ) { - owarn << "set cell content from editor" << oendl; if ( col == 1 ) { QWidget* wid = cellWidget(row, 1 ); if ( wid->inherits("QComboBox") ) { int pri = ((QComboBox*)wid)->currentItem() + 1; OPimTodo todo = sorted()[row]; if ( todo.priority() != pri ) { @@ -527,13 +533,12 @@ void TableView::slotPriority() { * filled enough. * We will try to read ahead 4 items in both ways * up and down. On odd or even we will currentRow()+-4 or +-9 * */ void TableView::timerEvent( QTimerEvent* ) { -// Opie::Core::owarn << "sorted " << sorted().count() << oendl; if (sorted().count() == 0 ) return; int row = currentRow(); if ( m_row ) { int ro = row-4; @@ -575,13 +580,12 @@ void TableView::timerEvent( QTimerEvent* ) { * row and two columns! */ void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { int row = rowAt(m_prevP.y()); int colOld = columnAt(m_prevP.x() ); int colNew = columnAt(e->x() ); - owarn << "colNew: " << colNew << " colOld: " << colOld << oendl; if ( row == rowAt( e->y() ) && row != -1 && colOld != colNew ) { TodoView::complete( sorted()[row] ); return; } QTable::contentsMouseReleaseEvent( e ); |