-rw-r--r-- | core/pim/todo/mainwindow.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index a8f4c9c..47c0160 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -222,14 +222,12 @@ void MainWindow::initUI() { | |||
222 | void MainWindow::initViews() { | 222 | void MainWindow::initViews() { |
223 | TableView* tableView = new TableView( this, this ); | 223 | TableView* tableView = new TableView( this, this ); |
224 | m_stack->addWidget( tableView, m_counter++ ); | 224 | m_stack->addWidget( tableView, m_counter++ ); |
225 | m_views.append( tableView ); | 225 | m_views.append( tableView ); |
226 | m_curView = tableView; | 226 | m_curView = tableView; |
227 | connectBase( tableView ); | 227 | connectBase( tableView ); |
228 | // tableView->setTodos( begin(), end() ); we call populateCategories | ||
229 | |||
230 | /* add QString type + QString configname to | 228 | /* add QString type + QString configname to |
231 | * the View menu | 229 | * the View menu |
232 | * and subdirs for multiple views | 230 | * and subdirs for multiple views |
233 | */ | 231 | */ |
234 | } | 232 | } |
235 | void MainWindow::initEditor() { | 233 | void MainWindow::initEditor() { |
@@ -273,17 +271,35 @@ QPopupMenu* MainWindow::edit() { | |||
273 | QPopupMenu* MainWindow::view() { | 271 | QPopupMenu* MainWindow::view() { |
274 | return m_view; | 272 | return m_view; |
275 | } | 273 | } |
276 | QToolBar* MainWindow::toolbar() { | 274 | QToolBar* MainWindow::toolbar() { |
277 | return m_tool; | 275 | return m_tool; |
278 | } | 276 | } |
279 | OTodoAccess::List::Iterator MainWindow::begin() { | 277 | OTodoAccess::List MainWindow::list()const { |
280 | return m_todoMgr.begin(); | 278 | return m_todoMgr.list(); |
279 | } | ||
280 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { | ||
281 | int cat = 0; | ||
282 | if ( m_curCat == tr("All Categories") ) | ||
283 | cat = currentCatId(); | ||
284 | |||
285 | int filter = 1; | ||
286 | |||
287 | if (!m_completed ) | ||
288 | filter |= 4; | ||
289 | if (m_overdue) | ||
290 | filter |= 2; | ||
291 | |||
292 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); | ||
281 | } | 293 | } |
282 | OTodoAccess::List::Iterator MainWindow::end() { | 294 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { |
283 | return m_todoMgr.end(); | 295 | int cat = 0; |
296 | if ( m_curCat == tr("All Categories") ) | ||
297 | cat = currentCatId(); | ||
298 | |||
299 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); | ||
284 | } | 300 | } |
285 | OTodo MainWindow::event( int uid ) { | 301 | OTodo MainWindow::event( int uid ) { |
286 | return m_todoMgr.event( uid ); | 302 | return m_todoMgr.event( uid ); |
287 | } | 303 | } |
288 | bool MainWindow::isSyncing()const { | 304 | bool MainWindow::isSyncing()const { |
289 | return m_syncing; | 305 | return m_syncing; |
@@ -296,13 +312,13 @@ Editor* MainWindow::currentEditor() { | |||
296 | } | 312 | } |
297 | TodoShow* MainWindow::currentShow() { | 313 | TodoShow* MainWindow::currentShow() { |
298 | return m_curShow; | 314 | return m_curShow; |
299 | } | 315 | } |
300 | void MainWindow::slotReload() { | 316 | void MainWindow::slotReload() { |
301 | m_todoMgr.reload(); | 317 | m_todoMgr.reload(); |
302 | currentView()->setTodos( begin(), end() ); | 318 | currentView()->updateView( ); |
303 | raiseCurrentView(); | 319 | raiseCurrentView(); |
304 | } | 320 | } |
305 | void MainWindow::closeEvent( QCloseEvent* e ) { | 321 | void MainWindow::closeEvent( QCloseEvent* e ) { |
306 | if (m_stack->visibleWidget() == currentShow()->widget() ) { | 322 | if (m_stack->visibleWidget() == currentShow()->widget() ) { |
307 | raiseCurrentView(); | 323 | raiseCurrentView(); |
308 | e->ignore(); | 324 | e->ignore(); |
@@ -463,13 +479,13 @@ void MainWindow::slotDeleteCompleted() { | |||
463 | } | 479 | } |
464 | 480 | ||
465 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) ) | 481 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) ) |
466 | return; | 482 | return; |
467 | 483 | ||
468 | m_todoMgr.remove( currentView()->completed() ); | 484 | m_todoMgr.remove( currentView()->completed() ); |
469 | currentView()->setTodos( begin(), end() ); | 485 | currentView()->updateView( ); |
470 | } | 486 | } |
471 | void MainWindow::slotFind() { | 487 | void MainWindow::slotFind() { |
472 | 488 | ||
473 | } | 489 | } |
474 | void MainWindow::slotEdit() { | 490 | void MainWindow::slotEdit() { |
475 | slotEdit( currentView()->current() ); | 491 | slotEdit( currentView()->current() ); |