-rw-r--r-- | core/pim/todo/tableview.cpp | 7 | ||||
-rw-r--r-- | core/pim/todo/todoview.cpp | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 097af39..eaaf1bc 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp @@ -113,67 +113,70 @@ void TableView::updateFromTable( const OTodo& ev, CheckItem* item ) { * * We've two cases * either item or !item * this makes cases more easy */ if ( !item ) { item = m_cache[ev.uid()]; } DueTextItem *due = dueItem( item->row() ); due->setCompleted( ev.isCompleted() ); } QString TableView::type() const { return QString::fromLatin1( tr("Table View") ); } int TableView::current() { int cur = 0; CheckItem* i = checkItem( currentRow() ); if (i ) cur = i->uid(); return cur; } QString TableView::currentRepresentation() { return text( currentRow(), 2); } /* show overdue */ void TableView::showOverDue( bool ) { clear(); updateView(); } void TableView::updateView( ) { + setSortOrder( 0 ); + setAscending( true ); + sort(); OTodoAccess::List::Iterator it, end; - it = list().begin(); - end = list().end(); + it = sorted().begin(); + end = sorted().end(); qWarning("setTodos"); QTime time; time.start(); m_enablePaint = false; setUpdatesEnabled( false ); viewport()->setUpdatesEnabled( false ); clear(); QString currentCat = todoWindow()->currentCategory(); bool showCompleted = todoWindow()->showCompleted(); bool showOverDue = todoWindow()->showOverDue(); qWarning( "Current Category:" + todoWindow()->currentCategory() ); int id = todoWindow()->currentCatId(); QTime t; t.start(); setNumRows( it.count() ); uint i = 0; for (; it != end; ++it ) { OTodo todo = (*it); /* test if the categories match */ if ( !currentCat.isEmpty() && !todo.categories().contains( id ) ) { continue; } /* the item is completed but we shouldn't show it */ if ( !showCompleted && todo.isCompleted() ) { qWarning("isCompleted "); continue; } /* the item is not overdue but we should only show overdue */ if ( showOverDue && !todo.isOverdue() ) { continue; } diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp index b77baed..06eaaa9 100644 --- a/core/pim/todo/todoview.cpp +++ b/core/pim/todo/todoview.cpp @@ -30,48 +30,49 @@ void TodoView::connectUpdateSmall( QObject* obj, 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(){ 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 ) { m_asc = b; } void TodoView::update(int uid, const SmallTodo& to ) { //m_main->slotUpate1( uid, to ); } void TodoView::update(int uid, const OTodo& ev ) { m_main->updateTodo( ev ); } |