author | zecke <zecke> | 2003-05-07 17:44:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-05-07 17:44:59 (UTC) |
commit | ac895871f93dce9734189daf9cb95dbbda605096 (patch) (unidiff) | |
tree | 18f34fcdeededd689ea9b7a3f8fd9d76d2e22282 | |
parent | 1cee00987d34729393fb9383d90babd39517cc68 (diff) | |
download | opie-ac895871f93dce9734189daf9cb95dbbda605096.zip opie-ac895871f93dce9734189daf9cb95dbbda605096.tar.gz opie-ac895871f93dce9734189daf9cb95dbbda605096.tar.bz2 |
one more
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 77cbe17..c5cedc6 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -452,372 +452,372 @@ void MainWindow::slotDelete() { | |||
452 | 452 | ||
453 | m_todoMgr.remove( currentView()->current() ); | 453 | m_todoMgr.remove( currentView()->current() ); |
454 | currentView()->removeEvent( currentView()->current() ); | 454 | currentView()->removeEvent( currentView()->current() ); |
455 | raiseCurrentView(); | 455 | raiseCurrentView(); |
456 | } | 456 | } |
457 | void MainWindow::slotDeleteAll() { | 457 | void MainWindow::slotDeleteAll() { |
458 | if(m_syncing) { | 458 | if(m_syncing) { |
459 | QMessageBox::warning(this, QWidget::tr("Todo"), | 459 | QMessageBox::warning(this, QWidget::tr("Todo"), |
460 | QWidget::tr("Can not edit data, currently syncing")); | 460 | QWidget::tr("Can not edit data, currently syncing")); |
461 | return; | 461 | return; |
462 | } | 462 | } |
463 | 463 | ||
464 | 464 | ||
465 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) | 465 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) |
466 | return; | 466 | return; |
467 | 467 | ||
468 | m_todoMgr.removeAll(); | 468 | m_todoMgr.removeAll(); |
469 | currentView()->clear(); | 469 | currentView()->clear(); |
470 | 470 | ||
471 | raiseCurrentView(); | 471 | raiseCurrentView(); |
472 | } | 472 | } |
473 | void MainWindow::slotDeleteCompleted() { | 473 | void MainWindow::slotDeleteCompleted() { |
474 | if(m_syncing) { | 474 | if(m_syncing) { |
475 | QMessageBox::warning(this, QWidget::tr("Todo"), | 475 | QMessageBox::warning(this, QWidget::tr("Todo"), |
476 | QWidget::tr("Can not edit data, currently syncing")); | 476 | QWidget::tr("Can not edit data, currently syncing")); |
477 | return; | 477 | return; |
478 | } | 478 | } |
479 | 479 | ||
480 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) | 480 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) |
481 | return; | 481 | return; |
482 | 482 | ||
483 | 483 | ||
484 | m_todoMgr.removeCompleted(); | 484 | m_todoMgr.removeCompleted(); |
485 | currentView()->updateView( ); | 485 | currentView()->updateView( ); |
486 | } | 486 | } |
487 | void MainWindow::slotFind() { | 487 | void MainWindow::slotFind() { |
488 | 488 | ||
489 | } | 489 | } |
490 | void MainWindow::slotEdit() { | 490 | void MainWindow::slotEdit() { |
491 | slotEdit( currentView()->current() ); | 491 | slotEdit( currentView()->current() ); |
492 | } | 492 | } |
493 | /* | 493 | /* |
494 | * set the category | 494 | * set the category |
495 | */ | 495 | */ |
496 | void MainWindow::setCategory( int c) { | 496 | void MainWindow::setCategory( int c) { |
497 | if ( c <= 0 ) return; | 497 | if ( c <= 0 ) return; |
498 | 498 | ||
499 | 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( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); | 506 | setCaption( QWidget::tr("Todo") + " - " + QWidget::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 = QWidget::tr("Unfiled"); | 509 | m_curCat = QWidget::tr("Unfiled"); |
510 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); | 510 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); |
511 | }else { | 511 | }else { |
512 | m_curCat = m_todoMgr.categories()[c-2]; | 512 | m_curCat = m_todoMgr.categories()[c-2]; |
513 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); | 513 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); |
514 | } | 514 | } |
515 | m_catMenu->setItemChecked( c, true ); | 515 | m_catMenu->setItemChecked( c, true ); |
516 | 516 | ||
517 | currentView()->setShowCategory( m_curCat ); | 517 | currentView()->setShowCategory( m_curCat ); |
518 | raiseCurrentView(); | 518 | raiseCurrentView(); |
519 | } | 519 | } |
520 | void MainWindow::slotShowDeadLine( bool dead) { | 520 | void MainWindow::slotShowDeadLine( bool dead) { |
521 | m_deadline = dead; | 521 | m_deadline = dead; |
522 | currentView()->setShowDeadline( dead ); | 522 | currentView()->setShowDeadline( dead ); |
523 | } | 523 | } |
524 | void MainWindow::slotShowCompleted( bool show) { | 524 | void MainWindow::slotShowCompleted( bool show) { |
525 | m_completed = show; | 525 | m_completed = show; |
526 | currentView()->setShowCompleted( m_completed ); | 526 | currentView()->setShowCompleted( m_completed ); |
527 | } | 527 | } |
528 | void MainWindow::slotShowQuickTask( bool show ) { | 528 | void MainWindow::slotShowQuickTask( bool show ) { |
529 | m_quicktask = show; | 529 | m_quicktask = show; |
530 | if ( m_quicktask ) | 530 | if ( m_quicktask ) |
531 | m_curQuick->widget()->show(); | 531 | m_curQuick->widget()->show(); |
532 | else | 532 | else |
533 | m_curQuick->widget()->hide(); | 533 | m_curQuick->widget()->hide(); |
534 | } | 534 | } |
535 | bool MainWindow::showOverDue()const { | 535 | bool MainWindow::showOverDue()const { |
536 | return m_overdue; | 536 | return m_overdue; |
537 | } | 537 | } |
538 | void MainWindow::setDocument( const QString& fi) { | 538 | void MainWindow::setDocument( const QString& fi) { |
539 | DocLnk doc(fi); | 539 | DocLnk doc(fi); |
540 | if (doc.isValid() ) | 540 | if (doc.isValid() ) |
541 | receiveFile(doc.file() ); | 541 | receiveFile(doc.file() ); |
542 | else | 542 | else |
543 | receiveFile(fi ); | 543 | receiveFile(fi ); |
544 | } | 544 | } |
545 | 545 | ||
546 | static const char *beamfile = "/tmp/opie-todo.vcs"; | 546 | static const char *beamfile = "/tmp/opie-todo.vcs"; |
547 | void MainWindow::slotBeam() { | 547 | void MainWindow::slotBeam() { |
548 | beam( currentView()->current() ); | 548 | beam( currentView()->current() ); |
549 | } | 549 | } |
550 | void MainWindow::beamDone( Ir* ir) { | 550 | void MainWindow::beamDone( Ir* ir) { |
551 | delete ir; | 551 | delete ir; |
552 | ::unlink( beamfile ); | 552 | ::unlink( beamfile ); |
553 | } | 553 | } |
554 | void MainWindow::receiveFile( const QString& filename ) { | 554 | void MainWindow::receiveFile( const QString& filename ) { |
555 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); | 555 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); |
556 | OTodoAccess acc( cal ); | 556 | OTodoAccess acc( cal ); |
557 | acc.load(); | 557 | acc.load(); |
558 | OTodoAccess::List list = acc.allRecords(); | 558 | OTodoAccess::List list = acc.allRecords(); |
559 | 559 | ||
560 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); | 560 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); |
561 | 561 | ||
562 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), | 562 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), |
563 | message, QMessageBox::Ok, | 563 | message, QMessageBox::Ok, |
564 | QMessageBox::Cancel ) == QMessageBox::Ok ) { | 564 | QMessageBox::Cancel ) == QMessageBox::Ok ) { |
565 | OTodoAccess::List::Iterator it; | 565 | OTodoAccess::List::Iterator it; |
566 | for ( it = list.begin(); it != list.end(); ++it ) | 566 | for ( it = list.begin(); it != list.end(); ++it ) |
567 | m_todoMgr.add( (*it) ); | 567 | m_todoMgr.add( (*it) ); |
568 | 568 | ||
569 | currentView()->updateView(); | 569 | currentView()->updateView(); |
570 | } | 570 | } |
571 | } | 571 | } |
572 | 572 | ||
573 | void MainWindow::slotFlush() { | 573 | void MainWindow::slotFlush() { |
574 | m_syncing = FALSE; | 574 | m_syncing = FALSE; |
575 | m_todoMgr.save(); | 575 | m_todoMgr.save(); |
576 | } | 576 | } |
577 | void MainWindow::slotShowDetails() { | 577 | void MainWindow::slotShowDetails() { |
578 | slotShow( currentView()->current() ); | 578 | slotShow( currentView()->current() ); |
579 | } | 579 | } |
580 | /* | 580 | /* |
581 | * populate the Categories | 581 | * populate the Categories |
582 | * Menu | 582 | * Menu |
583 | */ | 583 | */ |
584 | void MainWindow::populateCategories() { | 584 | void MainWindow::populateCategories() { |
585 | m_todoMgr.load(); | 585 | m_todoMgr.load(); |
586 | 586 | ||
587 | m_catMenu->clear(); | 587 | m_catMenu->clear(); |
588 | int id, rememberId; | 588 | int id, rememberId; |
589 | id = 1; | 589 | id = 1; |
590 | rememberId = 1; | 590 | rememberId = 1; |
591 | 591 | ||
592 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); | 592 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); |
593 | m_catMenu->insertSeparator(); | 593 | m_catMenu->insertSeparator(); |
594 | QStringList categories = m_todoMgr.categories(); | 594 | QStringList categories = m_todoMgr.categories(); |
595 | categories.append( QWidget::tr( "Unfiled" ) ); | 595 | categories.append( QWidget::tr( "Unfiled" ) ); |
596 | for ( QStringList::Iterator it = categories.begin(); | 596 | for ( QStringList::Iterator it = categories.begin(); |
597 | it != categories.end(); ++it ) { | 597 | it != categories.end(); ++it ) { |
598 | m_catMenu->insertItem( *it, id ); | 598 | m_catMenu->insertItem( *it, id ); |
599 | if ( *it == currentCategory() ) | 599 | if ( *it == currentCategory() ) |
600 | rememberId = id; | 600 | rememberId = id; |
601 | ++id; | 601 | ++id; |
602 | } | 602 | } |
603 | setCategory( rememberId ); | 603 | setCategory( rememberId ); |
604 | } | 604 | } |
605 | bool MainWindow::showCompleted()const { | 605 | bool MainWindow::showCompleted()const { |
606 | return m_completed; | 606 | return m_completed; |
607 | } | 607 | } |
608 | bool MainWindow::showDeadline()const { | 608 | bool MainWindow::showDeadline()const { |
609 | return m_deadline; | 609 | return m_deadline; |
610 | } | 610 | } |
611 | bool MainWindow::showQuickTask()const { | 611 | bool MainWindow::showQuickTask()const { |
612 | return m_quicktask; | 612 | return m_quicktask; |
613 | } | 613 | } |
614 | QString MainWindow::currentCategory()const { | 614 | QString MainWindow::currentCategory()const { |
615 | return m_curCat; | 615 | return m_curCat; |
616 | } | 616 | } |
617 | int MainWindow::currentCatId() { | 617 | int MainWindow::currentCatId() { |
618 | return m_todoMgr.catId( m_curCat ); | 618 | return m_todoMgr.catId( m_curCat ); |
619 | } | 619 | } |
620 | ViewBase* MainWindow::currentView() { | 620 | ViewBase* MainWindow::currentView() { |
621 | return m_curView; | 621 | return m_curView; |
622 | } | 622 | } |
623 | void MainWindow::raiseCurrentView() { | 623 | void MainWindow::raiseCurrentView() { |
624 | m_stack->raiseWidget( m_curView->widget() ); | 624 | m_stack->raiseWidget( m_curView->widget() ); |
625 | } | 625 | } |
626 | void MainWindow::slotShowDue(bool ov) { | 626 | void MainWindow::slotShowDue(bool ov) { |
627 | m_overdue = ov; | 627 | m_overdue = ov; |
628 | currentView()->showOverDue( ov ); | 628 | currentView()->showOverDue( ov ); |
629 | raiseCurrentView(); | 629 | raiseCurrentView(); |
630 | } | 630 | } |
631 | void MainWindow::slotShow( int uid ) { | 631 | void MainWindow::slotShow( int uid ) { |
632 | qWarning("slotShow"); | 632 | qWarning("slotShow"); |
633 | currentShow()->slotShow( event( uid ) ); | 633 | currentShow()->slotShow( event( uid ) ); |
634 | m_stack->raiseWidget( currentShow()->widget() ); | 634 | m_stack->raiseWidget( currentShow()->widget() ); |
635 | } | 635 | } |
636 | void MainWindow::slotEdit( int uid ) { | 636 | void MainWindow::slotEdit( int uid ) { |
637 | if (uid == 1 ) return; | 637 | if (uid == 1 ) return; |
638 | if(m_syncing) { | 638 | if(m_syncing) { |
639 | QMessageBox::warning(this, QWidget::tr("Todo"), | 639 | QMessageBox::warning(this, QWidget::tr("Todo"), |
640 | QWidget::tr("Can not edit data, currently syncing")); | 640 | QWidget::tr("Can not edit data, currently syncing")); |
641 | return; | 641 | return; |
642 | } | 642 | } |
643 | 643 | ||
644 | OTodo todo = m_todoMgr.event( uid ); | 644 | OTodo todo = m_todoMgr.event( uid ); |
645 | 645 | ||
646 | todo = currentEditor()->edit(this, todo ); | 646 | todo = currentEditor()->edit(this, todo ); |
647 | 647 | ||
648 | /* if completed */ | 648 | /* if completed */ |
649 | if ( currentEditor()->accepted() ) { | 649 | if ( currentEditor()->accepted() ) { |
650 | qWarning("Replacing now" ); | 650 | qWarning("Replacing now" ); |
651 | m_todoMgr.update( todo.uid(), todo ); | 651 | m_todoMgr.update( todo.uid(), todo ); |
652 | currentView()->replaceEvent( todo ); | 652 | currentView()->replaceEvent( todo ); |
653 | /* a Category might have changed */ | 653 | /* a Category might have changed */ |
654 | populateCategories(); | 654 | populateCategories(); |
655 | } | 655 | } |
656 | 656 | ||
657 | raiseCurrentView(); | 657 | raiseCurrentView(); |
658 | } | 658 | } |
659 | /* | 659 | /* |
660 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { | 660 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { |
661 | m_todoMgr.update( uid, ev ); | 661 | m_todoMgr.update( uid, ev ); |
662 | } | 662 | } |
663 | */ | 663 | */ |
664 | void MainWindow::updateTodo( const OTodo& ev) { | 664 | void MainWindow::updateTodo( const OTodo& ev) { |
665 | m_todoMgr.update( ev.uid() , ev ); | 665 | m_todoMgr.update( ev.uid() , ev ); |
666 | } | 666 | } |
667 | /* The view changed it's configuration | 667 | /* The view changed it's configuration |
668 | * update the view menu | 668 | * update the view menu |
669 | */ | 669 | */ |
670 | void MainWindow::slotUpdate3( QWidget* ) { | 670 | void MainWindow::slotUpdate3( QWidget* ) { |
671 | 671 | ||
672 | } | 672 | } |
673 | void MainWindow::updateList() { | 673 | void MainWindow::updateList() { |
674 | m_todoMgr.updateList(); | 674 | m_todoMgr.updateList(); |
675 | } | 675 | } |
676 | void MainWindow::setReadAhead( uint count ) { | 676 | void MainWindow::setReadAhead( uint count ) { |
677 | if (m_todoMgr.todoDB() ) | 677 | if (m_todoMgr.todoDB() ) |
678 | m_todoMgr.todoDB()->setReadAhead( count ); | 678 | m_todoMgr.todoDB()->setReadAhead( count ); |
679 | } | 679 | } |
680 | void MainWindow::slotQuickEntered() { | 680 | void MainWindow::slotQuickEntered() { |
681 | qWarning("entered"); | 681 | qWarning("entered"); |
682 | OTodo todo = quickEditor()->todo(); | 682 | OTodo todo = quickEditor()->todo(); |
683 | if (todo.isEmpty() ) | 683 | if (todo.isEmpty() ) |
684 | return; | 684 | return; |
685 | 685 | ||
686 | m_todoMgr.add( todo ); | 686 | m_todoMgr.add( todo ); |
687 | currentView()->addEvent( todo ); | 687 | currentView()->addEvent( todo ); |
688 | raiseCurrentView(); | 688 | raiseCurrentView(); |
689 | } | 689 | } |
690 | QuickEditBase* MainWindow::quickEditor() { | 690 | QuickEditBase* MainWindow::quickEditor() { |
691 | return m_curQuick; | 691 | return m_curQuick; |
692 | } | 692 | } |
693 | void MainWindow::slotComplete( int uid ) { | 693 | void MainWindow::slotComplete( int uid ) { |
694 | slotComplete( event(uid) ); | 694 | slotComplete( event(uid) ); |
695 | } | 695 | } |
696 | void MainWindow::slotComplete( const OTodo& todo ) { | 696 | void MainWindow::slotComplete( const OTodo& todo ) { |
697 | OTodo to = todo; | 697 | OTodo to = todo; |
698 | to.setCompleted( !to.isCompleted() ); | 698 | to.setCompleted( !to.isCompleted() ); |
699 | to.setCompletedDate( QDate::currentDate() ); | 699 | to.setCompletedDate( QDate::currentDate() ); |
700 | 700 | ||
701 | /* | 701 | /* |
702 | * if the item does recur | 702 | * if the item does recur |
703 | * we need to spin it off | 703 | * we need to spin it off |
704 | * and update the items duedate to the next | 704 | * and update the items duedate to the next |
705 | * possible recurrance of this item... | 705 | * possible recurrance of this item... |
706 | * the spinned off one will loose the | 706 | * the spinned off one will loose the |
707 | */ | 707 | */ |
708 | if ( to.recurrence().doesRecur() && to.isCompleted() ) { | 708 | if ( to.hasRecurrence() && to.isCompleted() ) { |
709 | OTodo to2( to ); | 709 | OTodo to2( to ); |
710 | 710 | ||
711 | /* the spinned off one won't recur anymore */ | 711 | /* the spinned off one won't recur anymore */ |
712 | to.setRecurrence( ORecur() ); | 712 | to.setRecurrence( ORecur() ); |
713 | 713 | ||
714 | ORecur rec = to2.recurrence(); | 714 | ORecur rec = to2.recurrence(); |
715 | rec.setStart( to.dueDate() ); | 715 | rec.setStart( to.dueDate() ); |
716 | to2.setRecurrence( rec ); | 716 | to2.setRecurrence( rec ); |
717 | /* | 717 | /* |
718 | * if there is a next occurence | 718 | * if there is a next occurence |
719 | * from the duedate of the last recurrance | 719 | * from the duedate of the last recurrance |
720 | */ | 720 | */ |
721 | QDate date; | 721 | QDate date; |
722 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { | 722 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { |
723 | QDate inval; | 723 | QDate inval; |
724 | /* generate a new uid for the old record */ | 724 | /* generate a new uid for the old record */ |
725 | to.setUid( 1 ); | 725 | to.setUid( 1 ); |
726 | 726 | ||
727 | /* add the old one cause it has a new UID here cause it was spin off */ | 727 | /* add the old one cause it has a new UID here cause it was spin off */ |
728 | m_todoMgr.add( to ); | 728 | m_todoMgr.add( to ); |
729 | 729 | ||
730 | /* | 730 | /* |
731 | * update the due date | 731 | * update the due date |
732 | * start date | 732 | * start date |
733 | * and complete date | 733 | * and complete date |
734 | */ | 734 | */ |
735 | to2.setDueDate( date ); | 735 | to2.setDueDate( date ); |
736 | to2.setStartDate( inval ); | 736 | to2.setStartDate( inval ); |
737 | to2.setCompletedDate( inval ); | 737 | to2.setCompletedDate( inval ); |
738 | to2.setCompleted( false ); | 738 | to2.setCompleted( false ); |
739 | updateTodo( to2 ); | 739 | updateTodo( to2 ); |
740 | }else | 740 | }else |
741 | updateTodo( to ); | 741 | updateTodo( to ); |
742 | }else | 742 | }else |
743 | updateTodo( to ); | 743 | updateTodo( to ); |
744 | 744 | ||
745 | currentView()->updateView(); | 745 | currentView()->updateView(); |
746 | raiseCurrentView(); | 746 | raiseCurrentView(); |
747 | } | 747 | } |
748 | void MainWindow::flush() { | 748 | void MainWindow::flush() { |
749 | slotFlush(); | 749 | slotFlush(); |
750 | } | 750 | } |
751 | void MainWindow::reload() { | 751 | void MainWindow::reload() { |
752 | slotReload(); | 752 | slotReload(); |
753 | } | 753 | } |
754 | int MainWindow::create() { | 754 | int MainWindow::create() { |
755 | int uid = 0; | 755 | int uid = 0; |
756 | if(m_syncing) { | 756 | if(m_syncing) { |
757 | QMessageBox::warning(this, QWidget::tr("Todo"), | 757 | QMessageBox::warning(this, QWidget::tr("Todo"), |
758 | QWidget::tr("Can not edit data, currently syncing")); | 758 | QWidget::tr("Can not edit data, currently syncing")); |
759 | return uid; | 759 | return uid; |
760 | } | 760 | } |
761 | 761 | ||
762 | 762 | ||
763 | OTodo todo = currentEditor()->newTodo( currentCatId(), | 763 | OTodo todo = currentEditor()->newTodo( currentCatId(), |
764 | this ); | 764 | this ); |
765 | 765 | ||
766 | if ( currentEditor()->accepted() ) { | 766 | if ( currentEditor()->accepted() ) { |
767 | //todo.assignUid(); | 767 | //todo.assignUid(); |
768 | uid = todo.uid(); | 768 | uid = todo.uid(); |
769 | m_todoMgr.add( todo ); | 769 | m_todoMgr.add( todo ); |
770 | currentView()->addEvent( todo ); | 770 | currentView()->addEvent( todo ); |
771 | 771 | ||
772 | 772 | ||
773 | // I'm afraid we must call this every time now, otherwise | 773 | // I'm afraid we must call this every time now, otherwise |
774 | // spend expensive time comparing all these strings... | 774 | // spend expensive time comparing all these strings... |
775 | // but only call if we changed something -zecke | 775 | // but only call if we changed something -zecke |
776 | populateCategories(); | 776 | populateCategories(); |
777 | } | 777 | } |
778 | raiseCurrentView( ); | 778 | raiseCurrentView( ); |
779 | 779 | ||
780 | return uid; | 780 | return uid; |
781 | } | 781 | } |
782 | /* delete it silently... */ | 782 | /* delete it silently... */ |
783 | bool MainWindow::remove( int uid ) { | 783 | bool MainWindow::remove( int uid ) { |
784 | if (m_syncing) return false; | 784 | if (m_syncing) return false; |
785 | 785 | ||
786 | return m_todoMgr.remove( uid ); | 786 | return m_todoMgr.remove( uid ); |
787 | } | 787 | } |
788 | void MainWindow::beam( int uid) { | 788 | void MainWindow::beam( int uid) { |
789 | ::unlink( beamfile ); | 789 | ::unlink( beamfile ); |
790 | OTodo todo = event( uid ); | 790 | OTodo todo = event( uid ); |
791 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); | 791 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); |
792 | OTodoAccess acc( cal ); | 792 | OTodoAccess acc( cal ); |
793 | acc.load(); | 793 | acc.load(); |
794 | acc.add( todo ); | 794 | acc.add( todo ); |
795 | acc.save(); | 795 | acc.save(); |
796 | Ir* ir = new Ir(this ); | 796 | Ir* ir = new Ir(this ); |
797 | connect(ir, SIGNAL(done(Ir*) ), | 797 | connect(ir, SIGNAL(done(Ir*) ), |
798 | this, SLOT(beamDone(Ir*) ) ); | 798 | this, SLOT(beamDone(Ir*) ) ); |
799 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); | 799 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); |
800 | } | 800 | } |
801 | void MainWindow::show( int uid ) { | 801 | void MainWindow::show( int uid ) { |
802 | slotShow( uid ); | 802 | slotShow( uid ); |
803 | } | 803 | } |
804 | void MainWindow::edit( int uid ) { | 804 | void MainWindow::edit( int uid ) { |
805 | slotEdit( uid ); | 805 | slotEdit( uid ); |
806 | } | 806 | } |
807 | void MainWindow::add( const OPimRecord& rec) { | 807 | void MainWindow::add( const OPimRecord& rec) { |
808 | if ( rec.rtti() != OTodo::rtti() ) return; | 808 | if ( rec.rtti() != OTodo::rtti() ) return; |
809 | 809 | ||
810 | const OTodo& todo = static_cast<const OTodo&>(rec); | 810 | const OTodo& todo = static_cast<const OTodo&>(rec); |
811 | 811 | ||
812 | m_todoMgr.add(todo ); | 812 | m_todoMgr.add(todo ); |
813 | currentView()->addEvent( todo ); | 813 | currentView()->addEvent( todo ); |
814 | 814 | ||
815 | 815 | ||
816 | // I'm afraid we must call this every time now, otherwise | 816 | // I'm afraid we must call this every time now, otherwise |
817 | // spend expensive time comparing all these strings... | 817 | // spend expensive time comparing all these strings... |
818 | // but only call if we changed something -zecke | 818 | // but only call if we changed something -zecke |
819 | populateCategories(); | 819 | populateCategories(); |
820 | } | 820 | } |
821 | void MainWindow::slotReturnFromView() { | 821 | void MainWindow::slotReturnFromView() { |
822 | raiseCurrentView(); | 822 | raiseCurrentView(); |
823 | } | 823 | } |