author | zecke <zecke> | 2003-02-22 19:02:06 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-22 19:02:06 (UTC) |
commit | 00c146960fa7fd05dc56fac2a24b3d7968a4a772 (patch) (unidiff) | |
tree | 11d7fd4630cce7422448c31bd26034718d90656e | |
parent | 7b04887e382227c80c8985495f01dad2b1890719 (diff) | |
download | opie-00c146960fa7fd05dc56fac2a24b3d7968a4a772.zip opie-00c146960fa7fd05dc56fac2a24b3d7968a4a772.tar.gz opie-00c146960fa7fd05dc56fac2a24b3d7968a4a772.tar.bz2 |
shutup todolist while running
remove the transport thingie..
-rw-r--r-- | core/pim/todo/main.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/core/pim/todo/main.cpp b/core/pim/todo/main.cpp index aeae794..58ed45c 100644 --- a/core/pim/todo/main.cpp +++ b/core/pim/todo/main.cpp | |||
@@ -1,49 +1,49 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "mainwindow.h" | 21 | #include "mainwindow.h" |
22 | 22 | ||
23 | 23 | ||
24 | #include <qdatetime.h> | 24 | #include <qdatetime.h> |
25 | 25 | ||
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | 27 | ||
28 | void myMessages( QtMsgType, const char* ) { | 28 | void myMessages( QtMsgType, const char* ) { |
29 | 29 | ||
30 | } | 30 | } |
31 | 31 | ||
32 | int main( int argc, char **argv ) | 32 | int main( int argc, char **argv ) |
33 | { | 33 | { |
34 | // qInstallMsgHandler( myMessages ); | 34 | qInstallMsgHandler( myMessages ); |
35 | QPEApplication a( argc, argv ); | 35 | QPEApplication a( argc, argv ); |
36 | 36 | ||
37 | QTime time; | 37 | QTime time; |
38 | time.start(); | 38 | time.start(); |
39 | Todo::MainWindow mw; | 39 | Todo::MainWindow mw; |
40 | int t = time.elapsed(); | 40 | int t = time.elapsed(); |
41 | qWarning("QTime %d", t/1000 ); | 41 | qWarning("QTime %d", t/1000 ); |
42 | mw.setCaption("Opie Todolist"); | 42 | mw.setCaption("Opie Todolist"); |
43 | QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) ); | 43 | QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) ); |
44 | QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) ); | 44 | QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) ); |
45 | 45 | ||
46 | a.showMainWidget(&mw); | 46 | a.showMainWidget(&mw); |
47 | 47 | ||
48 | return a.exec(); | 48 | return a.exec(); |
49 | } | 49 | } |
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index d328558..7810285 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -527,292 +527,292 @@ void MainWindow::slotShowQuickTask( bool show ) { | |||
527 | m_curQuick->widget()->show(); | 527 | m_curQuick->widget()->show(); |
528 | else | 528 | else |
529 | m_curQuick->widget()->hide(); | 529 | m_curQuick->widget()->hide(); |
530 | } | 530 | } |
531 | bool MainWindow::showOverDue()const { | 531 | bool MainWindow::showOverDue()const { |
532 | return m_overdue; | 532 | return m_overdue; |
533 | } | 533 | } |
534 | void MainWindow::setDocument( const QString& fi) { | 534 | void MainWindow::setDocument( const QString& fi) { |
535 | DocLnk doc(fi); | 535 | DocLnk doc(fi); |
536 | if (doc.isValid() ) | 536 | if (doc.isValid() ) |
537 | receiveFile(doc.file() ); | 537 | receiveFile(doc.file() ); |
538 | else | 538 | else |
539 | receiveFile(fi ); | 539 | receiveFile(fi ); |
540 | } | 540 | } |
541 | 541 | ||
542 | static const char *beamfile = "/tmp/opie-todo.vcs"; | 542 | static const char *beamfile = "/tmp/opie-todo.vcs"; |
543 | void MainWindow::slotBeam() { | 543 | void MainWindow::slotBeam() { |
544 | beam( currentView()->current() ); | 544 | beam( currentView()->current() ); |
545 | } | 545 | } |
546 | void MainWindow::beamDone( Ir* ir) { | 546 | void MainWindow::beamDone( Ir* ir) { |
547 | delete ir; | 547 | delete ir; |
548 | ::unlink( beamfile ); | 548 | ::unlink( beamfile ); |
549 | } | 549 | } |
550 | void MainWindow::receiveFile( const QString& filename ) { | 550 | void MainWindow::receiveFile( const QString& filename ) { |
551 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); | 551 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); |
552 | OTodoAccess acc( cal ); | 552 | OTodoAccess acc( cal ); |
553 | acc.load(); | 553 | acc.load(); |
554 | OTodoAccess::List list = acc.allRecords(); | 554 | OTodoAccess::List list = acc.allRecords(); |
555 | 555 | ||
556 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); | 556 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); |
557 | 557 | ||
558 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), | 558 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), |
559 | message, QMessageBox::Ok, | 559 | message, QMessageBox::Ok, |
560 | QMessageBox::Cancel ) == QMessageBox::Ok ) { | 560 | QMessageBox::Cancel ) == QMessageBox::Ok ) { |
561 | OTodoAccess::List::Iterator it; | 561 | OTodoAccess::List::Iterator it; |
562 | for ( it = list.begin(); it != list.end(); ++it ) | 562 | for ( it = list.begin(); it != list.end(); ++it ) |
563 | m_todoMgr.add( (*it) ); | 563 | m_todoMgr.add( (*it) ); |
564 | 564 | ||
565 | currentView()->updateView(); | 565 | currentView()->updateView(); |
566 | } | 566 | } |
567 | } | 567 | } |
568 | 568 | ||
569 | void MainWindow::slotFlush() { | 569 | void MainWindow::slotFlush() { |
570 | m_syncing = FALSE; | 570 | m_syncing = FALSE; |
571 | m_todoMgr.save(); | 571 | m_todoMgr.save(); |
572 | } | 572 | } |
573 | void MainWindow::slotShowDetails() { | 573 | void MainWindow::slotShowDetails() { |
574 | slotShow( currentView()->current() ); | 574 | slotShow( currentView()->current() ); |
575 | } | 575 | } |
576 | /* | 576 | /* |
577 | * populate the Categories | 577 | * populate the Categories |
578 | * Menu | 578 | * Menu |
579 | */ | 579 | */ |
580 | void MainWindow::populateCategories() { | 580 | void MainWindow::populateCategories() { |
581 | m_todoMgr.load(); | 581 | m_todoMgr.load(); |
582 | 582 | ||
583 | m_catMenu->clear(); | 583 | m_catMenu->clear(); |
584 | int id, rememberId; | 584 | int id, rememberId; |
585 | id = 1; | 585 | id = 1; |
586 | rememberId = 1; | 586 | rememberId = 1; |
587 | 587 | ||
588 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); | 588 | m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); |
589 | m_catMenu->insertSeparator(); | 589 | m_catMenu->insertSeparator(); |
590 | QStringList categories = m_todoMgr.categories(); | 590 | QStringList categories = m_todoMgr.categories(); |
591 | categories.append( QWidget::tr( "Unfiled" ) ); | 591 | categories.append( QWidget::tr( "Unfiled" ) ); |
592 | for ( QStringList::Iterator it = categories.begin(); | 592 | for ( QStringList::Iterator it = categories.begin(); |
593 | it != categories.end(); ++it ) { | 593 | it != categories.end(); ++it ) { |
594 | m_catMenu->insertItem( *it, id ); | 594 | m_catMenu->insertItem( *it, id ); |
595 | if ( *it == currentCategory() ) | 595 | if ( *it == currentCategory() ) |
596 | rememberId = id; | 596 | rememberId = id; |
597 | ++id; | 597 | ++id; |
598 | } | 598 | } |
599 | setCategory( rememberId ); | 599 | setCategory( rememberId ); |
600 | } | 600 | } |
601 | bool MainWindow::showCompleted()const { | 601 | bool MainWindow::showCompleted()const { |
602 | return m_completed; | 602 | return m_completed; |
603 | } | 603 | } |
604 | bool MainWindow::showDeadline()const { | 604 | bool MainWindow::showDeadline()const { |
605 | return m_deadline; | 605 | return m_deadline; |
606 | } | 606 | } |
607 | bool MainWindow::showQuickTask()const { | 607 | bool MainWindow::showQuickTask()const { |
608 | return m_quicktask; | 608 | return m_quicktask; |
609 | } | 609 | } |
610 | QString MainWindow::currentCategory()const { | 610 | QString MainWindow::currentCategory()const { |
611 | return m_curCat; | 611 | return m_curCat; |
612 | } | 612 | } |
613 | int MainWindow::currentCatId() { | 613 | int MainWindow::currentCatId() { |
614 | return m_todoMgr.catId( m_curCat ); | 614 | return m_todoMgr.catId( m_curCat ); |
615 | } | 615 | } |
616 | ViewBase* MainWindow::currentView() { | 616 | ViewBase* MainWindow::currentView() { |
617 | return m_curView; | 617 | return m_curView; |
618 | } | 618 | } |
619 | void MainWindow::raiseCurrentView() { | 619 | void MainWindow::raiseCurrentView() { |
620 | m_stack->raiseWidget( m_curView->widget() ); | 620 | m_stack->raiseWidget( m_curView->widget() ); |
621 | } | 621 | } |
622 | void MainWindow::slotShowDue(bool ov) { | 622 | void MainWindow::slotShowDue(bool ov) { |
623 | m_overdue = ov; | 623 | m_overdue = ov; |
624 | currentView()->showOverDue( ov ); | 624 | currentView()->showOverDue( ov ); |
625 | raiseCurrentView(); | 625 | raiseCurrentView(); |
626 | } | 626 | } |
627 | void MainWindow::slotShow( int uid ) { | 627 | void MainWindow::slotShow( int uid ) { |
628 | qWarning("slotShow"); | 628 | qWarning("slotShow"); |
629 | currentShow()->slotShow( event( uid ) ); | 629 | currentShow()->slotShow( event( uid ) ); |
630 | m_stack->raiseWidget( currentShow()->widget() ); | 630 | m_stack->raiseWidget( currentShow()->widget() ); |
631 | } | 631 | } |
632 | void MainWindow::slotEdit( int uid ) { | 632 | void MainWindow::slotEdit( int uid ) { |
633 | if(m_syncing) { | 633 | if(m_syncing) { |
634 | QMessageBox::warning(this, QWidget::tr("Todo"), | 634 | QMessageBox::warning(this, QWidget::tr("Todo"), |
635 | QWidget::tr("Can not edit data, currently syncing")); | 635 | QWidget::tr("Can not edit data, currently syncing")); |
636 | return; | 636 | return; |
637 | } | 637 | } |
638 | 638 | ||
639 | OTodo todo = m_todoMgr.event( uid ); | 639 | OTodo todo = m_todoMgr.event( uid ); |
640 | 640 | ||
641 | todo = currentEditor()->edit(this, todo ); | 641 | todo = currentEditor()->edit(this, todo ); |
642 | 642 | ||
643 | /* if completed */ | 643 | /* if completed */ |
644 | if ( currentEditor()->accepted() ) { | 644 | if ( currentEditor()->accepted() ) { |
645 | qWarning("Replacing now" ); | 645 | qWarning("Replacing now" ); |
646 | m_todoMgr.update( todo.uid(), todo ); | 646 | m_todoMgr.update( todo.uid(), todo ); |
647 | currentView()->replaceEvent( todo ); | 647 | currentView()->replaceEvent( todo ); |
648 | /* a Category might have changed */ | 648 | /* a Category might have changed */ |
649 | populateCategories(); | 649 | populateCategories(); |
650 | } | 650 | } |
651 | 651 | ||
652 | raiseCurrentView(); | 652 | raiseCurrentView(); |
653 | } | 653 | } |
654 | /* | 654 | /* |
655 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { | 655 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { |
656 | m_todoMgr.update( uid, ev ); | 656 | m_todoMgr.update( uid, ev ); |
657 | } | 657 | } |
658 | */ | 658 | */ |
659 | void MainWindow::updateTodo( const OTodo& ev) { | 659 | void MainWindow::updateTodo( const OTodo& ev) { |
660 | m_todoMgr.update( ev.uid() , ev ); | 660 | m_todoMgr.update( ev.uid() , ev ); |
661 | } | 661 | } |
662 | /* The view changed it's configuration | 662 | /* The view changed it's configuration |
663 | * update the view menu | 663 | * update the view menu |
664 | */ | 664 | */ |
665 | void MainWindow::slotUpdate3( QWidget* ) { | 665 | void MainWindow::slotUpdate3( QWidget* ) { |
666 | 666 | ||
667 | } | 667 | } |
668 | void MainWindow::updateList() { | 668 | void MainWindow::updateList() { |
669 | m_todoMgr.updateList(); | 669 | m_todoMgr.updateList(); |
670 | } | 670 | } |
671 | void MainWindow::setReadAhead( uint count ) { | 671 | void MainWindow::setReadAhead( uint count ) { |
672 | if (m_todoMgr.todoDB() ) | 672 | if (m_todoMgr.todoDB() ) |
673 | m_todoMgr.todoDB()->setReadAhead( count ); | 673 | m_todoMgr.todoDB()->setReadAhead( count ); |
674 | } | 674 | } |
675 | void MainWindow::slotQuickEntered() { | 675 | void MainWindow::slotQuickEntered() { |
676 | qWarning("entered"); | 676 | qWarning("entered"); |
677 | OTodo todo = quickEditor()->todo(); | 677 | OTodo todo = quickEditor()->todo(); |
678 | if (todo.isEmpty() ) | 678 | if (todo.isEmpty() ) |
679 | return; | 679 | return; |
680 | 680 | ||
681 | m_todoMgr.add( todo ); | 681 | m_todoMgr.add( todo ); |
682 | currentView()->addEvent( todo ); | 682 | currentView()->addEvent( todo ); |
683 | raiseCurrentView(); | 683 | raiseCurrentView(); |
684 | } | 684 | } |
685 | QuickEditBase* MainWindow::quickEditor() { | 685 | QuickEditBase* MainWindow::quickEditor() { |
686 | return m_curQuick; | 686 | return m_curQuick; |
687 | } | 687 | } |
688 | void MainWindow::slotComplete( int uid ) { | 688 | void MainWindow::slotComplete( int uid ) { |
689 | slotComplete( event(uid) ); | 689 | slotComplete( event(uid) ); |
690 | } | 690 | } |
691 | void MainWindow::slotComplete( const OTodo& todo ) { | 691 | void MainWindow::slotComplete( const OTodo& todo ) { |
692 | OTodo to = todo; | 692 | OTodo to = todo; |
693 | to.setCompleted( !to.isCompleted() ); | 693 | to.setCompleted( !to.isCompleted() ); |
694 | to.setCompletedDate( QDate::currentDate() ); | 694 | to.setCompletedDate( QDate::currentDate() ); |
695 | 695 | ||
696 | /* | 696 | /* |
697 | * if the item does recur | 697 | * if the item does recur |
698 | * we need to spin it off | 698 | * we need to spin it off |
699 | * and update the items duedate to the next | 699 | * and update the items duedate to the next |
700 | * possible recurrance of this item... | 700 | * possible recurrance of this item... |
701 | * the spinned off one will loose the | 701 | * the spinned off one will loose the |
702 | */ | 702 | */ |
703 | if ( to.recurrence().doesRecur() && to.isCompleted() ) { | 703 | if ( to.recurrence().doesRecur() && to.isCompleted() ) { |
704 | OTodo to2( to ); | 704 | OTodo to2( to ); |
705 | 705 | ||
706 | /* the spinned off one won't recur anymore */ | 706 | /* the spinned off one won't recur anymore */ |
707 | to.setRecurrence( ORecur() ); | 707 | to.setRecurrence( ORecur() ); |
708 | 708 | ||
709 | ORecur rec = to2.recurrence(); | 709 | ORecur rec = to2.recurrence(); |
710 | rec.setStart( to.dueDate() ); | 710 | rec.setStart( to.dueDate() ); |
711 | to2.setRecurrence( rec ); | 711 | to2.setRecurrence( rec ); |
712 | /* | 712 | /* |
713 | * if there is a next occurence | 713 | * if there is a next occurence |
714 | * from the duedate of the last recurrance | 714 | * from the duedate of the last recurrance |
715 | */ | 715 | */ |
716 | QDate date; | 716 | QDate date; |
717 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { | 717 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { |
718 | QDate inval; | 718 | QDate inval; |
719 | /* generate a new uid for the old record */ | 719 | /* generate a new uid for the old record */ |
720 | to.setUid( 1 ); | 720 | to.setUid( 1 ); |
721 | 721 | ||
722 | /* add the old one cause it has a new UID here cause it was spin off */ | 722 | /* add the old one cause it has a new UID here cause it was spin off */ |
723 | m_todoMgr.add( to ); | 723 | m_todoMgr.add( to ); |
724 | 724 | ||
725 | /* | 725 | /* |
726 | * update the due date | 726 | * update the due date |
727 | * start date | 727 | * start date |
728 | * and complete date | 728 | * and complete date |
729 | */ | 729 | */ |
730 | to2.setDueDate( date ); | 730 | to2.setDueDate( date ); |
731 | to2.setStartDate( inval ); | 731 | to2.setStartDate( inval ); |
732 | to2.setCompletedDate( inval ); | 732 | to2.setCompletedDate( inval ); |
733 | to2.setCompleted( false ); | 733 | to2.setCompleted( false ); |
734 | updateTodo( to2 ); | 734 | updateTodo( to2 ); |
735 | }else | 735 | }else |
736 | updateTodo( to ); | 736 | updateTodo( to ); |
737 | }else | 737 | }else |
738 | updateTodo( to ); | 738 | updateTodo( to ); |
739 | 739 | ||
740 | currentView()->updateView(); | 740 | currentView()->updateView(); |
741 | raiseCurrentView(); | 741 | raiseCurrentView(); |
742 | } | 742 | } |
743 | void MainWindow::flush() { | 743 | void MainWindow::flush() { |
744 | slotFlush(); | 744 | slotFlush(); |
745 | } | 745 | } |
746 | void MainWindow::reload() { | 746 | void MainWindow::reload() { |
747 | slotReload(); | 747 | slotReload(); |
748 | } | 748 | } |
749 | int MainWindow::create() { | 749 | int MainWindow::create() { |
750 | int uid = 0; | 750 | int uid = 0; |
751 | if(m_syncing) { | 751 | if(m_syncing) { |
752 | QMessageBox::warning(this, QWidget::tr("Todo"), | 752 | QMessageBox::warning(this, QWidget::tr("Todo"), |
753 | QWidget::tr("Can not edit data, currently syncing")); | 753 | QWidget::tr("Can not edit data, currently syncing")); |
754 | return uid; | 754 | return uid; |
755 | } | 755 | } |
756 | 756 | ||
757 | 757 | ||
758 | OTodo todo = currentEditor()->newTodo( currentCatId(), | 758 | OTodo todo = currentEditor()->newTodo( currentCatId(), |
759 | this ); | 759 | this ); |
760 | 760 | ||
761 | if ( currentEditor()->accepted() ) { | 761 | if ( currentEditor()->accepted() ) { |
762 | //todo.assignUid(); | 762 | //todo.assignUid(); |
763 | uid = todo.uid(); | 763 | uid = todo.uid(); |
764 | m_todoMgr.add( todo ); | 764 | m_todoMgr.add( todo ); |
765 | currentView()->addEvent( todo ); | 765 | currentView()->addEvent( todo ); |
766 | 766 | ||
767 | 767 | ||
768 | // I'm afraid we must call this every time now, otherwise | 768 | // I'm afraid we must call this every time now, otherwise |
769 | // spend expensive time comparing all these strings... | 769 | // spend expensive time comparing all these strings... |
770 | // but only call if we changed something -zecke | 770 | // but only call if we changed something -zecke |
771 | populateCategories(); | 771 | populateCategories(); |
772 | } | 772 | } |
773 | raiseCurrentView( ); | 773 | raiseCurrentView( ); |
774 | 774 | ||
775 | return uid; | 775 | return uid; |
776 | } | 776 | } |
777 | /* delete it silently... */ | 777 | /* delete it silently... */ |
778 | bool MainWindow::remove( int uid ) { | 778 | bool MainWindow::remove( int uid ) { |
779 | if (m_syncing) return false; | 779 | if (m_syncing) return false; |
780 | 780 | ||
781 | return m_todoMgr.remove( uid ); | 781 | return m_todoMgr.remove( uid ); |
782 | } | 782 | } |
783 | void MainWindow::beam( int uid, int ) { | 783 | void MainWindow::beam( int uid) { |
784 | ::unlink( beamfile ); | 784 | ::unlink( beamfile ); |
785 | OTodo todo = event( uid ); | 785 | OTodo todo = event( uid ); |
786 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); | 786 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); |
787 | OTodoAccess acc( cal ); | 787 | OTodoAccess acc( cal ); |
788 | acc.load(); | 788 | acc.load(); |
789 | acc.add( todo ); | 789 | acc.add( todo ); |
790 | acc.save(); | 790 | acc.save(); |
791 | Ir* ir = new Ir(this ); | 791 | Ir* ir = new Ir(this ); |
792 | connect(ir, SIGNAL(done(Ir*) ), | 792 | connect(ir, SIGNAL(done(Ir*) ), |
793 | this, SLOT(beamDone(Ir*) ) ); | 793 | this, SLOT(beamDone(Ir*) ) ); |
794 | ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); | 794 | ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); |
795 | } | 795 | } |
796 | void MainWindow::show( int uid ) { | 796 | void MainWindow::show( int uid ) { |
797 | slotShow( uid ); | 797 | slotShow( uid ); |
798 | } | 798 | } |
799 | void MainWindow::edit( int uid ) { | 799 | void MainWindow::edit( int uid ) { |
800 | slotEdit( uid ); | 800 | slotEdit( uid ); |
801 | } | 801 | } |
802 | void MainWindow::add( const OPimRecord& rec) { | 802 | void MainWindow::add( const OPimRecord& rec) { |
803 | if ( rec.rtti() != OTodo::rtti() ) return; | 803 | if ( rec.rtti() != OTodo::rtti() ) return; |
804 | 804 | ||
805 | const OTodo& todo = static_cast<const OTodo&>(rec); | 805 | const OTodo& todo = static_cast<const OTodo&>(rec); |
806 | 806 | ||
807 | m_todoMgr.add(todo ); | 807 | m_todoMgr.add(todo ); |
808 | currentView()->addEvent( todo ); | 808 | currentView()->addEvent( todo ); |
809 | 809 | ||
810 | 810 | ||
811 | // I'm afraid we must call this every time now, otherwise | 811 | // I'm afraid we must call this every time now, otherwise |
812 | // spend expensive time comparing all these strings... | 812 | // spend expensive time comparing all these strings... |
813 | // but only call if we changed something -zecke | 813 | // but only call if we changed something -zecke |
814 | populateCategories(); | 814 | populateCategories(); |
815 | } | 815 | } |
816 | void MainWindow::slotReturnFromView() { | 816 | void MainWindow::slotReturnFromView() { |
817 | raiseCurrentView(); | 817 | raiseCurrentView(); |
818 | } | 818 | } |
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index f880505..434e969 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -1,201 +1,201 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This program is free software; you can | 5 | _;:, .> :=|. This program is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This program is distributed in the hope that | 12 | .i_,=:_. -<s. This program is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef TODO_MAIN_WINDOW_H | 29 | #ifndef TODO_MAIN_WINDOW_H |
30 | #define TODO_MAIN_WINDOW_H | 30 | #define TODO_MAIN_WINDOW_H |
31 | 31 | ||
32 | #include <qlist.h> | 32 | #include <qlist.h> |
33 | 33 | ||
34 | #include <opie/otodoaccess.h> | 34 | #include <opie/otodoaccess.h> |
35 | #include <opie/otodo.h> | 35 | #include <opie/otodo.h> |
36 | #include <opie/opimmainwindow.h> | 36 | #include <opie/opimmainwindow.h> |
37 | 37 | ||
38 | #include "smalltodo.h" | 38 | #include "smalltodo.h" |
39 | #include "todoview.h" | 39 | #include "todoview.h" |
40 | #include "quickedit.h" | 40 | #include "quickedit.h" |
41 | #include "todomanager.h" | 41 | #include "todomanager.h" |
42 | 42 | ||
43 | class QPopupMenu; | 43 | class QPopupMenu; |
44 | class QMenuBar; | 44 | class QMenuBar; |
45 | class QToolBar; | 45 | class QToolBar; |
46 | class QAction; | 46 | class QAction; |
47 | class QWidgetStack; | 47 | class QWidgetStack; |
48 | class Ir; | 48 | class Ir; |
49 | class QVBox; | 49 | class QVBox; |
50 | class QLineEdit; | 50 | class QLineEdit; |
51 | 51 | ||
52 | namespace Todo { | 52 | namespace Todo { |
53 | typedef TodoView View; | 53 | typedef TodoView View; |
54 | class TemplateManager; | 54 | class TemplateManager; |
55 | class Editor; | 55 | class Editor; |
56 | class TodoShow; | 56 | class TodoShow; |
57 | class TemplateEditor; | 57 | class TemplateEditor; |
58 | struct QuickEditBase; | 58 | struct QuickEditBase; |
59 | 59 | ||
60 | class MainWindow : public OPimMainWindow { | 60 | class MainWindow : public OPimMainWindow { |
61 | Q_OBJECT | 61 | Q_OBJECT |
62 | friend class TodoView; // avoid QObject here.... | 62 | friend class TodoView; // avoid QObject here.... |
63 | friend class TodoShow; // avoid QObject | 63 | friend class TodoShow; // avoid QObject |
64 | public: | 64 | public: |
65 | MainWindow( QWidget *parent = 0, | 65 | MainWindow( QWidget *parent = 0, |
66 | const char* name = 0 ); | 66 | const char* name = 0 ); |
67 | ~MainWindow(); | 67 | ~MainWindow(); |
68 | 68 | ||
69 | /** return a context menu for an OTodo */ | 69 | /** return a context menu for an OTodo */ |
70 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); | 70 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); |
71 | QPopupMenu* options(); | 71 | QPopupMenu* options(); |
72 | QPopupMenu* edit(); | 72 | QPopupMenu* edit(); |
73 | QToolBar* toolbar(); | 73 | QToolBar* toolbar(); |
74 | 74 | ||
75 | 75 | ||
76 | void updateList(); | 76 | void updateList(); |
77 | OTodoAccess::List list()const; | 77 | OTodoAccess::List list()const; |
78 | OTodoAccess::List sorted( bool asc, int sortOrder ); | 78 | OTodoAccess::List sorted( bool asc, int sortOrder ); |
79 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); | 79 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); |
80 | 80 | ||
81 | OTodo event(int uid ); | 81 | OTodo event(int uid ); |
82 | 82 | ||
83 | bool isSyncing()const; | 83 | bool isSyncing()const; |
84 | bool showCompleted()const; | 84 | bool showCompleted()const; |
85 | bool showDeadline()const; | 85 | bool showDeadline()const; |
86 | bool showOverDue()const; | 86 | bool showOverDue()const; |
87 | bool showQuickTask()const; | 87 | bool showQuickTask()const; |
88 | QString currentCategory()const; | 88 | QString currentCategory()const; |
89 | int currentCatId(); | 89 | int currentCatId(); |
90 | TemplateManager* templateManager(); | 90 | TemplateManager* templateManager(); |
91 | QuickEditBase* quickEditor(); | 91 | QuickEditBase* quickEditor(); |
92 | 92 | ||
93 | void updateTodo( const OTodo& ); | 93 | void updateTodo( const OTodo& ); |
94 | void populateTemplates(); | 94 | void populateTemplates(); |
95 | Editor* currentEditor(); | 95 | Editor* currentEditor(); |
96 | void setReadAhead(uint count ); | 96 | void setReadAhead(uint count ); |
97 | private slots: | 97 | private slots: |
98 | void slotQuickEntered(); | 98 | void slotQuickEntered(); |
99 | void populateCategories(); | 99 | void populateCategories(); |
100 | void slotReload(); | 100 | void slotReload(); |
101 | void slotFlush(); | 101 | void slotFlush(); |
102 | 102 | ||
103 | protected: | 103 | protected: |
104 | void closeEvent( QCloseEvent* e ); | 104 | void closeEvent( QCloseEvent* e ); |
105 | 105 | ||
106 | private: | 106 | private: |
107 | void receiveFile( const QString& filename ); | 107 | void receiveFile( const QString& filename ); |
108 | void connectBase( ViewBase* ); | 108 | void connectBase( ViewBase* ); |
109 | void initUI(); | 109 | void initUI(); |
110 | void initActions(); | 110 | void initActions(); |
111 | void initConfig(); | 111 | void initConfig(); |
112 | void initViews(); | 112 | void initViews(); |
113 | void initEditor(); | 113 | void initEditor(); |
114 | void initShow(); | 114 | void initShow(); |
115 | void initTemplate(); | 115 | void initTemplate(); |
116 | void raiseCurrentView(); | 116 | void raiseCurrentView(); |
117 | ViewBase* currentView(); | 117 | ViewBase* currentView(); |
118 | ViewBase* m_curView; | 118 | ViewBase* m_curView; |
119 | QuickEditBase* m_curQuick; | 119 | QuickEditBase* m_curQuick; |
120 | Editor* m_curEdit; | 120 | Editor* m_curEdit; |
121 | TodoShow* currentShow(); | 121 | TodoShow* currentShow(); |
122 | TodoShow* m_curShow; | 122 | TodoShow* m_curShow; |
123 | TemplateEditor* currentTemplateEditor(); | 123 | TemplateEditor* currentTemplateEditor(); |
124 | TemplateEditor* m_curTempEd; | 124 | TemplateEditor* m_curTempEd; |
125 | 125 | ||
126 | QMenuBar* m_bar; | 126 | QMenuBar* m_bar; |
127 | QToolBar* m_tool; | 127 | QToolBar* m_tool; |
128 | QAction* m_editAction, | 128 | QAction* m_editAction, |
129 | *m_deleteAction, | 129 | *m_deleteAction, |
130 | *m_findAction, | 130 | *m_findAction, |
131 | *m_completedAction, | 131 | *m_completedAction, |
132 | *m_showDeadLineAction, | 132 | *m_showDeadLineAction, |
133 | *m_deleteAllAction, | 133 | *m_deleteAllAction, |
134 | *m_deleteCompleteAction, | 134 | *m_deleteCompleteAction, |
135 | *m_duplicateAction, | 135 | *m_duplicateAction, |
136 | *m_showOverDueAction, | 136 | *m_showOverDueAction, |
137 | *m_showQuickTaskAction, | 137 | *m_showQuickTaskAction, |
138 | *m_effectiveAction; | 138 | *m_effectiveAction; |
139 | QWidgetStack *m_stack; | 139 | QWidgetStack *m_stack; |
140 | QPopupMenu* m_catMenu, | 140 | QPopupMenu* m_catMenu, |
141 | *m_edit, | 141 | *m_edit, |
142 | *m_options, | 142 | *m_options, |
143 | *m_template; | 143 | *m_template; |
144 | 144 | ||
145 | bool m_syncing:1; | 145 | bool m_syncing:1; |
146 | bool m_deadline:1; | 146 | bool m_deadline:1; |
147 | bool m_completed:1; | 147 | bool m_completed:1; |
148 | bool m_overdue:1; | 148 | bool m_overdue:1; |
149 | bool m_quicktask:1; | 149 | bool m_quicktask:1; |
150 | TodoManager m_todoMgr; | 150 | TodoManager m_todoMgr; |
151 | QString m_curCat; | 151 | QString m_curCat; |
152 | QList<ViewBase> m_views; | 152 | QList<ViewBase> m_views; |
153 | uint m_counter; | 153 | uint m_counter; |
154 | TemplateManager* m_tempManager; | 154 | TemplateManager* m_tempManager; |
155 | 155 | ||
156 | 156 | ||
157 | private slots: | 157 | private slots: |
158 | void slotShow(int); | 158 | void slotShow(int); |
159 | void slotEdit(int); | 159 | void slotEdit(int); |
160 | void slotUpdate3( QWidget* ); | 160 | void slotUpdate3( QWidget* ); |
161 | void slotComplete( int uid ); | 161 | void slotComplete( int uid ); |
162 | void slotComplete( const OTodo& ev ); | 162 | void slotComplete( const OTodo& ev ); |
163 | void slotNewFromTemplate(int id ); | 163 | void slotNewFromTemplate(int id ); |
164 | void slotNew(); | 164 | void slotNew(); |
165 | void slotDuplicate(); | 165 | void slotDuplicate(); |
166 | 166 | ||
167 | void slotDelete(); | 167 | void slotDelete(); |
168 | void slotDeleteAll(); | 168 | void slotDeleteAll(); |
169 | void slotDeleteCompleted(); | 169 | void slotDeleteCompleted(); |
170 | 170 | ||
171 | void slotEdit(); | 171 | void slotEdit(); |
172 | void slotFind(); | 172 | void slotFind(); |
173 | 173 | ||
174 | void setCategory( int ); | 174 | void setCategory( int ); |
175 | 175 | ||
176 | void slotShowDeadLine( bool ); | 176 | void slotShowDeadLine( bool ); |
177 | void slotShowCompleted( bool ); | 177 | void slotShowCompleted( bool ); |
178 | void slotShowQuickTask( bool ); | 178 | void slotShowQuickTask( bool ); |
179 | 179 | ||
180 | void setDocument( const QString& ); | 180 | void setDocument( const QString& ); |
181 | 181 | ||
182 | 182 | ||
183 | void slotBeam(); | 183 | void slotBeam(); |
184 | void beamDone( Ir* ); | 184 | void beamDone( Ir* ); |
185 | void slotShowDetails(); | 185 | void slotShowDetails(); |
186 | void slotShowDue( bool ); | 186 | void slotShowDue( bool ); |
187 | void slotReturnFromView(); // for TodoShow... | 187 | void slotReturnFromView(); // for TodoShow... |
188 | /* reimplementation from opimmainwindow */ | 188 | /* reimplementation from opimmainwindow */ |
189 | protected slots: | 189 | protected slots: |
190 | void flush(); | 190 | void flush(); |
191 | void reload(); | 191 | void reload(); |
192 | int create(); | 192 | int create(); |
193 | bool remove( int uid ); | 193 | bool remove( int uid ); |
194 | void beam(int uid, int transport = IrDa ); | 194 | void beam(int uid); |
195 | void show( int uid ); | 195 | void show( int uid ); |
196 | void edit( int uid ); | 196 | void edit( int uid ); |
197 | void add( const OPimRecord& ); | 197 | void add( const OPimRecord& ); |
198 | }; | 198 | }; |
199 | }; | 199 | }; |
200 | 200 | ||
201 | #endif | 201 | #endif |