-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 | |||
@@ -216,26 +216,24 @@ void MainWindow::initUI() { | |||
216 | 216 | ||
217 | connect(m_catMenu, SIGNAL(activated(int) ), | 217 | connect(m_catMenu, SIGNAL(activated(int) ), |
218 | this, SLOT(setCategory(int) ) ); | 218 | this, SLOT(setCategory(int) ) ); |
219 | connect(m_template, SIGNAL(activated(int) ), | 219 | connect(m_template, SIGNAL(activated(int) ), |
220 | this, SLOT(slotNewFromTemplate(int) ) ); | 220 | this, SLOT(slotNewFromTemplate(int) ) ); |
221 | } | 221 | } |
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() { |
236 | m_curEdit = new Editor(); | 234 | m_curEdit = new Editor(); |
237 | } | 235 | } |
238 | void MainWindow::initShow() { | 236 | void MainWindow::initShow() { |
239 | m_curShow = new TextViewShow(this); | 237 | m_curShow = new TextViewShow(this); |
240 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); | 238 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); |
241 | } | 239 | } |
@@ -267,48 +265,66 @@ QPopupMenu* MainWindow::options() { | |||
267 | qWarning("Options"); | 265 | qWarning("Options"); |
268 | return m_options; | 266 | return m_options; |
269 | } | 267 | } |
270 | QPopupMenu* MainWindow::edit() { | 268 | QPopupMenu* MainWindow::edit() { |
271 | return m_edit; | 269 | return m_edit; |
272 | } | 270 | } |
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; |
290 | } | 306 | } |
291 | TemplateManager* MainWindow::templateManager() { | 307 | TemplateManager* MainWindow::templateManager() { |
292 | return m_tempManager; | 308 | return m_tempManager; |
293 | } | 309 | } |
294 | Editor* MainWindow::currentEditor() { | 310 | Editor* MainWindow::currentEditor() { |
295 | return m_curEdit; | 311 | return m_curEdit; |
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(); |
309 | return; | 325 | return; |
310 | } | 326 | } |
311 | /* | 327 | /* |
312 | * we should have flushed and now we're still saving | 328 | * we should have flushed and now we're still saving |
313 | * so there is no need to flush | 329 | * so there is no need to flush |
314 | */ | 330 | */ |
@@ -457,25 +473,25 @@ void MainWindow::slotDeleteAll() { | |||
457 | } | 473 | } |
458 | void MainWindow::slotDeleteCompleted() { | 474 | void MainWindow::slotDeleteCompleted() { |
459 | if(m_syncing) { | 475 | if(m_syncing) { |
460 | QMessageBox::warning(this, tr("Todo"), | 476 | QMessageBox::warning(this, tr("Todo"), |
461 | tr("Can not edit data, currently syncing")); | 477 | tr("Can not edit data, currently syncing")); |
462 | return; | 478 | return; |
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() ); |
476 | } | 492 | } |
477 | /* | 493 | /* |
478 | * set the category | 494 | * set the category |
479 | */ | 495 | */ |
480 | void MainWindow::setCategory( int c) { | 496 | void MainWindow::setCategory( int c) { |
481 | if ( c <= 0 ) return; | 497 | if ( c <= 0 ) return; |