summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-02 00:09:04 (UTC)
committer zautrix <zautrix>2004-08-02 00:09:04 (UTC)
commit3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0 (patch) (unidiff)
treefdff56329649c084b6f5af8d8e96c0157686575e
parent3b4aa1cd78395c0f94b99decd901842944765746 (diff)
downloadkdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.zip
kdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.tar.gz
kdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.tar.bz2
More sync hacking
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp76
-rw-r--r--korganizer/calendarview.h5
-rw-r--r--korganizer/koprefs.cpp27
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/mainwindow.cpp3
-rw-r--r--libkcal/calendar.h2
-rw-r--r--libkcal/calendarlocal.cpp14
-rw-r--r--libkcal/calendarlocal.h2
8 files changed, 87 insertions, 43 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index cfc6b10..9160e1d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -661,877 +661,903 @@ KODialogManager *CalendarView::dialogManager()
661QDate CalendarView::startDate() 661QDate CalendarView::startDate()
662{ 662{
663 DateList dates = mNavigator->selectedDates(); 663 DateList dates = mNavigator->selectedDates();
664 664
665 return dates.first(); 665 return dates.first();
666} 666}
667 667
668QDate CalendarView::endDate() 668QDate CalendarView::endDate()
669{ 669{
670 DateList dates = mNavigator->selectedDates(); 670 DateList dates = mNavigator->selectedDates();
671 671
672 return dates.last(); 672 return dates.last();
673} 673}
674 674
675 675
676void CalendarView::createPrinter() 676void CalendarView::createPrinter()
677{ 677{
678#ifndef KORG_NOPRINTER 678#ifndef KORG_NOPRINTER
679 if (!mCalPrinter) { 679 if (!mCalPrinter) {
680 mCalPrinter = new CalPrinter(this, mCalendar); 680 mCalPrinter = new CalPrinter(this, mCalendar);
681 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 681 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
682 } 682 }
683#endif 683#endif
684} 684}
685 685
686void CalendarView::confSync() 686void CalendarView::confSync()
687{ 687{
688 static KSyncPrefsDialog* sp = 0; 688 static KSyncPrefsDialog* sp = 0;
689 if ( ! sp ) { 689 if ( ! sp ) {
690 sp = new KSyncPrefsDialog( this, "syncprefs", true ); 690 sp = new KSyncPrefsDialog( this, "syncprefs", true );
691 } 691 }
692 sp->usrReadConfig(); 692 sp->usrReadConfig();
693#ifndef DESKTOP_VERSION 693#ifndef DESKTOP_VERSION
694 sp->showMaximized(); 694 sp->showMaximized();
695#else 695#else
696 sp->show(); 696 sp->show();
697#endif 697#endif
698 sp->exec(); 698 sp->exec();
699 KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); 699 KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames();
700 KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); 700 KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName ();
701} 701}
702 702
703 703
704//KOPrefs::instance()->mWriteBackFile 704//KOPrefs::instance()->mWriteBackFile
705//KOPrefs::instance()->mWriteBackExistingOnly 705//KOPrefs::instance()->mWriteBackExistingOnly
706 706
707// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 707// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
708// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 708// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
709// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 709// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
710// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 710// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
711// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 711// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
712// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 712// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
713 713
714int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 714int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
715{ 715{
716 716
717 //void setZaurusId(int id); 717 //void setZaurusId(int id);
718 // int zaurusId() const; 718 // int zaurusId() const;
719 // void setZaurusUid(int id); 719 // void setZaurusUid(int id);
720 // int zaurusUid() const; 720 // int zaurusUid() const;
721 // void setZaurusStat(int id); 721 // void setZaurusStat(int id);
722 // int zaurusStat() const; 722 // int zaurusStat() const;
723 // 0 equal 723 // 0 equal
724 // 1 take local 724 // 1 take local
725 // 2 take remote 725 // 2 take remote
726 // 3 cancel 726 // 3 cancel
727 QDateTime lastSync = mLastCalendarSync; 727 QDateTime lastSync = mLastCalendarSync;
728 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 728 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
729 bool remCh, locCh; 729 bool remCh, locCh;
730 remCh = ( remote->zaurusUid() != local->zaurusUid() ); 730 remCh = ( remote->zaurusUid() != local->zaurusUid() );
731 locCh = ( local->lastModified() > mLastCalendarSync ); 731 locCh = ( local->lastModified() > mLastCalendarSync );
732 //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); 732 //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() );
733 if ( !remCh && ! locCh ) { 733 if ( !remCh && ! locCh ) {
734 //qDebug("both not changed "); 734 //qDebug("both not changed ");
735 lastSync = local->lastModified().addDays(1); 735 lastSync = local->lastModified().addDays(1);
736 } else { 736 } else {
737 if ( locCh ) { 737 if ( locCh ) {
738 //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); 738 //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() );
739 lastSync = local->lastModified().addDays( -1 ); 739 lastSync = local->lastModified().addDays( -1 );
740 if ( !remCh ) 740 if ( !remCh )
741 remote->setLastModified( lastSync.addDays( -1 ) ); 741 remote->setLastModified( lastSync.addDays( -1 ) );
742 } else { 742 } else {
743 //qDebug(" not loc changed "); 743 //qDebug(" not loc changed ");
744 lastSync = local->lastModified().addDays( 1 ); 744 lastSync = local->lastModified().addDays( 1 );
745 if ( remCh ) 745 if ( remCh )
746 remote->setLastModified( lastSync.addDays( 1 ) ); 746 remote->setLastModified( lastSync.addDays( 1 ) );
747 747
748 } 748 }
749 } 749 }
750 full = true; 750 full = true;
751 if ( mode < SYNC_PREF_ASK ) 751 if ( mode < SYNC_PREF_ASK )
752 mode = SYNC_PREF_ASK; 752 mode = SYNC_PREF_ASK;
753 } else { 753 } else {
754 if ( local->lastModified() == remote->lastModified() ) 754 if ( local->lastModified() == remote->lastModified() )
755 if ( local->revision() == remote->revision() ) 755 if ( local->revision() == remote->revision() )
756 return 0; 756 return 0;
757 757
758 } 758 }
759 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 759 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
760 760
761 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); 761 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision());
762 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 762 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
763 //full = true; //debug only 763 //full = true; //debug only
764 if ( full ) { 764 if ( full ) {
765 bool equ = false; 765 bool equ = false;
766 if ( local->type() == "Event" ) { 766 if ( local->type() == "Event" ) {
767 equ = (*((Event*) local) == *((Event*) remote)); 767 equ = (*((Event*) local) == *((Event*) remote));
768 } 768 }
769 else if ( local->type() =="Todo" ) 769 else if ( local->type() =="Todo" )
770 equ = (*((Todo*) local) == (*(Todo*) remote)); 770 equ = (*((Todo*) local) == (*(Todo*) remote));
771 else if ( local->type() =="Journal" ) 771 else if ( local->type() =="Journal" )
772 equ = (*((Journal*) local) == *((Journal*) remote)); 772 equ = (*((Journal*) local) == *((Journal*) remote));
773 if ( equ ) { 773 if ( equ ) {
774 //qDebug("equal "); 774 //qDebug("equal ");
775 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 775 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
776 local->setZaurusUid( remote->zaurusUid() ); 776 local->setZaurusUid( remote->zaurusUid() );
777 } 777 }
778 if ( mode < SYNC_PREF_FORCE_LOCAL ) 778 if ( mode < SYNC_PREF_FORCE_LOCAL )
779 return 0; 779 return 0;
780 780
781 }//else //debug only 781 }//else //debug only
782 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 782 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
783 } 783 }
784 int result; 784 int result;
785 bool localIsNew; 785 bool localIsNew;
786 if ( full && mode < SYNC_PREF_NEWEST ) 786 if ( full && mode < SYNC_PREF_NEWEST )
787 mode = SYNC_PREF_ASK; 787 mode = SYNC_PREF_ASK;
788 788
789 switch( mode ) { 789 switch( mode ) {
790 case SYNC_PREF_LOCAL: 790 case SYNC_PREF_LOCAL:
791 if ( lastSync > remote->lastModified() ) 791 if ( lastSync > remote->lastModified() )
792 return 1; 792 return 1;
793 if ( lastSync > local->lastModified() ) 793 if ( lastSync > local->lastModified() )
794 return 2; 794 return 2;
795 return 1; 795 return 1;
796 break; 796 break;
797 case SYNC_PREF_REMOTE: 797 case SYNC_PREF_REMOTE:
798 if ( lastSync > remote->lastModified() ) 798 if ( lastSync > remote->lastModified() )
799 return 1; 799 return 1;
800 if ( lastSync > local->lastModified() ) 800 if ( lastSync > local->lastModified() )
801 return 2; 801 return 2;
802 return 2; 802 return 2;
803 break; 803 break;
804 case SYNC_PREF_NEWEST: 804 case SYNC_PREF_NEWEST:
805 if ( local->lastModified() > remote->lastModified() ) 805 if ( local->lastModified() > remote->lastModified() )
806 return 1; 806 return 1;
807 else 807 else
808 return 2; 808 return 2;
809 break; 809 break;
810 case SYNC_PREF_ASK: 810 case SYNC_PREF_ASK:
811 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 811 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() );
812 if ( lastSync > remote->lastModified() ) 812 if ( lastSync > remote->lastModified() )
813 return 1; 813 return 1;
814 if ( lastSync > local->lastModified() ) 814 if ( lastSync > local->lastModified() )
815 return 2; 815 return 2;
816 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 816 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() );
817 localIsNew = local->lastModified() > remote->lastModified(); 817 localIsNew = local->lastModified() > remote->lastModified();
818 if ( localIsNew ) 818 if ( localIsNew )
819 getEventViewerDialog()->setColorMode( 1 ); 819 getEventViewerDialog()->setColorMode( 1 );
820 else 820 else
821 getEventViewerDialog()->setColorMode( 2 ); 821 getEventViewerDialog()->setColorMode( 2 );
822 getEventViewerDialog()->setIncidence(local); 822 getEventViewerDialog()->setIncidence(local);
823 if ( localIsNew ) 823 if ( localIsNew )
824 getEventViewerDialog()->setColorMode( 2 ); 824 getEventViewerDialog()->setColorMode( 2 );
825 else 825 else
826 getEventViewerDialog()->setColorMode( 1 ); 826 getEventViewerDialog()->setColorMode( 1 );
827 getEventViewerDialog()->addIncidence(remote); 827 getEventViewerDialog()->addIncidence(remote);
828 getEventViewerDialog()->setColorMode( 0 ); 828 getEventViewerDialog()->setColorMode( 0 );
829 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 829 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
830 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 830 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
831 getEventViewerDialog()->showMe(); 831 getEventViewerDialog()->showMe();
832 result = getEventViewerDialog()->executeS( localIsNew ); 832 result = getEventViewerDialog()->executeS( localIsNew );
833 return result; 833 return result;
834 834
835 break; 835 break;
836 case SYNC_PREF_FORCE_LOCAL: 836 case SYNC_PREF_FORCE_LOCAL:
837 return 1; 837 return 1;
838 break; 838 break;
839 case SYNC_PREF_FORCE_REMOTE: 839 case SYNC_PREF_FORCE_REMOTE:
840 return 2; 840 return 2;
841 break; 841 break;
842 842
843 default: 843 default:
844 // SYNC_PREF_TAKE_BOTH not implemented 844 // SYNC_PREF_TAKE_BOTH not implemented
845 break; 845 break;
846 } 846 }
847 return 0; 847 return 0;
848} 848}
849Event* CalendarView::getLastSyncEvent() 849Event* CalendarView::getLastSyncEvent()
850{ 850{
851 Event* lse; 851 Event* lse;
852 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 852 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
853 lse = mCalendar->event( "last-syncEvent-device-"+mCurrentSyncDevice ); 853 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
854 if (!lse) { 854 if (!lse) {
855 lse = new Event(); 855 lse = new Event();
856 lse->setUid( "last-syncEvent-device-"+mCurrentSyncDevice ); 856 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
857 lse->setSummary(mCurrentSyncDevice + i18n(" - sync event")); 857 QString sum = "";
858 if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
859 sum = "E: ";
860 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
858 lse->setDtStart( mLastCalendarSync ); 861 lse->setDtStart( mLastCalendarSync );
859 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 862 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
860 lse->setCategories( i18n("SyncEvent") ); 863 lse->setCategories( i18n("SyncEvent") );
861 lse->setReadOnly( true ); 864 lse->setReadOnly( true );
862 mCalendar->addEvent( lse ); 865 mCalendar->addEvent( lse );
863 } 866 }
864 867
865 return lse; 868 return lse;
866 869
867} 870}
868void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete ) 871void CalendarView::setupExternSyncProfiles()
869{ 872{
870 if ( ! lastSync ) 873 Event* lse;
871 return; 874 mExternLastSyncEvent.clear();
872 if ( toDelete->zaurusId() < 0 ) 875 int i;
876 for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) {
877 lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] );
878 if ( lse )
879 mExternLastSyncEvent.append( lse );
880 else
881 qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1());
882 }
883
884}
885// we check, if the to delete event has a id for a profile
886// if yes, we set this id in the profile to delete
887void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
888{
889 if ( ! lastSync.count() == 0 )
873 return; 890 return;
874 if ( toDelete->type() == "Journal" ) 891 if ( toDelete->type() == "Journal" )
875 return; 892 return;
876 QString des = lastSync->description(); 893
877 QString pref = "e"; 894 Event* eve = lastSync.first();
878 if ( toDelete->type() == "Todo" ) 895
879 pref = "t"; 896 while ( eve ) {
880 des += pref+ QString::number ( toDelete->zaurusId() ) + ","; 897 int id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
881 lastSync->setReadOnly( false ); 898 if ( id >= 0 ) {
882 lastSync->setDescription( des ); 899 QString des = eve->description();
883 lastSync->setReadOnly( true ); 900 QString pref = "e";
901 if ( toDelete->type() == "Todo" )
902 pref = "t";
903 des += pref+ QString::number ( id ) + ",";
904 eve->setReadOnly( false );
905 eve->setDescription( des );
906 eve->setReadOnly( true );
907 }
908 eve = lastSync.next();
909 }
884 910
885} 911}
886bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 912bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
887{ 913{
888 bool syncOK = true; 914 bool syncOK = true;
889 int addedEvent = 0; 915 int addedEvent = 0;
890 int addedEventR = 0; 916 int addedEventR = 0;
891 int deletedEventR = 0; 917 int deletedEventR = 0;
892 int deletedEventL = 0; 918 int deletedEventL = 0;
893 int changedLocal = 0; 919 int changedLocal = 0;
894 int changedRemote = 0; 920 int changedRemote = 0;
895 //QPtrList<Event> el = local->rawEvents(); 921 //QPtrList<Event> el = local->rawEvents();
896 Event* eventR; 922 Event* eventR;
897 QString uid; 923 QString uid;
898 int take; 924 int take;
899 Event* eventL; 925 Event* eventL;
900 Event* eventRSync; 926 Event* eventRSync;
901 Event* eventLSync; 927 Event* eventLSync;
902 Event* eventRSyncSharp = remote->event( "last-syncEvent-device-Sharp-DTM"); 928 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
903 Event* eventLSyncSharp = local->event( "last-syncEvent-device-Sharp-DTM"); 929 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
904 bool fullDateRange = false; 930 bool fullDateRange = false;
905 mLastCalendarSync = QDateTime::currentDateTime(); 931 mLastCalendarSync = QDateTime::currentDateTime();
906 QDateTime modifiedCalendar = mLastCalendarSync;; 932 QDateTime modifiedCalendar = mLastCalendarSync;;
907 eventR = remote->event("last-syncEvent-device-"+mCurrentSyncName ); 933 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
908 if ( eventR ) { 934 if ( eventR ) {
909 eventRSync = (Event*) eventR->clone(); 935 eventRSync = (Event*) eventR->clone();
910 remote->deleteEvent(eventR ); 936 remote->deleteEvent(eventR );
911 937
912 } else { 938 } else {
913 fullDateRange = true; 939 fullDateRange = true;
914 eventRSync = new Event(); 940 eventRSync = new Event();
915 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 941 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
916 eventRSync->setUid("last-syncEvent-device-"+mCurrentSyncName ); 942 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
917 eventRSync->setDtStart( mLastCalendarSync ); 943 eventRSync->setDtStart( mLastCalendarSync );
918 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 944 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
919 eventRSync->setCategories( i18n("SyncEvent") ); 945 eventRSync->setCategories( i18n("SyncEvent") );
920 } 946 }
921 eventLSync = getLastSyncEvent(); 947 eventLSync = getLastSyncEvent();
922 if ( eventLSync->dtStart() == mLastCalendarSync ) 948 if ( eventLSync->dtStart() == mLastCalendarSync )
923 fullDateRange = true; 949 fullDateRange = true;
924 950
925 if ( ! fullDateRange ) { 951 if ( ! fullDateRange ) {
926 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 952 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
927 953
928 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 954 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
929 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 955 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
930 fullDateRange = true; 956 fullDateRange = true;
931 } 957 }
932 } 958 }
933 if ( fullDateRange ) 959 if ( fullDateRange )
934 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 960 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
935 else 961 else
936 mLastCalendarSync = eventLSync->dtStart(); 962 mLastCalendarSync = eventLSync->dtStart();
937 // for resyncing if own file has changed 963 // for resyncing if own file has changed
938 if ( mCurrentSyncDevice == "deleteaftersync" ) { 964 if ( mCurrentSyncDevice == "deleteaftersync" ) {
939 mLastCalendarSync = loadedFileVersion; 965 mLastCalendarSync = loadedFileVersion;
940 qDebug("setting mLastCalendarSync "); 966 qDebug("setting mLastCalendarSync ");
941 } 967 }
942 //qDebug("*************************** "); 968 //qDebug("*************************** ");
943 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); 969 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() );
944 QPtrList<Incidence> er = remote->rawIncidences(); 970 QPtrList<Incidence> er = remote->rawIncidences();
945 Incidence* inR = er.first(); 971 Incidence* inR = er.first();
946 Incidence* inL; 972 Incidence* inL;
947 QProgressBar bar( er.count(),0 ); 973 QProgressBar bar( er.count(),0 );
948 bar.setCaption (i18n("Syncing - close to abort!") ); 974 bar.setCaption (i18n("Syncing - close to abort!") );
949 975
950 int w = 300; 976 int w = 300;
951 if ( QApplication::desktop()->width() < 320 ) 977 if ( QApplication::desktop()->width() < 320 )
952 w = 220; 978 w = 220;
953 int h = bar.sizeHint().height() ; 979 int h = bar.sizeHint().height() ;
954 int dw = QApplication::desktop()->width(); 980 int dw = QApplication::desktop()->width();
955 int dh = QApplication::desktop()->height(); 981 int dh = QApplication::desktop()->height();
956 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 982 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
957 bar.show(); 983 bar.show();
958 int modulo = (er.count()/10)+1; 984 int modulo = (er.count()/10)+1;
959 int incCounter = 0; 985 int incCounter = 0;
960 while ( inR ) { 986 while ( inR ) {
961 if ( ! bar.isVisible() ) 987 if ( ! bar.isVisible() )
962 return false; 988 return false;
963 if ( incCounter % modulo == 0 ) 989 if ( incCounter % modulo == 0 )
964 bar.setProgress( incCounter ); 990 bar.setProgress( incCounter );
965 ++incCounter; 991 ++incCounter;
966 uid = inR->uid(); 992 uid = inR->uid();
967 bool skipIncidence = false; 993 bool skipIncidence = false;
968 if ( uid.left(21) == QString("last-syncEvent-device") ) 994 if ( uid.left(15) == QString("last-syncEvent-") )
969 skipIncidence = true; 995 skipIncidence = true;
970 996
971 qApp->processEvents(); 997 qApp->processEvents();
972 if ( !skipIncidence ) { 998 if ( !skipIncidence ) {
973 inL = local->incidence( uid ); 999 inL = local->incidence( uid );
974 if ( inL ) { // maybe conflict - same uid in both calendars 1000 if ( inL ) { // maybe conflict - same uid in both calendars
975 int maxrev = inL->revision(); 1001 int maxrev = inL->revision();
976 if ( maxrev < inR->revision() ) 1002 if ( maxrev < inR->revision() )
977 maxrev = inR->revision(); 1003 maxrev = inR->revision();
978 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1004 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
979 //qDebug("take %d %s ", take, inL->summary().latin1()); 1005 //qDebug("take %d %s ", take, inL->summary().latin1());
980 if ( take == 3 ) 1006 if ( take == 3 )
981 return false; 1007 return false;
982 if ( take == 1 ) {// take local 1008 if ( take == 1 ) {// take local
983 inL->setZaurusUid( inR->zaurusUid() ); 1009 inL->setZaurusUid( inR->zaurusUid() );
984 remote->deleteIncidence( inR ); 1010 remote->deleteIncidence( inR );
985 if ( inL->revision() < maxrev ) 1011 if ( inL->revision() < maxrev )
986 inL->setRevision( maxrev ); 1012 inL->setRevision( maxrev );
987 remote->addIncidence( inL->clone() ); 1013 remote->addIncidence( inL->clone() );
988 ++changedRemote; 1014 ++changedRemote;
989 } else { 1015 } else {
990 if ( inR->revision() < maxrev ) 1016 if ( inR->revision() < maxrev )
991 inR->setRevision( maxrev ); 1017 inR->setRevision( maxrev );
992 local->deleteIncidence( inL ); 1018 local->deleteIncidence( inL );
993 local->addIncidence( inR->clone() ); 1019 local->addIncidence( inR->clone() );
994 ++changedLocal; 1020 ++changedLocal;
995 } 1021 }
996 } 1022 }
997 } else { // no conflict 1023 } else { // no conflict
998 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1024 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
999 QString des = eventLSync->description(); 1025 QString des = eventLSync->description();
1000 QString pref = "e"; 1026 QString pref = "e";
1001 if ( inR->type() == "Todo" ) 1027 if ( inR->type() == "Todo" )
1002 pref = "t"; 1028 pref = "t";
1003 if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it 1029 if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it
1004 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1030 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1005 //remote->deleteIncidence( inR ); 1031 //remote->deleteIncidence( inR );
1006 ++deletedEventR; 1032 ++deletedEventR;
1007 } else { 1033 } else {
1008 inR->setLastModified( modifiedCalendar ); 1034 inR->setLastModified( modifiedCalendar );
1009 local->addIncidence( inR->clone() ); 1035 local->addIncidence( inR->clone() );
1010 ++addedEvent; 1036 ++addedEvent;
1011 } 1037 }
1012 } else { 1038 } else {
1013 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1039 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1014 inR->setLastModified( modifiedCalendar ); 1040 inR->setLastModified( modifiedCalendar );
1015 local->addIncidence( inR->clone() ); 1041 local->addIncidence( inR->clone() );
1016 ++addedEvent; 1042 ++addedEvent;
1017 } else { 1043 } else {
1018 checkSharpEvent(eventRSyncSharp, inR); 1044 checkExternSyncEvent(eventRSyncSharp, inR);
1019 remote->deleteIncidence( inR ); 1045 remote->deleteIncidence( inR );
1020 ++deletedEventR; 1046 ++deletedEventR;
1021 } 1047 }
1022 } 1048 }
1023 } 1049 }
1024 } 1050 }
1025 inR = er.next(); 1051 inR = er.next();
1026 } 1052 }
1027 QPtrList<Incidence> el = local->rawIncidences(); 1053 QPtrList<Incidence> el = local->rawIncidences();
1028 inL = el.first(); 1054 inL = el.first();
1029 modulo = (el.count()/10)+1; 1055 modulo = (el.count()/10)+1;
1030 bar.setCaption (i18n("Add / remove events") ); 1056 bar.setCaption (i18n("Add / remove events") );
1031 bar.setTotalSteps ( el.count() ) ; 1057 bar.setTotalSteps ( el.count() ) ;
1032 bar.show(); 1058 bar.show();
1033 incCounter = 0; 1059 incCounter = 0;
1034 1060
1035 while ( inL ) { 1061 while ( inL ) {
1036 1062
1037 qApp->processEvents(); 1063 qApp->processEvents();
1038 if ( ! bar.isVisible() ) 1064 if ( ! bar.isVisible() )
1039 return false; 1065 return false;
1040 if ( incCounter % modulo == 0 ) 1066 if ( incCounter % modulo == 0 )
1041 bar.setProgress( incCounter ); 1067 bar.setProgress( incCounter );
1042 ++incCounter; 1068 ++incCounter;
1043 uid = inL->uid(); 1069 uid = inL->uid();
1044 bool skipIncidence = false; 1070 bool skipIncidence = false;
1045 if ( uid.left(21) == QString("last-syncEvent-device") ) 1071 if ( uid.left(15) == QString("last-syncEvent-") )
1046 skipIncidence = true; 1072 skipIncidence = true;
1047 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1073 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1048 skipIncidence = true; 1074 skipIncidence = true;
1049 if ( !skipIncidence ) { 1075 if ( !skipIncidence ) {
1050 inR = remote->incidence( uid ); 1076 inR = remote->incidence( uid );
1051 if ( ! inR ) { 1077 if ( ! inR ) {
1052 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1078 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1053 if ( inL->zaurusId() >= 0 && mode != 4 ) { 1079 if ( inL->zaurusId() >= 0 && mode != 4 ) {
1054 local->deleteIncidence( inL ); 1080 local->deleteIncidence( inL );
1055 ++deletedEventL; 1081 ++deletedEventL;
1056 } else { 1082 } else {
1057 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1083 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1058 inL->setZaurusId( -1 ); 1084 inL->setZaurusId( -1 );
1059 ++addedEventR; 1085 ++addedEventR;
1060 inL->setLastModified( modifiedCalendar ); 1086 inL->setLastModified( modifiedCalendar );
1061 remote->addIncidence( inL->clone() ); 1087 remote->addIncidence( inL->clone() );
1062 } 1088 }
1063 } 1089 }
1064 } else { 1090 } else {
1065 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1091 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1066 checkSharpEvent(eventLSyncSharp, inL); 1092 checkExternSyncEvent(eventLSyncSharp, inL);
1067 local->deleteIncidence( inL ); 1093 local->deleteIncidence( inL );
1068 ++deletedEventL; 1094 ++deletedEventL;
1069 } else { 1095 } else {
1070 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1096 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1071 ++addedEventR; 1097 ++addedEventR;
1072 inL->setLastModified( modifiedCalendar ); 1098 inL->setLastModified( modifiedCalendar );
1073 remote->addIncidence( inL->clone() ); 1099 remote->addIncidence( inL->clone() );
1074 } 1100 }
1075 } 1101 }
1076 } 1102 }
1077 } 1103 }
1078 } 1104 }
1079 inL = el.next(); 1105 inL = el.next();
1080 } 1106 }
1081 1107
1082 bar.hide(); 1108 bar.hide();
1083 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1109 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1084 eventLSync->setReadOnly( false ); 1110 eventLSync->setReadOnly( false );
1085 eventLSync->setDtStart( mLastCalendarSync ); 1111 eventLSync->setDtStart( mLastCalendarSync );
1086 eventRSync->setDtStart( mLastCalendarSync ); 1112 eventRSync->setDtStart( mLastCalendarSync );
1087 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1113 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1088 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1114 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1089 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1115 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1090 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1116 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1091 eventLSync->setReadOnly( true ); 1117 eventLSync->setReadOnly( true );
1092 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1118 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
1093 remote->addEvent( eventRSync ); 1119 remote->addEvent( eventRSync );
1094 QString mes; 1120 QString mes;
1095 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1121 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1096 if ( KOPrefs::instance()->mShowSyncSummary ) { 1122 if ( KOPrefs::instance()->mShowSyncSummary ) {
1097 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1123 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1098 } 1124 }
1099 qDebug( mes ); 1125 qDebug( mes );
1100 mCalendar->checkAlarmForIncidence( 0, true ); 1126 mCalendar->checkAlarmForIncidence( 0, true );
1101 return syncOK; 1127 return syncOK;
1102} 1128}
1103 1129
1104void CalendarView::setSyncDevice( QString s ) 1130void CalendarView::setSyncDevice( QString s )
1105{ 1131{
1106 mCurrentSyncDevice= s; 1132 mCurrentSyncDevice= s;
1107} 1133}
1108void CalendarView::setSyncName( QString s ) 1134void CalendarView::setSyncName( QString s )
1109{ 1135{
1110 mCurrentSyncName= s; 1136 mCurrentSyncName= s;
1111} 1137}
1112bool CalendarView::syncCalendar(QString filename, int mode) 1138bool CalendarView::syncCalendar(QString filename, int mode)
1113{ 1139{
1114 mGlobalSyncMode = SYNC_MODE_NORMAL; 1140 mGlobalSyncMode = SYNC_MODE_NORMAL;
1115 CalendarLocal* calendar = new CalendarLocal(); 1141 CalendarLocal* calendar = new CalendarLocal();
1116 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1142 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1117 FileStorage* storage = new FileStorage( calendar ); 1143 FileStorage* storage = new FileStorage( calendar );
1118 bool syncOK = false; 1144 bool syncOK = false;
1119 storage->setFileName( filename ); 1145 storage->setFileName( filename );
1120 // qDebug("loading ... "); 1146 // qDebug("loading ... ");
1121 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { 1147 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
1122 getEventViewerDialog()->setSyncMode( true ); 1148 getEventViewerDialog()->setSyncMode( true );
1123 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1149 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1124 getEventViewerDialog()->setSyncMode( false ); 1150 getEventViewerDialog()->setSyncMode( false );
1125 if ( syncOK ) { 1151 if ( syncOK ) {
1126 if ( KOPrefs::instance()->mWriteBackFile ) 1152 if ( KOPrefs::instance()->mWriteBackFile )
1127 { 1153 {
1128 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1154 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1129 storage->save(); 1155 storage->save();
1130 } 1156 }
1131 } 1157 }
1132 setModified( true ); 1158 setModified( true );
1133 } 1159 }
1134 delete storage; 1160 delete storage;
1135 delete calendar; 1161 delete calendar;
1136 if ( syncOK ) 1162 if ( syncOK )
1137 updateView(); 1163 updateView();
1138 return syncOK; 1164 return syncOK;
1139} 1165}
1140void CalendarView::syncSharp() 1166void CalendarView::syncSharp()
1141{ 1167{
1142#ifndef DESKTOP_VERSION 1168#ifndef DESKTOP_VERSION
1143 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1169 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1144 //mCurrentSyncDevice = "sharp-DTM"; 1170 //mCurrentSyncDevice = "sharp-DTM";
1145 if ( KOPrefs::instance()->mAskForPreferences ) 1171 if ( KOPrefs::instance()->mAskForPreferences )
1146 edit_sync_options(); 1172 edit_sync_options();
1147 qApp->processEvents(); 1173 qApp->processEvents();
1148 CalendarLocal* calendar = new CalendarLocal(); 1174 CalendarLocal* calendar = new CalendarLocal();
1149 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1175 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1150 bool syncOK = false; 1176 bool syncOK = false;
1151 SharpFormat sharpFormat; 1177 SharpFormat sharpFormat;
1152 if ( sharpFormat.load( calendar, mCalendar ) ) { 1178 if ( sharpFormat.load( calendar, mCalendar ) ) {
1153 getEventViewerDialog()->setSyncMode( true ); 1179 getEventViewerDialog()->setSyncMode( true );
1154 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1180 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1155 getEventViewerDialog()->setSyncMode( false ); 1181 getEventViewerDialog()->setSyncMode( false );
1156 qApp->processEvents(); 1182 qApp->processEvents();
1157 if ( syncOK ) { 1183 if ( syncOK ) {
1158 if ( KOPrefs::instance()->mWriteBackFile ) 1184 if ( KOPrefs::instance()->mWriteBackFile )
1159 { 1185 {
1160 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1186 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1161 Incidence* inc = iL.first(); 1187 Incidence* inc = iL.first();
1162 /* obsolete 1188 /* obsolete
1163 while ( inc ) { 1189 while ( inc ) {
1164 inc->setZaurusStat( inc->revision () ); 1190 inc->setZaurusStat( inc->revision () );
1165 inc = iL.next(); 1191 inc = iL.next();
1166 } 1192 }
1167 */ 1193 */
1168 // pending: clean last sync event description 1194 // pending: clean last sync event description
1169 sharpFormat.save(calendar); 1195 sharpFormat.save(calendar);
1170 iL = calendar->rawIncidences(); 1196 iL = calendar->rawIncidences();
1171 inc = iL.first(); 1197 inc = iL.first();
1172 Incidence* loc; 1198 Incidence* loc;
1173 while ( inc ) { 1199 while ( inc ) {
1174 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1200 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1175 loc = mCalendar->incidence(inc->uid() ); 1201 loc = mCalendar->incidence(inc->uid() );
1176 if ( loc ) { 1202 if ( loc ) {
1177 loc->setZaurusId( inc->zaurusId() ); 1203 loc->setZaurusId( inc->zaurusId() );
1178 loc->setZaurusUid( inc->zaurusUid() ); 1204 loc->setZaurusUid( inc->zaurusUid() );
1179 } 1205 }
1180 } 1206 }
1181 inc = iL.next(); 1207 inc = iL.next();
1182 } 1208 }
1183 Incidence* lse = getLastSyncEvent(); 1209 Incidence* lse = getLastSyncEvent();
1184 if ( lse ) { 1210 if ( lse ) {
1185 lse->setReadOnly( false ); 1211 lse->setReadOnly( false );
1186 lse->setDescription( "" ); 1212 lse->setDescription( "" );
1187 lse->setReadOnly( true ); 1213 lse->setReadOnly( true );
1188 } 1214 }
1189 } 1215 }
1190 } 1216 }
1191 setModified( true ); 1217 setModified( true );
1192 } else { 1218 } else {
1193 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1219 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1194 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1220 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1195 question, i18n("Ok")) ; 1221 question, i18n("Ok")) ;
1196 1222
1197 } 1223 }
1198 delete calendar; 1224 delete calendar;
1199 updateView(); 1225 updateView();
1200 return ;//syncOK; 1226 return ;//syncOK;
1201#endif 1227#endif
1202} 1228}
1203 1229
1204 1230
1205#include <kabc/stdaddressbook.h> 1231#include <kabc/stdaddressbook.h>
1206bool CalendarView::importBday() 1232bool CalendarView::importBday()
1207{ 1233{
1208 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1234 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1209 KABC::AddressBook::Iterator it; 1235 KABC::AddressBook::Iterator it;
1210 int count = 0; 1236 int count = 0;
1211 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1237 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1212 ++count; 1238 ++count;
1213 } 1239 }
1214 QProgressBar bar(count,0 ); 1240 QProgressBar bar(count,0 );
1215 int w = 300; 1241 int w = 300;
1216 if ( QApplication::desktop()->width() < 320 ) 1242 if ( QApplication::desktop()->width() < 320 )
1217 w = 220; 1243 w = 220;
1218 int h = bar.sizeHint().height() ; 1244 int h = bar.sizeHint().height() ;
1219 int dw = QApplication::desktop()->width(); 1245 int dw = QApplication::desktop()->width();
1220 int dh = QApplication::desktop()->height(); 1246 int dh = QApplication::desktop()->height();
1221 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1247 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1222 bar.show(); 1248 bar.show();
1223 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1249 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1224 qApp->processEvents(); 1250 qApp->processEvents();
1225 count = 0; 1251 count = 0;
1226 int addCount = 0; 1252 int addCount = 0;
1227 KCal::Attendee* a = 0; 1253 KCal::Attendee* a = 0;
1228 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1254 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1229 if ( ! bar.isVisible() ) 1255 if ( ! bar.isVisible() )
1230 return false; 1256 return false;
1231 bar.setProgress( count++ ); 1257 bar.setProgress( count++ );
1232 qApp->processEvents(); 1258 qApp->processEvents();
1233 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1259 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1234 if ( (*it).birthday().date().isValid() ){ 1260 if ( (*it).birthday().date().isValid() ){
1235 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1261 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1236 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1262 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1237 ++addCount; 1263 ++addCount;
1238 } 1264 }
1239 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1265 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1240 if ( anni.isValid() ){ 1266 if ( anni.isValid() ){
1241 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1267 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1242 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1268 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1243 ++addCount; 1269 ++addCount;
1244 } 1270 }
1245 } 1271 }
1246 updateView(); 1272 updateView();
1247 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1273 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1248 return true; 1274 return true;
1249} 1275}
1250 1276
1251bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1277bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1252{ 1278{
1253 //qDebug("addAnni "); 1279 //qDebug("addAnni ");
1254 Event * ev = new Event(); 1280 Event * ev = new Event();
1255 if ( a ) { 1281 if ( a ) {
1256 ev->addAttendee( a ); 1282 ev->addAttendee( a );
1257 } 1283 }
1258 QString kind; 1284 QString kind;
1259 if ( birthday ) 1285 if ( birthday )
1260 kind = i18n( "Birthday" ); 1286 kind = i18n( "Birthday" );
1261 else 1287 else
1262 kind = i18n( "Anniversary" ); 1288 kind = i18n( "Anniversary" );
1263 ev->setSummary( name + " - " + kind ); 1289 ev->setSummary( name + " - " + kind );
1264 ev->setOrganizer( "nobody@nowhere" ); 1290 ev->setOrganizer( "nobody@nowhere" );
1265 ev->setCategories( kind ); 1291 ev->setCategories( kind );
1266 ev->setDtStart( QDateTime(date) ); 1292 ev->setDtStart( QDateTime(date) );
1267 ev->setDtEnd( QDateTime(date) ); 1293 ev->setDtEnd( QDateTime(date) );
1268 ev->setFloats( true ); 1294 ev->setFloats( true );
1269 Recurrence * rec = ev->recurrence(); 1295 Recurrence * rec = ev->recurrence();
1270 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1296 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1271 rec->addYearlyNum( date.month() ); 1297 rec->addYearlyNum( date.month() );
1272 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1298 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1273 delete ev; 1299 delete ev;
1274 return false; 1300 return false;
1275 } 1301 }
1276 return true; 1302 return true;
1277 1303
1278} 1304}
1279bool CalendarView::importQtopia( const QString &categories, 1305bool CalendarView::importQtopia( const QString &categories,
1280 const QString &datebook, 1306 const QString &datebook,
1281 const QString &todolist ) 1307 const QString &todolist )
1282{ 1308{
1283 1309
1284 QtopiaFormat qtopiaFormat; 1310 QtopiaFormat qtopiaFormat;
1285 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1311 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1286 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1312 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1287 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1313 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1288 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1314 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1289 1315
1290 updateView(); 1316 updateView();
1291 return true; 1317 return true;
1292 1318
1293#if 0 1319#if 0
1294 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1320 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1295 mCurrentSyncDevice = "qtopia-XML"; 1321 mCurrentSyncDevice = "qtopia-XML";
1296 if ( KOPrefs::instance()->mAskForPreferences ) 1322 if ( KOPrefs::instance()->mAskForPreferences )
1297 edit_sync_options(); 1323 edit_sync_options();
1298 qApp->processEvents(); 1324 qApp->processEvents();
1299 CalendarLocal* calendar = new CalendarLocal(); 1325 CalendarLocal* calendar = new CalendarLocal();
1300 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1326 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1301 bool syncOK = false; 1327 bool syncOK = false;
1302 QtopiaFormat qtopiaFormat; 1328 QtopiaFormat qtopiaFormat;
1303 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1329 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1304 bool loadOk = true; 1330 bool loadOk = true;
1305 if ( !categories.isEmpty() ) 1331 if ( !categories.isEmpty() )
1306 loadOk = qtopiaFormat.load( calendar, categories ); 1332 loadOk = qtopiaFormat.load( calendar, categories );
1307 if ( loadOk && !datebook.isEmpty() ) 1333 if ( loadOk && !datebook.isEmpty() )
1308 loadOk = qtopiaFormat.load( calendar, datebook ); 1334 loadOk = qtopiaFormat.load( calendar, datebook );
1309 if ( loadOk && !todolist.isEmpty() ) 1335 if ( loadOk && !todolist.isEmpty() )
1310 loadOk = qtopiaFormat.load( calendar, todolist ); 1336 loadOk = qtopiaFormat.load( calendar, todolist );
1311 1337
1312 if ( loadOk ) { 1338 if ( loadOk ) {
1313 getEventViewerDialog()->setSyncMode( true ); 1339 getEventViewerDialog()->setSyncMode( true );
1314 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1340 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1315 getEventViewerDialog()->setSyncMode( false ); 1341 getEventViewerDialog()->setSyncMode( false );
1316 qApp->processEvents(); 1342 qApp->processEvents();
1317 if ( syncOK ) { 1343 if ( syncOK ) {
1318 if ( KOPrefs::instance()->mWriteBackFile ) 1344 if ( KOPrefs::instance()->mWriteBackFile )
1319 { 1345 {
1320 // write back XML file 1346 // write back XML file
1321 1347
1322 } 1348 }
1323 setModified( true ); 1349 setModified( true );
1324 } 1350 }
1325 } else { 1351 } else {
1326 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1352 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1327 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1353 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1328 question, i18n("Ok")) ; 1354 question, i18n("Ok")) ;
1329 } 1355 }
1330 delete calendar; 1356 delete calendar;
1331 updateView(); 1357 updateView();
1332 return syncOK; 1358 return syncOK;
1333 1359
1334 1360
1335#endif 1361#endif
1336 1362
1337} 1363}
1338 1364
1339void CalendarView::setSyncEventsReadOnly() 1365void CalendarView::setSyncEventsReadOnly()
1340{ 1366{
1341 Event * ev; 1367 Event * ev;
1342 QPtrList<Event> eL = mCalendar->rawEvents(); 1368 QPtrList<Event> eL = mCalendar->rawEvents();
1343 ev = eL.first(); 1369 ev = eL.first();
1344 while ( ev ) { 1370 while ( ev ) {
1345 if ( ev->uid().left(21) == QString("last-syncEvent-device") ) 1371 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1346 ev->setReadOnly( true ); 1372 ev->setReadOnly( true );
1347 ev = eL.next(); 1373 ev = eL.next();
1348 } 1374 }
1349} 1375}
1350bool CalendarView::openCalendar(QString filename, bool merge) 1376bool CalendarView::openCalendar(QString filename, bool merge)
1351{ 1377{
1352 1378
1353 if (filename.isEmpty()) { 1379 if (filename.isEmpty()) {
1354 return false; 1380 return false;
1355 } 1381 }
1356 1382
1357 if (!QFile::exists(filename)) { 1383 if (!QFile::exists(filename)) {
1358 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1384 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1359 return false; 1385 return false;
1360 } 1386 }
1361 1387
1362 globalFlagBlockAgenda = 1; 1388 globalFlagBlockAgenda = 1;
1363 if (!merge) mCalendar->close(); 1389 if (!merge) mCalendar->close();
1364 1390
1365 mStorage->setFileName( filename ); 1391 mStorage->setFileName( filename );
1366 1392
1367 if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { 1393 if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) {
1368 if ( merge ) ;//setModified( true ); 1394 if ( merge ) ;//setModified( true );
1369 else { 1395 else {
1370 //setModified( true ); 1396 //setModified( true );
1371 mViewManager->setDocumentId( filename ); 1397 mViewManager->setDocumentId( filename );
1372 mDialogManager->setDocumentId( filename ); 1398 mDialogManager->setDocumentId( filename );
1373 mTodoList->setDocumentId( filename ); 1399 mTodoList->setDocumentId( filename );
1374 } 1400 }
1375 globalFlagBlockAgenda = 2; 1401 globalFlagBlockAgenda = 2;
1376 // if ( getLastSyncEvent() ) 1402 // if ( getLastSyncEvent() )
1377 // getLastSyncEvent()->setReadOnly( true ); 1403 // getLastSyncEvent()->setReadOnly( true );
1378 mCalendar->reInitAlarmSettings(); 1404 mCalendar->reInitAlarmSettings();
1379 setSyncEventsReadOnly(); 1405 setSyncEventsReadOnly();
1380 updateUnmanagedViews(); 1406 updateUnmanagedViews();
1381 updateView(); 1407 updateView();
1382 if ( filename != MainWindow::defaultFileName() ) 1408 if ( filename != MainWindow::defaultFileName() )
1383 saveCalendar( MainWindow::defaultFileName() ); 1409 saveCalendar( MainWindow::defaultFileName() );
1384 loadedFileVersion = QDateTime::currentDateTime(); 1410 loadedFileVersion = QDateTime::currentDateTime();
1385 return true; 1411 return true;
1386 } else { 1412 } else {
1387 // while failing to load, the calendar object could 1413 // while failing to load, the calendar object could
1388 // have become partially populated. Clear it out. 1414 // have become partially populated. Clear it out.
1389 if ( !merge ) mCalendar->close(); 1415 if ( !merge ) mCalendar->close();
1390 1416
1391 KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1417 KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1392 1418
1393 globalFlagBlockAgenda = 2; 1419 globalFlagBlockAgenda = 2;
1394 updateView(); 1420 updateView();
1395 } 1421 }
1396 return false; 1422 return false;
1397} 1423}
1398void CalendarView::setLoadedFileVersion(QDateTime dt) 1424void CalendarView::setLoadedFileVersion(QDateTime dt)
1399{ 1425{
1400 loadedFileVersion = dt; 1426 loadedFileVersion = dt;
1401} 1427}
1402bool CalendarView::checkFileChanged(QString fn) 1428bool CalendarView::checkFileChanged(QString fn)
1403{ 1429{
1404 QFileInfo finf ( fn ); 1430 QFileInfo finf ( fn );
1405 if ( !finf.exists() ) 1431 if ( !finf.exists() )
1406 return true; 1432 return true;
1407 QDateTime dt = finf.lastModified (); 1433 QDateTime dt = finf.lastModified ();
1408 if ( dt <= loadedFileVersion ) 1434 if ( dt <= loadedFileVersion )
1409 return false; 1435 return false;
1410 return true; 1436 return true;
1411 1437
1412} 1438}
1413bool CalendarView::checkFileVersion(QString fn) 1439bool CalendarView::checkFileVersion(QString fn)
1414{ 1440{
1415 QFileInfo finf ( fn ); 1441 QFileInfo finf ( fn );
1416 if ( !finf.exists() ) 1442 if ( !finf.exists() )
1417 return true; 1443 return true;
1418 QDateTime dt = finf.lastModified (); 1444 QDateTime dt = finf.lastModified ();
1419 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1445 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1420 //qDebug("file on disk version %s",dt.toString().latin1()); 1446 //qDebug("file on disk version %s",dt.toString().latin1());
1421 if ( dt <= loadedFileVersion ) 1447 if ( dt <= loadedFileVersion )
1422 return true; 1448 return true;
1423 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , 1449 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) ,
1424 i18n("KO/Pi Warning"),i18n("Overwrite"), 1450 i18n("KO/Pi Warning"),i18n("Overwrite"),
1425 i18n("Sync+save")); 1451 i18n("Sync+save"));
1426 1452
1427 if ( km == KMessageBox::Cancel ) 1453 if ( km == KMessageBox::Cancel )
1428 return false; 1454 return false;
1429 if ( km == KMessageBox::Yes ) 1455 if ( km == KMessageBox::Yes )
1430 return true; 1456 return true;
1431 1457
1432 setSyncDevice("deleteaftersync" ); 1458 setSyncDevice("deleteaftersync" );
1433 KOPrefs::instance()->mAskForPreferences = true; 1459 KOPrefs::instance()->mAskForPreferences = true;
1434 KOPrefs::instance()->mSyncAlgoPrefs = 3; 1460 KOPrefs::instance()->mSyncAlgoPrefs = 3;
1435 KOPrefs::instance()->mWriteBackFile = false; 1461 KOPrefs::instance()->mWriteBackFile = false;
1436 KOPrefs::instance()->mWriteBackExistingOnly = false; 1462 KOPrefs::instance()->mWriteBackExistingOnly = false;
1437 KOPrefs::instance()->mShowSyncSummary = false; 1463 KOPrefs::instance()->mShowSyncSummary = false;
1438 syncCalendar( fn, 3 ); 1464 syncCalendar( fn, 3 );
1439 Event * e = getLastSyncEvent(); 1465 Event * e = getLastSyncEvent();
1440 mCalendar->deleteEvent ( e ); 1466 mCalendar->deleteEvent ( e );
1441 updateView(); 1467 updateView();
1442 return true; 1468 return true;
1443} 1469}
1444 1470
1445bool CalendarView::saveCalendar( QString filename ) 1471bool CalendarView::saveCalendar( QString filename )
1446{ 1472{
1447 1473
1448 // Store back all unsaved data into calendar object 1474 // Store back all unsaved data into calendar object
1449 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1475 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1450 if ( mViewManager->currentView() ) 1476 if ( mViewManager->currentView() )
1451 mViewManager->currentView()->flushView(); 1477 mViewManager->currentView()->flushView();
1452 1478
1453 //mStorage->setFileName( filename ); 1479 //mStorage->setFileName( filename );
1454 1480
1455 mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1481 mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1456 mStorage->setFileName( filename ); 1482 mStorage->setFileName( filename );
1457 bool success; 1483 bool success;
1458 success = mStorage->save(); 1484 success = mStorage->save();
1459 if ( !success ) { 1485 if ( !success ) {
1460 return false; 1486 return false;
1461 } 1487 }
1462 1488
1463 return true; 1489 return true;
1464} 1490}
1465 1491
1466void CalendarView::closeCalendar() 1492void CalendarView::closeCalendar()
1467{ 1493{
1468 1494
1469 // child windows no longer valid 1495 // child windows no longer valid
1470 emit closingDown(); 1496 emit closingDown();
1471 1497
1472 mCalendar->close(); 1498 mCalendar->close();
1473 setModified(false); 1499 setModified(false);
1474 updateView(); 1500 updateView();
1475} 1501}
1476 1502
1477void CalendarView::archiveCalendar() 1503void CalendarView::archiveCalendar()
1478{ 1504{
1479 mDialogManager->showArchiveDialog(); 1505 mDialogManager->showArchiveDialog();
1480} 1506}
1481 1507
1482 1508
1483void CalendarView::readSettings() 1509void CalendarView::readSettings()
1484{ 1510{
1485 1511
1486 1512
1487 // mViewManager->showAgendaView(); 1513 // mViewManager->showAgendaView();
1488 QString str; 1514 QString str;
1489 //qDebug("CalendarView::readSettings() "); 1515 //qDebug("CalendarView::readSettings() ");
1490 // read settings from the KConfig, supplying reasonable 1516 // read settings from the KConfig, supplying reasonable
1491 // defaults where none are to be found 1517 // defaults where none are to be found
1492 KConfig *config = KOGlobals::config(); 1518 KConfig *config = KOGlobals::config();
1493#ifndef KORG_NOSPLITTER 1519#ifndef KORG_NOSPLITTER
1494 config->setGroup("KOrganizer Geometry"); 1520 config->setGroup("KOrganizer Geometry");
1495 1521
1496 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1522 QValueList<int> sizes = config->readIntListEntry("Separator1");
1497 if (sizes.count() != 2) { 1523 if (sizes.count() != 2) {
1498 sizes << mDateNavigator->minimumSizeHint().width(); 1524 sizes << mDateNavigator->minimumSizeHint().width();
1499 sizes << 300; 1525 sizes << 300;
1500 } 1526 }
1501 mPanner->setSizes(sizes); 1527 mPanner->setSizes(sizes);
1502 1528
1503 sizes = config->readIntListEntry("Separator2"); 1529 sizes = config->readIntListEntry("Separator2");
1504 if ( ( mResourceView && sizes.count() == 4 ) || 1530 if ( ( mResourceView && sizes.count() == 4 ) ||
1505 ( !mResourceView && sizes.count() == 3 ) ) { 1531 ( !mResourceView && sizes.count() == 3 ) ) {
1506 mLeftSplitter->setSizes(sizes); 1532 mLeftSplitter->setSizes(sizes);
1507 } 1533 }
1508#endif 1534#endif
1509 globalFlagBlockAgenda = 1; 1535 globalFlagBlockAgenda = 1;
1510 mViewManager->showAgendaView(); 1536 mViewManager->showAgendaView();
1511 //mViewManager->readSettings( config ); 1537 //mViewManager->readSettings( config );
1512 mTodoList->restoreLayout(config,QString("Todo Layout")); 1538 mTodoList->restoreLayout(config,QString("Todo Layout"));
1513 readFilterSettings(config); 1539 readFilterSettings(config);
1514 config->setGroup( "Views" ); 1540 config->setGroup( "Views" );
1515 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1541 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1516 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1542 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1517 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1543 else if ( dateCount == 7 ) mNavigator->selectWeek();
1518 else mNavigator->selectDates( dateCount ); 1544 else mNavigator->selectDates( dateCount );
1519 // mViewManager->readSettings( config ); 1545 // mViewManager->readSettings( config );
1520 updateConfig(); 1546 updateConfig();
1521 globalFlagBlockAgenda = 2; 1547 globalFlagBlockAgenda = 2;
1522 mViewManager->readSettings( config ); 1548 mViewManager->readSettings( config );
1523#ifdef DESKTOP_VERSION 1549#ifdef DESKTOP_VERSION
1524 config->setGroup("WidgetLayout"); 1550 config->setGroup("WidgetLayout");
1525 QStringList list; 1551 QStringList list;
1526 list = config->readListEntry("MainLayout"); 1552 list = config->readListEntry("MainLayout");
1527 int x,y,w,h; 1553 int x,y,w,h;
1528 if ( ! list.isEmpty() ) { 1554 if ( ! list.isEmpty() ) {
1529 x = list[0].toInt(); 1555 x = list[0].toInt();
1530 y = list[1].toInt(); 1556 y = list[1].toInt();
1531 w = list[2].toInt(); 1557 w = list[2].toInt();
1532 h = list[3].toInt(); 1558 h = list[3].toInt();
1533 topLevelWidget()->setGeometry(x,y,w,h); 1559 topLevelWidget()->setGeometry(x,y,w,h);
1534 1560
1535 } else { 1561 } else {
1536 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1562 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1537 } 1563 }
@@ -1617,385 +1643,385 @@ void CalendarView::writeSettings()
1617 h = wid->height(); 1643 h = wid->height();
1618 list.clear(); 1644 list.clear();
1619 list << QString::number( x ); 1645 list << QString::number( x );
1620 list << QString::number( y ); 1646 list << QString::number( y );
1621 list << QString::number( w ); 1647 list << QString::number( w );
1622 list << QString::number( h ); 1648 list << QString::number( h );
1623 config->writeEntry("EditEventLayout",list ); 1649 config->writeEntry("EditEventLayout",list );
1624 1650
1625 wid = mTodoEditor; 1651 wid = mTodoEditor;
1626 x = wid->geometry().x(); 1652 x = wid->geometry().x();
1627 y = wid->geometry().y(); 1653 y = wid->geometry().y();
1628 w = wid->width(); 1654 w = wid->width();
1629 h = wid->height(); 1655 h = wid->height();
1630 list.clear(); 1656 list.clear();
1631 list << QString::number( x ); 1657 list << QString::number( x );
1632 list << QString::number( y ); 1658 list << QString::number( y );
1633 list << QString::number( w ); 1659 list << QString::number( w );
1634 list << QString::number( h ); 1660 list << QString::number( h );
1635 config->writeEntry("EditTodoLayout",list ); 1661 config->writeEntry("EditTodoLayout",list );
1636 wid = getEventViewerDialog(); 1662 wid = getEventViewerDialog();
1637 x = wid->geometry().x(); 1663 x = wid->geometry().x();
1638 y = wid->geometry().y(); 1664 y = wid->geometry().y();
1639 w = wid->width(); 1665 w = wid->width();
1640 h = wid->height(); 1666 h = wid->height();
1641 list.clear(); 1667 list.clear();
1642 list << QString::number( x ); 1668 list << QString::number( x );
1643 list << QString::number( y ); 1669 list << QString::number( y );
1644 list << QString::number( w ); 1670 list << QString::number( w );
1645 list << QString::number( h ); 1671 list << QString::number( h );
1646 config->writeEntry("ViewerLayout",list ); 1672 config->writeEntry("ViewerLayout",list );
1647 wid = mDialogManager->getSearchDialog(); 1673 wid = mDialogManager->getSearchDialog();
1648 if ( wid ) { 1674 if ( wid ) {
1649 x = wid->geometry().x(); 1675 x = wid->geometry().x();
1650 y = wid->geometry().y(); 1676 y = wid->geometry().y();
1651 w = wid->width(); 1677 w = wid->width();
1652 h = wid->height(); 1678 h = wid->height();
1653 list.clear(); 1679 list.clear();
1654 list << QString::number( x ); 1680 list << QString::number( x );
1655 list << QString::number( y ); 1681 list << QString::number( y );
1656 list << QString::number( w ); 1682 list << QString::number( w );
1657 list << QString::number( h ); 1683 list << QString::number( h );
1658 config->writeEntry("SearchLayout",list ); 1684 config->writeEntry("SearchLayout",list );
1659 } 1685 }
1660#endif 1686#endif
1661 1687
1662 1688
1663 config->sync(); 1689 config->sync();
1664} 1690}
1665 1691
1666void CalendarView::readFilterSettings(KConfig *config) 1692void CalendarView::readFilterSettings(KConfig *config)
1667{ 1693{
1668 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1694 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1669 1695
1670 mFilters.clear(); 1696 mFilters.clear();
1671 1697
1672 config->setGroup("General"); 1698 config->setGroup("General");
1673 QStringList filterList = config->readListEntry("CalendarFilters"); 1699 QStringList filterList = config->readListEntry("CalendarFilters");
1674 1700
1675 QStringList::ConstIterator it = filterList.begin(); 1701 QStringList::ConstIterator it = filterList.begin();
1676 QStringList::ConstIterator end = filterList.end(); 1702 QStringList::ConstIterator end = filterList.end();
1677 while(it != end) { 1703 while(it != end) {
1678 // kdDebug() << " filter: " << (*it) << endl; 1704 // kdDebug() << " filter: " << (*it) << endl;
1679 1705
1680 CalFilter *filter; 1706 CalFilter *filter;
1681 filter = new CalFilter(*it); 1707 filter = new CalFilter(*it);
1682 config->setGroup("Filter_" + (*it)); 1708 config->setGroup("Filter_" + (*it));
1683 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1709 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1684 filter->setCriteria(config->readNumEntry("Criteria",0)); 1710 filter->setCriteria(config->readNumEntry("Criteria",0));
1685 filter->setCategoryList(config->readListEntry("CategoryList")); 1711 filter->setCategoryList(config->readListEntry("CategoryList"));
1686 mFilters.append(filter); 1712 mFilters.append(filter);
1687 1713
1688 ++it; 1714 ++it;
1689 } 1715 }
1690 1716
1691 if (mFilters.count() == 0) { 1717 if (mFilters.count() == 0) {
1692 CalFilter *filter = new CalFilter(i18n("Default")); 1718 CalFilter *filter = new CalFilter(i18n("Default"));
1693 mFilters.append(filter); 1719 mFilters.append(filter);
1694 } 1720 }
1695 mFilterView->updateFilters(); 1721 mFilterView->updateFilters();
1696 config->setGroup("FilterView"); 1722 config->setGroup("FilterView");
1697 1723
1698 mFilterView->blockSignals(true); 1724 mFilterView->blockSignals(true);
1699 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1725 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1700 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1726 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1701 mFilterView->blockSignals(false); 1727 mFilterView->blockSignals(false);
1702 // We do it manually to avoid it being done twice by the above calls 1728 // We do it manually to avoid it being done twice by the above calls
1703 updateFilter(); 1729 updateFilter();
1704} 1730}
1705 1731
1706void CalendarView::writeFilterSettings(KConfig *config) 1732void CalendarView::writeFilterSettings(KConfig *config)
1707{ 1733{
1708 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1734 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1709 1735
1710 QStringList filterList; 1736 QStringList filterList;
1711 1737
1712 CalFilter *filter = mFilters.first(); 1738 CalFilter *filter = mFilters.first();
1713 while(filter) { 1739 while(filter) {
1714 // kdDebug() << " fn: " << filter->name() << endl; 1740 // kdDebug() << " fn: " << filter->name() << endl;
1715 filterList << filter->name(); 1741 filterList << filter->name();
1716 config->setGroup("Filter_" + filter->name()); 1742 config->setGroup("Filter_" + filter->name());
1717 config->writeEntry("Criteria",filter->criteria()); 1743 config->writeEntry("Criteria",filter->criteria());
1718 config->writeEntry("CategoryList",filter->categoryList()); 1744 config->writeEntry("CategoryList",filter->categoryList());
1719 filter = mFilters.next(); 1745 filter = mFilters.next();
1720 } 1746 }
1721 config->setGroup("General"); 1747 config->setGroup("General");
1722 config->writeEntry("CalendarFilters",filterList); 1748 config->writeEntry("CalendarFilters",filterList);
1723 1749
1724 config->setGroup("FilterView"); 1750 config->setGroup("FilterView");
1725 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1751 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1726 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1752 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1727} 1753}
1728 1754
1729 1755
1730void CalendarView::goToday() 1756void CalendarView::goToday()
1731{ 1757{
1732 mNavigator->selectToday(); 1758 mNavigator->selectToday();
1733} 1759}
1734 1760
1735void CalendarView::goNext() 1761void CalendarView::goNext()
1736{ 1762{
1737 mNavigator->selectNext(); 1763 mNavigator->selectNext();
1738} 1764}
1739 1765
1740void CalendarView::goPrevious() 1766void CalendarView::goPrevious()
1741{ 1767{
1742 mNavigator->selectPrevious(); 1768 mNavigator->selectPrevious();
1743} 1769}
1744void CalendarView::goNextMonth() 1770void CalendarView::goNextMonth()
1745{ 1771{
1746 mNavigator->selectNextMonth(); 1772 mNavigator->selectNextMonth();
1747} 1773}
1748 1774
1749void CalendarView::goPreviousMonth() 1775void CalendarView::goPreviousMonth()
1750{ 1776{
1751 mNavigator->selectPreviousMonth(); 1777 mNavigator->selectPreviousMonth();
1752} 1778}
1753void CalendarView::writeLocale() 1779void CalendarView::writeLocale()
1754{ 1780{
1755 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 1781 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
1756 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 1782 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
1757 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 1783 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
1758 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 1784 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
1759 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1785 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1760 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 1786 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
1761 dummy = KOPrefs::instance()->mUserDateFormatShort; 1787 dummy = KOPrefs::instance()->mUserDateFormatShort;
1762 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 1788 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
1763 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 1789 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
1764 KOPrefs::instance()->mDaylightsavingStart, 1790 KOPrefs::instance()->mDaylightsavingStart,
1765 KOPrefs::instance()->mDaylightsavingEnd ); 1791 KOPrefs::instance()->mDaylightsavingEnd );
1766 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 1792 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
1767} 1793}
1768void CalendarView::updateConfig() 1794void CalendarView::updateConfig()
1769{ 1795{
1770 writeLocale(); 1796 writeLocale();
1771 if ( KOPrefs::instance()->mUseAppColors ) 1797 if ( KOPrefs::instance()->mUseAppColors )
1772 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 1798 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
1773 emit configChanged(); 1799 emit configChanged();
1774 mTodoList->updateConfig(); 1800 mTodoList->updateConfig();
1775 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 1801 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
1776 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1802 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1777 // To make the "fill window" configurations work 1803 // To make the "fill window" configurations work
1778 //mViewManager->raiseCurrentView(); 1804 //mViewManager->raiseCurrentView();
1779} 1805}
1780 1806
1781 1807
1782void CalendarView::eventChanged(Event *event) 1808void CalendarView::eventChanged(Event *event)
1783{ 1809{
1784 changeEventDisplay(event,KOGlobals::EVENTEDITED); 1810 changeEventDisplay(event,KOGlobals::EVENTEDITED);
1785 //updateUnmanagedViews(); 1811 //updateUnmanagedViews();
1786} 1812}
1787 1813
1788void CalendarView::eventAdded(Event *event) 1814void CalendarView::eventAdded(Event *event)
1789{ 1815{
1790 changeEventDisplay(event,KOGlobals::EVENTADDED); 1816 changeEventDisplay(event,KOGlobals::EVENTADDED);
1791} 1817}
1792 1818
1793void CalendarView::eventToBeDeleted(Event *) 1819void CalendarView::eventToBeDeleted(Event *)
1794{ 1820{
1795 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 1821 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
1796} 1822}
1797 1823
1798void CalendarView::eventDeleted() 1824void CalendarView::eventDeleted()
1799{ 1825{
1800 changeEventDisplay(0,KOGlobals::EVENTDELETED); 1826 changeEventDisplay(0,KOGlobals::EVENTDELETED);
1801} 1827}
1802void CalendarView::changeTodoDisplay(Todo *which, int action) 1828void CalendarView::changeTodoDisplay(Todo *which, int action)
1803{ 1829{
1804 changeIncidenceDisplay((Incidence *)which, action); 1830 changeIncidenceDisplay((Incidence *)which, action);
1805} 1831}
1806void CalendarView::checkZaurusId( int id, bool todo ) 1832void CalendarView::checkZaurusId( int id, bool todo )
1807{ 1833{
1808 if ( id >= 0 ) { 1834 if ( id >= 0 ) {
1809 Incidence* lse = mCalendar->event( "last-syncEvent-device-Sharp-DTM"); 1835 Incidence* lse = mCalendar->event( "last-syncEvent-Sharp-DTM");
1810 if ( lse ) { 1836 if ( lse ) {
1811 QString des = lse->description(); 1837 QString des = lse->description();
1812 QString pref = "e"; 1838 QString pref = "e";
1813 if ( todo ) 1839 if ( todo )
1814 pref = "t"; 1840 pref = "t";
1815 des += pref+ QString::number ( id ) + ","; 1841 des += pref+ QString::number ( id ) + ",";
1816 lse->setReadOnly( false ); 1842 lse->setReadOnly( false );
1817 lse->setDescription( des ); 1843 lse->setDescription( des );
1818 lse->setReadOnly( true ); 1844 lse->setReadOnly( true );
1819 } 1845 }
1820 } 1846 }
1821} 1847}
1822void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 1848void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
1823{ 1849{
1824 updateUnmanagedViews(); 1850 updateUnmanagedViews();
1825 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 1851 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
1826 if ( action == KOGlobals::EVENTDELETED ) { //delete 1852 if ( action == KOGlobals::EVENTDELETED ) { //delete
1827 mCalendar->checkAlarmForIncidence( 0, true ); 1853 mCalendar->checkAlarmForIncidence( 0, true );
1828 if ( mEventViewerDialog ) 1854 if ( mEventViewerDialog )
1829 mEventViewerDialog->hide(); 1855 mEventViewerDialog->hide();
1830 } 1856 }
1831 else 1857 else
1832 mCalendar->checkAlarmForIncidence( which , false ); 1858 mCalendar->checkAlarmForIncidence( which , false );
1833} 1859}
1834 1860
1835// most of the changeEventDisplays() right now just call the view's 1861// most of the changeEventDisplays() right now just call the view's
1836// total update mode, but they SHOULD be recoded to be more refresh-efficient. 1862// total update mode, but they SHOULD be recoded to be more refresh-efficient.
1837void CalendarView::changeEventDisplay(Event *which, int action) 1863void CalendarView::changeEventDisplay(Event *which, int action)
1838{ 1864{
1839 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 1865 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
1840 changeIncidenceDisplay((Incidence *)which, action); 1866 changeIncidenceDisplay((Incidence *)which, action);
1841 mDateNavigator->updateView(); 1867 mDateNavigator->updateView();
1842 //mDialogManager->updateSearchDialog(); 1868 //mDialogManager->updateSearchDialog();
1843 1869
1844 if (which) { 1870 if (which) {
1845 // If there is an event view visible update the display 1871 // If there is an event view visible update the display
1846 mViewManager->currentView()->changeEventDisplay(which,action); 1872 mViewManager->currentView()->changeEventDisplay(which,action);
1847 // TODO: check, if update needed 1873 // TODO: check, if update needed
1848 // if (which->getTodoStatus()) { 1874 // if (which->getTodoStatus()) {
1849 mTodoList->updateView(); 1875 mTodoList->updateView();
1850 // } 1876 // }
1851 } else { 1877 } else {
1852 mViewManager->currentView()->updateView(); 1878 mViewManager->currentView()->updateView();
1853 } 1879 }
1854} 1880}
1855 1881
1856 1882
1857void CalendarView::updateTodoViews() 1883void CalendarView::updateTodoViews()
1858{ 1884{
1859 1885
1860 mTodoList->updateView(); 1886 mTodoList->updateView();
1861 mViewManager->currentView()->updateView(); 1887 mViewManager->currentView()->updateView();
1862 1888
1863} 1889}
1864 1890
1865 1891
1866void CalendarView::updateView(const QDate &start, const QDate &end) 1892void CalendarView::updateView(const QDate &start, const QDate &end)
1867{ 1893{
1868 mTodoList->updateView(); 1894 mTodoList->updateView();
1869 mViewManager->updateView(start, end); 1895 mViewManager->updateView(start, end);
1870 //mDateNavigator->updateView(); 1896 //mDateNavigator->updateView();
1871} 1897}
1872 1898
1873void CalendarView::updateView() 1899void CalendarView::updateView()
1874{ 1900{
1875 DateList tmpList = mNavigator->selectedDates(); 1901 DateList tmpList = mNavigator->selectedDates();
1876 1902
1877 // We assume that the navigator only selects consecutive days. 1903 // We assume that the navigator only selects consecutive days.
1878 updateView( tmpList.first(), tmpList.last() ); 1904 updateView( tmpList.first(), tmpList.last() );
1879} 1905}
1880 1906
1881void CalendarView::updateUnmanagedViews() 1907void CalendarView::updateUnmanagedViews()
1882{ 1908{
1883 mDateNavigator->updateDayMatrix(); 1909 mDateNavigator->updateDayMatrix();
1884} 1910}
1885 1911
1886int CalendarView::msgItemDelete() 1912int CalendarView::msgItemDelete()
1887{ 1913{
1888 return KMessageBox::warningContinueCancel(this, 1914 return KMessageBox::warningContinueCancel(this,
1889 i18n("This item will be\npermanently deleted."), 1915 i18n("This item will be\npermanently deleted."),
1890 i18n("KO/Pi Confirmation"),i18n("Delete")); 1916 i18n("KO/Pi Confirmation"),i18n("Delete"));
1891} 1917}
1892 1918
1893 1919
1894void CalendarView::edit_cut() 1920void CalendarView::edit_cut()
1895{ 1921{
1896 Event *anEvent=0; 1922 Event *anEvent=0;
1897 1923
1898 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 1924 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
1899 1925
1900 if (mViewManager->currentView()->isEventView()) { 1926 if (mViewManager->currentView()->isEventView()) {
1901 if ( incidence && incidence->type() == "Event" ) { 1927 if ( incidence && incidence->type() == "Event" ) {
1902 anEvent = static_cast<Event *>(incidence); 1928 anEvent = static_cast<Event *>(incidence);
1903 } 1929 }
1904 } 1930 }
1905 1931
1906 if (!anEvent) { 1932 if (!anEvent) {
1907 KNotifyClient::beep(); 1933 KNotifyClient::beep();
1908 return; 1934 return;
1909 } 1935 }
1910 DndFactory factory( mCalendar ); 1936 DndFactory factory( mCalendar );
1911 factory.cutEvent(anEvent); 1937 factory.cutEvent(anEvent);
1912 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 1938 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
1913} 1939}
1914 1940
1915void CalendarView::edit_copy() 1941void CalendarView::edit_copy()
1916{ 1942{
1917 Event *anEvent=0; 1943 Event *anEvent=0;
1918 1944
1919 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 1945 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
1920 1946
1921 if (mViewManager->currentView()->isEventView()) { 1947 if (mViewManager->currentView()->isEventView()) {
1922 if ( incidence && incidence->type() == "Event" ) { 1948 if ( incidence && incidence->type() == "Event" ) {
1923 anEvent = static_cast<Event *>(incidence); 1949 anEvent = static_cast<Event *>(incidence);
1924 } 1950 }
1925 } 1951 }
1926 1952
1927 if (!anEvent) { 1953 if (!anEvent) {
1928 KNotifyClient::beep(); 1954 KNotifyClient::beep();
1929 return; 1955 return;
1930 } 1956 }
1931 DndFactory factory( mCalendar ); 1957 DndFactory factory( mCalendar );
1932 factory.copyEvent(anEvent); 1958 factory.copyEvent(anEvent);
1933} 1959}
1934 1960
1935void CalendarView::edit_paste() 1961void CalendarView::edit_paste()
1936{ 1962{
1937 QDate date = mNavigator->selectedDates().first(); 1963 QDate date = mNavigator->selectedDates().first();
1938 1964
1939 DndFactory factory( mCalendar ); 1965 DndFactory factory( mCalendar );
1940 Event *pastedEvent = factory.pasteEvent( date ); 1966 Event *pastedEvent = factory.pasteEvent( date );
1941 1967
1942 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 1968 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
1943} 1969}
1944 1970
1945void CalendarView::edit_options() 1971void CalendarView::edit_options()
1946{ 1972{
1947 mDialogManager->showOptionsDialog(); 1973 mDialogManager->showOptionsDialog();
1948 //writeSettings(); 1974 //writeSettings();
1949} 1975}
1950void CalendarView::edit_sync_options() 1976void CalendarView::edit_sync_options()
1951{ 1977{
1952 //mDialogManager->showSyncOptions(); 1978 //mDialogManager->showSyncOptions();
1953 //KOPrefs::instance()->mSyncAlgoPrefs 1979 //KOPrefs::instance()->mSyncAlgoPrefs
1954 QDialog dia( this, "dia", true ); 1980 QDialog dia( this, "dia", true );
1955 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); 1981 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
1956 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); 1982 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
1957 QVBoxLayout lay ( &dia ); 1983 QVBoxLayout lay ( &dia );
1958 lay.setSpacing( 2 ); 1984 lay.setSpacing( 2 );
1959 lay.setMargin( 3 ); 1985 lay.setMargin( 3 );
1960 lay.addWidget(&gr); 1986 lay.addWidget(&gr);
1961 QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); 1987 QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
1962 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); 1988 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
1963 QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); 1989 QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
1964 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); 1990 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
1965 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); 1991 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
1966 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); 1992 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
1967 //QRadioButton both( i18n("Take both on conflict"), &gr ); 1993 //QRadioButton both( i18n("Take both on conflict"), &gr );
1968 QPushButton pb ( "OK", &dia); 1994 QPushButton pb ( "OK", &dia);
1969 lay.addWidget( &pb ); 1995 lay.addWidget( &pb );
1970 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 1996 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
1971 switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { 1997 switch ( KOPrefs::instance()->mSyncAlgoPrefs ) {
1972 case 0: 1998 case 0:
1973 loc.setChecked( true); 1999 loc.setChecked( true);
1974 break; 2000 break;
1975 case 1: 2001 case 1:
1976 rem.setChecked( true ); 2002 rem.setChecked( true );
1977 break; 2003 break;
1978 case 2: 2004 case 2:
1979 newest.setChecked( true); 2005 newest.setChecked( true);
1980 break; 2006 break;
1981 case 3: 2007 case 3:
1982 ask.setChecked( true); 2008 ask.setChecked( true);
1983 break; 2009 break;
1984 case 4: 2010 case 4:
1985 f_loc.setChecked( true); 2011 f_loc.setChecked( true);
1986 break; 2012 break;
1987 case 5: 2013 case 5:
1988 f_rem.setChecked( true); 2014 f_rem.setChecked( true);
1989 break; 2015 break;
1990 case 6: 2016 case 6:
1991 // both.setChecked( true); 2017 // both.setChecked( true);
1992 break; 2018 break;
1993 default: 2019 default:
1994 break; 2020 break;
1995 } 2021 }
1996 if ( dia.exec() ) { 2022 if ( dia.exec() ) {
1997 KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; 2023 KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
1998 } 2024 }
1999 2025
2000} 2026}
2001 2027
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 8aa5e1c..557554f 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,586 +1,587 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42 42
43#include <korganizer/calendarviewbase.h> 43#include <korganizer/calendarviewbase.h>
44 44
45class QWidgetStack; 45class QWidgetStack;
46class QSplitter; 46class QSplitter;
47 47
48class CalPrinter; 48class CalPrinter;
49class KOFilterView; 49class KOFilterView;
50class KOViewManager; 50class KOViewManager;
51class KODialogManager; 51class KODialogManager;
52class KOTodoView; 52class KOTodoView;
53class KDateNavigator; 53class KDateNavigator;
54class DateNavigator; 54class DateNavigator;
55class KOIncidenceEditor; 55class KOIncidenceEditor;
56class KDatePicker; 56class KDatePicker;
57class ResourceView; 57class ResourceView;
58class NavigatorBar; 58class NavigatorBar;
59class KOEventEditor; 59class KOEventEditor;
60class KOTodoEditor ; 60class KOTodoEditor ;
61class KOEventViewerDialog; 61class KOEventViewerDialog;
62class KOBeamPrefs; 62class KOBeamPrefs;
63class KSyncProfile; 63class KSyncProfile;
64class AlarmDialog; 64class AlarmDialog;
65class KCal::Attendee; 65class KCal::Attendee;
66 66
67namespace KCal { class FileStorage; } 67namespace KCal { class FileStorage; }
68 68
69using namespace KCal; 69using namespace KCal;
70 70
71/** 71/**
72 This is the main calendar widget. It provides the different vies on t he 72 This is the main calendar widget. It provides the different vies on t he
73 calendar data as well as the date navigator. It also handles synchronisation 73 calendar data as well as the date navigator. It also handles synchronisation
74 of the different views and controls the different dialogs like preferences, 74 of the different views and controls the different dialogs like preferences,
75 event editor, search dialog etc. 75 event editor, search dialog etc.
76 76
77 @short main calendar view widget 77 @short main calendar view widget
78 @author Cornelius Schumacher 78 @author Cornelius Schumacher
79*/ 79*/
80class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer 80class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer
81{ 81{
82 Q_OBJECT 82 Q_OBJECT
83 public: 83 public:
84 /** 84 /**
85 Constructs a new calendar view widget. 85 Constructs a new calendar view widget.
86 86
87 @param calendar calendar document 87 @param calendar calendar document
88 @param parent parent window 88 @param parent parent window
89 @param name Qt internal widget object name 89 @param name Qt internal widget object name
90 */ 90 */
91 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 91 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
92 const char *name = 0 ); 92 const char *name = 0 );
93 CalendarView( Calendar *calendar, QWidget *parent = 0, 93 CalendarView( Calendar *calendar, QWidget *parent = 0,
94 const char *name = 0 ); 94 const char *name = 0 );
95 virtual ~CalendarView(); 95 virtual ~CalendarView();
96 96
97 Calendar *calendar() { return mCalendar; } 97 Calendar *calendar() { return mCalendar; }
98 98
99 KOViewManager *viewManager(); 99 KOViewManager *viewManager();
100 KODialogManager *dialogManager(); 100 KODialogManager *dialogManager();
101 101
102 QDate startDate(); 102 QDate startDate();
103 QDate endDate(); 103 QDate endDate();
104 104
105 QWidgetStack *viewStack(); 105 QWidgetStack *viewStack();
106 QWidget *leftFrame(); 106 QWidget *leftFrame();
107 NavigatorBar *navigatorBar(); 107 NavigatorBar *navigatorBar();
108 108
109 DateNavigator *dateNavigator(); 109 DateNavigator *dateNavigator();
110 KDateNavigator *dateNavigatorWidget(); 110 KDateNavigator *dateNavigatorWidget();
111 111
112 void addView(KOrg::BaseView *); 112 void addView(KOrg::BaseView *);
113 void showView(KOrg::BaseView *); 113 void showView(KOrg::BaseView *);
114 KOEventViewerDialog* getEventViewerDialog(); 114 KOEventViewerDialog* getEventViewerDialog();
115 Incidence *currentSelection(); 115 Incidence *currentSelection();
116 void setupExternSyncProfiles();
116 117
117 signals: 118 signals:
118 /** This todo has been modified */ 119 /** This todo has been modified */
119 void todoModified(Todo *, int); 120 void todoModified(Todo *, int);
120 121
121 /** when change is made to options dialog, the topwidget will catch this 122 /** when change is made to options dialog, the topwidget will catch this
122 * and emit this signal which notifies all widgets which have registered 123 * and emit this signal which notifies all widgets which have registered
123 * for notification to update their settings. */ 124 * for notification to update their settings. */
124 void configChanged(); 125 void configChanged();
125 /** emitted when the topwidget is closing down, so that any attached 126 /** emitted when the topwidget is closing down, so that any attached
126 child windows can also close. */ 127 child windows can also close. */
127 void closingDown(); 128 void closingDown();
128 /** emitted right before we die */ 129 /** emitted right before we die */
129 void closed(QWidget *); 130 void closed(QWidget *);
130 131
131 /** Emitted when state of modified flag changes */ 132 /** Emitted when state of modified flag changes */
132 void modifiedChanged(bool); 133 void modifiedChanged(bool);
133 void signalmodified(); 134 void signalmodified();
134 135
135 /** Emitted when state of read-only flag changes */ 136 /** Emitted when state of read-only flag changes */
136 void readOnlyChanged(bool); 137 void readOnlyChanged(bool);
137 138
138 /** Emitted when the unit of navigation changes */ 139 /** Emitted when the unit of navigation changes */
139 void changeNavStringPrev(const QString &); 140 void changeNavStringPrev(const QString &);
140 void changeNavStringNext(const QString &); 141 void changeNavStringNext(const QString &);
141 142
142 /** Emitted when state of events selection has changed and user is organizer*/ 143 /** Emitted when state of events selection has changed and user is organizer*/
143 void organizerEventsSelected(bool); 144 void organizerEventsSelected(bool);
144 /** Emitted when state of events selection has changed and user is attendee*/ 145 /** Emitted when state of events selection has changed and user is attendee*/
145 void groupEventsSelected(bool); 146 void groupEventsSelected(bool);
146 /** 147 /**
147 Emitted when an incidence gets selected. If the selection is cleared the 148 Emitted when an incidence gets selected. If the selection is cleared the
148 signal is emitted with 0 as argument. 149 signal is emitted with 0 as argument.
149 */ 150 */
150 void incidenceSelected( Incidence * ); 151 void incidenceSelected( Incidence * );
151 /** Emitted, when a todoitem is selected or deselected. */ 152 /** Emitted, when a todoitem is selected or deselected. */
152 void todoSelected( bool ); 153 void todoSelected( bool );
153 154
154 /** 155 /**
155 Emitted, when clipboard content changes. Parameter indicates if paste 156 Emitted, when clipboard content changes. Parameter indicates if paste
156 is possible or not. 157 is possible or not.
157 */ 158 */
158 void pasteEnabled(bool); 159 void pasteEnabled(bool);
159 160
160 /** Emitted, when the number of incoming messages has changed. */ 161 /** Emitted, when the number of incoming messages has changed. */
161 void numIncomingChanged(int); 162 void numIncomingChanged(int);
162 163
163 /** Emitted, when the number of outgoing messages has changed. */ 164 /** Emitted, when the number of outgoing messages has changed. */
164 void numOutgoingChanged(int); 165 void numOutgoingChanged(int);
165 166
166 /** Send status message, which can e.g. be displayed in the status bar. */ 167 /** Send status message, which can e.g. be displayed in the status bar. */
167 void statusMessage(const QString &); 168 void statusMessage(const QString &);
168 169
169 void calendarViewExpanded( bool ); 170 void calendarViewExpanded( bool );
170 void updateSearchDialog(); 171 void updateSearchDialog();
171 172
172 173
173 public slots: 174 public slots:
174 void recheckTimerAlarm(); 175 void recheckTimerAlarm();
175 void checkNextTimerAlarm(); 176 void checkNextTimerAlarm();
176 void addAlarm(const QDateTime &qdt, const QString &noti ); 177 void addAlarm(const QDateTime &qdt, const QString &noti );
177 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 178 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
178 void removeAlarm(const QDateTime &qdt, const QString &noti ); 179 void removeAlarm(const QDateTime &qdt, const QString &noti );
179 180
180 /** options dialog made a changed to the configuration. we catch this 181 /** options dialog made a changed to the configuration. we catch this
181 * and notify all widgets which need to update their configuration. */ 182 * and notify all widgets which need to update their configuration. */
182 void updateConfig(); 183 void updateConfig();
183 184
184 /** 185 /**
185 Load calendar from file \a filename. If \a merge is true, load 186 Load calendar from file \a filename. If \a merge is true, load
186 calendar into existing one, if it is false, clear calendar, before 187 calendar into existing one, if it is false, clear calendar, before
187 loading. Return true, if calendar could be successfully loaded. 188 loading. Return true, if calendar could be successfully loaded.
188 */ 189 */
189 bool openCalendar(QString filename, bool merge=false); 190 bool openCalendar(QString filename, bool merge=false);
190 bool syncCalendar(QString filename,int mode = 0 ); 191 bool syncCalendar(QString filename,int mode = 0 );
191 192
192 /** 193 /**
193 Save calendar data to file. Return true if calendar could be 194 Save calendar data to file. Return true if calendar could be
194 successfully saved. 195 successfully saved.
195 */ 196 */
196 bool saveCalendar(QString filename); 197 bool saveCalendar(QString filename);
197 198
198 /** 199 /**
199 Close calendar. Clear calendar data and reset views to display an empty 200 Close calendar. Clear calendar data and reset views to display an empty
200 calendar. 201 calendar.
201 */ 202 */
202 void closeCalendar(); 203 void closeCalendar();
203 204
204 /** Archive old events of calendar */ 205 /** Archive old events of calendar */
205 void archiveCalendar(); 206 void archiveCalendar();
206 207
207 void showIncidence(); 208 void showIncidence();
208 void editIncidence(); 209 void editIncidence();
209 void editIncidenceDescription(); 210 void editIncidenceDescription();
210 void deleteIncidence(); 211 void deleteIncidence();
211 212
212 /** create an editeventwin with supplied date/time, and if bool is true, 213 /** create an editeventwin with supplied date/time, and if bool is true,
213 * make the event take all day. */ 214 * make the event take all day. */
214 void newEvent(QDateTime, QDateTime, bool allDay = false); 215 void newEvent(QDateTime, QDateTime, bool allDay = false);
215 void newEvent(QDateTime fh); 216 void newEvent(QDateTime fh);
216 void newEvent(QDate dt); 217 void newEvent(QDate dt);
217 /** create new event without having a date hint. Takes current date as 218 /** create new event without having a date hint. Takes current date as
218 default hint. */ 219 default hint. */
219 void newEvent(); 220 void newEvent();
220 void newFloatingEvent(); 221 void newFloatingEvent();
221 222
222 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 223 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
223 void showIncidence(Incidence *); 224 void showIncidence(Incidence *);
224 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 225 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
225 void editIncidence(Incidence *); 226 void editIncidence(Incidence *);
226 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 227 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
227 void deleteIncidence(Incidence *); 228 void deleteIncidence(Incidence *);
228 void cloneIncidence(Incidence *); 229 void cloneIncidence(Incidence *);
229 void cancelIncidence(Incidence *); 230 void cancelIncidence(Incidence *);
230 /** Create an editor for the supplied event. */ 231 /** Create an editor for the supplied event. */
231 void editEvent(Event *); 232 void editEvent(Event *);
232 /** Delete the supplied event. */ 233 /** Delete the supplied event. */
233 void deleteEvent(Event *); 234 void deleteEvent(Event *);
234 /** Delete the event with the given unique ID. Returns false, if event wasn't 235 /** Delete the event with the given unique ID. Returns false, if event wasn't
235 found. */ 236 found. */
236 bool deleteEvent(const QString &uid); 237 bool deleteEvent(const QString &uid);
237 /** Create a read-only viewer dialog for the supplied event. */ 238 /** Create a read-only viewer dialog for the supplied event. */
238 void showEvent(Event *); 239 void showEvent(Event *);
239 240
240 void editJournal(Journal *); 241 void editJournal(Journal *);
241 void showJournal(Journal *); 242 void showJournal(Journal *);
242 void deleteJournal(Journal *); 243 void deleteJournal(Journal *);
243 /** Create an editor dialog for a todo */ 244 /** Create an editor dialog for a todo */
244 void editTodo(Todo *); 245 void editTodo(Todo *);
245 /** Create a read-only viewer dialog for the supplied todo */ 246 /** Create a read-only viewer dialog for the supplied todo */
246 void showTodo(Todo *); 247 void showTodo(Todo *);
247 /** create new todo */ 248 /** create new todo */
248 void newTodo(); 249 void newTodo();
249 /** create new todo with a parent todo */ 250 /** create new todo with a parent todo */
250 void newSubTodo(); 251 void newSubTodo();
251 /** create new todo with a parent todo */ 252 /** create new todo with a parent todo */
252 void newSubTodo(Todo *); 253 void newSubTodo(Todo *);
253 /** Delete todo */ 254 /** Delete todo */
254 void deleteTodo(Todo *); 255 void deleteTodo(Todo *);
255 256
256 257
257 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 258 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
258 * emitted as result. */ 259 * emitted as result. */
259 void checkClipboard(); 260 void checkClipboard();
260 261
261 /** using the KConfig associated with the kapp variable, read in the 262 /** using the KConfig associated with the kapp variable, read in the
262 * settings from the config file. 263 * settings from the config file.
263 */ 264 */
264 void readSettings(); 265 void readSettings();
265 266
266 /** write current state to config file. */ 267 /** write current state to config file. */
267 void writeSettings(); 268 void writeSettings();
268 269
269 /** read settings for calendar filters */ 270 /** read settings for calendar filters */
270 void readFilterSettings(KConfig *config); 271 void readFilterSettings(KConfig *config);
271 272
272 /** write settings for calendar filters */ 273 /** write settings for calendar filters */
273 void writeFilterSettings(KConfig *config); 274 void writeFilterSettings(KConfig *config);
274 275
275 /** passes on the message that an event has changed to the currently 276 /** passes on the message that an event has changed to the currently
276 * activated view so that it can make appropriate display changes. */ 277 * activated view so that it can make appropriate display changes. */
277 void changeEventDisplay(Event *, int); 278 void changeEventDisplay(Event *, int);
278 void changeIncidenceDisplay(Incidence *, int); 279 void changeIncidenceDisplay(Incidence *, int);
279 void changeTodoDisplay(Todo *, int); 280 void changeTodoDisplay(Todo *, int);
280 281
281 void eventAdded(Event *); 282 void eventAdded(Event *);
282 void eventChanged(Event *); 283 void eventChanged(Event *);
283 void eventToBeDeleted(Event *); 284 void eventToBeDeleted(Event *);
284 void eventDeleted(); 285 void eventDeleted();
285 286
286 void todoAdded(Todo *); 287 void todoAdded(Todo *);
287 void todoChanged(Todo *); 288 void todoChanged(Todo *);
288 void todoToBeDeleted(Todo *); 289 void todoToBeDeleted(Todo *);
289 void todoDeleted(); 290 void todoDeleted();
290 291
291 void updateView(const QDate &start, const QDate &end); 292 void updateView(const QDate &start, const QDate &end);
292 void updateView(); 293 void updateView();
293 294
294 /** Full update of visible todo views */ 295 /** Full update of visible todo views */
295 void updateTodoViews(); 296 void updateTodoViews();
296 297
297 void updateUnmanagedViews(); 298 void updateUnmanagedViews();
298 299
299 /** cut the current appointment to the clipboard */ 300 /** cut the current appointment to the clipboard */
300 void edit_cut(); 301 void edit_cut();
301 302
302 /** copy the current appointment(s) to the clipboard */ 303 /** copy the current appointment(s) to the clipboard */
303 void edit_copy(); 304 void edit_copy();
304 305
305 /** paste the current vobject(s) in the clipboard buffer into calendar */ 306 /** paste the current vobject(s) in the clipboard buffer into calendar */
306 void edit_paste(); 307 void edit_paste();
307 308
308 /** edit viewing and configuration options. */ 309 /** edit viewing and configuration options. */
309 void edit_options(); 310 void edit_options();
310 void edit_sync_options(); 311 void edit_sync_options();
311 /** 312 /**
312 Functions for printing, previewing a print, and setting up printing 313 Functions for printing, previewing a print, and setting up printing
313 parameters. 314 parameters.
314 */ 315 */
315 void print(); 316 void print();
316 void printSetup(); 317 void printSetup();
317 void printPreview(); 318 void printPreview();
318 319
319 /** Export as iCalendar file */ 320 /** Export as iCalendar file */
320 void exportICalendar(); 321 void exportICalendar();
321 322
322 /** Export as vCalendar file */ 323 /** Export as vCalendar file */
323 bool exportVCalendar( QString fn); 324 bool exportVCalendar( QString fn);
324 325
325 /** pop up a dialog to show an existing appointment. */ 326 /** pop up a dialog to show an existing appointment. */
326 void appointment_show(); 327 void appointment_show();
327 /** 328 /**
328 * pop up an Appointment Dialog to edit an existing appointment.Get 329 * pop up an Appointment Dialog to edit an existing appointment.Get
329 * information on the appointment from the list of unique IDs that is 330 * information on the appointment from the list of unique IDs that is
330 * currently in the View, called currIds. 331 * currently in the View, called currIds.
331 */ 332 */
332 void appointment_edit(); 333 void appointment_edit();
333 /** 334 /**
334 * pop up dialog confirming deletion of currently selected event in the 335 * pop up dialog confirming deletion of currently selected event in the
335 * View. 336 * View.
336 */ 337 */
337 void appointment_delete(); 338 void appointment_delete();
338 339
339 /** mails the currently selected event to a particular user as a vCalendar 340 /** mails the currently selected event to a particular user as a vCalendar
340 attachment. */ 341 attachment. */
341 void action_mail(); 342 void action_mail();
342 343
343 /* frees a subtodo from it's relation */ 344 /* frees a subtodo from it's relation */
344 void todo_unsub( Todo * ); 345 void todo_unsub( Todo * );
345 346
346 /** Take ownership of selected event. */ 347 /** Take ownership of selected event. */
347 void takeOverEvent(); 348 void takeOverEvent();
348 349
349 /** Take ownership of all events in calendar. */ 350 /** Take ownership of all events in calendar. */
350 void takeOverCalendar(); 351 void takeOverCalendar();
351 352
352 /** query whether or not the calendar is "dirty". */ 353 /** query whether or not the calendar is "dirty". */
353 bool isModified(); 354 bool isModified();
354 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 355 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
355 void setModified(bool modified=true); 356 void setModified(bool modified=true);
356 357
357 /** query if the calendar is read-only. */ 358 /** query if the calendar is read-only. */
358 bool isReadOnly(); 359 bool isReadOnly();
359 /** set state of calendar to read-only */ 360 /** set state of calendar to read-only */
360 void setReadOnly(bool readOnly=true); 361 void setReadOnly(bool readOnly=true);
361 362
362 void eventUpdated(Incidence *); 363 void eventUpdated(Incidence *);
363 364
364 /* iTIP scheduling actions */ 365 /* iTIP scheduling actions */
365 void schedule_publish(Incidence *incidence = 0); 366 void schedule_publish(Incidence *incidence = 0);
366 void schedule_request(Incidence *incidence = 0); 367 void schedule_request(Incidence *incidence = 0);
367 void schedule_refresh(Incidence *incidence = 0); 368 void schedule_refresh(Incidence *incidence = 0);
368 void schedule_cancel(Incidence *incidence = 0); 369 void schedule_cancel(Incidence *incidence = 0);
369 void schedule_add(Incidence *incidence = 0); 370 void schedule_add(Incidence *incidence = 0);
370 void schedule_reply(Incidence *incidence = 0); 371 void schedule_reply(Incidence *incidence = 0);
371 void schedule_counter(Incidence *incidence = 0); 372 void schedule_counter(Incidence *incidence = 0);
372 void schedule_declinecounter(Incidence *incidence = 0); 373 void schedule_declinecounter(Incidence *incidence = 0);
373 void schedule_publish_freebusy(int daysToPublish = 30); 374 void schedule_publish_freebusy(int daysToPublish = 30);
374 375
375 void openAddressbook(); 376 void openAddressbook();
376 377
377 void editFilters(); 378 void editFilters();
378 void toggleFilerEnabled(); 379 void toggleFilerEnabled();
379 380
380 void toggleFilter(); 381 void toggleFilter();
381 void showFilter(bool visible); 382 void showFilter(bool visible);
382 void updateFilter(); 383 void updateFilter();
383 void filterEdited(); 384 void filterEdited();
384 void selectFilter( int ); 385 void selectFilter( int );
385 386
386 void showIntro(); 387 void showIntro();
387 388
388 /** Move the curdatepient view date to today */ 389 /** Move the curdatepient view date to today */
389 void goToday(); 390 void goToday();
390 391
391 /** Move to the next date(s) in the current view */ 392 /** Move to the next date(s) in the current view */
392 void goNext(); 393 void goNext();
393 394
394 /** Move to the previous date(s) in the current view */ 395 /** Move to the previous date(s) in the current view */
395 void goPrevious(); 396 void goPrevious();
396 /** Move to the next date(s) in the current view */ 397 /** Move to the next date(s) in the current view */
397 void goNextMonth(); 398 void goNextMonth();
398 399
399 /** Move to the previous date(s) in the current view */ 400 /** Move to the previous date(s) in the current view */
400 void goPreviousMonth(); 401 void goPreviousMonth();
401 402
402 void toggleExpand(); 403 void toggleExpand();
403 void toggleDateNavigatorWidget(); 404 void toggleDateNavigatorWidget();
404 void toggleAllDaySize(); 405 void toggleAllDaySize();
405 void dialogClosing(Incidence *); 406 void dialogClosing(Incidence *);
406 407
407 /** Look for new messages in the inbox */ 408 /** Look for new messages in the inbox */
408 void lookForIncomingMessages(); 409 void lookForIncomingMessages();
409 /** Look for new messages in the outbox */ 410 /** Look for new messages in the outbox */
410 void lookForOutgoingMessages(); 411 void lookForOutgoingMessages();
411 412
412 void processMainViewSelection( Incidence * ); 413 void processMainViewSelection( Incidence * );
413 void processTodoListSelection( Incidence * ); 414 void processTodoListSelection( Incidence * );
414 415
415 void processIncidenceSelection( Incidence * ); 416 void processIncidenceSelection( Incidence * );
416 417
417 void purgeCompleted(); 418 void purgeCompleted();
418 bool removeCompletedSubTodos( Todo* ); 419 bool removeCompletedSubTodos( Todo* );
419 void slotCalendarChanged(); 420 void slotCalendarChanged();
420 bool importBday(); 421 bool importBday();
421 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 422 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
422 bool importQtopia( const QString &categoriesFile, 423 bool importQtopia( const QString &categoriesFile,
423 const QString &datebookFile, 424 const QString &datebookFile,
424 const QString &tasklistFile ); 425 const QString &tasklistFile );
425 void syncSharp( ); 426 void syncSharp( );
426 void slotSelectPickerDate( QDate ) ; 427 void slotSelectPickerDate( QDate ) ;
427 void showDatePicker( ) ; 428 void showDatePicker( ) ;
428 void moveIncidence(Incidence *) ; 429 void moveIncidence(Incidence *) ;
429 void beamIncidence(Incidence *) ; 430 void beamIncidence(Incidence *) ;
430 void beamCalendar() ; 431 void beamCalendar() ;
431 void beamFilteredCalendar() ; 432 void beamFilteredCalendar() ;
432 void beamIncidenceList(QPtrList<Incidence>) ; 433 void beamIncidenceList(QPtrList<Incidence>) ;
433 void manageCategories(); 434 void manageCategories();
434 int addCategories(); 435 int addCategories();
435 void removeCategories(); 436 void removeCategories();
436 void setSyncDevice( QString ); 437 void setSyncDevice( QString );
437 void setSyncName( QString ); 438 void setSyncName( QString );
438 protected slots: 439 protected slots:
439 void timerAlarm(); 440 void timerAlarm();
440 void suspendAlarm(); 441 void suspendAlarm();
441 void beamDone( Ir *ir ); 442 void beamDone( Ir *ir );
442 /** Select a view or adapt the current view to display the specified dates. */ 443 /** Select a view or adapt the current view to display the specified dates. */
443 void showDates( const KCal::DateList & ); 444 void showDates( const KCal::DateList & );
444 void selectWeekNum ( int ); 445 void selectWeekNum ( int );
445 446
446 public: 447 public:
447 // show a standard warning 448 // show a standard warning
448 // returns KMsgBox::yesNoCancel() 449 // returns KMsgBox::yesNoCancel()
449 int msgCalModified(); 450 int msgCalModified();
450 void confSync(); 451 void confSync();
451 void setLoadedFileVersion(QDateTime); 452 void setLoadedFileVersion(QDateTime);
452 bool checkFileVersion(QString fn); 453 bool checkFileVersion(QString fn);
453 bool checkFileChanged(QString fn); 454 bool checkFileChanged(QString fn);
454 Event* getLastSyncEvent(); 455 Event* getLastSyncEvent();
455 /** Adapt navigation units correpsonding to step size of navigation of the 456 /** Adapt navigation units correpsonding to step size of navigation of the
456 * current view. 457 * current view.
457 */ 458 */
458 void adaptNavigationUnits(); 459 void adaptNavigationUnits();
459 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 460 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
460 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 461 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
461 //Attendee* getYourAttendee(Event *event); 462 //Attendee* getYourAttendee(Event *event);
462 protected: 463 protected:
463 void schedule(Scheduler::Method, Incidence *incidence = 0); 464 void schedule(Scheduler::Method, Incidence *incidence = 0);
464 465
465 // returns KMsgBox::OKCandel() 466 // returns KMsgBox::OKCandel()
466 int msgItemDelete(); 467 int msgItemDelete();
467 void showEventEditor(); 468 void showEventEditor();
468 void showTodoEditor(); 469 void showTodoEditor();
469 void writeLocale(); 470 void writeLocale();
470 Todo *selectedTodo(); 471 Todo *selectedTodo();
471 472
472 private: 473 private:
473 AlarmDialog * mAlarmDialog; 474 AlarmDialog * mAlarmDialog;
474 QString mAlarmNotification; 475 QString mAlarmNotification;
475 QString mSuspendAlarmNotification; 476 QString mSuspendAlarmNotification;
476 QTimer* mSuspendTimer; 477 QTimer* mSuspendTimer;
477 QTimer* mAlarmTimer; 478 QTimer* mAlarmTimer;
478 QTimer* mRecheckAlarmTimer; 479 QTimer* mRecheckAlarmTimer;
479 void computeAlarm( QString ); 480 void computeAlarm( QString );
480 void startAlarm( QString, QString ); 481 void startAlarm( QString, QString );
481 void setSyncEventsReadOnly(); 482 void setSyncEventsReadOnly();
482 483
483 QDateTime loadedFileVersion; 484 QDateTime loadedFileVersion;
484 void checkSharpEvent( Event* lastSync, Incidence* toDelete ); 485 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
485 void checkZaurusId( int id, bool todo = false ); 486 void checkZaurusId( int id, bool todo = false );
486 int mGlobalSyncMode; 487 int mGlobalSyncMode;
487 QString mCurrentSyncDevice; 488 QString mCurrentSyncDevice;
488 QString mCurrentSyncName; 489 QString mCurrentSyncName;
489 KOBeamPrefs* beamDialog; 490 KOBeamPrefs* beamDialog;
490 void init(); 491 void init();
491 int mDatePickerMode; 492 int mDatePickerMode;
492 bool mFlagEditDescription; 493 bool mFlagEditDescription;
493 QDateTime mLastCalendarSync; 494 QDateTime mLastCalendarSync;
494 void createPrinter(); 495 void createPrinter();
495 496
496 void calendarModified( bool, Calendar * ); 497 void calendarModified( bool, Calendar * );
497 498
498 CalPrinter *mCalPrinter; 499 CalPrinter *mCalPrinter;
499 500
500 QSplitter *mPanner; 501 QSplitter *mPanner;
501 QSplitter *mLeftSplitter; 502 QSplitter *mLeftSplitter;
502 QWidget *mLeftFrame; 503 QWidget *mLeftFrame;
503 QWidgetStack *mRightFrame; 504 QWidgetStack *mRightFrame;
504 505
505 KDatePicker* mDatePicker; 506 KDatePicker* mDatePicker;
506 QVBox* mDateFrame; 507 QVBox* mDateFrame;
507 NavigatorBar *mNavigatorBar; 508 NavigatorBar *mNavigatorBar;
508 509
509 KDateNavigator *mDateNavigator; // widget showing small month view. 510 KDateNavigator *mDateNavigator; // widget showing small month view.
510 511
511 KOFilterView *mFilterView; 512 KOFilterView *mFilterView;
512 513
513 ResourceView *mResourceView; 514 ResourceView *mResourceView;
514 515
515 // calendar object for this viewing instance 516 // calendar object for this viewing instance
516 Calendar *mCalendar; 517 Calendar *mCalendar;
517 518
518 CalendarResourceManager *mResourceManager; 519 CalendarResourceManager *mResourceManager;
519 520
520 FileStorage *mStorage; 521 FileStorage *mStorage;
521 522
522 DateNavigator *mNavigator; 523 DateNavigator *mNavigator;
523 524
524 KOViewManager *mViewManager; 525 KOViewManager *mViewManager;
525 KODialogManager *mDialogManager; 526 KODialogManager *mDialogManager;
526 527
527 // Calendar filters 528 // Calendar filters
528 QPtrList<CalFilter> mFilters; 529 QPtrList<CalFilter> mFilters;
529 530
530 // various housekeeping variables. 531 // various housekeeping variables.
531 bool mModified; // flag indicating if calendar is modified 532 bool mModified; // flag indicating if calendar is modified
532 bool mReadOnly; // flag indicating if calendar is read-only 533 bool mReadOnly; // flag indicating if calendar is read-only
533 QDate mSaveSingleDate; 534 QDate mSaveSingleDate;
534 535
535 Incidence *mSelectedIncidence; 536 Incidence *mSelectedIncidence;
536 Incidence *mMoveIncidence; 537 Incidence *mMoveIncidence;
537 538 QPtrList<Event> mExternLastSyncEvent;
538 KOTodoView *mTodoList; 539 KOTodoView *mTodoList;
539 KOEventEditor * mEventEditor; 540 KOEventEditor * mEventEditor;
540 KOTodoEditor * mTodoEditor; 541 KOTodoEditor * mTodoEditor;
541 KOEventViewerDialog * mEventViewerDialog; 542 KOEventViewerDialog * mEventViewerDialog;
542 void keyPressEvent ( QKeyEvent *e) ; 543 void keyPressEvent ( QKeyEvent *e) ;
543 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 544 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
544}; 545};
545 546
546 547
547class CalendarViewVisitor : public Incidence::Visitor 548class CalendarViewVisitor : public Incidence::Visitor
548{ 549{
549 public: 550 public:
550 CalendarViewVisitor() : mView( 0 ) {} 551 CalendarViewVisitor() : mView( 0 ) {}
551 552
552 bool act( Incidence *incidence, CalendarView *view ) 553 bool act( Incidence *incidence, CalendarView *view )
553 { 554 {
554 mView = view; 555 mView = view;
555 return incidence->accept( *this ); 556 return incidence->accept( *this );
556 } 557 }
557 558
558 protected: 559 protected:
559 CalendarView *mView; 560 CalendarView *mView;
560}; 561};
561 562
562class ShowIncidenceVisitor : public CalendarViewVisitor 563class ShowIncidenceVisitor : public CalendarViewVisitor
563{ 564{
564 protected: 565 protected:
565 bool visit( Event *event ) { mView->showEvent( event ); return true; } 566 bool visit( Event *event ) { mView->showEvent( event ); return true; }
566 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 567 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
567 bool visit( Journal * j ) { mView->showJournal( j );return true; } 568 bool visit( Journal * j ) { mView->showJournal( j );return true; }
568}; 569};
569 570
570class EditIncidenceVisitor : public CalendarViewVisitor 571class EditIncidenceVisitor : public CalendarViewVisitor
571{ 572{
572 protected: 573 protected:
573 bool visit( Event *event ) { mView->editEvent( event ); return true; } 574 bool visit( Event *event ) { mView->editEvent( event ); return true; }
574 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 575 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
575 bool visit( Journal *j ) { mView->editJournal( j); return true; } 576 bool visit( Journal *j ) { mView->editJournal( j); return true; }
576}; 577};
577 578
578class DeleteIncidenceVisitor : public CalendarViewVisitor 579class DeleteIncidenceVisitor : public CalendarViewVisitor
579{ 580{
580 protected: 581 protected:
581 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 582 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
582 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 583 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
583 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 584 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
584}; 585};
585 586
586#endif 587#endif
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 3ba5ab2..f3231ff 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,396 +1,397 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qfont.h> 32#include <qfont.h>
33#include <qcolor.h> 33#include <qcolor.h>
34#include <qstringlist.h> 34#include <qstringlist.h>
35#include <stdlib.h> 35#include <stdlib.h>
36 36
37#include <kglobal.h> 37#include <kglobal.h>
38#include <kconfig.h> 38#include <kconfig.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kdebug.h> 40#include <kdebug.h>
41#include <kemailsettings.h> 41#include <kemailsettings.h>
42#include <kstaticdeleter.h> 42#include <kstaticdeleter.h>
43 43
44#include "koprefs.h" 44#include "koprefs.h"
45#include "mainwindow.h" 45#include "mainwindow.h"
46 46
47const char *germanwords[][2] = { 47const char *germanwords[][2] = {
48#include "wordsgerman.h" 48#include "wordsgerman.h"
49 "", "" 49 "", ""
50}; 50};
51 51
52KOPrefs *KOPrefs::mInstance = 0; 52KOPrefs *KOPrefs::mInstance = 0;
53static KStaticDeleter<KOPrefs> insd; 53static KStaticDeleter<KOPrefs> insd;
54 54
55KOPrefs::KOPrefs() : 55KOPrefs::KOPrefs() :
56 KPimPrefs("korganizerrc") 56 KPimPrefs("korganizerrc")
57{ 57{
58 mCategoryColors.setAutoDelete(true); 58 mCategoryColors.setAutoDelete(true);
59 mLocaleDict = 0; 59 mLocaleDict = 0;
60 fillMailDefaults(); 60 fillMailDefaults();
61 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 61 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
62 QColor defaultHolidayColor = QColor(255,0,0); 62 QColor defaultHolidayColor = QColor(255,0,0);
63 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 63 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
64 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 64 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
65 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 65 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
66 QColor defaultTodoDueTodayColor = QColor(255,220,100); 66 QColor defaultTodoDueTodayColor = QColor(255,220,100);
67 QColor defaultTodoOverdueColor = QColor(255,153,125); 67 QColor defaultTodoOverdueColor = QColor(255,153,125);
68 68
69 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); 69 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
70 mDefaultViewFont = QFont("helvetica",10); 70 mDefaultViewFont = QFont("helvetica",10);
71 mDefaultMonthViewFont = QFont("helvetica",8); 71 mDefaultMonthViewFont = QFont("helvetica",8);
72 mMarcusBainsFont= QFont("helvetica",10); 72 mMarcusBainsFont= QFont("helvetica",10);
73 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); 73 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
74 mEditBoxFont = QFont("helvetica",12); 74 mEditBoxFont = QFont("helvetica",12);
75 mJornalViewFont = QFont("helvetica",12); 75 mJornalViewFont = QFont("helvetica",12);
76 76
77 KPrefs::setCurrentGroup("General"); 77 KPrefs::setCurrentGroup("General");
78 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 78 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
79 79
80 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 80 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
81 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 81 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
82 addItemBool("ShowIconSearch",&mShowIconSearch,true); 82 addItemBool("ShowIconSearch",&mShowIconSearch,true);
83 addItemBool("ShowIconList",&mShowIconList,true); 83 addItemBool("ShowIconList",&mShowIconList,true);
84 addItemBool("ShowIconDay1",&mShowIconDay1,true); 84 addItemBool("ShowIconDay1",&mShowIconDay1,true);
85 addItemBool("ShowIconDay5",&mShowIconDay5,true); 85 addItemBool("ShowIconDay5",&mShowIconDay5,true);
86 addItemBool("ShowIconDay7",&mShowIconDay7,true); 86 addItemBool("ShowIconDay7",&mShowIconDay7,true);
87 addItemBool("ShowIconMonth",&mShowIconMonth,true); 87 addItemBool("ShowIconMonth",&mShowIconMonth,true);
88 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 88 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
89 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 89 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
90 addItemBool("ShowIconBack",&mShowIconBack,true); 90 addItemBool("ShowIconBack",&mShowIconBack,true);
91 addItemBool("ShowIconToday",&mShowIconToday,true); 91 addItemBool("ShowIconToday",&mShowIconToday,true);
92 addItemBool("ShowIconForward",&mShowIconForward,true); 92 addItemBool("ShowIconForward",&mShowIconForward,true);
93 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 93 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
94 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); 94 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
95 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 95 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
96 addItemBool("ShowIconNext",&mShowIconNext,true); 96 addItemBool("ShowIconNext",&mShowIconNext,true);
97 addItemBool("ShowIconJournal",&mShowIconJournal,true); 97 addItemBool("ShowIconJournal",&mShowIconJournal,true);
98 addItemBool("ShowIconStretch",&mShowIconStretch,true); 98 addItemBool("ShowIconStretch",&mShowIconStretch,true);
99 addItemBool("LanguageChanged",&mLanguageChanged,false); 99 addItemBool("LanguageChanged",&mLanguageChanged,false);
100 100
101 addItemBool("AskForQuit",&mAskForQuit,false); 101 addItemBool("AskForQuit",&mAskForQuit,false);
102 102
103#ifndef DESKTOP_VERSION 103#ifndef DESKTOP_VERSION
104 addItemBool("ShowFullMenu",&mShowFullMenu,false); 104 addItemBool("ShowFullMenu",&mShowFullMenu,false);
105#else 105#else
106 addItemBool("ShowFullMenu",&mShowFullMenu,true); 106 addItemBool("ShowFullMenu",&mShowFullMenu,true);
107#endif 107#endif
108 addItemBool("ToolBarHor",&mToolBarHor, true ); 108 addItemBool("ToolBarHor",&mToolBarHor, true );
109 addItemBool("ToolBarUp",&mToolBarUp, false ); 109 addItemBool("ToolBarUp",&mToolBarUp, false );
110 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 110 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
111 addItemInt("Whats Next Days",&mWhatsNextDays,3); 111 addItemInt("Whats Next Days",&mWhatsNextDays,3);
112 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 112 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
113 113
114 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 114 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
115 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 115 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
116 addItemInt("AllDay Size",&mAllDaySize,28); 116 addItemInt("AllDay Size",&mAllDaySize,28);
117 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 117 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
118 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 118 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
119 119
120 addItemStringList("LocationDefaults",&mLocationDefaults ); 120 addItemStringList("LocationDefaults",&mLocationDefaults );
121 addItemStringList("EventSummary User",&mEventSummaryUser); 121 addItemStringList("EventSummary User",&mEventSummaryUser);
122 addItemStringList("TodoSummary User",&mTodoSummaryUser); 122 addItemStringList("TodoSummary User",&mTodoSummaryUser);
123 123
124 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 124 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
125 addItemBool("Enable Project View",&mEnableProjectView,false); 125 addItemBool("Enable Project View",&mEnableProjectView,false);
126 addItemBool("Auto Save",&mAutoSave,false); 126 addItemBool("Auto Save",&mAutoSave,false);
127 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 127 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
128 addItemBool("Confirm Deletes",&mConfirm,true); 128 addItemBool("Confirm Deletes",&mConfirm,true);
129 addItemString("Archive File",&mArchiveFile); 129 addItemString("Archive File",&mArchiveFile);
130 addItemString("Html Export File",&mHtmlExportFile, 130 addItemString("Html Export File",&mHtmlExportFile,
131 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 131 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
132 addItemBool("Html With Save",&mHtmlWithSave,false); 132 addItemBool("Html With Save",&mHtmlWithSave,false);
133 133
134 KPrefs::setCurrentGroup("Personal Settings"); 134 KPrefs::setCurrentGroup("Personal Settings");
135 135
136 addItemInt("Mail Client",&mMailClient,MailClientKMail); 136 addItemInt("Mail Client",&mMailClient,MailClientKMail);
137 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 137 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
138 addItemBool("Bcc",&mBcc,false); 138 addItemBool("Bcc",&mBcc,false);
139 139
140 KPrefs::setCurrentGroup("Time & Date"); 140 KPrefs::setCurrentGroup("Time & Date");
141 141
142 // addItemString("Time Zone",&mTimeZone,"+0100"); 142 // addItemString("Time Zone",&mTimeZone,"+0100");
143 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 143 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
144 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); 144 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60);
145 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 145 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
146 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 146 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
147 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 147 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
148 148
149 149
150 addItemInt("Default Start Time",&mStartTime,10); 150 addItemInt("Default Start Time",&mStartTime,10);
151 addItemInt("Default Duration",&mDefaultDuration,2); 151 addItemInt("Default Duration",&mDefaultDuration,2);
152 addItemInt("Default Alarm Time",&mAlarmTime,3); 152 addItemInt("Default Alarm Time",&mAlarmTime,3);
153 addItemInt("Daylight Savings",&mDaylightSavings,0); 153 addItemInt("Daylight Savings",&mDaylightSavings,0);
154 KPrefs::setCurrentGroup("AlarmSettings"); 154 KPrefs::setCurrentGroup("AlarmSettings");
155 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 155 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
156 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 156 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
157 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 157 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
158 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 158 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
159 159
160 160
161 KPrefs::setCurrentGroup("Calendar"); 161 KPrefs::setCurrentGroup("Calendar");
162 162
163 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 163 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
164 164
165 KPrefs::setCurrentGroup("Fonts"); 165 KPrefs::setCurrentGroup("Fonts");
166 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 166 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
167 addItemFont("TimeBar Font",&mTimeBarFont); 167 addItemFont("TimeBar Font",&mTimeBarFont);
168 addItemFont("MonthView Font",&mMonthViewFont); 168 addItemFont("MonthView Font",&mMonthViewFont);
169 addItemFont("AgendaView Font",&mAgendaViewFont); 169 addItemFont("AgendaView Font",&mAgendaViewFont);
170 addItemFont("MarcusBains Font",&mMarcusBainsFont); 170 addItemFont("MarcusBains Font",&mMarcusBainsFont);
171 addItemFont("TimeLabels Font",&mTimeLabelsFont); 171 addItemFont("TimeLabels Font",&mTimeLabelsFont);
172 addItemFont("TodoView Font",&mTodoViewFont); 172 addItemFont("TodoView Font",&mTodoViewFont);
173 addItemFont("ListView Font",&mListViewFont); 173 addItemFont("ListView Font",&mListViewFont);
174 addItemFont("DateNavigator Font",&mDateNavigatorFont); 174 addItemFont("DateNavigator Font",&mDateNavigatorFont);
175 addItemFont("EditBox Font",&mEditBoxFont); 175 addItemFont("EditBox Font",&mEditBoxFont);
176 addItemFont("JournalView Font",&mJornalViewFont); 176 addItemFont("JournalView Font",&mJornalViewFont);
177 addItemFont("WhatsNextView Font",&mWhatsNextFont); 177 addItemFont("WhatsNextView Font",&mWhatsNextFont);
178 addItemFont("EventView Font",&mEventViewFont); 178 addItemFont("EventView Font",&mEventViewFont);
179 179
180 KPrefs::setCurrentGroup("SyncProfiles"); 180// KPrefs::setCurrentGroup("SyncProfiles");
181 addItemString("LocalMachineName",&mLocalMachineName, "undefined"); 181// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
182 addItemStringList("SyncProfileNames",&mSyncProfileNames); 182// addItemStringList("SyncProfileNames",&mSyncProfileNames);
183// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
183 184
184 KPrefs::setCurrentGroup("RemoteSyncing"); 185 KPrefs::setCurrentGroup("RemoteSyncing");
185 addItemBool("UsePasswd",&mUsePassWd,false); 186// addItemBool("UsePasswd",&mUsePassWd,false);
186 addItemBool("WriteBackFile",&mWriteBackFile,true); 187// addItemBool("WriteBackFile",&mWriteBackFile,true);
187 addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); 188// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
188 addItemBool("AskForPreferences",&mAskForPreferences,true); 189// addItemBool("AskForPreferences",&mAskForPreferences,true);
189 addItemBool("ShowSyncSummary",&mShowSyncSummary,true); 190// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
190 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 191 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
191 addItemInt("LastSyncTime",&mLastSyncTime,0); 192 addItemInt("LastSyncTime",&mLastSyncTime,0);
192 addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); 193 addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3);
193 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); 194 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
194 195
195#ifdef _WIN32_ 196#ifdef _WIN32_
196 QString hdp= locateLocal("data","korganizer")+"\\\\"; 197 QString hdp= locateLocal("data","korganizer")+"\\\\";
197#else 198#else
198 QString hdp= locateLocal("data","korganizer")+"/"; 199 QString hdp= locateLocal("data","korganizer")+"/";
199#endif 200#endif
200 addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); 201// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
201 addItemString("RemoteUser",&mRemoteUser, "zaurus"); 202// addItemString("RemoteUser",&mRemoteUser, "zaurus");
202 addItemString("RemotePassWd",&mRemotePassWd, ""); 203// addItemString("RemotePassWd",&mRemotePassWd, "");
203 addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); 204// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
204 addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); 205// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
205 206
206 207
207 KPrefs::setCurrentGroup("LoadSaveFileNames"); 208 KPrefs::setCurrentGroup("LoadSaveFileNames");
208 209
209 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 210 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
210 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 211 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
211 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 212 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
212 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 213 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
213 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); 214 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
214 215
215 216
216 KPrefs::setCurrentGroup("Locale"); 217 KPrefs::setCurrentGroup("Locale");
217 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 218 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
218 addItemInt("PreferredTime",&mPreferredTime,0); 219 addItemInt("PreferredTime",&mPreferredTime,0);
219 addItemInt("PreferredDate",&mPreferredDate,0); 220 addItemInt("PreferredDate",&mPreferredDate,0);
220 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 221 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
221 addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); 222 addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
222 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 223 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
223 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 224 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
224 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 225 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
225 226
226 227
227 KPrefs::setCurrentGroup("Colors"); 228 KPrefs::setCurrentGroup("Colors");
228 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 229 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
229 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 230 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
230 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 231 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
231 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 232 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
232 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 233 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
233 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 234 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
234 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 235 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
235 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 236 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
236 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 237 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
237 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 238 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
238 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 239 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
239 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 240 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
240 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 241 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
241 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 242 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
242 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 243 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
243 addItemBool("UseAppColors",&mUseAppColors,false); 244 addItemBool("UseAppColors",&mUseAppColors,false);
244 245
245 246
246 247
247 KPrefs::setCurrentGroup("Views"); 248 KPrefs::setCurrentGroup("Views");
248 addItemInt("Hour Size",&mHourSize,8); 249 addItemInt("Hour Size",&mHourSize,8);
249 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 250 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
250 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 251 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
251 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 252 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
252 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 253 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
253 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 254 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
254 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 255 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
255 addItemBool("Enable ToolTips",&mEnableToolTips,false); 256 addItemBool("Enable ToolTips",&mEnableToolTips,false);
256 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 257 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
257 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 258 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
258 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 259 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
259 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 260 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
260 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); 261 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
261 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 262 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
262 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 263 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
263 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 264 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
264 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 265 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
265 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); 266 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);
266 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 267 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
267 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 268 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
268 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 269 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
269 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 270 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
270 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 271 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
271 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); 272 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
272 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 273 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
273 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 274 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
274#ifdef DESKTOP_VERSION 275#ifdef DESKTOP_VERSION
275 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 276 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
276#else 277#else
277 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 278 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
278#endif 279#endif
279 addItemInt("Day Begins",&mDayBegins,7); 280 addItemInt("Day Begins",&mDayBegins,7);
280 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 281 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
281 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 282 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
282 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 283 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
283 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 284 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
284 285
285 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 286 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
286 addItemBool("Full View Month",&mFullViewMonth,true); 287 addItemBool("Full View Month",&mFullViewMonth,true);
287 addItemBool("Full View Todo",&mFullViewTodo,true); 288 addItemBool("Full View Todo",&mFullViewTodo,true);
288 addItemBool("Quick Todo",&mEnableQuickTodo,false); 289 addItemBool("Quick Todo",&mEnableQuickTodo,false);
289 290
290 addItemInt("Next X Days",&mNextXDays,3); 291 addItemInt("Next X Days",&mNextXDays,3);
291 292
292 KPrefs::setCurrentGroup("Printer"); 293 KPrefs::setCurrentGroup("Printer");
293 294
294 KPrefs::setCurrentGroup("Layout"); 295 KPrefs::setCurrentGroup("Layout");
295 296
296 addItemBool("CompactDialogs",&mCompactDialogs,false); 297 addItemBool("CompactDialogs",&mCompactDialogs,false);
297 addItemBool("VerticalScreen",&mVerticalScreen,true); 298 addItemBool("VerticalScreen",&mVerticalScreen,true);
298 299
299 KPrefs::setCurrentGroup("KOrganizer Plugins"); 300 KPrefs::setCurrentGroup("KOrganizer Plugins");
300 301
301 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 302 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
302 303
303 KPrefs::setCurrentGroup("Group Scheduling"); 304 KPrefs::setCurrentGroup("Group Scheduling");
304 305
305 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 306 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
306 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 307 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
307 addItemStringList("AdditionalMails",&mAdditionalMails,""); 308 addItemStringList("AdditionalMails",&mAdditionalMails,"");
308 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 309 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
309 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 310 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
310 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 311 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
311 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 312 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
312 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 313 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
313 314
314 KPrefs::setCurrentGroup( "Editors" ); 315 KPrefs::setCurrentGroup( "Editors" );
315 316
316 addItemStringList( "EventTemplates", &mEventTemplates ); 317 addItemStringList( "EventTemplates", &mEventTemplates );
317 addItemStringList( "TodoTemplates", &mTodoTemplates ); 318 addItemStringList( "TodoTemplates", &mTodoTemplates );
318 319
319 addItemInt("DestinationPolicy",&mDestination,standardDestination); 320 addItemInt("DestinationPolicy",&mDestination,standardDestination);
320 321
321 322
322 323
323} 324}
324 325
325 326
326KOPrefs::~KOPrefs() 327KOPrefs::~KOPrefs()
327{ 328{
328 if (mInstance == this) 329 if (mInstance == this)
329 mInstance = insd.setObject(0); 330 mInstance = insd.setObject(0);
330 setLocaleDict( 0 ); 331 setLocaleDict( 0 );
331 if ( mLocaleDict ) 332 if ( mLocaleDict )
332 delete mLocaleDict; 333 delete mLocaleDict;
333 //qDebug("KOPrefs::~KOPrefs() "); 334 //qDebug("KOPrefs::~KOPrefs() ");
334} 335}
335 336
336 337
337KOPrefs *KOPrefs::instance() 338KOPrefs *KOPrefs::instance()
338{ 339{
339 if (!mInstance) { 340 if (!mInstance) {
340 mInstance = insd.setObject(new KOPrefs()); 341 mInstance = insd.setObject(new KOPrefs());
341 mInstance->readConfig(); 342 mInstance->readConfig();
342 } 343 }
343 344
344 return mInstance; 345 return mInstance;
345} 346}
346 347
347void KOPrefs::usrSetDefaults() 348void KOPrefs::usrSetDefaults()
348{ 349{
349 350
350} 351}
351 352
352void KOPrefs::fillMailDefaults() 353void KOPrefs::fillMailDefaults()
353{ 354{
354 if (mName.isEmpty()) mName = i18n("Anonymous"); 355 if (mName.isEmpty()) mName = i18n("Anonymous");
355 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 356 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
356} 357}
357 358
358void KOPrefs::setTimeZoneIdDefault() 359void KOPrefs::setTimeZoneIdDefault()
359{ 360{
360 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); 361 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)");
361} 362}
362 363
363void KOPrefs::setCategoryDefaults() 364void KOPrefs::setCategoryDefaults()
364{ 365{
365 mCustomCategories.clear(); 366 mCustomCategories.clear();
366 mCustomCategories = getDefaultList(); 367 mCustomCategories = getDefaultList();
367 368
368 QStringList::Iterator it; 369 QStringList::Iterator it;
369 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 370 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
370 setCategoryColor(*it,mDefaultCategoryColor); 371 setCategoryColor(*it,mDefaultCategoryColor);
371 } 372 }
372} 373}
373 374
374QStringList KOPrefs::getDefaultList() 375QStringList KOPrefs::getDefaultList()
375{ 376{
376 QStringList retval ; 377 QStringList retval ;
377 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 378 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
378 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 379 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
379 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 380 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
380 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 381 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
381 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 382 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
382 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 383 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
383 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 384 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
384 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 385 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
385 retval.sort(); 386 retval.sort();
386 return retval; 387 return retval;
387} 388}
388 389
389void KOPrefs::usrReadConfig() 390void KOPrefs::usrReadConfig()
390{ 391{
391 mLocaleDict = 0; 392 mLocaleDict = 0;
392 // pending LR fix translation 393 // pending LR fix translation
393 // qDebug("KOPrefs::usrReadConfig() fix translation "); 394 // qDebug("KOPrefs::usrReadConfig() fix translation ");
394 if ( mPreferredLanguage == 1 ) { 395 if ( mPreferredLanguage == 1 ) {
395 mLocaleDict = new QDict<QString>; 396 mLocaleDict = new QDict<QString>;
396 int i = 0; 397 int i = 0;
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index fe044e6..424fa98 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -26,274 +26,275 @@
26#include <qdict.h> 26#include <qdict.h>
27 27
28#include <libkdepim/kpimprefs.h> 28#include <libkdepim/kpimprefs.h>
29 29
30class KConfig; 30class KConfig;
31class QFont; 31class QFont;
32class QColor; 32class QColor;
33class QStringList; 33class QStringList;
34 34
35class KOPrefs : public KPimPrefs 35class KOPrefs : public KPimPrefs
36{ 36{
37 public: 37 public:
38 enum { FormatVCalendar, FormatICalendar }; 38 enum { FormatVCalendar, FormatICalendar };
39 enum { MailClientKMail, MailClientSendmail }; 39 enum { MailClientKMail, MailClientSendmail };
40 enum { IMIPDummy, IMIPKMail }; 40 enum { IMIPDummy, IMIPKMail };
41 enum { IMIPOutbox, IMIPdirectsend }; 41 enum { IMIPOutbox, IMIPdirectsend };
42 enum { neverAuto, addressbookAuto, selectedAuto }; 42 enum { neverAuto, addressbookAuto, selectedAuto };
43 enum { standardDestination, askDestination }; 43 enum { standardDestination, askDestination };
44 44
45 virtual ~KOPrefs(); 45 virtual ~KOPrefs();
46 46
47 /** Get instance of KOPrefs. It is made sure that there is only one 47 /** Get instance of KOPrefs. It is made sure that there is only one
48 instance. */ 48 instance. */
49 static KOPrefs *instance(); 49 static KOPrefs *instance();
50 50
51 /** Set preferences to default values */ 51 /** Set preferences to default values */
52 void usrSetDefaults(); 52 void usrSetDefaults();
53 53
54 /** Read preferences from config file */ 54 /** Read preferences from config file */
55 void usrReadConfig(); 55 void usrReadConfig();
56 56
57 /** Write preferences to config file */ 57 /** Write preferences to config file */
58 void usrWriteConfig(); 58 void usrWriteConfig();
59 void setCategoryDefaults(); 59 void setCategoryDefaults();
60 60
61 protected: 61 protected:
62 void setTimeZoneIdDefault(); 62 void setTimeZoneIdDefault();
63 63
64 /** Fill empty mail fields with default values. */ 64 /** Fill empty mail fields with default values. */
65 void fillMailDefaults(); 65 void fillMailDefaults();
66 66
67 private: 67 private:
68 /** Constructor disabled for public. Use instance() to create a KOPrefs 68 /** Constructor disabled for public. Use instance() to create a KOPrefs
69 object. */ 69 object. */
70 KOPrefs(); 70 KOPrefs();
71 71
72 static KOPrefs *mInstance; 72 static KOPrefs *mInstance;
73 QDict<QString> *mLocaleDict; 73 QDict<QString> *mLocaleDict;
74 QStringList getDefaultList(); 74 QStringList getDefaultList();
75 public: 75 public:
76 // preferences data 76 // preferences data
77 KConfig* getConfig(); 77 KConfig* getConfig();
78 void setFullName(const QString &); 78 void setFullName(const QString &);
79 QString fullName(); 79 QString fullName();
80 void setEmail(const QString &); 80 void setEmail(const QString &);
81 QString email(); 81 QString email();
82 82
83 QString mAdditional; 83 QString mAdditional;
84 84
85 bool mEmailControlCenter; 85 bool mEmailControlCenter;
86 86
87 bool mBcc; 87 bool mBcc;
88 bool mAutoSave; 88 bool mAutoSave;
89 int mAutoSaveInterval; 89 int mAutoSaveInterval;
90 bool mConfirm; 90 bool mConfirm;
91 91
92 bool mEnableGroupScheduling; 92 bool mEnableGroupScheduling;
93 bool mEnableProjectView; 93 bool mEnableProjectView;
94 94
95 int mDefaultFormat; 95 int mDefaultFormat;
96 int mMailClient; 96 int mMailClient;
97 97
98 QString mTimeZone; 98 QString mTimeZone;
99 QString mTimeZoneId; 99 QString mTimeZoneId;
100 //QString mTimeZoneName; // e.g. +00:04:00 Indian/Mauritius 100 //QString mTimeZoneName; // e.g. +00:04:00 Indian/Mauritius
101 //int mTimeZoneOffset; // e.g. -240 min 101 //int mTimeZoneOffset; // e.g. -240 min
102 bool mUseDaylightsaving; 102 bool mUseDaylightsaving;
103 int mDaylightsavingStart; 103 int mDaylightsavingStart;
104 int mDaylightsavingEnd; 104 int mDaylightsavingEnd;
105 int mStartTime; 105 int mStartTime;
106 int mDefaultDuration; 106 int mDefaultDuration;
107 int mAlarmTime; 107 int mAlarmTime;
108 int mDaylightSavings; 108 int mDaylightSavings;
109 109
110 int mWorkingHoursStart; 110 int mWorkingHoursStart;
111 int mWorkingHoursEnd; 111 int mWorkingHoursEnd;
112 bool mExcludeHolidays; 112 bool mExcludeHolidays;
113 bool mExcludeSaturdays; 113 bool mExcludeSaturdays;
114 bool mMarcusBainsShowSeconds; 114 bool mMarcusBainsShowSeconds;
115 115
116 QFont mTimeBarFont; 116 QFont mTimeBarFont;
117 QFont mMonthViewFont; 117 QFont mMonthViewFont;
118 QFont mAgendaViewFont; 118 QFont mAgendaViewFont;
119 QFont mMarcusBainsFont; 119 QFont mMarcusBainsFont;
120 QFont mTimeLabelsFont; 120 QFont mTimeLabelsFont;
121 QFont mTodoViewFont; 121 QFont mTodoViewFont;
122 QFont mListViewFont; 122 QFont mListViewFont;
123 QFont mDateNavigatorFont; 123 QFont mDateNavigatorFont;
124 QFont mEditBoxFont; 124 QFont mEditBoxFont;
125 QFont mJornalViewFont; 125 QFont mJornalViewFont;
126 QFont mWhatsNextFont; 126 QFont mWhatsNextFont;
127 QFont mEventViewFont; 127 QFont mEventViewFont;
128 128
129 129
130 130
131 131
132 QColor mHolidayColor; 132 QColor mHolidayColor;
133 QColor mHighlightColor; 133 QColor mHighlightColor;
134 QColor mEventColor; 134 QColor mEventColor;
135 QColor mAgendaBgColor; 135 QColor mAgendaBgColor;
136 QColor mWorkingHoursColor; 136 QColor mWorkingHoursColor;
137 QColor mTodoDueTodayColor; 137 QColor mTodoDueTodayColor;
138 QColor mTodoOverdueColor; 138 QColor mTodoOverdueColor;
139 QColor mMonthViewEvenColor; 139 QColor mMonthViewEvenColor;
140 QColor mMonthViewOddColor; 140 QColor mMonthViewOddColor;
141 QColor mMonthViewHolidayColor; 141 QColor mMonthViewHolidayColor;
142 bool mMonthViewUsesDayColors; 142 bool mMonthViewUsesDayColors;
143 bool mMonthViewSatSunTog; 143 bool mMonthViewSatSunTog;
144 QColor mAppColor1; 144 QColor mAppColor1;
145 QColor mAppColor2; 145 QColor mAppColor2;
146 bool mUseAppColors; 146 bool mUseAppColors;
147 147
148 int mDayBegins; 148 int mDayBegins;
149 int mHourSize; 149 int mHourSize;
150 int mAllDaySize; 150 int mAllDaySize;
151 bool mShowFullMenu; 151 bool mShowFullMenu;
152 bool mDailyRecur; 152 bool mDailyRecur;
153 bool mWeeklyRecur; 153 bool mWeeklyRecur;
154 bool mMonthDailyRecur; 154 bool mMonthDailyRecur;
155 bool mMonthWeeklyRecur; 155 bool mMonthWeeklyRecur;
156 bool mMonthShowIcons; 156 bool mMonthShowIcons;
157 bool mMonthShowShort; 157 bool mMonthShowShort;
158 bool mEnableToolTips; 158 bool mEnableToolTips;
159 bool mEnableMonthScroll; 159 bool mEnableMonthScroll;
160 bool mFullViewMonth; 160 bool mFullViewMonth;
161 bool mMonthViewUsesCategoryColor; 161 bool mMonthViewUsesCategoryColor;
162 bool mFullViewTodo; 162 bool mFullViewTodo;
163 bool mShowCompletedTodo; 163 bool mShowCompletedTodo;
164 bool mMarcusBainsEnabled; 164 bool mMarcusBainsEnabled;
165 int mNextXDays; 165 int mNextXDays;
166 int mWhatsNextDays; 166 int mWhatsNextDays;
167 int mWhatsNextPrios; 167 int mWhatsNextPrios;
168 bool mEnableQuickTodo; 168 bool mEnableQuickTodo;
169 bool mLanguageChanged; 169 bool mLanguageChanged;
170 170
171 bool mCompactDialogs; 171 bool mCompactDialogs;
172 bool mVerticalScreen; 172 bool mVerticalScreen;
173 173
174 bool mShowIconNewTodo; 174 bool mShowIconNewTodo;
175 bool mShowIconNewEvent; 175 bool mShowIconNewEvent;
176 bool mShowIconSearch; 176 bool mShowIconSearch;
177 bool mShowIconList; 177 bool mShowIconList;
178 bool mShowIconDay1; 178 bool mShowIconDay1;
179 bool mShowIconDay5; 179 bool mShowIconDay5;
180 bool mShowIconDay7; 180 bool mShowIconDay7;
181 bool mShowIconMonth; 181 bool mShowIconMonth;
182 bool mShowIconTodoview; 182 bool mShowIconTodoview;
183 bool mShowIconBackFast; 183 bool mShowIconBackFast;
184 bool mShowIconBack; 184 bool mShowIconBack;
185 bool mShowIconToday; 185 bool mShowIconToday;
186 bool mShowIconForward; 186 bool mShowIconForward;
187 bool mShowIconForwardFast; 187 bool mShowIconForwardFast;
188 bool mShowIconWhatsThis; 188 bool mShowIconWhatsThis;
189 bool mShowIconNextDays; 189 bool mShowIconNextDays;
190 bool mShowIconNext; 190 bool mShowIconNext;
191 bool mShowIconJournal; 191 bool mShowIconJournal;
192 192
193 bool mShowIconStretch; 193 bool mShowIconStretch;
194 194
195 bool mToolBarHor; 195 bool mToolBarHor;
196 bool mToolBarUp; 196 bool mToolBarUp;
197 bool mToolBarMiniIcons; 197 bool mToolBarMiniIcons;
198 198
199 bool mAskForQuit; 199 bool mAskForQuit;
200 bool mUsePassWd; 200 bool mUsePassWd;
201 bool mWriteBackFile; 201 bool mWriteBackFile;
202 bool mAskForPreferences; 202 bool mAskForPreferences;
203 bool mShowSyncSummary; 203 bool mShowSyncSummary;
204 bool mShowSyncEvents; 204 bool mShowSyncEvents;
205 bool mShowTodoInAgenda; 205 bool mShowTodoInAgenda;
206 bool mWriteBackExistingOnly; 206 bool mWriteBackExistingOnly;
207 207
208 QString mRemoteIP; 208 QString mRemoteIP;
209 QString mRemoteUser; 209 QString mRemoteUser;
210 QString mRemotePassWd; 210 QString mRemotePassWd;
211 QString mRemoteFile; 211 QString mRemoteFile;
212 QString mLocalTempFile; 212 QString mLocalTempFile;
213 213
214 int mLastSyncTime; 214 int mLastSyncTime;
215 int mSyncAlgoPrefs; 215 int mSyncAlgoPrefs;
216 int mRingSyncAlgoPrefs; 216 int mRingSyncAlgoPrefs;
217 QStringList mSyncProfileNames; 217 QStringList mSyncProfileNames;
218 QStringList mExternSyncProfiles;
218 QString mLocalMachineName; 219 QString mLocalMachineName;
219 void setCategoryColor(QString cat,const QColor & color); 220 void setCategoryColor(QString cat,const QColor & color);
220 QColor *categoryColor(QString cat); 221 QColor *categoryColor(QString cat);
221 222
222 QString mArchiveFile; 223 QString mArchiveFile;
223 QString mHtmlExportFile; 224 QString mHtmlExportFile;
224 bool mHtmlWithSave; 225 bool mHtmlWithSave;
225 226
226 QStringList mSelectedPlugins; 227 QStringList mSelectedPlugins;
227 228
228 QString mLastImportFile; 229 QString mLastImportFile;
229 QString mLastVcalFile; 230 QString mLastVcalFile;
230 QString mLastSaveFile; 231 QString mLastSaveFile;
231 QString mLastLoadFile; 232 QString mLastLoadFile;
232 QString mLastSyncedLocalFile; 233 QString mLastSyncedLocalFile;
233 234
234 235
235 QString mDefaultAlarmFile; 236 QString mDefaultAlarmFile;
236 int mIMIPScheduler; 237 int mIMIPScheduler;
237 int mIMIPSend; 238 int mIMIPSend;
238 QStringList mAdditionalMails; 239 QStringList mAdditionalMails;
239 int mIMIPAutoRefresh; 240 int mIMIPAutoRefresh;
240 int mIMIPAutoInsertReply; 241 int mIMIPAutoInsertReply;
241 int mIMIPAutoInsertRequest; 242 int mIMIPAutoInsertRequest;
242 int mIMIPAutoFreeBusy; 243 int mIMIPAutoFreeBusy;
243 int mIMIPAutoFreeBusyReply; 244 int mIMIPAutoFreeBusyReply;
244 245
245 QStringList mTodoTemplates; 246 QStringList mTodoTemplates;
246 QStringList mEventTemplates; 247 QStringList mEventTemplates;
247 248
248 int mDestination; 249 int mDestination;
249 250
250 251
251 bool mEditOnDoubleClick; 252 bool mEditOnDoubleClick;
252 bool mViewChangeHoldFullscreen; 253 bool mViewChangeHoldFullscreen;
253 bool mViewChangeHoldNonFullscreen; 254 bool mViewChangeHoldNonFullscreen;
254 bool mCenterOnCurrentTime; 255 bool mCenterOnCurrentTime;
255 bool mSetTimeToDayStartAt; 256 bool mSetTimeToDayStartAt;
256 bool mHighlightCurrentDay; 257 bool mHighlightCurrentDay;
257 bool mUseHighlightLightColor; 258 bool mUseHighlightLightColor;
258 bool mListViewMonthTimespan; 259 bool mListViewMonthTimespan;
259 bool mWNViewShowsParents; 260 bool mWNViewShowsParents;
260 bool mWNViewShowLocation; 261 bool mWNViewShowLocation;
261 bool mTodoViewShowsPercentage; 262 bool mTodoViewShowsPercentage;
262 bool mTodoViewUsesCatColors; 263 bool mTodoViewUsesCatColors;
263 bool mTodoViewUsesSmallFont; 264 bool mTodoViewUsesSmallFont;
264 bool mTodoViewUsesForegroundColor; 265 bool mTodoViewUsesForegroundColor;
265 bool mMonthViewUsesForegroundColor; 266 bool mMonthViewUsesForegroundColor;
266 267
267 bool mHightlightDateTimeEdit; 268 bool mHightlightDateTimeEdit;
268 int mPreferredLanguage; 269 int mPreferredLanguage;
269 bool mUseQuicksave; 270 bool mUseQuicksave;
270 int mPreferredTime; 271 int mPreferredTime;
271 int mPreferredDate; 272 int mPreferredDate;
272 bool mWeekStartsOnSunday; 273 bool mWeekStartsOnSunday;
273 bool mShortDateInViewer; 274 bool mShortDateInViewer;
274 QString mUserDateFormatLong; 275 QString mUserDateFormatLong;
275 QString mUserDateFormatShort; 276 QString mUserDateFormatShort;
276 277
277 QStringList mLocationDefaults; 278 QStringList mLocationDefaults;
278 QStringList mEventSummaryUser; 279 QStringList mEventSummaryUser;
279 QStringList mTodoSummaryUser; 280 QStringList mTodoSummaryUser;
280 281
281 bool mUseInternalAlarmNotification; 282 bool mUseInternalAlarmNotification;
282 int mAlarmPlayBeeps; 283 int mAlarmPlayBeeps;
283 int mAlarmSuspendTime; 284 int mAlarmSuspendTime;
284 int mAlarmSuspendCount; 285 int mAlarmSuspendCount;
285 int mAlarmBeepInterval; 286 int mAlarmBeepInterval;
286 287
287 private: 288 private:
288 QDict<QColor> mCategoryColors; 289 QDict<QColor> mCategoryColors;
289 QColor mDefaultCategoryColor; 290 QColor mDefaultCategoryColor;
290 291
291 QFont mDefaultTimeBarFont; 292 QFont mDefaultTimeBarFont;
292 QFont mDefaultViewFont; 293 QFont mDefaultViewFont;
293 QFont mDefaultMonthViewFont; 294 QFont mDefaultMonthViewFont;
294 295
295 QString mName; 296 QString mName;
296 QString mEmail; 297 QString mEmail;
297}; 298};
298 299
299#endif 300#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 44b1264..6020a46 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -647,399 +647,402 @@ void MainWindow::initActions()
647 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 647 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
648 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 648 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
649 this ); 649 this );
650 action->addTo( importMenu ); 650 action->addTo( importMenu );
651 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 651 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
652 652
653 //menuBar->insertItem( "Configure",configureMenu ); 653 //menuBar->insertItem( "Configure",configureMenu );
654 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 654 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
655 icon = loadPixmap( "korganizer/korganizer" ); 655 icon = loadPixmap( "korganizer/korganizer" );
656 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 656 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
657 action->addTo( helpMenu ); 657 action->addTo( helpMenu );
658 connect( action, SIGNAL( activated() ), 658 connect( action, SIGNAL( activated() ),
659 SLOT( keyBindings() ) ); 659 SLOT( keyBindings() ) );
660 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 660 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
661 action->addTo( helpMenu ); 661 action->addTo( helpMenu );
662 connect( action, SIGNAL( activated() ), 662 connect( action, SIGNAL( activated() ),
663 SLOT( features() ) ); 663 SLOT( features() ) );
664 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 664 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
665 action->addTo( helpMenu ); 665 action->addTo( helpMenu );
666 connect( action, SIGNAL( activated() ), 666 connect( action, SIGNAL( activated() ),
667 SLOT( aboutAutoSaving() ) ); 667 SLOT( aboutAutoSaving() ) );
668 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 668 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
669 action->addTo( helpMenu ); 669 action->addTo( helpMenu );
670 connect( action, SIGNAL( activated() ), 670 connect( action, SIGNAL( activated() ),
671 SLOT( aboutKnownBugs() ) ); 671 SLOT( aboutKnownBugs() ) );
672 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 672 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
673 action->addTo( helpMenu ); 673 action->addTo( helpMenu );
674 connect( action, SIGNAL( activated() ), 674 connect( action, SIGNAL( activated() ),
675 SLOT( usertrans() ) ); 675 SLOT( usertrans() ) );
676 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 676 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
677 action->addTo( helpMenu ); 677 action->addTo( helpMenu );
678 connect( action, SIGNAL( activated() ), 678 connect( action, SIGNAL( activated() ),
679 SLOT( synchowto() ) ); 679 SLOT( synchowto() ) );
680 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 680 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
681 action->addTo( helpMenu ); 681 action->addTo( helpMenu );
682 connect( action, SIGNAL( activated() ), 682 connect( action, SIGNAL( activated() ),
683 SLOT( whatsNew() ) ); 683 SLOT( whatsNew() ) );
684 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 684 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
685 action->addTo( helpMenu ); 685 action->addTo( helpMenu );
686 connect( action, SIGNAL( activated() ), 686 connect( action, SIGNAL( activated() ),
687 SLOT( faq() ) ); 687 SLOT( faq() ) );
688 688
689 689
690 action = new QAction( "about", i18n("About..."), 0, this ); 690 action = new QAction( "about", i18n("About..."), 0, this );
691 action->addTo( helpMenu ); 691 action->addTo( helpMenu );
692 connect( action, SIGNAL( activated() ), 692 connect( action, SIGNAL( activated() ),
693 SLOT( about() ) ); 693 SLOT( about() ) );
694 //menuBar->insertSeparator(); 694 //menuBar->insertSeparator();
695 695
696 // ****************************************************** 696 // ******************************************************
697 // menubar icons 697 // menubar icons
698 698
699 699
700 iconToolBar->setHorizontalStretchable (true ); 700 iconToolBar->setHorizontalStretchable (true );
701 //menuBar->insertItem( iconToolBar ); 701 //menuBar->insertItem( iconToolBar );
702 //xdays_action 702 //xdays_action
703 if (p-> mShowIconNewEvent) 703 if (p-> mShowIconNewEvent)
704 ne_action->addTo( iconToolBar ); 704 ne_action->addTo( iconToolBar );
705 if (p->mShowIconNewTodo ) 705 if (p->mShowIconNewTodo )
706 nt_action->addTo( iconToolBar ); 706 nt_action->addTo( iconToolBar );
707 if (p-> mShowIconSearch) 707 if (p-> mShowIconSearch)
708 search_action->addTo( iconToolBar ); 708 search_action->addTo( iconToolBar );
709 if (p-> mShowIconNext) 709 if (p-> mShowIconNext)
710 whatsnext_action->addTo( iconToolBar ); 710 whatsnext_action->addTo( iconToolBar );
711 if (p-> mShowIconNextDays) 711 if (p-> mShowIconNextDays)
712 xdays_action->addTo( iconToolBar ); 712 xdays_action->addTo( iconToolBar );
713 if (p-> mShowIconList) 713 if (p-> mShowIconList)
714 showlist_action->addTo( iconToolBar ); 714 showlist_action->addTo( iconToolBar );
715 if (p-> mShowIconDay1) 715 if (p-> mShowIconDay1)
716 day1_action->addTo( iconToolBar ); 716 day1_action->addTo( iconToolBar );
717 if (p-> mShowIconDay5) 717 if (p-> mShowIconDay5)
718 day5_action->addTo( iconToolBar ); 718 day5_action->addTo( iconToolBar );
719 if (p-> mShowIconDay7) 719 if (p-> mShowIconDay7)
720 day7_action->addTo( iconToolBar ); 720 day7_action->addTo( iconToolBar );
721 if (p-> mShowIconMonth) 721 if (p-> mShowIconMonth)
722 month_action->addTo( iconToolBar ); 722 month_action->addTo( iconToolBar );
723 if (p-> mShowIconTodoview) 723 if (p-> mShowIconTodoview)
724 todoview_action->addTo( iconToolBar ); 724 todoview_action->addTo( iconToolBar );
725 if (p-> mShowIconJournal) 725 if (p-> mShowIconJournal)
726 viewjournal_action->addTo( iconToolBar ); 726 viewjournal_action->addTo( iconToolBar );
727 icon = loadPixmap( pathString + "2leftarrowB" ); 727 icon = loadPixmap( pathString + "2leftarrowB" );
728 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 728 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
729 if (p-> mShowIconBackFast) { 729 if (p-> mShowIconBackFast) {
730 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 730 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
731 connect( action, SIGNAL( activated() ), 731 connect( action, SIGNAL( activated() ),
732 mView, SLOT( goPreviousMonth() ) ); 732 mView, SLOT( goPreviousMonth() ) );
733 action->addTo( iconToolBar ); 733 action->addTo( iconToolBar );
734 } 734 }
735 icon = loadPixmap( pathString + "1leftarrowB" ); 735 icon = loadPixmap( pathString + "1leftarrowB" );
736 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 736 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
737 if (p-> mShowIconBack) { 737 if (p-> mShowIconBack) {
738 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 738 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
739 connect( action, SIGNAL( activated() ), 739 connect( action, SIGNAL( activated() ),
740 mView, SLOT( goPrevious() ) ); 740 mView, SLOT( goPrevious() ) );
741 action->addTo( iconToolBar ); 741 action->addTo( iconToolBar );
742 } 742 }
743 if (p-> mShowIconToday) 743 if (p-> mShowIconToday)
744 today_action->addTo( iconToolBar ); 744 today_action->addTo( iconToolBar );
745 icon = loadPixmap( pathString + "1rightarrowB" ); 745 icon = loadPixmap( pathString + "1rightarrowB" );
746 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 746 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
747 if (p-> mShowIconForward) { 747 if (p-> mShowIconForward) {
748 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 748 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
749 connect( action, SIGNAL( activated() ), 749 connect( action, SIGNAL( activated() ),
750 mView, SLOT( goNext() ) ); 750 mView, SLOT( goNext() ) );
751 action->addTo( iconToolBar ); 751 action->addTo( iconToolBar );
752 } 752 }
753 icon = loadPixmap( pathString + "2rightarrowB" ); 753 icon = loadPixmap( pathString + "2rightarrowB" );
754 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 754 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
755 if (p-> mShowIconForwardFast) { 755 if (p-> mShowIconForwardFast) {
756 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 756 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
757 connect( action, SIGNAL( activated() ), 757 connect( action, SIGNAL( activated() ),
758 mView, SLOT( goNextMonth() ) ); 758 mView, SLOT( goNextMonth() ) );
759 action->addTo( iconToolBar ); 759 action->addTo( iconToolBar );
760 } 760 }
761 761
762 762
763 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 763 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
764 764
765 if (p-> mShowIconNewEvent) 765 if (p-> mShowIconNewEvent)
766 configureToolBarMenu->setItemChecked( 10, true ); 766 configureToolBarMenu->setItemChecked( 10, true );
767 if (p->mShowIconNewTodo ) 767 if (p->mShowIconNewTodo )
768 configureToolBarMenu->setItemChecked( 20, true ); 768 configureToolBarMenu->setItemChecked( 20, true );
769 if (p-> mShowIconSearch) 769 if (p-> mShowIconSearch)
770 configureToolBarMenu->setItemChecked( 120, true ); 770 configureToolBarMenu->setItemChecked( 120, true );
771 if (p-> mShowIconList) 771 if (p-> mShowIconList)
772 configureToolBarMenu->setItemChecked( 30, true ); 772 configureToolBarMenu->setItemChecked( 30, true );
773 if (p-> mShowIconDay1) 773 if (p-> mShowIconDay1)
774 configureToolBarMenu->setItemChecked( 40, true ); 774 configureToolBarMenu->setItemChecked( 40, true );
775 if (p-> mShowIconDay5) 775 if (p-> mShowIconDay5)
776 configureToolBarMenu->setItemChecked( 50, true ); 776 configureToolBarMenu->setItemChecked( 50, true );
777 if (p-> mShowIconDay7) 777 if (p-> mShowIconDay7)
778 configureToolBarMenu->setItemChecked( 60, true ); 778 configureToolBarMenu->setItemChecked( 60, true );
779 if (p-> mShowIconMonth) 779 if (p-> mShowIconMonth)
780 configureToolBarMenu->setItemChecked( 70, true ); 780 configureToolBarMenu->setItemChecked( 70, true );
781 if (p-> mShowIconTodoview) 781 if (p-> mShowIconTodoview)
782 configureToolBarMenu->setItemChecked( 80, true ); 782 configureToolBarMenu->setItemChecked( 80, true );
783 if (p-> mShowIconBackFast) 783 if (p-> mShowIconBackFast)
784 configureToolBarMenu->setItemChecked( 200, true ); 784 configureToolBarMenu->setItemChecked( 200, true );
785 if (p-> mShowIconBack) 785 if (p-> mShowIconBack)
786 configureToolBarMenu->setItemChecked( 210, true ); 786 configureToolBarMenu->setItemChecked( 210, true );
787 if (p-> mShowIconToday) 787 if (p-> mShowIconToday)
788 configureToolBarMenu->setItemChecked( 130, true ); 788 configureToolBarMenu->setItemChecked( 130, true );
789 if (p-> mShowIconForward) 789 if (p-> mShowIconForward)
790 configureToolBarMenu->setItemChecked( 220, true ); 790 configureToolBarMenu->setItemChecked( 220, true );
791 if (p-> mShowIconForwardFast) 791 if (p-> mShowIconForwardFast)
792 configureToolBarMenu->setItemChecked( 230, true ); 792 configureToolBarMenu->setItemChecked( 230, true );
793 if (p-> mShowIconNextDays) 793 if (p-> mShowIconNextDays)
794 configureToolBarMenu->setItemChecked( 100, true ); 794 configureToolBarMenu->setItemChecked( 100, true );
795 if (p-> mShowIconNext) 795 if (p-> mShowIconNext)
796 configureToolBarMenu->setItemChecked( 110, true ); 796 configureToolBarMenu->setItemChecked( 110, true );
797 if (p-> mShowIconJournal) 797 if (p-> mShowIconJournal)
798 configureToolBarMenu->setItemChecked( 90, true ); 798 configureToolBarMenu->setItemChecked( 90, true );
799 if (p-> mShowIconWhatsThis) 799 if (p-> mShowIconWhatsThis)
800 configureToolBarMenu->setItemChecked( 300, true ); 800 configureToolBarMenu->setItemChecked( 300, true );
801 801
802 QLabel* dummy = new QLabel( iconToolBar ); 802 QLabel* dummy = new QLabel( iconToolBar );
803 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 803 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
804 if (!p-> mShowIconStretch) 804 if (!p-> mShowIconStretch)
805 iconToolBar->setStretchableWidget ( dummy ) ; 805 iconToolBar->setStretchableWidget ( dummy ) ;
806 else 806 else
807 configureToolBarMenu->setItemChecked( 5, true ); 807 configureToolBarMenu->setItemChecked( 5, true );
808 if (p-> mShowIconWhatsThis) 808 if (p-> mShowIconWhatsThis)
809 QWhatsThis::whatsThisButton ( iconToolBar ); 809 QWhatsThis::whatsThisButton ( iconToolBar );
810 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 810 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
811 configureAgenda( p->mHourSize ); 811 configureAgenda( p->mHourSize );
812 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 812 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
813} 813}
814void MainWindow::fillSyncMenu() 814void MainWindow::fillSyncMenu()
815{ 815{
816 syncMenu->clear(); 816 syncMenu->clear();
817 syncMenu->insertItem( i18n("Configure..."), 0 ); 817 syncMenu->insertItem( i18n("Configure..."), 0 );
818 syncMenu->insertSeparator(); 818 syncMenu->insertSeparator();
819 syncMenu->insertItem( i18n("Multiple sync"), 1 ); 819 syncMenu->insertItem( i18n("Multiple sync"), 1 );
820 syncMenu->insertSeparator(); 820 syncMenu->insertSeparator();
821 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 821 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
822 config.setGroup("General"); 822 config.setGroup("General");
823 QStringList prof = config.readListEntry("SyncProfileNames"); 823 QStringList prof = config.readListEntry("SyncProfileNames");
824 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 824 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
825 if ( prof.count() < 3 ) { 825 if ( prof.count() < 3 ) {
826 prof.clear(); 826 prof.clear();
827 prof << i18n("Sharp_DTM"); 827 prof << i18n("Sharp_DTM");
828 prof << i18n("Local_file"); 828 prof << i18n("Local_file");
829 prof << i18n("Last_file"); 829 prof << i18n("Last_file");
830 KSyncProfile* temp = new KSyncProfile (); 830 KSyncProfile* temp = new KSyncProfile ();
831 temp->setName( prof[0] ); 831 temp->setName( prof[0] );
832 temp->writeConfig(&config); 832 temp->writeConfig(&config);
833 temp->setName( prof[1] ); 833 temp->setName( prof[1] );
834 temp->writeConfig(&config); 834 temp->writeConfig(&config);
835 temp->setName( prof[2] ); 835 temp->setName( prof[2] );
836 temp->writeConfig(&config); 836 temp->writeConfig(&config);
837 config.setGroup("General"); 837 config.setGroup("General");
838 config.writeEntry("SyncProfileNames",prof); 838 config.writeEntry("SyncProfileNames",prof);
839 config.writeEntry("ExternSyncProfiles","Sharp_DTM");
839 config.sync(); 840 config.sync();
840 delete temp; 841 delete temp;
841 } 842 }
843 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
842 KOPrefs::instance()->mSyncProfileNames = prof; 844 KOPrefs::instance()->mSyncProfileNames = prof;
843 int i; 845 int i;
844 for ( i = 0; i < prof.count(); ++i ) { 846 for ( i = 0; i < prof.count(); ++i ) {
845 847
846 syncMenu->insertItem( prof[i], 1000+i ); 848 syncMenu->insertItem( prof[i], 1000+i );
847 if ( i == 2 ) 849 if ( i == 2 )
848 syncMenu->insertSeparator(); 850 syncMenu->insertSeparator();
849 } 851 }
850 QDir app_dir; 852 QDir app_dir;
851 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 853 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
852 syncMenu->setItemEnabled( false , 1000 ); 854 syncMenu->setItemEnabled( false , 1000 );
853 } 855 }
856 mView->setupExternSyncProfiles();
854} 857}
855 858
856int MainWindow::ringSync() 859int MainWindow::ringSync()
857{ 860{
858 int syncedProfiles = 0; 861 int syncedProfiles = 0;
859 int i; 862 int i;
860 QTime timer; 863 QTime timer;
861 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 864 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
862 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; 865 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
863 KSyncProfile* temp = new KSyncProfile (); 866 KSyncProfile* temp = new KSyncProfile ();
864 KOPrefs::instance()->mAskForPreferences = false; 867 KOPrefs::instance()->mAskForPreferences = false;
865 for ( i = 0; i < syncProfileNames.count(); ++i ) { 868 for ( i = 0; i < syncProfileNames.count(); ++i ) {
866 mCurrentSyncProfile = i; 869 mCurrentSyncProfile = i;
867 temp->setName(syncProfileNames[mCurrentSyncProfile]); 870 temp->setName(syncProfileNames[mCurrentSyncProfile]);
868 temp->readConfig(&config); 871 temp->readConfig(&config);
869 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { 872 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
870 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 873 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
871 ++syncedProfiles; 874 ++syncedProfiles;
872 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 875 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
873 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 876 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
874 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 877 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
875 KOPrefs::instance()->mShowSyncSummary = false; 878 KOPrefs::instance()->mShowSyncSummary = false;
876 mView->setSyncDevice(syncProfileNames[i] ); 879 mView->setSyncDevice(syncProfileNames[i] );
877 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 880 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
878 if ( i == 0 ) { 881 if ( i == 0 ) {
879 syncSharp(); 882 syncSharp();
880 } else { 883 } else {
881 if ( temp->getIsLocalFileSync() ) { 884 if ( temp->getIsLocalFileSync() ) {
882 if ( syncWithFile( temp->getRemoteFileName( ), true ) ) 885 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
883 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 886 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
884 } else { 887 } else {
885 syncRemote( temp, false ); 888 syncRemote( temp, false );
886 889
887 } 890 }
888 } 891 }
889 timer.start(); 892 timer.start();
890 setCaption(i18n("Multiple sync in progress ... please wait!") ); 893 setCaption(i18n("Multiple sync in progress ... please wait!") );
891 while ( timer.elapsed () < 2000 ) { 894 while ( timer.elapsed () < 2000 ) {
892 qApp->processEvents(); 895 qApp->processEvents();
893#ifndef _WIN32_ 896#ifndef _WIN32_
894 sleep (1); 897 sleep (1);
895#endif 898#endif
896 } 899 }
897 900
898 } 901 }
899 902
900 } 903 }
901 delete temp; 904 delete temp;
902 return syncedProfiles; 905 return syncedProfiles;
903} 906}
904 907
905void MainWindow::multiSync( bool askforPrefs ) 908void MainWindow::multiSync( bool askforPrefs )
906{ 909{
907 if (mBlockSaveFlag) 910 if (mBlockSaveFlag)
908 return; 911 return;
909 mBlockSaveFlag = true; 912 mBlockSaveFlag = true;
910 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 913 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
911 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 914 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
912 question, 915 question,
913 i18n("Yes"), i18n("No"), 916 i18n("Yes"), i18n("No"),
914 0, 0 ) != 0 ) { 917 0, 0 ) != 0 ) {
915 mBlockSaveFlag = false; 918 mBlockSaveFlag = false;
916 setCaption(i18n("Aborted! Nothing synced!")); 919 setCaption(i18n("Aborted! Nothing synced!"));
917 return; 920 return;
918 } 921 }
919 mView->setSyncDevice(i18n("Multiple profiles") ); 922 mView->setSyncDevice(i18n("Multiple profiles") );
920 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 923 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
921 if ( askforPrefs ) { 924 if ( askforPrefs ) {
922 mView->edit_sync_options(); 925 mView->edit_sync_options();
923 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 926 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
924 } 927 }
925 setCaption(i18n("Multiple sync started.") ); 928 setCaption(i18n("Multiple sync started.") );
926 qApp->processEvents(); 929 qApp->processEvents();
927 int num = ringSync() ; 930 int num = ringSync() ;
928 if ( num > 1 ) 931 if ( num > 1 )
929 ringSync(); 932 ringSync();
930 mBlockSaveFlag = false; 933 mBlockSaveFlag = false;
931 if ( num ) 934 if ( num )
932 save(); 935 save();
933 if ( num ) 936 if ( num )
934 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 937 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
935 else 938 else
936 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 939 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
937 return; 940 return;
938} 941}
939void MainWindow::slotSyncMenu( int action ) 942void MainWindow::slotSyncMenu( int action )
940{ 943{
941 //qDebug("syncaction %d ", action); 944 //qDebug("syncaction %d ", action);
942 if ( action == 0 ) { 945 if ( action == 0 ) {
943 946
944 confSync(); 947 confSync();
945 948
946 return; 949 return;
947 } 950 }
948 if ( action == 1 ) { 951 if ( action == 1 ) {
949 multiSync( true ); 952 multiSync( true );
950 return; 953 return;
951 } 954 }
952 955
953 if (mBlockSaveFlag) 956 if (mBlockSaveFlag)
954 return; 957 return;
955 mBlockSaveFlag = true; 958 mBlockSaveFlag = true;
956 mCurrentSyncProfile = action - 1000 ; 959 mCurrentSyncProfile = action - 1000 ;
957 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 960 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
958 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 961 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
959 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 962 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
960 KSyncProfile* temp = new KSyncProfile (); 963 KSyncProfile* temp = new KSyncProfile ();
961 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 964 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
962 temp->readConfig(&config); 965 temp->readConfig(&config);
963 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 966 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
964 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 967 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
965 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 968 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
966 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 969 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
967 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 970 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
968 if ( action == 1000 ) { 971 if ( action == 1000 ) {
969 syncSharp(); 972 syncSharp();
970 973
971 } else if ( action == 1001 ) { 974 } else if ( action == 1001 ) {
972 syncLocalFile(); 975 syncLocalFile();
973 976
974 } else if ( action == 1002 ) { 977 } else if ( action == 1002 ) {
975 quickSyncLocalFile(); 978 quickSyncLocalFile();
976 979
977 } else if ( action >= 1003 ) { 980 } else if ( action >= 1003 ) {
978 if ( temp->getIsLocalFileSync() ) { 981 if ( temp->getIsLocalFileSync() ) {
979 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 982 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
980 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 983 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
981 } else { 984 } else {
982 syncRemote( temp ); 985 syncRemote( temp );
983 986
984 } 987 }
985 } 988 }
986 delete temp; 989 delete temp;
987 mBlockSaveFlag = false; 990 mBlockSaveFlag = false;
988} 991}
989void MainWindow::setDefaultPreferences() 992void MainWindow::setDefaultPreferences()
990{ 993{
991 KOPrefs *p = KOPrefs::instance(); 994 KOPrefs *p = KOPrefs::instance();
992 995
993 p->mCompactDialogs = true; 996 p->mCompactDialogs = true;
994 p->mConfirm = true; 997 p->mConfirm = true;
995 // p->mEnableQuickTodo = false; 998 // p->mEnableQuickTodo = false;
996} 999}
997 1000
998QString MainWindow::resourcePath() 1001QString MainWindow::resourcePath()
999{ 1002{
1000 return KGlobal::iconLoader()->iconPath(); 1003 return KGlobal::iconLoader()->iconPath();
1001} 1004}
1002 1005
1003void MainWindow::displayText( QString text ,QString cap ) 1006void MainWindow::displayText( QString text ,QString cap )
1004{ 1007{
1005 QDialog dia( this, "name", true ); ; 1008 QDialog dia( this, "name", true ); ;
1006 dia.setCaption( cap ); 1009 dia.setCaption( cap );
1007 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1010 QVBoxLayout* lay = new QVBoxLayout( &dia );
1008 lay->setSpacing( 3 ); 1011 lay->setSpacing( 3 );
1009 lay->setMargin( 3 ); 1012 lay->setMargin( 3 );
1010 QTextBrowser tb ( &dia ); 1013 QTextBrowser tb ( &dia );
1011 lay->addWidget( &tb ); 1014 lay->addWidget( &tb );
1012 tb.setText( text ); 1015 tb.setText( text );
1013#ifdef DESKTOP_VERSION 1016#ifdef DESKTOP_VERSION
1014 dia.resize( 640, 480); 1017 dia.resize( 640, 480);
1015#else 1018#else
1016 dia.showMaximized(); 1019 dia.showMaximized();
1017#endif 1020#endif
1018 dia.exec(); 1021 dia.exec();
1019} 1022}
1020void MainWindow::displayFile( QString fn, QString cap ) 1023void MainWindow::displayFile( QString fn, QString cap )
1021{ 1024{
1022 QString fileName = resourcePath() + fn; 1025 QString fileName = resourcePath() + fn;
1023 QString text; 1026 QString text;
1024 QFile file( fileName ); 1027 QFile file( fileName );
1025 if (!file.open( IO_ReadOnly ) ) { 1028 if (!file.open( IO_ReadOnly ) ) {
1026 return ; 1029 return ;
1027 1030
1028 } 1031 }
1029 QTextStream ts( &file ); 1032 QTextStream ts( &file );
1030 text = ts.read(); 1033 text = ts.read();
1031 file.close(); 1034 file.close();
1032 displayText( text, cap); 1035 displayText( text, cap);
1033} 1036}
1034void MainWindow::features() 1037void MainWindow::features()
1035{ 1038{
1036 1039
1037 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1040 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1038} 1041}
1039 1042
1040void MainWindow::usertrans() 1043void MainWindow::usertrans()
1041{ 1044{
1042 1045
1043 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1046 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1044} 1047}
1045void MainWindow::synchowto() 1048void MainWindow::synchowto()
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 7d23619..df5bbcf 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -1,270 +1,270 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#ifndef CALENDAR_H 22#ifndef CALENDAR_H
23#define CALENDAR_H 23#define CALENDAR_H
24 24
25#include <qobject.h> 25#include <qobject.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qptrlist.h> 28#include <qptrlist.h>
29#include <qdict.h> 29#include <qdict.h>
30 30
31#include "customproperties.h" 31#include "customproperties.h"
32#include "event.h" 32#include "event.h"
33#include "todo.h" 33#include "todo.h"
34#include "journal.h" 34#include "journal.h"
35 35
36#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ 36#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */
37 37
38class KConfig; 38class KConfig;
39 39
40namespace KCal { 40namespace KCal {
41 41
42class CalFilter; 42class CalFilter;
43 43
44/** 44/**
45 This is the main "calendar" object class for KOrganizer. It holds 45 This is the main "calendar" object class for KOrganizer. It holds
46 information like all appointments/events, user information, etc. etc. 46 information like all appointments/events, user information, etc. etc.
47 one calendar is associated with each CalendarView (@see calendarview.h). 47 one calendar is associated with each CalendarView (@see calendarview.h).
48 This is an abstract base class defining the interface to a calendar. It is 48 This is an abstract base class defining the interface to a calendar. It is
49 implemented by subclasses like @see CalendarLocal, which use different 49 implemented by subclasses like @see CalendarLocal, which use different
50 methods to store and access the data. 50 methods to store and access the data.
51 51
52 Ownership of events etc. is handled by the following policy: As soon as an 52 Ownership of events etc. is handled by the following policy: As soon as an
53 event (or any other subclass of IncidenceBase) object is added to the 53 event (or any other subclass of IncidenceBase) object is added to the
54 Calendar by addEvent() it is owned by the Calendar object. The Calendar takes 54 Calendar by addEvent() it is owned by the Calendar object. The Calendar takes
55 care of deleting it. All Events returned by the query functions are returned 55 care of deleting it. All Events returned by the query functions are returned
56 as pointers, that means all changes to the returned events are immediately 56 as pointers, that means all changes to the returned events are immediately
57 visible in the Calendar. You shouldn't delete any Event object you get from 57 visible in the Calendar. You shouldn't delete any Event object you get from
58 Calendar. 58 Calendar.
59*/ 59*/
60class Calendar : public QObject, public CustomProperties, 60class Calendar : public QObject, public CustomProperties,
61 public IncidenceBase::Observer 61 public IncidenceBase::Observer
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
65 Calendar(); 65 Calendar();
66 Calendar(const QString &timeZoneId); 66 Calendar(const QString &timeZoneId);
67 virtual ~Calendar(); 67 virtual ~Calendar();
68 void deleteIncidence(Incidence *in); 68 void deleteIncidence(Incidence *in);
69 /** 69 /**
70 Clears out the current calendar, freeing all used memory etc. 70 Clears out the current calendar, freeing all used memory etc.
71 */ 71 */
72 virtual void close() = 0; 72 virtual void close() = 0;
73 73
74 /** 74 /**
75 Sync changes in memory to persistant storage. 75 Sync changes in memory to persistant storage.
76 */ 76 */
77 virtual void save() = 0; 77 virtual void save() = 0;
78 78 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
79 virtual bool isSaving() { return false; } 79 virtual bool isSaving() { return false; }
80 80
81 /** 81 /**
82 Return the owner of the calendar's full name. 82 Return the owner of the calendar's full name.
83 */ 83 */
84 const QString &getOwner() const; 84 const QString &getOwner() const;
85 /** 85 /**
86 Set the owner of the calendar. Should be owner's full name. 86 Set the owner of the calendar. Should be owner's full name.
87 */ 87 */
88 void setOwner( const QString &os ); 88 void setOwner( const QString &os );
89 /** 89 /**
90 Return the email address of the calendar owner. 90 Return the email address of the calendar owner.
91 */ 91 */
92 const QString &getEmail(); 92 const QString &getEmail();
93 /** 93 /**
94 Set the email address of the calendar owner. 94 Set the email address of the calendar owner.
95 */ 95 */
96 void setEmail( const QString & ); 96 void setEmail( const QString & );
97 97
98 /** 98 /**
99 Set time zone from a timezone string (e.g. -2:00) 99 Set time zone from a timezone string (e.g. -2:00)
100 */ 100 */
101 void setTimeZone( const QString &tz ); 101 void setTimeZone( const QString &tz );
102 /** 102 /**
103 Set time zone from a minutes value (e.g. -60) 103 Set time zone from a minutes value (e.g. -60)
104 */ 104 */
105 void setTimeZone( int tz ); 105 void setTimeZone( int tz );
106 /** 106 /**
107 Return time zone as offest in minutes. 107 Return time zone as offest in minutes.
108 */ 108 */
109 int getTimeZone() const; 109 int getTimeZone() const;
110 /** 110 /**
111 Compute an ISO 8601 format string from the time zone. 111 Compute an ISO 8601 format string from the time zone.
112 */ 112 */
113 QString getTimeZoneStr() const; 113 QString getTimeZoneStr() const;
114 /** 114 /**
115 Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal 115 Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal
116 values). 116 values).
117 */ 117 */
118 void setTimeZoneId( const QString & ); 118 void setTimeZoneId( const QString & );
119 /** 119 /**
120 Return time zone id. 120 Return time zone id.
121 */ 121 */
122 QString timeZoneId() const; 122 QString timeZoneId() const;
123 /** 123 /**
124 Use local time, not UTC or a time zone. 124 Use local time, not UTC or a time zone.
125 */ 125 */
126 void setLocalTime(); 126 void setLocalTime();
127 /** 127 /**
128 Return whether local time is being used. 128 Return whether local time is being used.
129 */ 129 */
130 bool isLocalTime() const; 130 bool isLocalTime() const;
131 131
132 /** 132 /**
133 Add an incidence to calendar. 133 Add an incidence to calendar.
134 134
135 @return true on success, false on error. 135 @return true on success, false on error.
136 */ 136 */
137 virtual bool addIncidence( Incidence * ); 137 virtual bool addIncidence( Incidence * );
138 /** 138 /**
139 Return filtered list of all incidences of this calendar. 139 Return filtered list of all incidences of this calendar.
140 */ 140 */
141 virtual QPtrList<Incidence> incidences(); 141 virtual QPtrList<Incidence> incidences();
142 142
143 /** 143 /**
144 Return unfiltered list of all incidences of this calendar. 144 Return unfiltered list of all incidences of this calendar.
145 */ 145 */
146 virtual QPtrList<Incidence> rawIncidences(); 146 virtual QPtrList<Incidence> rawIncidences();
147 147
148 /** 148 /**
149 Adds a Event to this calendar object. 149 Adds a Event to this calendar object.
150 @param anEvent a pointer to the event to add 150 @param anEvent a pointer to the event to add
151 151
152 @return true on success, false on error. 152 @return true on success, false on error.
153 */ 153 */
154 virtual bool addEventNoDup( Event *event ) = 0; 154 virtual bool addEventNoDup( Event *event ) = 0;
155 virtual bool addAnniversaryNoDup( Event *event ) = 0; 155 virtual bool addAnniversaryNoDup( Event *event ) = 0;
156 virtual bool addEvent( Event *anEvent ) = 0; 156 virtual bool addEvent( Event *anEvent ) = 0;
157 /** 157 /**
158 Delete event from calendar. 158 Delete event from calendar.
159 */ 159 */
160 virtual void deleteEvent( Event * ) = 0; 160 virtual void deleteEvent( Event * ) = 0;
161 /** 161 /**
162 Retrieves an event on the basis of the unique string ID. 162 Retrieves an event on the basis of the unique string ID.
163 */ 163 */
164 virtual Event *event( const QString &UniqueStr ) = 0; 164 virtual Event *event( const QString &UniqueStr ) = 0;
165 virtual Event *event( int ) = 0; 165 virtual Event *event( int ) = 0;
166 /** 166 /**
167 Builds and then returns a list of all events that match for the 167 Builds and then returns a list of all events that match for the
168 date specified. useful for dayView, etc. etc. 168 date specified. useful for dayView, etc. etc.
169 The calendar filter is applied. 169 The calendar filter is applied.
170 */ 170 */
171 QPtrList<Event> events( const QDate &date, bool sorted = false); 171 QPtrList<Event> events( const QDate &date, bool sorted = false);
172 /** 172 /**
173 Get events, which occur on the given date. 173 Get events, which occur on the given date.
174 The calendar filter is applied. 174 The calendar filter is applied.
175 */ 175 */
176 QPtrList<Event> events( const QDateTime &qdt ); 176 QPtrList<Event> events( const QDateTime &qdt );
177 /** 177 /**
178 Get events in a range of dates. If inclusive is set to true, only events 178 Get events in a range of dates. If inclusive is set to true, only events
179 are returned, which are completely included in the range. 179 are returned, which are completely included in the range.
180 The calendar filter is applied. 180 The calendar filter is applied.
181 */ 181 */
182 QPtrList<Event> events( const QDate &start, const QDate &end, 182 QPtrList<Event> events( const QDate &start, const QDate &end,
183 bool inclusive = false); 183 bool inclusive = false);
184 /** 184 /**
185 Return filtered list of all events in calendar. 185 Return filtered list of all events in calendar.
186 */ 186 */
187 virtual QPtrList<Event> events(); 187 virtual QPtrList<Event> events();
188 /** 188 /**
189 Return unfiltered list of all events in calendar. 189 Return unfiltered list of all events in calendar.
190 */ 190 */
191 virtual QPtrList<Event> rawEvents() = 0; 191 virtual QPtrList<Event> rawEvents() = 0;
192 192
193 /** 193 /**
194 Add a todo to the todolist. 194 Add a todo to the todolist.
195 195
196 @return true on success, false on error. 196 @return true on success, false on error.
197 */ 197 */
198 virtual bool addTodo( Todo *todo ) = 0; 198 virtual bool addTodo( Todo *todo ) = 0;
199 virtual bool addTodoNoDup( Todo *todo ) = 0; 199 virtual bool addTodoNoDup( Todo *todo ) = 0;
200 /** 200 /**
201 Remove a todo from the todolist. 201 Remove a todo from the todolist.
202 */ 202 */
203 virtual void deleteTodo( Todo * ) = 0; 203 virtual void deleteTodo( Todo * ) = 0;
204 virtual void deleteJournal( Journal * ) = 0; 204 virtual void deleteJournal( Journal * ) = 0;
205 /** 205 /**
206 Return filterd list of todos. 206 Return filterd list of todos.
207 */ 207 */
208 virtual QPtrList<Todo> todos(); 208 virtual QPtrList<Todo> todos();
209 /** 209 /**
210 Searches todolist for an event with this unique string identifier, 210 Searches todolist for an event with this unique string identifier,
211 returns a pointer or null. 211 returns a pointer or null.
212 */ 212 */
213 virtual Todo *todo( const QString &uid ) = 0; 213 virtual Todo *todo( const QString &uid ) = 0;
214 virtual Todo *todo( int ) = 0; 214 virtual Todo *todo( int ) = 0;
215 /** 215 /**
216 Returns list of todos due on the specified date. 216 Returns list of todos due on the specified date.
217 */ 217 */
218 virtual QPtrList<Todo> todos( const QDate &date ) = 0; 218 virtual QPtrList<Todo> todos( const QDate &date ) = 0;
219 /** 219 /**
220 Return unfiltered list of todos. 220 Return unfiltered list of todos.
221 */ 221 */
222 virtual QPtrList<Todo> rawTodos() = 0; 222 virtual QPtrList<Todo> rawTodos() = 0;
223 223
224 /** 224 /**
225 Add a Journal entry to calendar. 225 Add a Journal entry to calendar.
226 226
227 @return true on success, false on error. 227 @return true on success, false on error.
228 */ 228 */
229 virtual bool addJournal( Journal * ) = 0; 229 virtual bool addJournal( Journal * ) = 0;
230 /** 230 /**
231 Return Journal for given date. 231 Return Journal for given date.
232 */ 232 */
233 virtual Journal *journal( const QDate & ) = 0; 233 virtual Journal *journal( const QDate & ) = 0;
234 /** 234 /**
235 Return Journal with given UID. 235 Return Journal with given UID.
236 */ 236 */
237 virtual Journal *journal( const QString &UID ) = 0; 237 virtual Journal *journal( const QString &UID ) = 0;
238 /** 238 /**
239 Return list of all Journal entries. 239 Return list of all Journal entries.
240 */ 240 */
241 virtual QPtrList<Journal> journals() = 0; 241 virtual QPtrList<Journal> journals() = 0;
242 242
243 /** 243 /**
244 Searches all incidence types for an incidence with this unique 244 Searches all incidence types for an incidence with this unique
245 string identifier, returns a pointer or null. 245 string identifier, returns a pointer or null.
246 */ 246 */
247 Incidence* incidence( const QString&UID ); 247 Incidence* incidence( const QString&UID );
248 248
249 /** 249 /**
250 Setup relations for an incidence. 250 Setup relations for an incidence.
251 */ 251 */
252 virtual void setupRelations( Incidence * ); 252 virtual void setupRelations( Incidence * );
253 /** 253 /**
254 Remove all relations to an incidence 254 Remove all relations to an incidence
255 */ 255 */
256 virtual void removeRelations( Incidence * ); 256 virtual void removeRelations( Incidence * );
257 257
258 /** 258 /**
259 Set calendar filter, which filters events for the events() functions. 259 Set calendar filter, which filters events for the events() functions.
260 The Filter object is owned by the caller. 260 The Filter object is owned by the caller.
261 */ 261 */
262 void setFilter( CalFilter * ); 262 void setFilter( CalFilter * );
263 /** 263 /**
264 Return calendar filter. 264 Return calendar filter.
265 */ 265 */
266 CalFilter *filter(); 266 CalFilter *filter();
267 virtual QDateTime nextAlarm( int daysTo ) = 0; 267 virtual QDateTime nextAlarm( int daysTo ) = 0;
268 virtual QString nextSummary( ) const = 0; 268 virtual QString nextSummary( ) const = 0;
269 virtual void reInitAlarmSettings() = 0; 269 virtual void reInitAlarmSettings() = 0;
270 virtual QDateTime nextAlarmEventDateTime() const = 0; 270 virtual QDateTime nextAlarmEventDateTime() const = 0;
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 3c572f0..09ce9f0 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -33,483 +33,495 @@
33#include "vcalformat.h" 33#include "vcalformat.h"
34#include "icalformat.h" 34#include "icalformat.h"
35#include "exceptions.h" 35#include "exceptions.h"
36#include "incidence.h" 36#include "incidence.h"
37#include "journal.h" 37#include "journal.h"
38#include "filestorage.h" 38#include "filestorage.h"
39#include "calfilter.h" 39#include "calfilter.h"
40 40
41#include "calendarlocal.h" 41#include "calendarlocal.h"
42 42
43// #ifndef DESKTOP_VERSION 43// #ifndef DESKTOP_VERSION
44// #include <qtopia/alarmserver.h> 44// #include <qtopia/alarmserver.h>
45// #endif 45// #endif
46using namespace KCal; 46using namespace KCal;
47 47
48CalendarLocal::CalendarLocal() 48CalendarLocal::CalendarLocal()
49 : Calendar() 49 : Calendar()
50{ 50{
51 init(); 51 init();
52} 52}
53 53
54CalendarLocal::CalendarLocal(const QString &timeZoneId) 54CalendarLocal::CalendarLocal(const QString &timeZoneId)
55 : Calendar(timeZoneId) 55 : Calendar(timeZoneId)
56{ 56{
57 init(); 57 init();
58} 58}
59 59
60void CalendarLocal::init() 60void CalendarLocal::init()
61{ 61{
62 mNextAlarmIncidence = 0; 62 mNextAlarmIncidence = 0;
63} 63}
64 64
65 65
66CalendarLocal::~CalendarLocal() 66CalendarLocal::~CalendarLocal()
67{ 67{
68 close(); 68 close();
69} 69}
70 70
71bool CalendarLocal::load( const QString &fileName ) 71bool CalendarLocal::load( const QString &fileName )
72{ 72{
73 FileStorage storage( this, fileName ); 73 FileStorage storage( this, fileName );
74 return storage.load(); 74 return storage.load();
75} 75}
76 76
77bool CalendarLocal::save( const QString &fileName, CalFormat *format ) 77bool CalendarLocal::save( const QString &fileName, CalFormat *format )
78{ 78{
79 FileStorage storage( this, fileName, format ); 79 FileStorage storage( this, fileName, format );
80 return storage.save(); 80 return storage.save();
81} 81}
82 82
83void CalendarLocal::close() 83void CalendarLocal::close()
84{ 84{
85 mEventList.setAutoDelete( true ); 85 mEventList.setAutoDelete( true );
86 mTodoList.setAutoDelete( true ); 86 mTodoList.setAutoDelete( true );
87 mJournalList.setAutoDelete( false ); 87 mJournalList.setAutoDelete( false );
88 88
89 mEventList.clear(); 89 mEventList.clear();
90 mTodoList.clear(); 90 mTodoList.clear();
91 mJournalList.clear(); 91 mJournalList.clear();
92 92
93 mEventList.setAutoDelete( false ); 93 mEventList.setAutoDelete( false );
94 mTodoList.setAutoDelete( false ); 94 mTodoList.setAutoDelete( false );
95 mJournalList.setAutoDelete( false ); 95 mJournalList.setAutoDelete( false );
96 96
97 setModified( false ); 97 setModified( false );
98} 98}
99 99
100bool CalendarLocal::addAnniversaryNoDup( Event *event ) 100bool CalendarLocal::addAnniversaryNoDup( Event *event )
101{ 101{
102 QString cat; 102 QString cat;
103 bool isBirthday = true; 103 bool isBirthday = true;
104 if( event->categoriesStr() == i18n( "Anniversary" ) ) { 104 if( event->categoriesStr() == i18n( "Anniversary" ) ) {
105 isBirthday = false; 105 isBirthday = false;
106 cat = i18n( "Anniversary" ); 106 cat = i18n( "Anniversary" );
107 } else if( event->categoriesStr() == i18n( "Birthday" ) ) { 107 } else if( event->categoriesStr() == i18n( "Birthday" ) ) {
108 isBirthday = true; 108 isBirthday = true;
109 cat = i18n( "Birthday" ); 109 cat = i18n( "Birthday" );
110 } else { 110 } else {
111 qDebug("addAnniversaryNoDup called without fitting category! "); 111 qDebug("addAnniversaryNoDup called without fitting category! ");
112 return false; 112 return false;
113 } 113 }
114 Event * eve; 114 Event * eve;
115 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 115 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
116 if ( !(eve->categories().contains( cat ) )) 116 if ( !(eve->categories().contains( cat ) ))
117 continue; 117 continue;
118 // now we have an event with fitting category 118 // now we have an event with fitting category
119 if ( eve->dtStart().date() != event->dtStart().date() ) 119 if ( eve->dtStart().date() != event->dtStart().date() )
120 continue; 120 continue;
121 // now we have an event with fitting category+date 121 // now we have an event with fitting category+date
122 if ( eve->summary() != event->summary() ) 122 if ( eve->summary() != event->summary() )
123 continue; 123 continue;
124 // now we have an event with fitting category+date+summary 124 // now we have an event with fitting category+date+summary
125 return false; 125 return false;
126 } 126 }
127 return addEvent( event ); 127 return addEvent( event );
128 128
129} 129}
130bool CalendarLocal::addEventNoDup( Event *event ) 130bool CalendarLocal::addEventNoDup( Event *event )
131{ 131{
132 Event * eve; 132 Event * eve;
133 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 133 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
134 if ( *eve == *event ) { 134 if ( *eve == *event ) {
135 //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); 135 //qDebug("CalendarLocal::Duplicate event found! Not inserted! ");
136 return false; 136 return false;
137 } 137 }
138 } 138 }
139 return addEvent( event ); 139 return addEvent( event );
140} 140}
141 141
142bool CalendarLocal::addEvent( Event *event ) 142bool CalendarLocal::addEvent( Event *event )
143{ 143{
144 insertEvent( event ); 144 insertEvent( event );
145 145
146 event->registerObserver( this ); 146 event->registerObserver( this );
147 147
148 setModified( true ); 148 setModified( true );
149 149
150 return true; 150 return true;
151} 151}
152 152
153void CalendarLocal::deleteEvent( Event *event ) 153void CalendarLocal::deleteEvent( Event *event )
154{ 154{
155 155
156 156
157 if ( mEventList.removeRef( event ) ) { 157 if ( mEventList.removeRef( event ) ) {
158 setModified( true ); 158 setModified( true );
159 } 159 }
160} 160}
161 161
162 162
163Event *CalendarLocal::event( const QString &uid ) 163Event *CalendarLocal::event( const QString &uid )
164{ 164{
165 165
166 Event *event; 166 Event *event;
167 167
168 for ( event = mEventList.first(); event; event = mEventList.next() ) { 168 for ( event = mEventList.first(); event; event = mEventList.next() ) {
169 if ( event->uid() == uid ) { 169 if ( event->uid() == uid ) {
170 return event; 170 return event;
171 } 171 }
172 } 172 }
173 173
174 return 0; 174 return 0;
175} 175}
176bool CalendarLocal::addTodoNoDup( Todo *todo ) 176bool CalendarLocal::addTodoNoDup( Todo *todo )
177{ 177{
178 Todo * eve; 178 Todo * eve;
179 for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { 179 for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) {
180 if ( *eve == *todo ) { 180 if ( *eve == *todo ) {
181 //qDebug("duplicate todo found! not inserted! "); 181 //qDebug("duplicate todo found! not inserted! ");
182 return false; 182 return false;
183 } 183 }
184 } 184 }
185 return addTodo( todo ); 185 return addTodo( todo );
186} 186}
187bool CalendarLocal::addTodo( Todo *todo ) 187bool CalendarLocal::addTodo( Todo *todo )
188{ 188{
189 mTodoList.append( todo ); 189 mTodoList.append( todo );
190 190
191 todo->registerObserver( this ); 191 todo->registerObserver( this );
192 192
193 // Set up subtask relations 193 // Set up subtask relations
194 setupRelations( todo ); 194 setupRelations( todo );
195 195
196 setModified( true ); 196 setModified( true );
197 197
198 return true; 198 return true;
199} 199}
200 200
201void CalendarLocal::deleteTodo( Todo *todo ) 201void CalendarLocal::deleteTodo( Todo *todo )
202{ 202{
203 // Handle orphaned children 203 // Handle orphaned children
204 removeRelations( todo ); 204 removeRelations( todo );
205 205
206 if ( mTodoList.removeRef( todo ) ) { 206 if ( mTodoList.removeRef( todo ) ) {
207 setModified( true ); 207 setModified( true );
208 } 208 }
209} 209}
210 210
211QPtrList<Todo> CalendarLocal::rawTodos() 211QPtrList<Todo> CalendarLocal::rawTodos()
212{ 212{
213 return mTodoList; 213 return mTodoList;
214} 214}
215Todo *CalendarLocal::todo( int id ) 215Todo *CalendarLocal::todo( int id )
216{ 216{
217 Todo *todo; 217 Todo *todo;
218 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 218 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
219 if ( todo->zaurusId() == id ) return todo; 219 if ( todo->zaurusId() == id ) return todo;
220 } 220 }
221 221
222 return 0; 222 return 0;
223} 223}
224 224
225QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
226{
227 QPtrList<Event> el;
228 Event *todo;
229 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
230 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
231 if ( todo->summary().left(3) == "E: " )
232 el.append( todo );
233 }
234
235 return el;
236
237}
225Event *CalendarLocal::event( int id ) 238Event *CalendarLocal::event( int id )
226{ 239{
227 Event *todo; 240 Event *todo;
228 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 241 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
229 if ( todo->zaurusId() == id ) return todo; 242 if ( todo->zaurusId() == id ) return todo;
230 } 243 }
231 244
232 return 0; 245 return 0;
233} 246}
234Todo *CalendarLocal::todo( const QString &uid ) 247Todo *CalendarLocal::todo( const QString &uid )
235{ 248{
236 Todo *todo; 249 Todo *todo;
237 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 250 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
238 if ( todo->uid() == uid ) return todo; 251 if ( todo->uid() == uid ) return todo;
239 } 252 }
240 253
241 return 0; 254 return 0;
242} 255}
243QString CalendarLocal::nextSummary() const 256QString CalendarLocal::nextSummary() const
244{ 257{
245 return mNextSummary; 258 return mNextSummary;
246} 259}
247QDateTime CalendarLocal::nextAlarmEventDateTime() const 260QDateTime CalendarLocal::nextAlarmEventDateTime() const
248{ 261{
249 return mNextAlarmEventDateTime; 262 return mNextAlarmEventDateTime;
250} 263}
251void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) 264void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted)
252{ 265{
253 //mNextAlarmIncidence 266 //mNextAlarmIncidence
254 //mNextAlarmDateTime 267 //mNextAlarmDateTime
255 //return mNextSummary; 268 //return mNextSummary;
256 //return mNextAlarmEventDateTime; 269 //return mNextAlarmEventDateTime;
257 bool newNextAlarm = false; 270 bool newNextAlarm = false;
258 bool computeNextAlarm = false; 271 bool computeNextAlarm = false;
259 bool ok; 272 bool ok;
260 int offset; 273 int offset;
261 QDateTime nextA; 274 QDateTime nextA;
262 // QString nextSum; 275 // QString nextSum;
263 //QDateTime nextEvent; 276 //QDateTime nextEvent;
264 if ( mNextAlarmIncidence == 0 || incidence == 0 ) { 277 if ( mNextAlarmIncidence == 0 || incidence == 0 ) {
265 computeNextAlarm = true; 278 computeNextAlarm = true;
266 } else { 279 } else {
267 if ( ! deleted ) { 280 if ( ! deleted ) {
268 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; 281 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ;
269 if ( ok ) { 282 if ( ok ) {
270 if ( nextA < mNextAlarmDateTime ) { 283 if ( nextA < mNextAlarmDateTime ) {
271 deRegisterAlarm(); 284 deRegisterAlarm();
272 mNextAlarmDateTime = nextA; 285 mNextAlarmDateTime = nextA;
273 mNextSummary = incidence->summary(); 286 mNextSummary = incidence->summary();
274 mNextAlarmEventDateTime = nextA.addSecs(offset ) ; 287 mNextAlarmEventDateTime = nextA.addSecs(offset ) ;
275 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); 288 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
276 newNextAlarm = true; 289 newNextAlarm = true;
277 mNextAlarmIncidence = incidence; 290 mNextAlarmIncidence = incidence;
278 } else { 291 } else {
279 if ( incidence == mNextAlarmIncidence ) { 292 if ( incidence == mNextAlarmIncidence ) {
280 computeNextAlarm = true; 293 computeNextAlarm = true;
281 } 294 }
282 } 295 }
283 } else { 296 } else {
284 if ( mNextAlarmIncidence == incidence ) { 297 if ( mNextAlarmIncidence == incidence ) {
285 computeNextAlarm = true; 298 computeNextAlarm = true;
286 } 299 }
287 } 300 }
288 } else { // deleted 301 } else { // deleted
289 if ( incidence == mNextAlarmIncidence ) { 302 if ( incidence == mNextAlarmIncidence ) {
290 computeNextAlarm = true; 303 computeNextAlarm = true;
291 } 304 }
292 } 305 }
293 } 306 }
294 if ( computeNextAlarm ) { 307 if ( computeNextAlarm ) {
295 deRegisterAlarm(); 308 deRegisterAlarm();
296 nextA = nextAlarm( 1000 ); 309 nextA = nextAlarm( 1000 );
297 if (! mNextAlarmIncidence ) { 310 if (! mNextAlarmIncidence ) {
298 return; 311 return;
299 } 312 }
300 newNextAlarm = true; 313 newNextAlarm = true;
301 } 314 }
302 if ( newNextAlarm ) 315 if ( newNextAlarm )
303 registerAlarm(); 316 registerAlarm();
304} 317}
305QString CalendarLocal:: getAlarmNotification() 318QString CalendarLocal:: getAlarmNotification()
306{ 319{
307 QString ret; 320 QString ret;
308 // this should not happen 321 // this should not happen
309 if (! mNextAlarmIncidence ) 322 if (! mNextAlarmIncidence )
310 return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; 323 return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString;
311 Alarm* alarm = mNextAlarmIncidence->alarms().first(); 324 Alarm* alarm = mNextAlarmIncidence->alarms().first();
312 if ( alarm->type() == Alarm::Procedure ) { 325 if ( alarm->type() == Alarm::Procedure ) {
313 ret = "proc_alarm" + alarm->programFile()+"+++"; 326 ret = "proc_alarm" + alarm->programFile()+"+++";
314 } else { 327 } else {
315 ret = "audio_alarm" +alarm->audioFile() +"+++"; 328 ret = "audio_alarm" +alarm->audioFile() +"+++";
316 } 329 }
317 ret += "cal_alarm"+ mNextSummary.left( 25 ); 330 ret += "cal_alarm"+ mNextSummary.left( 25 );
318 if ( mNextSummary.length() > 25 ) 331 if ( mNextSummary.length() > 25 )
319 ret += "\n" + mNextSummary.mid(25, 25 ); 332 ret += "\n" + mNextSummary.mid(25, 25 );
320 ret+= "\n"+mNextAlarmEventDateTimeString; 333 ret+= "\n"+mNextAlarmEventDateTimeString;
321 return ret; 334 return ret;
322} 335}
323
324void CalendarLocal::registerAlarm() 336void CalendarLocal::registerAlarm()
325{ 337{
326 mLastAlarmNotificationString = getAlarmNotification(); 338 mLastAlarmNotificationString = getAlarmNotification();
327 // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); 339 // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() );
328 emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); 340 emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
329// #ifndef DESKTOP_VERSION 341// #ifndef DESKTOP_VERSION
330// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); 342// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() );
331// #endif 343// #endif
332} 344}
333void CalendarLocal::deRegisterAlarm() 345void CalendarLocal::deRegisterAlarm()
334{ 346{
335 if ( mLastAlarmNotificationString.isNull() ) 347 if ( mLastAlarmNotificationString.isNull() )
336 return; 348 return;
337 //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); 349 //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() );
338 350
339 emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); 351 emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
340// #ifndef DESKTOP_VERSION 352// #ifndef DESKTOP_VERSION
341// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); 353// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() );
342// #endif 354// #endif
343} 355}
344 356
345QPtrList<Todo> CalendarLocal::todos( const QDate &date ) 357QPtrList<Todo> CalendarLocal::todos( const QDate &date )
346{ 358{
347 QPtrList<Todo> todos; 359 QPtrList<Todo> todos;
348 360
349 Todo *todo; 361 Todo *todo;
350 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 362 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
351 if ( todo->hasDueDate() && todo->dtDue().date() == date ) { 363 if ( todo->hasDueDate() && todo->dtDue().date() == date ) {
352 todos.append( todo ); 364 todos.append( todo );
353 } 365 }
354 } 366 }
355 367
356 filter()->apply( &todos ); 368 filter()->apply( &todos );
357 return todos; 369 return todos;
358} 370}
359void CalendarLocal::reInitAlarmSettings() 371void CalendarLocal::reInitAlarmSettings()
360{ 372{
361 if ( !mNextAlarmIncidence ) { 373 if ( !mNextAlarmIncidence ) {
362 nextAlarm( 1000 ); 374 nextAlarm( 1000 );
363 } 375 }
364 deRegisterAlarm(); 376 deRegisterAlarm();
365 mNextAlarmIncidence = 0; 377 mNextAlarmIncidence = 0;
366 checkAlarmForIncidence( 0, false ); 378 checkAlarmForIncidence( 0, false );
367 379
368} 380}
369 381
370 382
371 383
372QDateTime CalendarLocal::nextAlarm( int daysTo ) 384QDateTime CalendarLocal::nextAlarm( int daysTo )
373{ 385{
374 QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); 386 QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo );
375 QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); 387 QDateTime start = QDateTime::currentDateTime().addSecs( 30 );
376 QDateTime next; 388 QDateTime next;
377 Event *e; 389 Event *e;
378 bool ok; 390 bool ok;
379 bool found = false; 391 bool found = false;
380 int offset; 392 int offset;
381 mNextAlarmIncidence = 0; 393 mNextAlarmIncidence = 0;
382 for( e = mEventList.first(); e; e = mEventList.next() ) { 394 for( e = mEventList.first(); e; e = mEventList.next() ) {
383 next = e->getNextAlarmDateTime(& ok, &offset ) ; 395 next = e->getNextAlarmDateTime(& ok, &offset ) ;
384 if ( ok ) { 396 if ( ok ) {
385 if ( next < nextA ) { 397 if ( next < nextA ) {
386 nextA = next; 398 nextA = next;
387 found = true; 399 found = true;
388 mNextSummary = e->summary(); 400 mNextSummary = e->summary();
389 mNextAlarmEventDateTime = next.addSecs(offset ) ; 401 mNextAlarmEventDateTime = next.addSecs(offset ) ;
390 mNextAlarmIncidence = (Incidence *) e; 402 mNextAlarmIncidence = (Incidence *) e;
391 } 403 }
392 } 404 }
393 } 405 }
394 Todo *t; 406 Todo *t;
395 for( t = mTodoList.first(); t; t = mTodoList.next() ) { 407 for( t = mTodoList.first(); t; t = mTodoList.next() ) {
396 next = t->getNextAlarmDateTime(& ok, &offset ) ; 408 next = t->getNextAlarmDateTime(& ok, &offset ) ;
397 if ( ok ) { 409 if ( ok ) {
398 if ( next < nextA ) { 410 if ( next < nextA ) {
399 nextA = next; 411 nextA = next;
400 found = true; 412 found = true;
401 mNextSummary = t->summary(); 413 mNextSummary = t->summary();
402 mNextAlarmEventDateTime = next.addSecs(offset ); 414 mNextAlarmEventDateTime = next.addSecs(offset );
403 mNextAlarmIncidence = (Incidence *) t; 415 mNextAlarmIncidence = (Incidence *) t;
404 } 416 }
405 } 417 }
406 } 418 }
407 if ( mNextAlarmIncidence ) { 419 if ( mNextAlarmIncidence ) {
408 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); 420 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
409 mNextAlarmDateTime = nextA; 421 mNextAlarmDateTime = nextA;
410 } 422 }
411 return nextA; 423 return nextA;
412} 424}
413Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) 425Alarm::List CalendarLocal::alarmsTo( const QDateTime &to )
414{ 426{
415 return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); 427 return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to );
416} 428}
417 429
418Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) 430Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
419{ 431{
420 kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " 432 kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - "
421 << to.toString() << ")\n"; 433 << to.toString() << ")\n";
422 434
423 Alarm::List alarms; 435 Alarm::List alarms;
424 436
425 Event *e; 437 Event *e;
426 438
427 for( e = mEventList.first(); e; e = mEventList.next() ) { 439 for( e = mEventList.first(); e; e = mEventList.next() ) {
428 if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); 440 if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to );
429 else appendAlarms( alarms, e, from, to ); 441 else appendAlarms( alarms, e, from, to );
430 } 442 }
431 443
432 Todo *t; 444 Todo *t;
433 for( t = mTodoList.first(); t; t = mTodoList.next() ) { 445 for( t = mTodoList.first(); t; t = mTodoList.next() ) {
434 appendAlarms( alarms, t, from, to ); 446 appendAlarms( alarms, t, from, to );
435 } 447 }
436 448
437 return alarms; 449 return alarms;
438} 450}
439 451
440void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, 452void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence,
441 const QDateTime &from, const QDateTime &to ) 453 const QDateTime &from, const QDateTime &to )
442{ 454{
443 QPtrList<Alarm> alarmList = incidence->alarms(); 455 QPtrList<Alarm> alarmList = incidence->alarms();
444 Alarm *alarm; 456 Alarm *alarm;
445 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { 457 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
446// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() 458// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text()
447// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; 459// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl;
448 if ( alarm->enabled() ) { 460 if ( alarm->enabled() ) {
449 if ( alarm->time() >= from && alarm->time() <= to ) { 461 if ( alarm->time() >= from && alarm->time() <= to ) {
450 kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary() 462 kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary()
451 << "': " << alarm->time().toString() << endl; 463 << "': " << alarm->time().toString() << endl;
452 alarms.append( alarm ); 464 alarms.append( alarm );
453 } 465 }
454 } 466 }
455 } 467 }
456} 468}
457 469
458void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, 470void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms,
459 Incidence *incidence, 471 Incidence *incidence,
460 const QDateTime &from, 472 const QDateTime &from,
461 const QDateTime &to ) 473 const QDateTime &to )
462{ 474{
463 475
464 QPtrList<Alarm> alarmList = incidence->alarms(); 476 QPtrList<Alarm> alarmList = incidence->alarms();
465 Alarm *alarm; 477 Alarm *alarm;
466 QDateTime qdt; 478 QDateTime qdt;
467 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { 479 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
468 if (incidence->recursOn(from.date())) { 480 if (incidence->recursOn(from.date())) {
469 qdt.setTime(alarm->time().time()); 481 qdt.setTime(alarm->time().time());
470 qdt.setDate(from.date()); 482 qdt.setDate(from.date());
471 } 483 }
472 else qdt = alarm->time(); 484 else qdt = alarm->time();
473 // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); 485 // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1());
474 if ( alarm->enabled() ) { 486 if ( alarm->enabled() ) {
475 if ( qdt >= from && qdt <= to ) { 487 if ( qdt >= from && qdt <= to ) {
476 alarms.append( alarm ); 488 alarms.append( alarm );
477 } 489 }
478 } 490 }
479 } 491 }
480} 492}
481 493
482 494
483/****************************** PROTECTED METHODS ****************************/ 495/****************************** PROTECTED METHODS ****************************/
484 496
485// after changes are made to an event, this should be called. 497// after changes are made to an event, this should be called.
486void CalendarLocal::update( IncidenceBase *incidence ) 498void CalendarLocal::update( IncidenceBase *incidence )
487{ 499{
488 incidence->setSyncStatus( Event::SYNCMOD ); 500 incidence->setSyncStatus( Event::SYNCMOD );
489 incidence->setLastModified( QDateTime::currentDateTime() ); 501 incidence->setLastModified( QDateTime::currentDateTime() );
490 // we should probably update the revision number here, 502 // we should probably update the revision number here,
491 // or internally in the Event itself when certain things change. 503 // or internally in the Event itself when certain things change.
492 // need to verify with ical documentation. 504 // need to verify with ical documentation.
493 505
494 setModified( true ); 506 setModified( true );
495} 507}
496 508
497void CalendarLocal::insertEvent( Event *event ) 509void CalendarLocal::insertEvent( Event *event )
498{ 510{
499 if ( mEventList.findRef( event ) < 0 ) mEventList.append( event ); 511 if ( mEventList.findRef( event ) < 0 ) mEventList.append( event );
500} 512}
501 513
502 514
503QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) 515QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted )
504{ 516{
505 QPtrList<Event> eventList; 517 QPtrList<Event> eventList;
506 518
507 Event *event; 519 Event *event;
508 for( event = mEventList.first(); event; event = mEventList.next() ) { 520 for( event = mEventList.first(); event; event = mEventList.next() ) {
509 if ( event->doesRecur() ) { 521 if ( event->doesRecur() ) {
510 if ( event->isMultiDay() ) { 522 if ( event->isMultiDay() ) {
511 int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); 523 int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() );
512 int i; 524 int i;
513 for ( i = 0; i <= extraDays; i++ ) { 525 for ( i = 0; i <= extraDays; i++ ) {
514 if ( event->recursOn( qd.addDays( -i ) ) ) { 526 if ( event->recursOn( qd.addDays( -i ) ) ) {
515 eventList.append( event ); 527 eventList.append( event );
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index a2e50e3..3257198 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -1,217 +1,217 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 3
4 Copyright (c) 1998 Preston Brown 4 Copyright (c) 1998 Preston Brown
5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> 5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22#ifndef KCAL_CALENDARLOCAL_H 22#ifndef KCAL_CALENDARLOCAL_H
23#define KCAL_CALENDARLOCAL_H 23#define KCAL_CALENDARLOCAL_H
24 24
25#include "calendar.h" 25#include "calendar.h"
26 26
27namespace KCal { 27namespace KCal {
28 28
29class CalFormat; 29class CalFormat;
30 30
31/** 31/**
32 This class provides a calendar stored as a local file. 32 This class provides a calendar stored as a local file.
33*/ 33*/
34class CalendarLocal : public Calendar 34class CalendarLocal : public Calendar
35{ 35{
36 public: 36 public:
37 /** 37 /**
38 Constructs a new calendar, with variables initialized to sane values. 38 Constructs a new calendar, with variables initialized to sane values.
39 */ 39 */
40 CalendarLocal(); 40 CalendarLocal();
41 /** 41 /**
42 Constructs a new calendar, with variables initialized to sane values. 42 Constructs a new calendar, with variables initialized to sane values.
43 */ 43 */
44 CalendarLocal( const QString &timeZoneId ); 44 CalendarLocal( const QString &timeZoneId );
45 ~CalendarLocal(); 45 ~CalendarLocal();
46 46
47 /** 47 /**
48 Loads a calendar on disk in vCalendar or iCalendar format into the current 48 Loads a calendar on disk in vCalendar or iCalendar format into the current
49 calendar. Any information already present is lost. 49 calendar. Any information already present is lost.
50 @return true, if successfull, false on error. 50 @return true, if successfull, false on error.
51 @param fileName the name of the calendar on disk. 51 @param fileName the name of the calendar on disk.
52 */ 52 */
53 bool load( const QString &fileName ); 53 bool load( const QString &fileName );
54 /** 54 /**
55 Writes out the calendar to disk in the specified \a format. 55 Writes out the calendar to disk in the specified \a format.
56 CalendarLocal takes ownership of the CalFormat object. 56 CalendarLocal takes ownership of the CalFormat object.
57 @return true, if successfull, false on error. 57 @return true, if successfull, false on error.
58 @param fileName the name of the file 58 @param fileName the name of the file
59 */ 59 */
60 bool save( const QString &fileName, CalFormat *format = 0 ); 60 bool save( const QString &fileName, CalFormat *format = 0 );
61 61
62 /** 62 /**
63 Clears out the current calendar, freeing all used memory etc. etc. 63 Clears out the current calendar, freeing all used memory etc. etc.
64 */ 64 */
65 void close(); 65 void close();
66 66
67 void save() {} 67 void save() {}
68 68
69 /** 69 /**
70 Add Event to calendar. 70 Add Event to calendar.
71 */ 71 */
72 bool addAnniversaryNoDup( Event *event ); 72 bool addAnniversaryNoDup( Event *event );
73 bool addEventNoDup( Event *event ); 73 bool addEventNoDup( Event *event );
74 bool addEvent( Event *event ); 74 bool addEvent( Event *event );
75 /** 75 /**
76 Deletes an event from this calendar. 76 Deletes an event from this calendar.
77 */ 77 */
78 void deleteEvent( Event *event ); 78 void deleteEvent( Event *event );
79 79
80 /** 80 /**
81 Retrieves an event on the basis of the unique string ID. 81 Retrieves an event on the basis of the unique string ID.
82 */ 82 */
83 Event *event( const QString &uid ); 83 Event *event( const QString &uid );
84 /** 84 /**
85 Return unfiltered list of all events in calendar. 85 Return unfiltered list of all events in calendar.
86 */ 86 */
87 QPtrList<Event> rawEvents(); 87 QPtrList<Event> rawEvents();
88 88 QPtrList<Event> getExternLastSyncEvents();
89 /** 89 /**
90 Add a todo to the todolist. 90 Add a todo to the todolist.
91 */ 91 */
92 bool addTodo( Todo *todo ); 92 bool addTodo( Todo *todo );
93 bool addTodoNoDup( Todo *todo ); 93 bool addTodoNoDup( Todo *todo );
94 /** 94 /**
95 Remove a todo from the todolist. 95 Remove a todo from the todolist.
96 */ 96 */
97 void deleteTodo( Todo * ); 97 void deleteTodo( Todo * );
98 /** 98 /**
99 Searches todolist for an event with this unique string identifier, 99 Searches todolist for an event with this unique string identifier,
100 returns a pointer or null. 100 returns a pointer or null.
101 */ 101 */
102 Todo *todo( const QString &uid ); 102 Todo *todo( const QString &uid );
103 /** 103 /**
104 Return list of all todos. 104 Return list of all todos.
105 */ 105 */
106 QPtrList<Todo> rawTodos(); 106 QPtrList<Todo> rawTodos();
107 /** 107 /**
108 Returns list of todos due on the specified date. 108 Returns list of todos due on the specified date.
109 */ 109 */
110 QPtrList<Todo> todos( const QDate &date ); 110 QPtrList<Todo> todos( const QDate &date );
111 /** 111 /**
112 Return list of all todos. 112 Return list of all todos.
113 113
114 Workaround because compiler does not recognize function of base class. 114 Workaround because compiler does not recognize function of base class.
115 */ 115 */
116 QPtrList<Todo> todos() { return Calendar::todos(); } 116 QPtrList<Todo> todos() { return Calendar::todos(); }
117 117
118 /** 118 /**
119 Add a Journal entry to calendar. 119 Add a Journal entry to calendar.
120 */ 120 */
121 bool addJournal( Journal * ); 121 bool addJournal( Journal * );
122 /** 122 /**
123 Remove a Journal from the calendar. 123 Remove a Journal from the calendar.
124 */ 124 */
125 void deleteJournal( Journal * ); 125 void deleteJournal( Journal * );
126 /** 126 /**
127 Return Journal for given date. 127 Return Journal for given date.
128 */ 128 */
129 Journal *journal( const QDate & ); 129 Journal *journal( const QDate & );
130 /** 130 /**
131 Return Journal with given UID. 131 Return Journal with given UID.
132 */ 132 */
133 Journal *journal( const QString &uid ); 133 Journal *journal( const QString &uid );
134 /** 134 /**
135 Return list of all Journals stored in calendar. 135 Return list of all Journals stored in calendar.
136 */ 136 */
137 QPtrList<Journal> journals(); 137 QPtrList<Journal> journals();
138 138
139 /** 139 /**
140 Return all alarms, which ocur in the given time interval. 140 Return all alarms, which ocur in the given time interval.
141 */ 141 */
142 Alarm::List alarms( const QDateTime &from, const QDateTime &to ); 142 Alarm::List alarms( const QDateTime &from, const QDateTime &to );
143 143
144 /** 144 /**
145 Return all alarms, which ocur before given date. 145 Return all alarms, which ocur before given date.
146 */ 146 */
147 Alarm::List alarmsTo( const QDateTime &to ); 147 Alarm::List alarmsTo( const QDateTime &to );
148 148
149 QDateTime nextAlarm( int daysTo ) ; 149 QDateTime nextAlarm( int daysTo ) ;
150 QDateTime nextAlarmEventDateTime() const; 150 QDateTime nextAlarmEventDateTime() const;
151 void checkAlarmForIncidence( Incidence *, bool deleted ) ; 151 void checkAlarmForIncidence( Incidence *, bool deleted ) ;
152 void registerAlarm(); 152 void registerAlarm();
153 void deRegisterAlarm(); 153 void deRegisterAlarm();
154 QString getAlarmNotification(); 154 QString getAlarmNotification();
155 QString nextSummary() const ; 155 QString nextSummary() const ;
156 /** 156 /**
157 This method should be called whenever a Event is modified directly 157 This method should be called whenever a Event is modified directly
158 via it's pointer. It makes sure that the calendar is internally 158 via it's pointer. It makes sure that the calendar is internally
159 consistent. 159 consistent.
160 */ 160 */
161 void update( IncidenceBase *incidence ); 161 void update( IncidenceBase *incidence );
162 162
163 /** 163 /**
164 Builds and then returns a list of all events that match for the 164 Builds and then returns a list of all events that match for the
165 date specified. useful for dayView, etc. etc. 165 date specified. useful for dayView, etc. etc.
166 */ 166 */
167 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); 167 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
168 /** 168 /**
169 Get unfiltered events for date \a qdt. 169 Get unfiltered events for date \a qdt.
170 */ 170 */
171 QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); 171 QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
172 /** 172 /**
173 Get unfiltered events in a range of dates. If inclusive is set to true, 173 Get unfiltered events in a range of dates. If inclusive is set to true,
174 only events are returned, which are completely included in the range. 174 only events are returned, which are completely included in the range.
175 */ 175 */
176 QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 176 QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
177 bool inclusive = false ); 177 bool inclusive = false );
178 Todo *CalendarLocal::todo( int uid ); 178 Todo *CalendarLocal::todo( int uid );
179 Event *CalendarLocal::event( int uid ); 179 Event *CalendarLocal::event( int uid );
180 180
181 181
182 182
183 protected: 183 protected:
184 184
185 // Event* mNextAlarmEvent; 185 // Event* mNextAlarmEvent;
186 QString mNextSummary; 186 QString mNextSummary;
187 QString mNextAlarmEventDateTimeString; 187 QString mNextAlarmEventDateTimeString;
188 QString mLastAlarmNotificationString; 188 QString mLastAlarmNotificationString;
189 QDateTime mNextAlarmEventDateTime; 189 QDateTime mNextAlarmEventDateTime;
190 QDateTime mNextAlarmDateTime; 190 QDateTime mNextAlarmDateTime;
191 void reInitAlarmSettings(); 191 void reInitAlarmSettings();
192 192
193 /** Notification function of IncidenceBase::Observer. */ 193 /** Notification function of IncidenceBase::Observer. */
194 void incidenceUpdated( IncidenceBase *i ) { update( i ); } 194 void incidenceUpdated( IncidenceBase *i ) { update( i ); }
195 195
196 /** inserts an event into its "proper place" in the calendar. */ 196 /** inserts an event into its "proper place" in the calendar. */
197 void insertEvent( Event *event ); 197 void insertEvent( Event *event );
198 198
199 /** Append alarms of incidence in interval to list of alarms. */ 199 /** Append alarms of incidence in interval to list of alarms. */
200 void appendAlarms( Alarm::List &alarms, Incidence *incidence, 200 void appendAlarms( Alarm::List &alarms, Incidence *incidence,
201 const QDateTime &from, const QDateTime &to ); 201 const QDateTime &from, const QDateTime &to );
202 202
203 /** Append alarms of recurring events in interval to list of alarms. */ 203 /** Append alarms of recurring events in interval to list of alarms. */
204 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, 204 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
205 const QDateTime &from, const QDateTime &to ); 205 const QDateTime &from, const QDateTime &to );
206 206
207 private: 207 private:
208 void init(); 208 void init();
209 209
210 QPtrList<Event> mEventList; 210 QPtrList<Event> mEventList;
211 QPtrList<Todo> mTodoList; 211 QPtrList<Todo> mTodoList;
212 QPtrList<Journal> mJournalList; 212 QPtrList<Journal> mJournalList;
213}; 213};
214 214
215} 215}
216 216
217#endif 217#endif