Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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 | |||
@@ -411,25 +411,24 @@ void MainWindow::slotNew() { | |||
411 | this ); | 411 | this ); |
412 | 412 | ||
413 | if ( currentEditor()->accepted() ) { | 413 | if ( currentEditor()->accepted() ) { |
414 | //todo.assignUid(); | 414 | //todo.assignUid(); |
415 | currentView()->addEvent( todo ); | 415 | currentView()->addEvent( todo ); |
416 | m_todoMgr.add( todo ); | 416 | m_todoMgr.add( todo ); |
417 | 417 | ||
418 | // I'm afraid we must call this every time now, otherwise | 418 | // I'm afraid we must call this every time now, otherwise |
419 | // spend expensive time comparing all these strings... | 419 | // spend expensive time comparing all these strings... |
420 | // but only call if we changed something -zecke | 420 | // but only call if we changed something -zecke |
421 | populateCategories(); | 421 | populateCategories(); |
422 | } | 422 | } |
423 | |||
424 | raiseCurrentView( ); | 423 | raiseCurrentView( ); |
425 | } | 424 | } |
426 | void MainWindow::slotDuplicate() { | 425 | void MainWindow::slotDuplicate() { |
427 | if(m_syncing) { | 426 | if(m_syncing) { |
428 | QMessageBox::warning(this, tr("Todo"), | 427 | QMessageBox::warning(this, tr("Todo"), |
429 | tr("Can not edit data, currently syncing")); | 428 | tr("Can not edit data, currently syncing")); |
430 | return; | 429 | return; |
431 | } | 430 | } |
432 | OTodo ev = m_todoMgr.event( currentView()->current() ); | 431 | OTodo ev = m_todoMgr.event( currentView()->current() ); |
433 | /* let's generate a new uid */ | 432 | /* let's generate a new uid */ |
434 | ev.setUid(-1); | 433 | ev.setUid(-1); |
435 | m_todoMgr.add( ev ); | 434 | m_todoMgr.add( ev ); |
@@ -488,40 +487,42 @@ void MainWindow::slotDeleteCompleted() { | |||
488 | void MainWindow::slotFind() { | 487 | void MainWindow::slotFind() { |
489 | 488 | ||
490 | } | 489 | } |
491 | void MainWindow::slotEdit() { | 490 | void MainWindow::slotEdit() { |
492 | slotEdit( currentView()->current() ); | 491 | slotEdit( currentView()->current() ); |
493 | } | 492 | } |
494 | /* | 493 | /* |
495 | * set the category | 494 | * set the category |
496 | */ | 495 | */ |
497 | void MainWindow::setCategory( int c) { | 496 | void MainWindow::setCategory( int c) { |
498 | if ( c <= 0 ) return; | 497 | if ( c <= 0 ) return; |
499 | 498 | ||
499 | |||
500 | qWarning("Iterating over cats %d", c ); | 500 | qWarning("Iterating over cats %d", c ); |
501 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) | 501 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) |
502 | m_catMenu->setItemChecked(i, c == (int)i ); | 502 | m_catMenu->setItemChecked(i, c == (int)i ); |
503 | 503 | ||
504 | if (c == 1 ) { | 504 | if (c == 1 ) { |
505 | m_curCat = QString::null; | 505 | m_curCat = QString::null; |
506 | setCaption( tr("Todo") + " - " + tr("All Categories" ) ); | 506 | setCaption( tr("Todo") + " - " + tr("All Categories" ) ); |
507 | 507 | ||
508 | }else if ( c == (int)m_catMenu->count() - 1 ) { | 508 | }else if ( c == (int)m_catMenu->count() - 1 ) { |
509 | m_curCat = tr("Unfiled"); | 509 | m_curCat = tr("Unfiled"); |
510 | setCaption( tr("Todo") + " - " + tr("Unfiled") ); | 510 | setCaption( tr("Todo") + " - " + tr("Unfiled") ); |
511 | }else { | 511 | }else { |
512 | m_curCat = m_todoMgr.categories()[c-2]; | 512 | m_curCat = m_todoMgr.categories()[c-2]; |
513 | setCaption( tr("Todo") + " - " + m_curCat ); | 513 | setCaption( tr("Todo") + " - " + m_curCat ); |
514 | } | 514 | } |
515 | m_catMenu->setItemChecked( c, true ); | 515 | m_catMenu->setItemChecked( c, true ); |
516 | |||
516 | currentView()->setShowCategory( m_curCat ); | 517 | currentView()->setShowCategory( m_curCat ); |
517 | raiseCurrentView(); | 518 | raiseCurrentView(); |
518 | } | 519 | } |
519 | void MainWindow::slotShowDeadLine( bool dead) { | 520 | void MainWindow::slotShowDeadLine( bool dead) { |
520 | m_deadline = dead; | 521 | m_deadline = dead; |
521 | currentView()->setShowDeadline( dead ); | 522 | currentView()->setShowDeadline( dead ); |
522 | } | 523 | } |
523 | void MainWindow::slotShowCompleted( bool show) { | 524 | void MainWindow::slotShowCompleted( bool show) { |
524 | m_completed = show; | 525 | m_completed = show; |
525 | currentView()->setShowCompleted( m_completed ); | 526 | currentView()->setShowCompleted( m_completed ); |
526 | } | 527 | } |
527 | bool MainWindow::showOverDue()const { | 528 | bool MainWindow::showOverDue()const { |
@@ -540,26 +541,25 @@ void MainWindow::beamDone( Ir* ) { | |||
540 | void MainWindow::slotFlush() { | 541 | void MainWindow::slotFlush() { |
541 | m_syncing = FALSE; | 542 | m_syncing = FALSE; |
542 | m_todoMgr.save(); | 543 | m_todoMgr.save(); |
543 | } | 544 | } |
544 | void MainWindow::slotShowDetails() { | 545 | void MainWindow::slotShowDetails() { |
545 | slotShow( currentView()->current() ); | 546 | slotShow( currentView()->current() ); |
546 | } | 547 | } |
547 | /* | 548 | /* |
548 | * populate the Categories | 549 | * populate the Categories |
549 | * Menu | 550 | * Menu |
550 | */ | 551 | */ |
551 | void MainWindow::populateCategories() { | 552 | void MainWindow::populateCategories() { |
552 | if (m_todoMgr.isLoaded() ) | 553 | m_todoMgr.load(); |
553 | m_todoMgr.load(); | ||
554 | 554 | ||
555 | m_catMenu->clear(); | 555 | m_catMenu->clear(); |
556 | int id, rememberId; | 556 | int id, rememberId; |
557 | id = 1; | 557 | id = 1; |
558 | rememberId = 1; | 558 | rememberId = 1; |
559 | 559 | ||
560 | m_catMenu->insertItem( tr( "All Categories" ), id++ ); | 560 | m_catMenu->insertItem( tr( "All Categories" ), id++ ); |
561 | m_catMenu->insertSeparator(); | 561 | m_catMenu->insertSeparator(); |
562 | QStringList categories = m_todoMgr.categories(); | 562 | QStringList categories = m_todoMgr.categories(); |
563 | categories.append( tr( "Unfiled" ) ); | 563 | categories.append( tr( "Unfiled" ) ); |
564 | for ( QStringList::Iterator it = categories.begin(); | 564 | for ( QStringList::Iterator it = categories.begin(); |
565 | it != categories.end(); ++it ) { | 565 | it != categories.end(); ++it ) { |
@@ -605,24 +605,25 @@ void MainWindow::slotEdit( int uid ) { | |||
605 | return; | 605 | return; |
606 | } | 606 | } |
607 | 607 | ||
608 | OTodo todo = m_todoMgr.event( uid ); | 608 | OTodo todo = m_todoMgr.event( uid ); |
609 | 609 | ||
610 | todo = currentEditor()->edit(this, todo ); | 610 | todo = currentEditor()->edit(this, todo ); |
611 | 611 | ||
612 | /* if completed */ | 612 | /* if completed */ |
613 | if ( currentEditor()->accepted() ) { | 613 | if ( currentEditor()->accepted() ) { |
614 | qWarning("Replacing now" ); | 614 | qWarning("Replacing now" ); |
615 | m_todoMgr.update( todo.uid(), todo ); | 615 | m_todoMgr.update( todo.uid(), todo ); |
616 | currentView()->replaceEvent( todo ); | 616 | currentView()->replaceEvent( todo ); |
617 | /* a Category might have changed */ | ||
617 | populateCategories(); | 618 | populateCategories(); |
618 | } | 619 | } |
619 | 620 | ||
620 | raiseCurrentView(); | 621 | raiseCurrentView(); |
621 | } | 622 | } |
622 | /* | 623 | /* |
623 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { | 624 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { |
624 | m_todoMgr.update( uid, ev ); | 625 | m_todoMgr.update( uid, ev ); |
625 | } | 626 | } |
626 | */ | 627 | */ |
627 | void MainWindow::updateTodo( const OTodo& ev) { | 628 | void MainWindow::updateTodo( const OTodo& ev) { |
628 | m_todoMgr.update( ev.uid() , ev ); | 629 | m_todoMgr.update( ev.uid() , ev ); |