author | zecke <zecke> | 2002-11-02 13:47:01 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-02 13:47:01 (UTC) |
commit | d21d693d91af8ee8fb54478a6db67f5a0590a767 (patch) (side-by-side diff) | |
tree | b38c34f39d70d056fb99cdd35515e2308b06c74a | |
parent | f655415f77b200f9edfbe5732cd5f8da2b4dec47 (diff) | |
download | opie-d21d693d91af8ee8fb54478a6db67f5a0590a767.zip opie-d21d693d91af8ee8fb54478a6db67f5a0590a767.tar.gz opie-d21d693d91af8ee8fb54478a6db67f5a0590a767.tar.bz2 |
Cut some warning
and applied trekres customStrokeWidth patch
-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 @@ -1,146 +1,158 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 <> .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; 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 ); setColumnWidth(0, 20 ); setColumnWidth(1, 35 ); setColumnWidth(3, 18 ); setLeftMargin( 0 ); verticalHeader()->hide(); horizontalHeader()->setLabel(0, tr("C.") ); horizontalHeader()->setLabel(1, tr("Prior.") ); horizontalHeader()->setLabel(2, tr("Description" ) ); // setColumnStretchable(3, FALSE ); horizontalHeader()->setLabel(3, tr("Deadline") ); if ( todoWindow()->showDeadline() ) showColumn( 3); else hideColumn(3 ); connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); connect((QTable*)this, SIGNAL(valueChanged(int, int) ), this, SLOT( slotValueChanged(int, int) ) ); connect((QTable*)this, SIGNAL(currentChanged(int, int) ), this, SLOT( slotCurrentChanged(int, int) ) ); 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() { QPopupMenu *menu = todoWindow()->contextMenu( current() ); menu->exec(QCursor::pos() ); delete menu; } QString TableView::type() const { return QString::fromLatin1( tr("Table View") ); } int TableView::current() { int uid = sorted().uidAt(currentRow() ); qWarning("uid %d", uid ); return uid; } QString TableView::currentRepresentation() { return text( currentRow(), 2); } /* show overdue */ void TableView::showOverDue( bool ) { clear(); updateView(); } void TableView::updateView( ) { qWarning("update view"); m_row = false; static int id; id = startTimer(2000 ); /* FIXME we want one page to be read! * * Calculate that screensize */ todoWindow()->setReadAhead( 4 ); sort(); OTodoAccess::List::Iterator it, end; it = sorted().begin(); end = sorted().end(); @@ -443,63 +455,63 @@ void TableView::slotPriority() { } /* * We'll use the TimerEvent to read ahead or to keep the cahce always * 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* ev ) { qWarning("sorted %d", sorted().count() ); if (sorted().count() == 0 ) return; int row = currentRow(); if ( m_row ) { int ro = row-4; if (ro < 0 ) ro = 0; sorted()[ro]; ro = row+4; sorted()[ro]; } else { int ro = row + 8; sorted()[ro]; ro = row-8; if (ro < 0 ) ro = 0; sorted()[ro]; } m_row = !m_row; } // 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() ) && 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(); QTable::contentsMouseMoveEvent( e ); } 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 @@ -53,54 +53,56 @@ namespace Todo { void clear(); void showOverDue( bool ); void updateView(); void setTodo( int uid, const OTodo& ); void addEvent( const OTodo& event ); void replaceEvent( const OTodo& ); void removeEvent( int uid ); void setShowCompleted( bool ); void setShowDeadline( bool ); void setShowCategory(const QString& =QString::null ); void newDay(); QWidget* widget(); void sortColumn(int, bool, bool ); /* * we do our drawing ourselves * because we don't want to have * 40.000 QTableItems for 10.000 * OTodos where we only show 10 at a time! */ void paintCell(QPainter* p, int row, int col, const QRect&, bool ); private: /* reimplented for internal reasons */ void viewportPaintEvent( QPaintEvent* ); QTimer *m_menuTimer; bool m_enablePaint:1; QString m_oleCat; bool m_first : 1; protected: void contentsMouseReleaseEvent( QMouseEvent* ); void contentsMouseMoveEvent( QMouseEvent* ); void timerEvent( QTimerEvent* e ); QWidget* createEditor(int row, int col, bool initFromCell )const; 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 @@ -26,54 +26,54 @@ void TodoView::connectEdit( QObject* obj, obj, slot ); } void TodoView::connectUpdateSmall( QObject* obj, const char* slot ) { QObject::connect( hack, SIGNAL(update(int, const Todo::SmallTodo& ) ), obj, slot ); } void TodoView::connectUpdateBig( QObject* obj, const char* slot ) { QObject::connect( hack, SIGNAL(update(int, const OTodo& ) ), obj, slot ); } void TodoView::connectUpdateView( QObject* obj, const char* slot ) { QObject::connect( hack, SIGNAL(update(QWidget*) ), obj, slot ); } void TodoView::connectRemove( QObject* obj, const char* slot ) { QObject::connect( hack, SIGNAL(remove(int) ), obj, slot ); } MainWindow* TodoView::todoWindow() { return m_main; } OTodo TodoView::event(int uid ) { return m_main->event( uid ); } OTodoAccess::List TodoView::list(){ todoWindow()->updateList(); return todoWindow()->list(); } OTodoAccess::List TodoView::sorted()const{ return m_sort; } void TodoView::sort() { m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); 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 ); } |