-rw-r--r-- | core/pim/todo/main.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 7 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 97 | ||||
-rw-r--r-- | core/pim/todo/tableview.h | 7 | ||||
-rw-r--r-- | core/pim/todo/todomanager.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/todoview.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/todoview.h | 2 |
7 files changed, 86 insertions, 34 deletions
diff --git a/core/pim/todo/main.cpp b/core/pim/todo/main.cpp index 58ed45c..aeae794 100644 --- a/core/pim/todo/main.cpp +++ b/core/pim/todo/main.cpp @@ -33,3 +33,3 @@ int main( int argc, char **argv ) { - qInstallMsgHandler( myMessages ); +// qInstallMsgHandler( myMessages ); QPEApplication a( argc, argv ); diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 48954ce..c9c43d4 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -422,3 +422,2 @@ void MainWindow::slotNew() { } - raiseCurrentView( ); @@ -499,2 +498,3 @@ void MainWindow::setCategory( int c) { + qWarning("Iterating over cats %d", c ); @@ -515,2 +515,3 @@ void MainWindow::setCategory( int c) { m_catMenu->setItemChecked( c, true ); + currentView()->setShowCategory( m_curCat ); @@ -551,4 +552,3 @@ void MainWindow::slotShowDetails() { void MainWindow::populateCategories() { - if (m_todoMgr.isLoaded() ) - m_todoMgr.load(); + m_todoMgr.load(); @@ -616,2 +616,3 @@ void MainWindow::slotEdit( int uid ) { currentView()->replaceEvent( todo ); + /* a Category might have changed */ populateCategories(); diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 5594b13..5d82eb2 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp @@ -91,2 +91,5 @@ TableView::TableView( MainWindow* window, QWidget* wid ) viewport()->update(); + setSortOrder( 0 ); + setAscending( TRUE ); + m_first = true; } @@ -111,5 +114,5 @@ QString TableView::type() const { int TableView::current() { - int cur = 0; - // FIXME - return cur; + int uid = sorted().uidAt(currentRow() ); + qWarning("uid %d", uid ); + return uid; } @@ -125,4 +128,2 @@ void TableView::showOverDue( bool ) { void TableView::updateView( ) { - setSortOrder( 0 ); - setAscending( true ); sort(); @@ -189,5 +190,10 @@ void TableView::setShowDeadline( bool b) { } -void TableView::setShowCategory( const QString& ) { +void TableView::setShowCategory( const QString& str) { qWarning("setShowCategory"); - updateView(); + if ( str != m_oleCat || m_first ) + updateView(); + + m_oleCat = str; + m_first = false; + } @@ -200,3 +206,4 @@ void TableView::slotClicked(int row, int col, int, return; - int ui=0; // FIXME = uid(row); + + int ui= sorted().uidAt( row ); @@ -204,19 +211,16 @@ void TableView::slotClicked(int row, int col, int, switch( col ) { - case 0: { - // FIXME - CheckItem* item = 0l; - /* - * let's see if we centered clicked - */ - if ( item ) { - int x = point.x() -columnPos( col ); - int y = point.y() -rowPos( row ); - int w = columnWidth( col ); - int h = rowHeight( row ); - if ( x >= ( w - OCheckItem::BoxSize ) / 2 && - x <= ( w - OCheckItem::BoxSize ) / 2 + OCheckItem::BoxSize && - y >= ( h - OCheckItem::BoxSize ) / 2 && - y <= ( h - OCheckItem::BoxSize ) / 2 + OCheckItem::BoxSize ) - item->toggle(); - } + case 0:{ + int x = point.x() -columnPos( col ); + int y = point.y() -rowPos( row ); + int w = columnWidth( col ); + int h = rowHeight( row ); + if ( x >= ( w - BoxSize ) / 2 && + x <= ( w - BoxSize ) / 2 + BoxSize && + y >= ( h - BoxSize ) / 2 && + y <= ( h - BoxSize ) / 2 + BoxSize ) { + OTodo todo = sorted()[row]; + todo.setCompleted( !todo.isCompleted() ); + TodoView::update( todo.uid(), todo ); + updateView(); + } } @@ -264,5 +268,7 @@ QWidget* TableView::widget() { */ -void TableView::sortColumn( int row, bool asc, bool ) { - QTable::sortColumn( row, asc, TRUE ); - +void TableView::sortColumn( int col, bool asc, bool ) { + qWarning("bool %d", asc ); + setSortOrder( col ); + setAscending( asc ); + updateView(); } @@ -359 +365,36 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool } +QWidget* TableView::createEditor(int row, int col, bool )const { + switch( col ) { + case 1: { + /* the priority stuff */ + QComboBox* combo = new QComboBox( viewport() ); + combo->insertItem( "1" ); + combo->insertItem( "2" ); + combo->insertItem( "3" ); + combo->insertItem( "4" ); + combo->insertItem( "5" ); + combo->setCurrentItem( sorted()[row].priority()-1 ); + return combo; + } + case 0: + default: + return 0l; + } +} +void TableView::setCellContentFromEditor(int row, int col ) { + if ( col == 1 ) { + QWidget* wid = cellWidget(row, 1 ); + if ( wid->inherits("QComboBox") ) { + int pri = ((QComboBox*)wid)->currentItem() + 1; + OTodo todo = sorted()[row]; + if ( todo.priority() != pri ) { + todo.setPriority( pri ); + TodoView::update( todo.uid(), todo ); + updateView(); + } + } + } +} +void TableView::slotPriority() { + setCellContentFromEditor( currentRow(), currentColumn() ); +} diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index b608204..bf41aea 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h @@ -80,2 +80,8 @@ namespace Todo { bool m_enablePaint:1; + QString m_oleCat; + bool m_first : 1; + + protected: + QWidget* createEditor(int row, int col, bool initFromCell )const; + void setCellContentFromEditor( int row, int col ); @@ -89,2 +95,3 @@ private slots: void slotCurrentChanged(int, int ); + void slotPriority(); }; diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp index ebf9e8a..1f81539 100644 --- a/core/pim/todo/todomanager.cpp +++ b/core/pim/todo/todomanager.cpp @@ -49,2 +49,3 @@ OTodo TodoManager::event(int uid ) { void TodoManager::updateList() { + qWarning("update list"); m_list = m_db->allRecords(); @@ -120,2 +121,3 @@ void TodoManager::load() { if (!m_db) { + qWarning("loading!"); m_db = new OTodoAccess(); diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp index 06eaaa9..639fa66 100644 --- a/core/pim/todo/todoview.cpp +++ b/core/pim/todo/todoview.cpp @@ -56,3 +56,3 @@ OTodoAccess::List TodoView::list(){ } -OTodoAccess::List TodoView::sorted(){ +OTodoAccess::List TodoView::sorted()const{ return m_sort; @@ -70,2 +70,3 @@ void TodoView::setSortOrder( int order ) { void TodoView::setAscending( bool b ) { + qWarning("setAscending %d", b ); m_asc = b; diff --git a/core/pim/todo/todoview.h b/core/pim/todo/todoview.h index 9408ef1..e5c77f9 100644 --- a/core/pim/todo/todoview.h +++ b/core/pim/todo/todoview.h @@ -159,3 +159,3 @@ namespace Todo { OTodoAccess::List list(); - OTodoAccess::List sorted(); + OTodoAccess::List sorted()const; void sort(); |