summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-10-28 11:03:42 (UTC)
committer zautrix <zautrix>2004-10-28 11:03:42 (UTC)
commit01cd4ef94b8604532181c390e9abd560aebaf372 (patch) (unidiff)
tree96ca1a524512ae2e2868f0bd3df03e4da5c445f9 /korganizer
parent61d9eb436349a841410559f51e2601a34ceb5794 (diff)
downloadkdepimpi-01cd4ef94b8604532181c390e9abd560aebaf372.zip
kdepimpi-01cd4ef94b8604532181c390e9abd560aebaf372.tar.gz
kdepimpi-01cd4ef94b8604532181c390e9abd560aebaf372.tar.bz2
added howto to menus
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp12
-rw-r--r--korganizer/mainwindow.cpp48
-rw-r--r--korganizer/mainwindow.h2
3 files changed, 42 insertions, 20 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 6e61351..4667918 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -685,1142 +685,1148 @@ QDate CalendarView::startDate()
685QDate CalendarView::endDate() 685QDate CalendarView::endDate()
686{ 686{
687 DateList dates = mNavigator->selectedDates(); 687 DateList dates = mNavigator->selectedDates();
688 688
689 return dates.last(); 689 return dates.last();
690} 690}
691 691
692 692
693void CalendarView::createPrinter() 693void CalendarView::createPrinter()
694{ 694{
695#ifndef KORG_NOPRINTER 695#ifndef KORG_NOPRINTER
696 if (!mCalPrinter) { 696 if (!mCalPrinter) {
697 mCalPrinter = new CalPrinter(this, mCalendar); 697 mCalPrinter = new CalPrinter(this, mCalendar);
698 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 698 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
699 } 699 }
700#endif 700#endif
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 // 0 equal 717 // 0 equal
718 // 1 take local 718 // 1 take local
719 // 2 take remote 719 // 2 take remote
720 // 3 cancel 720 // 3 cancel
721 QDateTime lastSync = mLastCalendarSync; 721 QDateTime lastSync = mLastCalendarSync;
722 QDateTime localMod = local->lastModified(); 722 QDateTime localMod = local->lastModified();
723 QDateTime remoteMod = remote->lastModified(); 723 QDateTime remoteMod = remote->lastModified();
724 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 724 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
725 bool remCh, locCh; 725 bool remCh, locCh;
726 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 726 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
727 //if ( remCh ) 727 //if ( remCh )
728 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 728 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
729 locCh = ( localMod > mLastCalendarSync ); 729 locCh = ( localMod > mLastCalendarSync );
730 if ( !remCh && ! locCh ) { 730 if ( !remCh && ! locCh ) {
731 //qDebug("both not changed "); 731 //qDebug("both not changed ");
732 lastSync = localMod.addDays(1); 732 lastSync = localMod.addDays(1);
733 if ( mode <= SYNC_PREF_ASK ) 733 if ( mode <= SYNC_PREF_ASK )
734 return 0; 734 return 0;
735 } else { 735 } else {
736 if ( locCh ) { 736 if ( locCh ) {
737 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 737 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
738 lastSync = localMod.addDays( -1 ); 738 lastSync = localMod.addDays( -1 );
739 if ( !remCh ) 739 if ( !remCh )
740 remoteMod = ( lastSync.addDays( -1 ) ); 740 remoteMod = ( lastSync.addDays( -1 ) );
741 } else { 741 } else {
742 //qDebug(" not loc changed "); 742 //qDebug(" not loc changed ");
743 lastSync = localMod.addDays( 1 ); 743 lastSync = localMod.addDays( 1 );
744 if ( remCh ) 744 if ( remCh )
745 remoteMod =( lastSync.addDays( 1 ) ); 745 remoteMod =( lastSync.addDays( 1 ) );
746 746
747 } 747 }
748 } 748 }
749 full = true; 749 full = true;
750 if ( mode < SYNC_PREF_ASK ) 750 if ( mode < SYNC_PREF_ASK )
751 mode = SYNC_PREF_ASK; 751 mode = SYNC_PREF_ASK;
752 } else { 752 } else {
753 if ( localMod == remoteMod ) 753 if ( localMod == remoteMod )
754 // if ( local->revision() == remote->revision() ) 754 // if ( local->revision() == remote->revision() )
755 return 0; 755 return 0;
756 756
757 } 757 }
758 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 758 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
759 759
760 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 760 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
761 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 761 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
762 //full = true; //debug only 762 //full = true; //debug only
763 if ( full ) { 763 if ( full ) {
764 bool equ = false; 764 bool equ = false;
765 if ( local->type() == "Event" ) { 765 if ( local->type() == "Event" ) {
766 equ = (*((Event*) local) == *((Event*) remote)); 766 equ = (*((Event*) local) == *((Event*) remote));
767 } 767 }
768 else if ( local->type() =="Todo" ) 768 else if ( local->type() =="Todo" )
769 equ = (*((Todo*) local) == (*(Todo*) remote)); 769 equ = (*((Todo*) local) == (*(Todo*) remote));
770 else if ( local->type() =="Journal" ) 770 else if ( local->type() =="Journal" )
771 equ = (*((Journal*) local) == *((Journal*) remote)); 771 equ = (*((Journal*) local) == *((Journal*) remote));
772 if ( equ ) { 772 if ( equ ) {
773 //qDebug("equal "); 773 //qDebug("equal ");
774 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 774 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
775 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 775 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
776 } 776 }
777 if ( mode < SYNC_PREF_FORCE_LOCAL ) 777 if ( mode < SYNC_PREF_FORCE_LOCAL )
778 return 0; 778 return 0;
779 779
780 }//else //debug only 780 }//else //debug only
781 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 781 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
782 } 782 }
783 int result; 783 int result;
784 bool localIsNew; 784 bool localIsNew;
785 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); 785 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
786 786
787 if ( full && mode < SYNC_PREF_NEWEST ) 787 if ( full && mode < SYNC_PREF_NEWEST )
788 mode = SYNC_PREF_ASK; 788 mode = SYNC_PREF_ASK;
789 789
790 switch( mode ) { 790 switch( mode ) {
791 case SYNC_PREF_LOCAL: 791 case SYNC_PREF_LOCAL:
792 if ( lastSync > remoteMod ) 792 if ( lastSync > remoteMod )
793 return 1; 793 return 1;
794 if ( lastSync > localMod ) 794 if ( lastSync > localMod )
795 return 2; 795 return 2;
796 return 1; 796 return 1;
797 break; 797 break;
798 case SYNC_PREF_REMOTE: 798 case SYNC_PREF_REMOTE:
799 if ( lastSync > remoteMod ) 799 if ( lastSync > remoteMod )
800 return 1; 800 return 1;
801 if ( lastSync > localMod ) 801 if ( lastSync > localMod )
802 return 2; 802 return 2;
803 return 2; 803 return 2;
804 break; 804 break;
805 case SYNC_PREF_NEWEST: 805 case SYNC_PREF_NEWEST:
806 if ( localMod > remoteMod ) 806 if ( localMod > remoteMod )
807 return 1; 807 return 1;
808 else 808 else
809 return 2; 809 return 2;
810 break; 810 break;
811 case SYNC_PREF_ASK: 811 case SYNC_PREF_ASK:
812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
813 if ( lastSync > remoteMod ) 813 if ( lastSync > remoteMod )
814 return 1; 814 return 1;
815 if ( lastSync > localMod ) 815 if ( lastSync > localMod )
816 return 2; 816 return 2;
817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
818 localIsNew = localMod >= remoteMod; 818 localIsNew = localMod >= remoteMod;
819 if ( localIsNew ) 819 if ( localIsNew )
820 getEventViewerDialog()->setColorMode( 1 ); 820 getEventViewerDialog()->setColorMode( 1 );
821 else 821 else
822 getEventViewerDialog()->setColorMode( 2 ); 822 getEventViewerDialog()->setColorMode( 2 );
823 getEventViewerDialog()->setIncidence(local); 823 getEventViewerDialog()->setIncidence(local);
824 if ( localIsNew ) 824 if ( localIsNew )
825 getEventViewerDialog()->setColorMode( 2 ); 825 getEventViewerDialog()->setColorMode( 2 );
826 else 826 else
827 getEventViewerDialog()->setColorMode( 1 ); 827 getEventViewerDialog()->setColorMode( 1 );
828 getEventViewerDialog()->addIncidence(remote); 828 getEventViewerDialog()->addIncidence(remote);
829 getEventViewerDialog()->setColorMode( 0 ); 829 getEventViewerDialog()->setColorMode( 0 );
830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
832 getEventViewerDialog()->showMe(); 832 getEventViewerDialog()->showMe();
833 result = getEventViewerDialog()->executeS( localIsNew ); 833 result = getEventViewerDialog()->executeS( localIsNew );
834 return result; 834 return result;
835 835
836 break; 836 break;
837 case SYNC_PREF_FORCE_LOCAL: 837 case SYNC_PREF_FORCE_LOCAL:
838 return 1; 838 return 1;
839 break; 839 break;
840 case SYNC_PREF_FORCE_REMOTE: 840 case SYNC_PREF_FORCE_REMOTE:
841 return 2; 841 return 2;
842 break; 842 break;
843 843
844 default: 844 default:
845 // SYNC_PREF_TAKE_BOTH not implemented 845 // SYNC_PREF_TAKE_BOTH not implemented
846 break; 846 break;
847 } 847 }
848 return 0; 848 return 0;
849} 849}
850Event* CalendarView::getLastSyncEvent() 850Event* CalendarView::getLastSyncEvent()
851{ 851{
852 Event* lse; 852 Event* lse;
853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
854 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 854 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
855 if (!lse) { 855 if (!lse) {
856 lse = new Event(); 856 lse = new Event();
857 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 857 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
858 QString sum = ""; 858 QString sum = "";
859 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 859 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
860 sum = "E: "; 860 sum = "E: ";
861 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 861 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
862 lse->setDtStart( mLastCalendarSync ); 862 lse->setDtStart( mLastCalendarSync );
863 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 863 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
864 lse->setCategories( i18n("SyncEvent") ); 864 lse->setCategories( i18n("SyncEvent") );
865 lse->setReadOnly( true ); 865 lse->setReadOnly( true );
866 mCalendar->addEvent( lse ); 866 mCalendar->addEvent( lse );
867 } 867 }
868 868
869 return lse; 869 return lse;
870 870
871} 871}
872 872
873// we check, if the to delete event has a id for a profile 873// we check, if the to delete event has a id for a profile
874// if yes, we set this id in the profile to delete 874// if yes, we set this id in the profile to delete
875void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 875void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
876{ 876{
877 if ( lastSync.count() == 0 ) { 877 if ( lastSync.count() == 0 ) {
878 //qDebug(" lastSync.count() == 0"); 878 //qDebug(" lastSync.count() == 0");
879 return; 879 return;
880 } 880 }
881 if ( toDelete->type() == "Journal" ) 881 if ( toDelete->type() == "Journal" )
882 return; 882 return;
883 883
884 Event* eve = lastSync.first(); 884 Event* eve = lastSync.first();
885 885
886 while ( eve ) { 886 while ( eve ) {
887 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 887 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
888 if ( !id.isEmpty() ) { 888 if ( !id.isEmpty() ) {
889 QString des = eve->description(); 889 QString des = eve->description();
890 QString pref = "e"; 890 QString pref = "e";
891 if ( toDelete->type() == "Todo" ) 891 if ( toDelete->type() == "Todo" )
892 pref = "t"; 892 pref = "t";
893 des += pref+ id + ","; 893 des += pref+ id + ",";
894 eve->setReadOnly( false ); 894 eve->setReadOnly( false );
895 eve->setDescription( des ); 895 eve->setDescription( des );
896 //qDebug("setdes %s ", des.latin1()); 896 //qDebug("setdes %s ", des.latin1());
897 eve->setReadOnly( true ); 897 eve->setReadOnly( true );
898 } 898 }
899 eve = lastSync.next(); 899 eve = lastSync.next();
900 } 900 }
901 901
902} 902}
903void CalendarView::checkExternalId( Incidence * inc ) 903void CalendarView::checkExternalId( Incidence * inc )
904{ 904{
905 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 905 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
906 checkExternSyncEvent( lastSync, inc ); 906 checkExternSyncEvent( lastSync, inc );
907 907
908} 908}
909bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 909bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
910{ 910{
911 bool syncOK = true; 911 bool syncOK = true;
912 int addedEvent = 0; 912 int addedEvent = 0;
913 int addedEventR = 0; 913 int addedEventR = 0;
914 int deletedEventR = 0; 914 int deletedEventR = 0;
915 int deletedEventL = 0; 915 int deletedEventL = 0;
916 int changedLocal = 0; 916 int changedLocal = 0;
917 int changedRemote = 0; 917 int changedRemote = 0;
918 //QPtrList<Event> el = local->rawEvents(); 918 //QPtrList<Event> el = local->rawEvents();
919 Event* eventR; 919 Event* eventR;
920 QString uid; 920 QString uid;
921 int take; 921 int take;
922 Event* eventL; 922 Event* eventL;
923 Event* eventRSync; 923 Event* eventRSync;
924 Event* eventLSync; 924 Event* eventLSync;
925 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 925 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
926 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 926 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
927 bool fullDateRange = false; 927 bool fullDateRange = false;
928 local->resetTempSyncStat(); 928 local->resetTempSyncStat();
929 mLastCalendarSync = QDateTime::currentDateTime(); 929 mLastCalendarSync = QDateTime::currentDateTime();
930 if ( mSyncManager->syncWithDesktop() ) { 930 if ( mSyncManager->syncWithDesktop() ) {
931 remote->resetPilotStat(1); 931 remote->resetPilotStat(1);
932 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 932 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
933 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 933 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
934 qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 934 qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
935 } else { 935 } else {
936 qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime "); 936 qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime ");
937 } 937 }
938 } 938 }
939 QDateTime modifiedCalendar = mLastCalendarSync;; 939 QDateTime modifiedCalendar = mLastCalendarSync;;
940 eventLSync = getLastSyncEvent(); 940 eventLSync = getLastSyncEvent();
941 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 941 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
942 if ( eventR ) { 942 if ( eventR ) {
943 eventRSync = (Event*) eventR->clone(); 943 eventRSync = (Event*) eventR->clone();
944 remote->deleteEvent(eventR ); 944 remote->deleteEvent(eventR );
945 945
946 } else { 946 } else {
947 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 947 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
948 eventRSync = (Event*)eventLSync->clone(); 948 eventRSync = (Event*)eventLSync->clone();
949 } else { 949 } else {
950 fullDateRange = true; 950 fullDateRange = true;
951 eventRSync = new Event(); 951 eventRSync = new Event();
952 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 952 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
953 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 953 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
954 eventRSync->setDtStart( mLastCalendarSync ); 954 eventRSync->setDtStart( mLastCalendarSync );
955 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 955 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
956 eventRSync->setCategories( i18n("SyncEvent") ); 956 eventRSync->setCategories( i18n("SyncEvent") );
957 } 957 }
958 } 958 }
959 if ( eventLSync->dtStart() == mLastCalendarSync ) 959 if ( eventLSync->dtStart() == mLastCalendarSync )
960 fullDateRange = true; 960 fullDateRange = true;
961 961
962 if ( ! fullDateRange ) { 962 if ( ! fullDateRange ) {
963 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 963 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
964 964
965 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 965 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
966 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 966 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
967 fullDateRange = true; 967 fullDateRange = true;
968 } 968 }
969 } 969 }
970 if ( mSyncManager->syncWithDesktop() ) { 970 if ( mSyncManager->syncWithDesktop() ) {
971 fullDateRange = ( eventLSync->dtStart() == mLastCalendarSync ); 971 fullDateRange = ( eventLSync->dtStart() == mLastCalendarSync );
972 } 972 }
973 if ( fullDateRange ) 973 if ( fullDateRange )
974 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 974 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
975 else 975 else
976 mLastCalendarSync = eventLSync->dtStart(); 976 mLastCalendarSync = eventLSync->dtStart();
977 // for resyncing if own file has changed 977 // for resyncing if own file has changed
978 if ( mCurrentSyncDevice == "deleteaftersync" ) { 978 if ( mCurrentSyncDevice == "deleteaftersync" ) {
979 mLastCalendarSync = loadedFileVersion; 979 mLastCalendarSync = loadedFileVersion;
980 //qDebug("setting mLastCalendarSync "); 980 //qDebug("setting mLastCalendarSync ");
981 } 981 }
982 //qDebug("*************************** "); 982 //qDebug("*************************** ");
983 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 983 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
984 QPtrList<Incidence> er = remote->rawIncidences(); 984 QPtrList<Incidence> er = remote->rawIncidences();
985 Incidence* inR = er.first(); 985 Incidence* inR = er.first();
986 Incidence* inL; 986 Incidence* inL;
987 QProgressBar bar( er.count(),0 ); 987 QProgressBar bar( er.count(),0 );
988 bar.setCaption (i18n("Syncing - close to abort!") ); 988 bar.setCaption (i18n("Syncing - close to abort!") );
989 989
990 int w = 300; 990 int w = 300;
991 if ( QApplication::desktop()->width() < 320 ) 991 if ( QApplication::desktop()->width() < 320 )
992 w = 220; 992 w = 220;
993 int h = bar.sizeHint().height() ; 993 int h = bar.sizeHint().height() ;
994 int dw = QApplication::desktop()->width(); 994 int dw = QApplication::desktop()->width();
995 int dh = QApplication::desktop()->height(); 995 int dh = QApplication::desktop()->height();
996 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 996 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
997 bar.show(); 997 bar.show();
998 int modulo = (er.count()/10)+1; 998 int modulo = (er.count()/10)+1;
999 int incCounter = 0; 999 int incCounter = 0;
1000 while ( inR ) { 1000 while ( inR ) {
1001 if ( ! bar.isVisible() ) 1001 if ( ! bar.isVisible() )
1002 return false; 1002 return false;
1003 if ( incCounter % modulo == 0 ) 1003 if ( incCounter % modulo == 0 )
1004 bar.setProgress( incCounter ); 1004 bar.setProgress( incCounter );
1005 ++incCounter; 1005 ++incCounter;
1006 uid = inR->uid(); 1006 uid = inR->uid();
1007 bool skipIncidence = false; 1007 bool skipIncidence = false;
1008 if ( uid.left(15) == QString("last-syncEvent-") ) 1008 if ( uid.left(15) == QString("last-syncEvent-") )
1009 skipIncidence = true; 1009 skipIncidence = true;
1010 QString idS; 1010 QString idS;
1011 qApp->processEvents(); 1011 qApp->processEvents();
1012 if ( !skipIncidence ) { 1012 if ( !skipIncidence ) {
1013 inL = local->incidence( uid ); 1013 inL = local->incidence( uid );
1014 if ( inL ) { // maybe conflict - same uid in both calendars 1014 if ( inL ) { // maybe conflict - same uid in both calendars
1015 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1015 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1016 //qDebug("take %d %s ", take, inL->summary().latin1()); 1016 //qDebug("take %d %s ", take, inL->summary().latin1());
1017 if ( take == 3 ) 1017 if ( take == 3 )
1018 return false; 1018 return false;
1019 if ( take == 1 ) {// take local 1019 if ( take == 1 ) {// take local
1020 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1020 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1021 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1021 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1022 else 1022 else
1023 idS = inR->IDStr(); 1023 idS = inR->IDStr();
1024 remote->deleteIncidence( inR ); 1024 remote->deleteIncidence( inR );
1025 inR = inL->clone(); 1025 inR = inL->clone();
1026 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1026 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1027 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1027 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1028 inR->setIDStr( idS ); 1028 inR->setIDStr( idS );
1029 remote->addIncidence( inR ); 1029 remote->addIncidence( inR );
1030 if ( mSyncManager->syncWithDesktop() ) 1030 if ( mSyncManager->syncWithDesktop() )
1031 inR->setPilotId( 2 ); 1031 inR->setPilotId( 2 );
1032 ++changedRemote; 1032 ++changedRemote;
1033 } else { 1033 } else {
1034 idS = inL->IDStr(); 1034 idS = inL->IDStr();
1035 int pid = inL->pilotId(); 1035 int pid = inL->pilotId();
1036 local->deleteIncidence( inL ); 1036 local->deleteIncidence( inL );
1037 inL = inR->clone(); 1037 inL = inR->clone();
1038 if ( mSyncManager->syncWithDesktop() ) 1038 if ( mSyncManager->syncWithDesktop() )
1039 inL->setPilotId( pid ); 1039 inL->setPilotId( pid );
1040 inL->setIDStr( idS ); 1040 inL->setIDStr( idS );
1041 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1041 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1042 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1042 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1043 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1043 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1044 } 1044 }
1045 local->addIncidence( inL ); 1045 local->addIncidence( inL );
1046 ++changedLocal; 1046 ++changedLocal;
1047 } 1047 }
1048 } 1048 }
1049 } else { // no conflict 1049 } else { // no conflict
1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1051 QString des = eventLSync->description(); 1051 QString des = eventLSync->description();
1052 QString pref = "e"; 1052 QString pref = "e";
1053 if ( inR->type() == "Todo" ) 1053 if ( inR->type() == "Todo" )
1054 pref = "t"; 1054 pref = "t";
1055 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1055 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1056 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1056 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1057 //remote->deleteIncidence( inR ); 1057 //remote->deleteIncidence( inR );
1058 ++deletedEventR; 1058 ++deletedEventR;
1059 } else { 1059 } else {
1060 inR->setLastModified( modifiedCalendar ); 1060 inR->setLastModified( modifiedCalendar );
1061 inL = inR->clone(); 1061 inL = inR->clone();
1062 inL->setIDStr( ":" ); 1062 inL->setIDStr( ":" );
1063 local->addIncidence( inL ); 1063 local->addIncidence( inL );
1064 ++addedEvent; 1064 ++addedEvent;
1065 } 1065 }
1066 } else { 1066 } else {
1067 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1067 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1068 inR->setLastModified( modifiedCalendar ); 1068 inR->setLastModified( modifiedCalendar );
1069 inL = inR->clone(); 1069 inL = inR->clone();
1070 inL->setIDStr( ":" ); 1070 inL->setIDStr( ":" );
1071 local->addIncidence( inL ); 1071 local->addIncidence( inL );
1072 ++addedEvent; 1072 ++addedEvent;
1073 } else { 1073 } else {
1074 checkExternSyncEvent(eventRSyncSharp, inR); 1074 checkExternSyncEvent(eventRSyncSharp, inR);
1075 remote->deleteIncidence( inR ); 1075 remote->deleteIncidence( inR );
1076 ++deletedEventR; 1076 ++deletedEventR;
1077 } 1077 }
1078 } 1078 }
1079 } 1079 }
1080 } 1080 }
1081 inR = er.next(); 1081 inR = er.next();
1082 } 1082 }
1083 QPtrList<Incidence> el = local->rawIncidences(); 1083 QPtrList<Incidence> el = local->rawIncidences();
1084 inL = el.first(); 1084 inL = el.first();
1085 modulo = (el.count()/10)+1; 1085 modulo = (el.count()/10)+1;
1086 bar.setCaption (i18n("Add / remove events") ); 1086 bar.setCaption (i18n("Add / remove events") );
1087 bar.setTotalSteps ( el.count() ) ; 1087 bar.setTotalSteps ( el.count() ) ;
1088 bar.show(); 1088 bar.show();
1089 incCounter = 0; 1089 incCounter = 0;
1090 1090
1091 while ( inL ) { 1091 while ( inL ) {
1092 1092
1093 qApp->processEvents(); 1093 qApp->processEvents();
1094 if ( ! bar.isVisible() ) 1094 if ( ! bar.isVisible() )
1095 return false; 1095 return false;
1096 if ( incCounter % modulo == 0 ) 1096 if ( incCounter % modulo == 0 )
1097 bar.setProgress( incCounter ); 1097 bar.setProgress( incCounter );
1098 ++incCounter; 1098 ++incCounter;
1099 uid = inL->uid(); 1099 uid = inL->uid();
1100 bool skipIncidence = false; 1100 bool skipIncidence = false;
1101 if ( uid.left(15) == QString("last-syncEvent-") ) 1101 if ( uid.left(15) == QString("last-syncEvent-") )
1102 skipIncidence = true; 1102 skipIncidence = true;
1103 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1103 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1104 skipIncidence = true; 1104 skipIncidence = true;
1105 if ( !skipIncidence ) { 1105 if ( !skipIncidence ) {
1106 inR = remote->incidence( uid ); 1106 inR = remote->incidence( uid );
1107 if ( ! inR ) { 1107 if ( ! inR ) {
1108 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1108 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1109 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1109 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1110 checkExternSyncEvent(eventLSyncSharp, inL); 1110 checkExternSyncEvent(eventLSyncSharp, inL);
1111 local->deleteIncidence( inL ); 1111 local->deleteIncidence( inL );
1112 ++deletedEventL; 1112 ++deletedEventL;
1113 } else { 1113 } else {
1114 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1114 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1115 inL->removeID(mCurrentSyncDevice ); 1115 inL->removeID(mCurrentSyncDevice );
1116 ++addedEventR; 1116 ++addedEventR;
1117 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1117 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1118 inL->setLastModified( modifiedCalendar ); 1118 inL->setLastModified( modifiedCalendar );
1119 inR = inL->clone(); 1119 inR = inL->clone();
1120 inR->setIDStr( ":" ); 1120 inR->setIDStr( ":" );
1121 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1121 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1122 remote->addIncidence( inR ); 1122 remote->addIncidence( inR );
1123 } 1123 }
1124 } 1124 }
1125 } else { 1125 } else {
1126 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1126 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1127 checkExternSyncEvent(eventLSyncSharp, inL); 1127 checkExternSyncEvent(eventLSyncSharp, inL);
1128 local->deleteIncidence( inL ); 1128 local->deleteIncidence( inL );
1129 ++deletedEventL; 1129 ++deletedEventL;
1130 } else { 1130 } else {
1131 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1131 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1132 ++addedEventR; 1132 ++addedEventR;
1133 inL->setLastModified( modifiedCalendar ); 1133 inL->setLastModified( modifiedCalendar );
1134 inR = inL->clone(); 1134 inR = inL->clone();
1135 inR->setIDStr( ":" ); 1135 inR->setIDStr( ":" );
1136 remote->addIncidence( inR ); 1136 remote->addIncidence( inR );
1137 } 1137 }
1138 } 1138 }
1139 } 1139 }
1140 } 1140 }
1141 } 1141 }
1142 inL = el.next(); 1142 inL = el.next();
1143 } 1143 }
1144 int delFut = 0; 1144 int delFut = 0;
1145 int remRem = 0; 1145 int remRem = 0;
1146 if ( mSyncManager->mWriteBackInFuture ) { 1146 if ( mSyncManager->mWriteBackInFuture ) {
1147 er = remote->rawIncidences(); 1147 er = remote->rawIncidences();
1148 remRem = er.count(); 1148 remRem = er.count();
1149 inR = er.first(); 1149 inR = er.first();
1150 QDateTime dt; 1150 QDateTime dt;
1151 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1151 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1152 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); 1152 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
1153 while ( inR ) { 1153 while ( inR ) {
1154 if ( inR->type() == "Todo" ) { 1154 if ( inR->type() == "Todo" ) {
1155 Todo * t = (Todo*)inR; 1155 Todo * t = (Todo*)inR;
1156 if ( t->hasDueDate() ) 1156 if ( t->hasDueDate() )
1157 dt = t->dtDue(); 1157 dt = t->dtDue();
1158 else 1158 else
1159 dt = cur.addSecs( 62 ); 1159 dt = cur.addSecs( 62 );
1160 } 1160 }
1161 else if (inR->type() == "Event" ) { 1161 else if (inR->type() == "Event" ) {
1162 bool ok; 1162 bool ok;
1163 dt = inR->getNextOccurence( cur, &ok ); 1163 dt = inR->getNextOccurence( cur, &ok );
1164 if ( !ok ) 1164 if ( !ok )
1165 dt = cur.addSecs( -62 ); 1165 dt = cur.addSecs( -62 );
1166 } 1166 }
1167 else 1167 else
1168 dt = inR->dtStart(); 1168 dt = inR->dtStart();
1169 if ( dt < cur || dt > end ) { 1169 if ( dt < cur || dt > end ) {
1170 remote->deleteIncidence( inR ); 1170 remote->deleteIncidence( inR );
1171 ++delFut; 1171 ++delFut;
1172 } 1172 }
1173 inR = er.next(); 1173 inR = er.next();
1174 } 1174 }
1175 } 1175 }
1176 bar.hide(); 1176 bar.hide();
1177 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1177 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1178 eventLSync->setReadOnly( false ); 1178 eventLSync->setReadOnly( false );
1179 eventLSync->setDtStart( mLastCalendarSync ); 1179 eventLSync->setDtStart( mLastCalendarSync );
1180 eventRSync->setDtStart( mLastCalendarSync ); 1180 eventRSync->setDtStart( mLastCalendarSync );
1181 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1181 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1182 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1182 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1183 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1183 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1184 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1184 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1185 eventLSync->setReadOnly( true ); 1185 eventLSync->setReadOnly( true );
1186 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1186 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1187 remote->addEvent( eventRSync ); 1187 remote->addEvent( eventRSync );
1188 else 1188 else
1189 delete eventRSync; 1189 delete eventRSync;
1190 QString mes; 1190 QString mes;
1191 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 ); 1191 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 );
1192 QString delmess; 1192 QString delmess;
1193 if ( delFut ) { 1193 if ( delFut ) {
1194 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1194 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1195 mes += delmess; 1195 mes += delmess;
1196 } 1196 }
1197 mCalendar->checkAlarmForIncidence( 0, true );
1198 qDebug( mes );
1197 if ( mSyncManager->mShowSyncSummary ) { 1199 if ( mSyncManager->mShowSyncSummary ) {
1198 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1200 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1201 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1202 qDebug("cancelled ");
1203 return false;
1204 }
1199 } 1205 }
1200 qDebug( mes );
1201 mCalendar->checkAlarmForIncidence( 0, true );
1202 return syncOK; 1206 return syncOK;
1203} 1207}
1204 1208
1205void CalendarView::setSyncDevice( QString s ) 1209void CalendarView::setSyncDevice( QString s )
1206{ 1210{
1207 mCurrentSyncDevice= s; 1211 mCurrentSyncDevice= s;
1208} 1212}
1209void CalendarView::setSyncName( QString s ) 1213void CalendarView::setSyncName( QString s )
1210{ 1214{
1211 mCurrentSyncName= s; 1215 mCurrentSyncName= s;
1212} 1216}
1213bool CalendarView::syncCalendar(QString filename, int mode) 1217bool CalendarView::syncCalendar(QString filename, int mode)
1214{ 1218{
1215 //qDebug("syncCalendar %s ", filename.latin1()); 1219 //qDebug("syncCalendar %s ", filename.latin1());
1216 mGlobalSyncMode = SYNC_MODE_NORMAL; 1220 mGlobalSyncMode = SYNC_MODE_NORMAL;
1217 CalendarLocal* calendar = new CalendarLocal(); 1221 CalendarLocal* calendar = new CalendarLocal();
1218 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1222 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1219 FileStorage* storage = new FileStorage( calendar ); 1223 FileStorage* storage = new FileStorage( calendar );
1220 bool syncOK = false; 1224 bool syncOK = false;
1221 storage->setFileName( filename ); 1225 storage->setFileName( filename );
1222 // qDebug("loading ... "); 1226 // qDebug("loading ... ");
1223 if ( storage->load() ) { 1227 if ( storage->load() ) {
1224 getEventViewerDialog()->setSyncMode( true ); 1228 getEventViewerDialog()->setSyncMode( true );
1225 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1229 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1226 getEventViewerDialog()->setSyncMode( false ); 1230 getEventViewerDialog()->setSyncMode( false );
1227 if ( syncOK ) { 1231 if ( syncOK ) {
1228 if ( mSyncManager->mWriteBackFile ) 1232 if ( mSyncManager->mWriteBackFile )
1229 { 1233 {
1230 storage->setSaveFormat( new ICalFormat() ); 1234 storage->setSaveFormat( new ICalFormat() );
1231 storage->save(); 1235 storage->save();
1232 } 1236 }
1233 } 1237 }
1234 setModified( true ); 1238 setModified( true );
1235 } 1239 }
1236 delete storage; 1240 delete storage;
1237 delete calendar; 1241 delete calendar;
1238 if ( syncOK ) 1242 if ( syncOK )
1239 updateView(); 1243 updateView();
1240 return syncOK; 1244 return syncOK;
1241} 1245}
1242 1246
1243void CalendarView::syncExternal( int mode ) 1247void CalendarView::syncExternal( int mode )
1244{ 1248{
1245 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1249 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1246 1250
1247 qApp->processEvents(); 1251 qApp->processEvents();
1248 CalendarLocal* calendar = new CalendarLocal(); 1252 CalendarLocal* calendar = new CalendarLocal();
1249 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1253 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1250 bool syncOK = false; 1254 bool syncOK = false;
1251 bool loadSuccess = false; 1255 bool loadSuccess = false;
1252 PhoneFormat* phoneFormat = 0; 1256 PhoneFormat* phoneFormat = 0;
1253 emit tempDisableBR(true); 1257 emit tempDisableBR(true);
1254#ifndef DESKTOP_VERSION 1258#ifndef DESKTOP_VERSION
1255 SharpFormat* sharpFormat = 0; 1259 SharpFormat* sharpFormat = 0;
1256 if ( mode == 0 ) { // sharp 1260 if ( mode == 0 ) { // sharp
1257 sharpFormat = new SharpFormat () ; 1261 sharpFormat = new SharpFormat () ;
1258 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1262 loadSuccess = sharpFormat->load( calendar, mCalendar );
1259 1263
1260 } else 1264 } else
1261#endif 1265#endif
1262 if ( mode == 1 ) { // phone 1266 if ( mode == 1 ) { // phone
1263 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1267 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1264 mSyncManager->mPhoneDevice, 1268 mSyncManager->mPhoneDevice,
1265 mSyncManager->mPhoneConnection, 1269 mSyncManager->mPhoneConnection,
1266 mSyncManager->mPhoneModel); 1270 mSyncManager->mPhoneModel);
1267 loadSuccess = phoneFormat->load( calendar,mCalendar); 1271 loadSuccess = phoneFormat->load( calendar,mCalendar);
1268 1272
1269 } else { 1273 } else {
1270 emit tempDisableBR(false); 1274 emit tempDisableBR(false);
1271 return; 1275 return;
1272 } 1276 }
1273 if ( loadSuccess ) { 1277 if ( loadSuccess ) {
1274 getEventViewerDialog()->setSyncMode( true ); 1278 getEventViewerDialog()->setSyncMode( true );
1275 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1279 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1276 getEventViewerDialog()->setSyncMode( false ); 1280 getEventViewerDialog()->setSyncMode( false );
1277 qApp->processEvents(); 1281 qApp->processEvents();
1278 if ( syncOK ) { 1282 if ( syncOK ) {
1279 if ( mSyncManager->mWriteBackFile ) 1283 if ( mSyncManager->mWriteBackFile )
1280 { 1284 {
1281 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1285 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1282 Incidence* inc = iL.first(); 1286 Incidence* inc = iL.first();
1283 if ( phoneFormat ) { 1287 if ( phoneFormat ) {
1284 while ( inc ) { 1288 while ( inc ) {
1285 inc->removeID(mCurrentSyncDevice); 1289 inc->removeID(mCurrentSyncDevice);
1286 inc = iL.next(); 1290 inc = iL.next();
1287 } 1291 }
1288 } 1292 }
1289#ifndef DESKTOP_VERSION 1293#ifndef DESKTOP_VERSION
1290 if ( sharpFormat ) 1294 if ( sharpFormat )
1291 sharpFormat->save(calendar); 1295 sharpFormat->save(calendar);
1292#endif 1296#endif
1293 if ( phoneFormat ) 1297 if ( phoneFormat )
1294 phoneFormat->save(calendar); 1298 phoneFormat->save(calendar);
1295 iL = calendar->rawIncidences(); 1299 iL = calendar->rawIncidences();
1296 inc = iL.first(); 1300 inc = iL.first();
1297 Incidence* loc; 1301 Incidence* loc;
1298 while ( inc ) { 1302 while ( inc ) {
1299 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1303 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1300 loc = mCalendar->incidence(inc->uid() ); 1304 loc = mCalendar->incidence(inc->uid() );
1301 if ( loc ) { 1305 if ( loc ) {
1302 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1306 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1303 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1307 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1304 } 1308 }
1305 } 1309 }
1306 inc = iL.next(); 1310 inc = iL.next();
1307 } 1311 }
1308 Incidence* lse = getLastSyncEvent(); 1312 Incidence* lse = getLastSyncEvent();
1309 if ( lse ) { 1313 if ( lse ) {
1310 lse->setReadOnly( false ); 1314 lse->setReadOnly( false );
1311 lse->setDescription( "" ); 1315 lse->setDescription( "" );
1312 lse->setReadOnly( true ); 1316 lse->setReadOnly( true );
1313 } 1317 }
1314 } 1318 }
1319 } else {
1320 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1315 } 1321 }
1316 setModified( true ); 1322 setModified( true );
1317 } else { 1323 } else {
1318 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1324 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1319 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1325 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1320 question, i18n("Ok")) ; 1326 question, i18n("Ok")) ;
1321 1327
1322 } 1328 }
1323 delete calendar; 1329 delete calendar;
1324 updateView(); 1330 updateView();
1325 emit tempDisableBR(false); 1331 emit tempDisableBR(false);
1326 return ;//syncOK; 1332 return ;//syncOK;
1327 1333
1328} 1334}
1329 1335
1330bool CalendarView::importBday() 1336bool CalendarView::importBday()
1331{ 1337{
1332#ifndef KORG_NOKABC 1338#ifndef KORG_NOKABC
1333 1339
1334#ifdef DESKTOP_VERSION 1340#ifdef DESKTOP_VERSION
1335 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1341 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1336 KABC::AddressBook::Iterator it; 1342 KABC::AddressBook::Iterator it;
1337 int count = 0; 1343 int count = 0;
1338 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1344 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1339 ++count; 1345 ++count;
1340 } 1346 }
1341 QProgressBar bar(count,0 ); 1347 QProgressBar bar(count,0 );
1342 int w = 300; 1348 int w = 300;
1343 if ( QApplication::desktop()->width() < 320 ) 1349 if ( QApplication::desktop()->width() < 320 )
1344 w = 220; 1350 w = 220;
1345 int h = bar.sizeHint().height() ; 1351 int h = bar.sizeHint().height() ;
1346 int dw = QApplication::desktop()->width(); 1352 int dw = QApplication::desktop()->width();
1347 int dh = QApplication::desktop()->height(); 1353 int dh = QApplication::desktop()->height();
1348 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1354 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1349 bar.show(); 1355 bar.show();
1350 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1356 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1351 qApp->processEvents(); 1357 qApp->processEvents();
1352 count = 0; 1358 count = 0;
1353 int addCount = 0; 1359 int addCount = 0;
1354 KCal::Attendee* a = 0; 1360 KCal::Attendee* a = 0;
1355 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1361 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1356 if ( ! bar.isVisible() ) 1362 if ( ! bar.isVisible() )
1357 return false; 1363 return false;
1358 bar.setProgress( count++ ); 1364 bar.setProgress( count++ );
1359 qApp->processEvents(); 1365 qApp->processEvents();
1360 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1366 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1361 if ( (*it).birthday().date().isValid() ){ 1367 if ( (*it).birthday().date().isValid() ){
1362 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1368 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1363 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1369 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1364 ++addCount; 1370 ++addCount;
1365 } 1371 }
1366 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1372 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1367 if ( anni.isValid() ){ 1373 if ( anni.isValid() ){
1368 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1374 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1369 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1375 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1370 ++addCount; 1376 ++addCount;
1371 } 1377 }
1372 } 1378 }
1373 updateView(); 1379 updateView();
1374 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1380 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1375#else //DESKTOP_VERSION 1381#else //DESKTOP_VERSION
1376 1382
1377 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1383 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1378 // the result should now arrive through method insertBirthdays 1384 // the result should now arrive through method insertBirthdays
1379 1385
1380#endif //DESKTOP_VERSION 1386#endif //DESKTOP_VERSION
1381 1387
1382#endif //KORG_NOKABC 1388#endif //KORG_NOKABC
1383 1389
1384 1390
1385 return true; 1391 return true;
1386} 1392}
1387 1393
1388// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1394// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1389void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1395void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1390 const QStringList& anniversaryList, const QStringList& realNameList, 1396 const QStringList& anniversaryList, const QStringList& realNameList,
1391 const QStringList& emailList, const QStringList& assembledNameList, 1397 const QStringList& emailList, const QStringList& assembledNameList,
1392 const QStringList& uidList) 1398 const QStringList& uidList)
1393{ 1399{
1394 qDebug("CalendarView::insertBirthdays"); 1400 qDebug("CalendarView::insertBirthdays");
1395 if (uid == this->name()) 1401 if (uid == this->name())
1396 { 1402 {
1397 int count = birthdayList.count(); 1403 int count = birthdayList.count();
1398 int addCount = 0; 1404 int addCount = 0;
1399 KCal::Attendee* a = 0; 1405 KCal::Attendee* a = 0;
1400 1406
1401 qDebug("CalView 1 %i", count); 1407 qDebug("CalView 1 %i", count);
1402 1408
1403 QProgressBar bar(count,0 ); 1409 QProgressBar bar(count,0 );
1404 int w = 300; 1410 int w = 300;
1405 if ( QApplication::desktop()->width() < 320 ) 1411 if ( QApplication::desktop()->width() < 320 )
1406 w = 220; 1412 w = 220;
1407 int h = bar.sizeHint().height() ; 1413 int h = bar.sizeHint().height() ;
1408 int dw = QApplication::desktop()->width(); 1414 int dw = QApplication::desktop()->width();
1409 int dh = QApplication::desktop()->height(); 1415 int dh = QApplication::desktop()->height();
1410 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1416 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1411 bar.show(); 1417 bar.show();
1412 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1418 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1413 qApp->processEvents(); 1419 qApp->processEvents();
1414 1420
1415 QDate birthday; 1421 QDate birthday;
1416 QDate anniversary; 1422 QDate anniversary;
1417 QString realName; 1423 QString realName;
1418 QString email; 1424 QString email;
1419 QString assembledName; 1425 QString assembledName;
1420 QString uid; 1426 QString uid;
1421 bool ok = true; 1427 bool ok = true;
1422 for ( int i = 0; i < count; i++) 1428 for ( int i = 0; i < count; i++)
1423 { 1429 {
1424 if ( ! bar.isVisible() ) 1430 if ( ! bar.isVisible() )
1425 return; 1431 return;
1426 bar.setProgress( i ); 1432 bar.setProgress( i );
1427 qApp->processEvents(); 1433 qApp->processEvents();
1428 1434
1429 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1435 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1430 if (!ok) { 1436 if (!ok) {
1431 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1437 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1432 } 1438 }
1433 1439
1434 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1440 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1435 if (!ok) { 1441 if (!ok) {
1436 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1442 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1437 } 1443 }
1438 realName = realNameList[i]; 1444 realName = realNameList[i];
1439 email = emailList[i]; 1445 email = emailList[i];
1440 assembledName = assembledNameList[i]; 1446 assembledName = assembledNameList[i];
1441 uid = uidList[i]; 1447 uid = uidList[i];
1442 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); 1448 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() );
1443 1449
1444 if ( birthday.isValid() ){ 1450 if ( birthday.isValid() ){
1445 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1451 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1446 KCal::Attendee::ReqParticipant,uid) ; 1452 KCal::Attendee::ReqParticipant,uid) ;
1447 if ( addAnniversary( birthday, assembledName, a, true ) ) 1453 if ( addAnniversary( birthday, assembledName, a, true ) )
1448 ++addCount; 1454 ++addCount;
1449 } 1455 }
1450 1456
1451 if ( anniversary.isValid() ){ 1457 if ( anniversary.isValid() ){
1452 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1458 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1453 KCal::Attendee::ReqParticipant,uid) ; 1459 KCal::Attendee::ReqParticipant,uid) ;
1454 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1460 if ( addAnniversary( anniversary, assembledName, a, false ) )
1455 ++addCount; 1461 ++addCount;
1456 } 1462 }
1457 } 1463 }
1458 1464
1459 updateView(); 1465 updateView();
1460 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1466 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1461 1467
1462 } 1468 }
1463 1469
1464} 1470}
1465 1471
1466 1472
1467 1473
1468bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1474bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1469{ 1475{
1470 //qDebug("addAnni "); 1476 //qDebug("addAnni ");
1471 Event * ev = new Event(); 1477 Event * ev = new Event();
1472 if ( a ) { 1478 if ( a ) {
1473 ev->addAttendee( a ); 1479 ev->addAttendee( a );
1474 } 1480 }
1475 QString kind; 1481 QString kind;
1476 if ( birthday ) 1482 if ( birthday )
1477 kind = i18n( "Birthday" ); 1483 kind = i18n( "Birthday" );
1478 else 1484 else
1479 kind = i18n( "Anniversary" ); 1485 kind = i18n( "Anniversary" );
1480 ev->setSummary( name + " - " + kind ); 1486 ev->setSummary( name + " - " + kind );
1481 ev->setOrganizer(a->email()); 1487 ev->setOrganizer(a->email());
1482 ev->setCategories( kind ); 1488 ev->setCategories( kind );
1483 ev->setDtStart( QDateTime(date) ); 1489 ev->setDtStart( QDateTime(date) );
1484 ev->setDtEnd( QDateTime(date) ); 1490 ev->setDtEnd( QDateTime(date) );
1485 ev->setFloats( true ); 1491 ev->setFloats( true );
1486 Recurrence * rec = ev->recurrence(); 1492 Recurrence * rec = ev->recurrence();
1487 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1493 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1488 rec->addYearlyNum( date.month() ); 1494 rec->addYearlyNum( date.month() );
1489 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1495 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1490 delete ev; 1496 delete ev;
1491 return false; 1497 return false;
1492 } 1498 }
1493 return true; 1499 return true;
1494 1500
1495} 1501}
1496bool CalendarView::importQtopia( const QString &categories, 1502bool CalendarView::importQtopia( const QString &categories,
1497 const QString &datebook, 1503 const QString &datebook,
1498 const QString &todolist ) 1504 const QString &todolist )
1499{ 1505{
1500 1506
1501 QtopiaFormat qtopiaFormat; 1507 QtopiaFormat qtopiaFormat;
1502 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1508 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1503 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1509 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1504 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1510 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1505 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1511 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1506 1512
1507 updateView(); 1513 updateView();
1508 return true; 1514 return true;
1509 1515
1510#if 0 1516#if 0
1511 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1517 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1512 mCurrentSyncDevice = "qtopia-XML"; 1518 mCurrentSyncDevice = "qtopia-XML";
1513 if ( mSyncManager->mAskForPreferences ) 1519 if ( mSyncManager->mAskForPreferences )
1514 edit_sync_options(); 1520 edit_sync_options();
1515 qApp->processEvents(); 1521 qApp->processEvents();
1516 CalendarLocal* calendar = new CalendarLocal(); 1522 CalendarLocal* calendar = new CalendarLocal();
1517 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1523 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1518 bool syncOK = false; 1524 bool syncOK = false;
1519 QtopiaFormat qtopiaFormat; 1525 QtopiaFormat qtopiaFormat;
1520 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1526 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1521 bool loadOk = true; 1527 bool loadOk = true;
1522 if ( !categories.isEmpty() ) 1528 if ( !categories.isEmpty() )
1523 loadOk = qtopiaFormat.load( calendar, categories ); 1529 loadOk = qtopiaFormat.load( calendar, categories );
1524 if ( loadOk && !datebook.isEmpty() ) 1530 if ( loadOk && !datebook.isEmpty() )
1525 loadOk = qtopiaFormat.load( calendar, datebook ); 1531 loadOk = qtopiaFormat.load( calendar, datebook );
1526 if ( loadOk && !todolist.isEmpty() ) 1532 if ( loadOk && !todolist.isEmpty() )
1527 loadOk = qtopiaFormat.load( calendar, todolist ); 1533 loadOk = qtopiaFormat.load( calendar, todolist );
1528 1534
1529 if ( loadOk ) { 1535 if ( loadOk ) {
1530 getEventViewerDialog()->setSyncMode( true ); 1536 getEventViewerDialog()->setSyncMode( true );
1531 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1537 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1532 getEventViewerDialog()->setSyncMode( false ); 1538 getEventViewerDialog()->setSyncMode( false );
1533 qApp->processEvents(); 1539 qApp->processEvents();
1534 if ( syncOK ) { 1540 if ( syncOK ) {
1535 if ( mSyncManager->mWriteBackFile ) 1541 if ( mSyncManager->mWriteBackFile )
1536 { 1542 {
1537 // write back XML file 1543 // write back XML file
1538 1544
1539 } 1545 }
1540 setModified( true ); 1546 setModified( true );
1541 } 1547 }
1542 } else { 1548 } else {
1543 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1549 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1544 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1550 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1545 question, i18n("Ok")) ; 1551 question, i18n("Ok")) ;
1546 } 1552 }
1547 delete calendar; 1553 delete calendar;
1548 updateView(); 1554 updateView();
1549 return syncOK; 1555 return syncOK;
1550 1556
1551 1557
1552#endif 1558#endif
1553 1559
1554} 1560}
1555 1561
1556void CalendarView::setSyncEventsReadOnly() 1562void CalendarView::setSyncEventsReadOnly()
1557{ 1563{
1558 Event * ev; 1564 Event * ev;
1559 QPtrList<Event> eL = mCalendar->rawEvents(); 1565 QPtrList<Event> eL = mCalendar->rawEvents();
1560 ev = eL.first(); 1566 ev = eL.first();
1561 while ( ev ) { 1567 while ( ev ) {
1562 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1568 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1563 ev->setReadOnly( true ); 1569 ev->setReadOnly( true );
1564 ev = eL.next(); 1570 ev = eL.next();
1565 } 1571 }
1566} 1572}
1567bool CalendarView::openCalendar(QString filename, bool merge) 1573bool CalendarView::openCalendar(QString filename, bool merge)
1568{ 1574{
1569 1575
1570 if (filename.isEmpty()) { 1576 if (filename.isEmpty()) {
1571 return false; 1577 return false;
1572 } 1578 }
1573 1579
1574 if (!QFile::exists(filename)) { 1580 if (!QFile::exists(filename)) {
1575 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1581 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1576 return false; 1582 return false;
1577 } 1583 }
1578 1584
1579 globalFlagBlockAgenda = 1; 1585 globalFlagBlockAgenda = 1;
1580 if (!merge) mCalendar->close(); 1586 if (!merge) mCalendar->close();
1581 1587
1582 mStorage->setFileName( filename ); 1588 mStorage->setFileName( filename );
1583 1589
1584 if ( mStorage->load() ) { 1590 if ( mStorage->load() ) {
1585 if ( merge ) ;//setModified( true ); 1591 if ( merge ) ;//setModified( true );
1586 else { 1592 else {
1587 //setModified( true ); 1593 //setModified( true );
1588 mViewManager->setDocumentId( filename ); 1594 mViewManager->setDocumentId( filename );
1589 mDialogManager->setDocumentId( filename ); 1595 mDialogManager->setDocumentId( filename );
1590 mTodoList->setDocumentId( filename ); 1596 mTodoList->setDocumentId( filename );
1591 } 1597 }
1592 globalFlagBlockAgenda = 2; 1598 globalFlagBlockAgenda = 2;
1593 // if ( getLastSyncEvent() ) 1599 // if ( getLastSyncEvent() )
1594 // getLastSyncEvent()->setReadOnly( true ); 1600 // getLastSyncEvent()->setReadOnly( true );
1595 mCalendar->reInitAlarmSettings(); 1601 mCalendar->reInitAlarmSettings();
1596 setSyncEventsReadOnly(); 1602 setSyncEventsReadOnly();
1597 updateUnmanagedViews(); 1603 updateUnmanagedViews();
1598 updateView(); 1604 updateView();
1599 if ( filename != MainWindow::defaultFileName() ) { 1605 if ( filename != MainWindow::defaultFileName() ) {
1600 saveCalendar( MainWindow::defaultFileName() ); 1606 saveCalendar( MainWindow::defaultFileName() );
1601 } else { 1607 } else {
1602 QFileInfo finf ( MainWindow::defaultFileName()); 1608 QFileInfo finf ( MainWindow::defaultFileName());
1603 if ( finf.exists() ) { 1609 if ( finf.exists() ) {
1604 setLoadedFileVersion( finf.lastModified () ); 1610 setLoadedFileVersion( finf.lastModified () );
1605 } 1611 }
1606 } 1612 }
1607 return true; 1613 return true;
1608 } else { 1614 } else {
1609 // while failing to load, the calendar object could 1615 // while failing to load, the calendar object could
1610 // have become partially populated. Clear it out. 1616 // have become partially populated. Clear it out.
1611 if ( !merge ) { 1617 if ( !merge ) {
1612 mCalendar->close(); 1618 mCalendar->close();
1613 mViewManager->setDocumentId( filename ); 1619 mViewManager->setDocumentId( filename );
1614 mDialogManager->setDocumentId( filename ); 1620 mDialogManager->setDocumentId( filename );
1615 mTodoList->setDocumentId( filename ); 1621 mTodoList->setDocumentId( filename );
1616 } 1622 }
1617 1623
1618 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1624 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1619 1625
1620 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 1626 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1621 globalFlagBlockAgenda = 2; 1627 globalFlagBlockAgenda = 2;
1622 mCalendar->reInitAlarmSettings(); 1628 mCalendar->reInitAlarmSettings();
1623 setSyncEventsReadOnly(); 1629 setSyncEventsReadOnly();
1624 updateUnmanagedViews(); 1630 updateUnmanagedViews();
1625 updateView(); 1631 updateView();
1626 } 1632 }
1627 return false; 1633 return false;
1628} 1634}
1629void CalendarView::showOpenError() 1635void CalendarView::showOpenError()
1630{ 1636{
1631 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 1637 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
1632} 1638}
1633void CalendarView::setLoadedFileVersion(QDateTime dt) 1639void CalendarView::setLoadedFileVersion(QDateTime dt)
1634{ 1640{
1635 loadedFileVersion = dt; 1641 loadedFileVersion = dt;
1636} 1642}
1637bool CalendarView::checkFileChanged(QString fn) 1643bool CalendarView::checkFileChanged(QString fn)
1638{ 1644{
1639 QFileInfo finf ( fn ); 1645 QFileInfo finf ( fn );
1640 if ( !finf.exists() ) 1646 if ( !finf.exists() )
1641 return true; 1647 return true;
1642 QDateTime dt = finf.lastModified (); 1648 QDateTime dt = finf.lastModified ();
1643 if ( dt <= loadedFileVersion ) 1649 if ( dt <= loadedFileVersion )
1644 return false; 1650 return false;
1645 return true; 1651 return true;
1646 1652
1647} 1653}
1648void CalendarView::watchSavedFile() 1654void CalendarView::watchSavedFile()
1649{ 1655{
1650 QFileInfo finf ( MainWindow::defaultFileName()); 1656 QFileInfo finf ( MainWindow::defaultFileName());
1651 if ( !finf.exists() ) 1657 if ( !finf.exists() )
1652 return; 1658 return;
1653 QDateTime dt = finf.lastModified (); 1659 QDateTime dt = finf.lastModified ();
1654 if ( dt < loadedFileVersion ) { 1660 if ( dt < loadedFileVersion ) {
1655 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 1661 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
1656 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1662 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1657 return; 1663 return;
1658 } 1664 }
1659 loadedFileVersion = dt; 1665 loadedFileVersion = dt;
1660} 1666}
1661 1667
1662bool CalendarView::checkFileVersion(QString fn) 1668bool CalendarView::checkFileVersion(QString fn)
1663{ 1669{
1664 QFileInfo finf ( fn ); 1670 QFileInfo finf ( fn );
1665 if ( !finf.exists() ) 1671 if ( !finf.exists() )
1666 return true; 1672 return true;
1667 QDateTime dt = finf.lastModified (); 1673 QDateTime dt = finf.lastModified ();
1668 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1674 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1669 //qDebug("file on disk version %s",dt.toString().latin1()); 1675 //qDebug("file on disk version %s",dt.toString().latin1());
1670 if ( dt <= loadedFileVersion ) 1676 if ( dt <= loadedFileVersion )
1671 return true; 1677 return true;
1672 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, true)) , 1678 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, true)) ,
1673 i18n("KO/Pi Warning"),i18n("Overwrite"), 1679 i18n("KO/Pi Warning"),i18n("Overwrite"),
1674 i18n("Sync+save")); 1680 i18n("Sync+save"));
1675 1681
1676 if ( km == KMessageBox::Cancel ) 1682 if ( km == KMessageBox::Cancel )
1677 return false; 1683 return false;
1678 if ( km == KMessageBox::Yes ) 1684 if ( km == KMessageBox::Yes )
1679 return true; 1685 return true;
1680 1686
1681 setSyncDevice("deleteaftersync" ); 1687 setSyncDevice("deleteaftersync" );
1682 mSyncManager->mAskForPreferences = true; 1688 mSyncManager->mAskForPreferences = true;
1683 mSyncManager->mSyncAlgoPrefs = 3; 1689 mSyncManager->mSyncAlgoPrefs = 3;
1684 mSyncManager->mWriteBackFile = false; 1690 mSyncManager->mWriteBackFile = false;
1685 mSyncManager->mWriteBackExistingOnly = false; 1691 mSyncManager->mWriteBackExistingOnly = false;
1686 mSyncManager->mShowSyncSummary = false; 1692 mSyncManager->mShowSyncSummary = false;
1687 syncCalendar( fn, 3 ); 1693 syncCalendar( fn, 3 );
1688 Event * e = getLastSyncEvent(); 1694 Event * e = getLastSyncEvent();
1689 mCalendar->deleteEvent ( e ); 1695 mCalendar->deleteEvent ( e );
1690 updateView(); 1696 updateView();
1691 return true; 1697 return true;
1692} 1698}
1693 1699
1694bool CalendarView::saveCalendar( QString filename ) 1700bool CalendarView::saveCalendar( QString filename )
1695{ 1701{
1696 1702
1697 // Store back all unsaved data into calendar object 1703 // Store back all unsaved data into calendar object
1698 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1704 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1699 if ( mViewManager->currentView() ) 1705 if ( mViewManager->currentView() )
1700 mViewManager->currentView()->flushView(); 1706 mViewManager->currentView()->flushView();
1701 1707
1702 1708
1703 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1709 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1704 mStorage->setSaveFormat( new ICalFormat() ); 1710 mStorage->setSaveFormat( new ICalFormat() );
1705 mStorage->setFileName( filename ); 1711 mStorage->setFileName( filename );
1706 bool success; 1712 bool success;
1707 success = mStorage->save(); 1713 success = mStorage->save();
1708 if ( !success ) { 1714 if ( !success ) {
1709 return false; 1715 return false;
1710 } 1716 }
1711 if ( filename == MainWindow::defaultFileName() ) { 1717 if ( filename == MainWindow::defaultFileName() ) {
1712 setLoadedFileVersion( lfv ); 1718 setLoadedFileVersion( lfv );
1713 watchSavedFile(); 1719 watchSavedFile();
1714 } 1720 }
1715 return true; 1721 return true;
1716} 1722}
1717 1723
1718void CalendarView::closeCalendar() 1724void CalendarView::closeCalendar()
1719{ 1725{
1720 1726
1721 // child windows no longer valid 1727 // child windows no longer valid
1722 emit closingDown(); 1728 emit closingDown();
1723 1729
1724 mCalendar->close(); 1730 mCalendar->close();
1725 setModified(false); 1731 setModified(false);
1726 updateView(); 1732 updateView();
1727} 1733}
1728 1734
1729void CalendarView::archiveCalendar() 1735void CalendarView::archiveCalendar()
1730{ 1736{
1731 mDialogManager->showArchiveDialog(); 1737 mDialogManager->showArchiveDialog();
1732} 1738}
1733 1739
1734 1740
1735void CalendarView::readSettings() 1741void CalendarView::readSettings()
1736{ 1742{
1737 1743
1738 1744
1739 // mViewManager->showAgendaView(); 1745 // mViewManager->showAgendaView();
1740 QString str; 1746 QString str;
1741 //qDebug("CalendarView::readSettings() "); 1747 //qDebug("CalendarView::readSettings() ");
1742 // read settings from the KConfig, supplying reasonable 1748 // read settings from the KConfig, supplying reasonable
1743 // defaults where none are to be found 1749 // defaults where none are to be found
1744 KConfig *config = KOGlobals::config(); 1750 KConfig *config = KOGlobals::config();
1745#ifndef KORG_NOSPLITTER 1751#ifndef KORG_NOSPLITTER
1746 config->setGroup("KOrganizer Geometry"); 1752 config->setGroup("KOrganizer Geometry");
1747 1753
1748 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1754 QValueList<int> sizes = config->readIntListEntry("Separator1");
1749 if (sizes.count() != 2) { 1755 if (sizes.count() != 2) {
1750 sizes << mDateNavigator->minimumSizeHint().width(); 1756 sizes << mDateNavigator->minimumSizeHint().width();
1751 sizes << 300; 1757 sizes << 300;
1752 } 1758 }
1753 mPanner->setSizes(sizes); 1759 mPanner->setSizes(sizes);
1754 1760
1755 sizes = config->readIntListEntry("Separator2"); 1761 sizes = config->readIntListEntry("Separator2");
1756 if ( ( mResourceView && sizes.count() == 4 ) || 1762 if ( ( mResourceView && sizes.count() == 4 ) ||
1757 ( !mResourceView && sizes.count() == 3 ) ) { 1763 ( !mResourceView && sizes.count() == 3 ) ) {
1758 mLeftSplitter->setSizes(sizes); 1764 mLeftSplitter->setSizes(sizes);
1759 } 1765 }
1760#endif 1766#endif
1761 globalFlagBlockAgenda = 1; 1767 globalFlagBlockAgenda = 1;
1762 mViewManager->showAgendaView(); 1768 mViewManager->showAgendaView();
1763 //mViewManager->readSettings( config ); 1769 //mViewManager->readSettings( config );
1764 mTodoList->restoreLayout(config,QString("Todo Layout")); 1770 mTodoList->restoreLayout(config,QString("Todo Layout"));
1765 readFilterSettings(config); 1771 readFilterSettings(config);
1766 config->setGroup( "Views" ); 1772 config->setGroup( "Views" );
1767 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1773 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1768 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1774 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1769 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1775 else if ( dateCount == 7 ) mNavigator->selectWeek();
1770 else mNavigator->selectDates( dateCount ); 1776 else mNavigator->selectDates( dateCount );
1771 // mViewManager->readSettings( config ); 1777 // mViewManager->readSettings( config );
1772 updateConfig(); 1778 updateConfig();
1773 globalFlagBlockAgenda = 2; 1779 globalFlagBlockAgenda = 2;
1774 mViewManager->readSettings( config ); 1780 mViewManager->readSettings( config );
1775#ifdef DESKTOP_VERSION 1781#ifdef DESKTOP_VERSION
1776 config->setGroup("WidgetLayout"); 1782 config->setGroup("WidgetLayout");
1777 QStringList list; 1783 QStringList list;
1778 list = config->readListEntry("MainLayout"); 1784 list = config->readListEntry("MainLayout");
1779 int x,y,w,h; 1785 int x,y,w,h;
1780 if ( ! list.isEmpty() ) { 1786 if ( ! list.isEmpty() ) {
1781 x = list[0].toInt(); 1787 x = list[0].toInt();
1782 y = list[1].toInt(); 1788 y = list[1].toInt();
1783 w = list[2].toInt(); 1789 w = list[2].toInt();
1784 h = list[3].toInt(); 1790 h = list[3].toInt();
1785 topLevelWidget()->setGeometry(x,y,w,h); 1791 topLevelWidget()->setGeometry(x,y,w,h);
1786 1792
1787 } else { 1793 } else {
1788 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1794 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1789 } 1795 }
1790 list = config->readListEntry("EditEventLayout"); 1796 list = config->readListEntry("EditEventLayout");
1791 if ( ! list.isEmpty() ) { 1797 if ( ! list.isEmpty() ) {
1792 x = list[0].toInt(); 1798 x = list[0].toInt();
1793 y = list[1].toInt(); 1799 y = list[1].toInt();
1794 w = list[2].toInt(); 1800 w = list[2].toInt();
1795 h = list[3].toInt(); 1801 h = list[3].toInt();
1796 mEventEditor->setGeometry(x,y,w,h); 1802 mEventEditor->setGeometry(x,y,w,h);
1797 1803
1798 } 1804 }
1799 list = config->readListEntry("EditTodoLayout"); 1805 list = config->readListEntry("EditTodoLayout");
1800 if ( ! list.isEmpty() ) { 1806 if ( ! list.isEmpty() ) {
1801 x = list[0].toInt(); 1807 x = list[0].toInt();
1802 y = list[1].toInt(); 1808 y = list[1].toInt();
1803 w = list[2].toInt(); 1809 w = list[2].toInt();
1804 h = list[3].toInt(); 1810 h = list[3].toInt();
1805 mTodoEditor->setGeometry(x,y,w,h); 1811 mTodoEditor->setGeometry(x,y,w,h);
1806 1812
1807 } 1813 }
1808 list = config->readListEntry("ViewerLayout"); 1814 list = config->readListEntry("ViewerLayout");
1809 if ( ! list.isEmpty() ) { 1815 if ( ! list.isEmpty() ) {
1810 x = list[0].toInt(); 1816 x = list[0].toInt();
1811 y = list[1].toInt(); 1817 y = list[1].toInt();
1812 w = list[2].toInt(); 1818 w = list[2].toInt();
1813 h = list[3].toInt(); 1819 h = list[3].toInt();
1814 getEventViewerDialog()->setGeometry(x,y,w,h); 1820 getEventViewerDialog()->setGeometry(x,y,w,h);
1815 } 1821 }
1816#endif 1822#endif
1817 1823
1818} 1824}
1819 1825
1820 1826
1821void CalendarView::writeSettings() 1827void CalendarView::writeSettings()
1822{ 1828{
1823 // kdDebug() << "CalendarView::writeSettings" << endl; 1829 // kdDebug() << "CalendarView::writeSettings" << endl;
1824 1830
1825 KConfig *config = KOGlobals::config(); 1831 KConfig *config = KOGlobals::config();
1826 1832
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fc2d59b..65566b5 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -340,1325 +340,1339 @@ void MainWindow::toggleBeamReceive()
340 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 340 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
341#endif 341#endif
342} 342}
343void MainWindow::showMaximized () 343void MainWindow::showMaximized ()
344{ 344{
345#ifndef DESKTOP_VERSION 345#ifndef DESKTOP_VERSION
346 if ( ! globalFlagBlockStartup ) 346 if ( ! globalFlagBlockStartup )
347 if ( mClosed ) 347 if ( mClosed )
348 mView->goToday(); 348 mView->goToday();
349#endif 349#endif
350 QWidget::showMaximized () ; 350 QWidget::showMaximized () ;
351 mClosed = false; 351 mClosed = false;
352} 352}
353void MainWindow::closeEvent( QCloseEvent* ce ) 353void MainWindow::closeEvent( QCloseEvent* ce )
354{ 354{
355 355
356 356
357 357
358 if ( ! KOPrefs::instance()->mAskForQuit ) { 358 if ( ! KOPrefs::instance()->mAskForQuit ) {
359 saveOnClose(); 359 saveOnClose();
360 mClosed = true; 360 mClosed = true;
361 ce->accept(); 361 ce->accept();
362 return; 362 return;
363 363
364 } 364 }
365 365
366 switch( QMessageBox::information( this, "KO/Pi", 366 switch( QMessageBox::information( this, "KO/Pi",
367 i18n("Do you really want\nto close KO/Pi?"), 367 i18n("Do you really want\nto close KO/Pi?"),
368 i18n("Close"), i18n("No"), 368 i18n("Close"), i18n("No"),
369 0, 0 ) ) { 369 0, 0 ) ) {
370 case 0: 370 case 0:
371 saveOnClose(); 371 saveOnClose();
372 mClosed = true; 372 mClosed = true;
373 ce->accept(); 373 ce->accept();
374 break; 374 break;
375 case 1: 375 case 1:
376 ce->ignore(); 376 ce->ignore();
377 break; 377 break;
378 case 2: 378 case 2:
379 379
380 default: 380 default:
381 break; 381 break;
382 } 382 }
383 383
384 384
385} 385}
386 386
387void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 387void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
388{ 388{
389 QDataStream stream( data, IO_ReadOnly ); 389 QDataStream stream( data, IO_ReadOnly );
390 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 390 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
391 //QString datamess; 391 //QString datamess;
392 //qDebug("message "); 392 //qDebug("message ");
393 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 393 qDebug("KO: QCOP message received: %s ", cmsg.data() );
394 394
395 if ( cmsg == "setDocument(QString)" ) { 395 if ( cmsg == "setDocument(QString)" ) {
396 QDataStream stream( data, IO_ReadOnly ); 396 QDataStream stream( data, IO_ReadOnly );
397 QString fileName; 397 QString fileName;
398 stream >> fileName; 398 stream >> fileName;
399 //qDebug("filename %s ", fileName.latin1()); 399 //qDebug("filename %s ", fileName.latin1());
400 showMaximized(); 400 showMaximized();
401 raise(); 401 raise();
402 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 402 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
403 mSyncManager->slotSyncMenu( 1002 ); 403 mSyncManager->slotSyncMenu( 1002 );
404 return; 404 return;
405 } 405 }
406 406
407 if ( cmsg == "-writeFile" ) { 407 if ( cmsg == "-writeFile" ) {
408 // I made from the "-writeFile" an "-writeAlarm" 408 // I made from the "-writeFile" an "-writeAlarm"
409 mView->viewManager()->showWhatsNextView(); 409 mView->viewManager()->showWhatsNextView();
410 mCalendar->checkAlarmForIncidence( 0, true); 410 mCalendar->checkAlarmForIncidence( 0, true);
411 showMaximized(); 411 showMaximized();
412 raise(); 412 raise();
413 return; 413 return;
414 414
415 } 415 }
416 if ( cmsg == "-writeFileSilent" ) { 416 if ( cmsg == "-writeFileSilent" ) {
417 // I made from the "-writeFile" an "-writeAlarm" 417 // I made from the "-writeFile" an "-writeAlarm"
418 // mView->viewManager()->showWhatsNextView(); 418 // mView->viewManager()->showWhatsNextView();
419 mCalendar->checkAlarmForIncidence( 0, true); 419 mCalendar->checkAlarmForIncidence( 0, true);
420 //showMaximized(); 420 //showMaximized();
421 //raise(); 421 //raise();
422 hide(); 422 hide();
423 return; 423 return;
424 } 424 }
425 if ( cmsg == "-newCountdown" ) { 425 if ( cmsg == "-newCountdown" ) {
426 qDebug("newCountdown "); 426 qDebug("newCountdown ");
427 427
428 } 428 }
429 QString msg ; 429 QString msg ;
430 QString allmsg = cmsg; 430 QString allmsg = cmsg;
431 while ( allmsg.length() > 0 ) { 431 while ( allmsg.length() > 0 ) {
432 int nextC = allmsg.find( "-", 1 ); 432 int nextC = allmsg.find( "-", 1 );
433 if ( nextC == -1 ) { 433 if ( nextC == -1 ) {
434 msg = allmsg; 434 msg = allmsg;
435 allmsg = ""; 435 allmsg = "";
436 } else{ 436 } else{
437 msg = allmsg.left( nextC ); 437 msg = allmsg.left( nextC );
438 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 438 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
439 } 439 }
440 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 440 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
441 if ( msg == "-newEvent" ) { 441 if ( msg == "-newEvent" ) {
442 mView->newEvent(); 442 mView->newEvent();
443 } 443 }
444 if ( msg == "-newTodo" ) { 444 if ( msg == "-newTodo" ) {
445 mView->newTodo(); 445 mView->newTodo();
446 446
447 } 447 }
448 if ( msg == "-showWN" ) { 448 if ( msg == "-showWN" ) {
449 mView->viewManager()->showWhatsNextView(); 449 mView->viewManager()->showWhatsNextView();
450 } 450 }
451 if ( msg == "-showTodo" ) { 451 if ( msg == "-showTodo" ) {
452 mView->viewManager()->showTodoView(); 452 mView->viewManager()->showTodoView();
453 } 453 }
454 if ( msg == "-showList" ) { 454 if ( msg == "-showList" ) {
455 mView->viewManager()->showListView(); 455 mView->viewManager()->showListView();
456 } 456 }
457 else if ( msg == "-showDay" ) { 457 else if ( msg == "-showDay" ) {
458 mView->viewManager()->showDayView(); 458 mView->viewManager()->showDayView();
459 } 459 }
460 else if ( msg == "-showWWeek" ) { 460 else if ( msg == "-showWWeek" ) {
461 mView->viewManager()->showWorkWeekView(); 461 mView->viewManager()->showWorkWeekView();
462 } 462 }
463 else if ( msg == "-ringSync" ) { 463 else if ( msg == "-ringSync" ) {
464 mSyncManager->multiSync( false ); 464 mSyncManager->multiSync( false );
465 } 465 }
466 else if ( msg == "-showWeek" ) { 466 else if ( msg == "-showWeek" ) {
467 mView->viewManager()->showWeekView(); 467 mView->viewManager()->showWeekView();
468 } 468 }
469 else if ( msg == "-showTodo" ) { 469 else if ( msg == "-showTodo" ) {
470 mView->viewManager()->showTodoView(); 470 mView->viewManager()->showTodoView();
471 } 471 }
472 else if ( msg == "-showJournal" ) { 472 else if ( msg == "-showJournal" ) {
473 mView->dateNavigator()->selectDates( 1 ); 473 mView->dateNavigator()->selectDates( 1 );
474 mView->dateNavigator()->selectToday(); 474 mView->dateNavigator()->selectToday();
475 mView->viewManager()->showJournalView(); 475 mView->viewManager()->showJournalView();
476 } 476 }
477 else if ( msg == "-showKO" ) { 477 else if ( msg == "-showKO" ) {
478 mView->viewManager()->showNextXView(); 478 mView->viewManager()->showNextXView();
479 } 479 }
480 else if ( msg == "-showWNext" || msg == "nextView()" ) { 480 else if ( msg == "-showWNext" || msg == "nextView()" ) {
481 mView->viewManager()->showWhatsNextView(); 481 mView->viewManager()->showWhatsNextView();
482 } 482 }
483 else if ( msg == "-showNextXView" ) { 483 else if ( msg == "-showNextXView" ) {
484 mView->viewManager()->showNextXView(); 484 mView->viewManager()->showNextXView();
485 } 485 }
486 486
487 487
488 } 488 }
489 489
490 showMaximized(); 490 showMaximized();
491 raise(); 491 raise();
492} 492}
493 493
494QPixmap MainWindow::loadPixmap( QString name ) 494QPixmap MainWindow::loadPixmap( QString name )
495{ 495{
496 return SmallIcon( name ); 496 return SmallIcon( name );
497 497
498} 498}
499void MainWindow::initActions() 499void MainWindow::initActions()
500{ 500{
501 //KOPrefs::instance()->mShowFullMenu 501 //KOPrefs::instance()->mShowFullMenu
502 iconToolBar->clear(); 502 iconToolBar->clear();
503 KOPrefs *p = KOPrefs::instance(); 503 KOPrefs *p = KOPrefs::instance();
504 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 504 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
505 505
506 QPopupMenu *viewMenu = new QPopupMenu( this ); 506 QPopupMenu *viewMenu = new QPopupMenu( this );
507 QPopupMenu *actionMenu = new QPopupMenu( this ); 507 QPopupMenu *actionMenu = new QPopupMenu( this );
508 QPopupMenu *importMenu = new QPopupMenu( this ); 508 QPopupMenu *importMenu = new QPopupMenu( this );
509 selectFilterMenu = new QPopupMenu( this ); 509 selectFilterMenu = new QPopupMenu( this );
510 selectFilterMenu->setCheckable( true ); 510 selectFilterMenu->setCheckable( true );
511 syncMenu = new QPopupMenu( this ); 511 syncMenu = new QPopupMenu( this );
512 configureAgendaMenu = new QPopupMenu( this ); 512 configureAgendaMenu = new QPopupMenu( this );
513 configureToolBarMenu = new QPopupMenu( this ); 513 configureToolBarMenu = new QPopupMenu( this );
514 QPopupMenu *helpMenu = new QPopupMenu( this ); 514 QPopupMenu *helpMenu = new QPopupMenu( this );
515 if ( KOPrefs::instance()->mShowFullMenu ) { 515 if ( KOPrefs::instance()->mShowFullMenu ) {
516 QMenuBar *menuBar1; 516 QMenuBar *menuBar1;
517 menuBar1 = menuBar(); 517 menuBar1 = menuBar();
518 menuBar1->insertItem( i18n("File"), importMenu ); 518 menuBar1->insertItem( i18n("File"), importMenu );
519 menuBar1->insertItem( i18n("View"), viewMenu ); 519 menuBar1->insertItem( i18n("View"), viewMenu );
520 menuBar1->insertItem( i18n("Actions"), actionMenu ); 520 menuBar1->insertItem( i18n("Actions"), actionMenu );
521 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 521 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
522 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 522 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
523 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 523 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
524 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 524 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
525 menuBar1->insertItem( i18n("Help"), helpMenu ); 525 menuBar1->insertItem( i18n("Help"), helpMenu );
526 } else { 526 } else {
527 QPEMenuBar *menuBar1; 527 QPEMenuBar *menuBar1;
528 menuBar1 = new QPEMenuBar( iconToolBar ); 528 menuBar1 = new QPEMenuBar( iconToolBar );
529 QPopupMenu *menuBar = new QPopupMenu( this ); 529 QPopupMenu *menuBar = new QPopupMenu( this );
530 menuBar1->insertItem( i18n("ME"), menuBar); 530 menuBar1->insertItem( i18n("ME"), menuBar);
531 menuBar->insertItem( i18n("File"), importMenu ); 531 menuBar->insertItem( i18n("File"), importMenu );
532 menuBar->insertItem( i18n("View"), viewMenu ); 532 menuBar->insertItem( i18n("View"), viewMenu );
533 menuBar->insertItem( i18n("Actions"), actionMenu ); 533 menuBar->insertItem( i18n("Actions"), actionMenu );
534 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 534 menuBar->insertItem( i18n("Synchronize"), syncMenu );
535 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 535 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
536 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 536 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
537 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 537 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
538 menuBar->insertItem( i18n("Help"), helpMenu ); 538 menuBar->insertItem( i18n("Help"), helpMenu );
539 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 539 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
540 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 540 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
541 } 541 }
542 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 542 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
543 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 543 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
544 544
545 // ****************** 545 // ******************
546 QAction *action; 546 QAction *action;
547 QIconSet icon; 547 QIconSet icon;
548 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 548 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
549 configureToolBarMenu->setCheckable( true ); 549 configureToolBarMenu->setCheckable( true );
550 550
551 QString pathString = ""; 551 QString pathString = "";
552 if ( !p->mToolBarMiniIcons ) { 552 if ( !p->mToolBarMiniIcons ) {
553 if ( QApplication::desktop()->width() < 480 ) 553 if ( QApplication::desktop()->width() < 480 )
554 pathString += "icons16/"; 554 pathString += "icons16/";
555 } else 555 } else
556 pathString += "iconsmini/"; 556 pathString += "iconsmini/";
557 configureAgendaMenu->setCheckable( true ); 557 configureAgendaMenu->setCheckable( true );
558 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 558 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
559 configureAgendaMenu->insertSeparator(); 559 configureAgendaMenu->insertSeparator();
560 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 560 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
561 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 561 configureAgendaMenu->insertItem(i18n("Small"), 6 );
562 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 562 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
563 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 563 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
564 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 564 configureAgendaMenu->insertItem(i18n("Large"), 12 );
565 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 565 configureAgendaMenu->insertItem(i18n("Big"), 14 );
566 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 566 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
567 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 567 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
568 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 568 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
569 569
570 icon = loadPixmap( pathString + "configure" ); 570 icon = loadPixmap( pathString + "configure" );
571 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 571 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
572 action->addTo( actionMenu ); 572 action->addTo( actionMenu );
573 connect( action, SIGNAL( activated() ), 573 connect( action, SIGNAL( activated() ),
574 mView, SLOT( edit_options() ) ); 574 mView, SLOT( edit_options() ) );
575 actionMenu->insertSeparator(); 575 actionMenu->insertSeparator();
576 icon = loadPixmap( pathString + "newevent" ); 576 icon = loadPixmap( pathString + "newevent" );
577 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 577 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
578 configureToolBarMenu->insertSeparator(); 578 configureToolBarMenu->insertSeparator();
579 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 579 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
580 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 580 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
581 ne_action->addTo( actionMenu ); 581 ne_action->addTo( actionMenu );
582 connect( ne_action, SIGNAL( activated() ), 582 connect( ne_action, SIGNAL( activated() ),
583 mView, SLOT( newEvent() ) ); 583 mView, SLOT( newEvent() ) );
584 icon = loadPixmap( pathString + "newtodo" ); 584 icon = loadPixmap( pathString + "newtodo" );
585 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 585 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
586 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 586 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
587 nt_action->addTo( actionMenu ); 587 nt_action->addTo( actionMenu );
588 connect( nt_action, SIGNAL( activated() ), 588 connect( nt_action, SIGNAL( activated() ),
589 mView, SLOT( newTodo() ) ); 589 mView, SLOT( newTodo() ) );
590 icon = loadPixmap( pathString + "navi" ); 590 icon = loadPixmap( pathString + "navi" );
591 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 591 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
592 action->addTo( viewMenu ); 592 action->addTo( viewMenu );
593 connect( action, SIGNAL( activated() ), 593 connect( action, SIGNAL( activated() ),
594 mView, SLOT( toggleDateNavigatorWidget() ) ); 594 mView, SLOT( toggleDateNavigatorWidget() ) );
595 icon = loadPixmap( pathString + "filter" ); 595 icon = loadPixmap( pathString + "filter" );
596 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 596 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
597 action->addTo( viewMenu ); 597 action->addTo( viewMenu );
598 connect( action, SIGNAL( activated() ), 598 connect( action, SIGNAL( activated() ),
599 mView, SLOT( toggleFilter() ) ); 599 mView, SLOT( toggleFilter() ) );
600 600
601 601
602 viewMenu->insertSeparator(); 602 viewMenu->insertSeparator();
603 icon = loadPixmap( pathString + "picker" ); 603 icon = loadPixmap( pathString + "picker" );
604 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 604 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
605 action->addTo( viewMenu ); 605 action->addTo( viewMenu );
606 connect( action, SIGNAL( activated() ), 606 connect( action, SIGNAL( activated() ),
607 mView, SLOT( showDatePicker() ) ); 607 mView, SLOT( showDatePicker() ) );
608 action->addTo( iconToolBar ); 608 action->addTo( iconToolBar );
609 viewMenu->insertSeparator(); 609 viewMenu->insertSeparator();
610 icon = loadPixmap( pathString + "list" ); 610 icon = loadPixmap( pathString + "list" );
611 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 611 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
612 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 612 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
613 showlist_action->addTo( viewMenu ); 613 showlist_action->addTo( viewMenu );
614 connect( showlist_action, SIGNAL( activated() ), 614 connect( showlist_action, SIGNAL( activated() ),
615 mView->viewManager(), SLOT( showListView() ) ); 615 mView->viewManager(), SLOT( showListView() ) );
616 616
617 617
618 icon = loadPixmap( pathString + "day" ); 618 icon = loadPixmap( pathString + "day" );
619 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 619 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
620 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 620 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
621 day1_action->addTo( viewMenu ); 621 day1_action->addTo( viewMenu );
622 // action->addTo( toolBar ); 622 // action->addTo( toolBar );
623 connect( day1_action, SIGNAL( activated() ), 623 connect( day1_action, SIGNAL( activated() ),
624 mView->viewManager(), SLOT( showDayView() ) ); 624 mView->viewManager(), SLOT( showDayView() ) );
625 625
626 icon = loadPixmap( pathString + "workweek" ); 626 icon = loadPixmap( pathString + "workweek" );
627 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 627 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
628 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 628 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
629 day5_action->addTo( viewMenu ); 629 day5_action->addTo( viewMenu );
630 connect( day5_action, SIGNAL( activated() ), 630 connect( day5_action, SIGNAL( activated() ),
631 mView->viewManager(), SLOT( showWorkWeekView() ) ); 631 mView->viewManager(), SLOT( showWorkWeekView() ) );
632 632
633 icon = loadPixmap( pathString + "week" ); 633 icon = loadPixmap( pathString + "week" );
634 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 634 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
635 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 635 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
636 day7_action->addTo( viewMenu ); 636 day7_action->addTo( viewMenu );
637 connect( day7_action, SIGNAL( activated() ), 637 connect( day7_action, SIGNAL( activated() ),
638 mView->viewManager(), SLOT( showWeekView() ) ); 638 mView->viewManager(), SLOT( showWeekView() ) );
639 639
640 icon = loadPixmap( pathString + "month" ); 640 icon = loadPixmap( pathString + "month" );
641 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 641 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
642 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 642 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
643 month_action->addTo( viewMenu ); 643 month_action->addTo( viewMenu );
644 connect( month_action, SIGNAL( activated() ), 644 connect( month_action, SIGNAL( activated() ),
645 mView->viewManager(), SLOT( showMonthView() ) ); 645 mView->viewManager(), SLOT( showMonthView() ) );
646 646
647 icon = loadPixmap( pathString + "todo" ); 647 icon = loadPixmap( pathString + "todo" );
648 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 648 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
649 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 649 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
650 todoview_action->addTo( viewMenu ); 650 todoview_action->addTo( viewMenu );
651 connect( todoview_action, SIGNAL( activated() ), 651 connect( todoview_action, SIGNAL( activated() ),
652 mView->viewManager(), SLOT( showTodoView() ) ); 652 mView->viewManager(), SLOT( showTodoView() ) );
653 653
654 icon = loadPixmap( pathString + "journal" ); 654 icon = loadPixmap( pathString + "journal" );
655 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 655 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
656 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 656 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
657 viewjournal_action->addTo( viewMenu ); 657 viewjournal_action->addTo( viewMenu );
658 connect( viewjournal_action, SIGNAL( activated() ), 658 connect( viewjournal_action, SIGNAL( activated() ),
659 mView->viewManager(), SLOT( showJournalView() ) ); 659 mView->viewManager(), SLOT( showJournalView() ) );
660 660
661 icon = loadPixmap( pathString + "xdays" ); 661 icon = loadPixmap( pathString + "xdays" );
662 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 662 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
663 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 663 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
664 xdays_action->addTo( viewMenu ); 664 xdays_action->addTo( viewMenu );
665 connect( xdays_action, SIGNAL( activated() ), 665 connect( xdays_action, SIGNAL( activated() ),
666 mView->viewManager(), SLOT( showNextXView() ) ); 666 mView->viewManager(), SLOT( showNextXView() ) );
667 667
668 icon = loadPixmap( pathString + "whatsnext" ); 668 icon = loadPixmap( pathString + "whatsnext" );
669 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 669 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
670 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 670 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
671 whatsnext_action->addTo( viewMenu ); 671 whatsnext_action->addTo( viewMenu );
672 connect( whatsnext_action, SIGNAL( activated() ), 672 connect( whatsnext_action, SIGNAL( activated() ),
673 mView->viewManager(), SLOT( showWhatsNextView() ) ); 673 mView->viewManager(), SLOT( showWhatsNextView() ) );
674 674
675#if 0 675#if 0
676 action = new QAction( "view_timespan", "Time Span", 0, this ); 676 action = new QAction( "view_timespan", "Time Span", 0, this );
677 action->addTo( viewMenu ); 677 action->addTo( viewMenu );
678 connect( action, SIGNAL( activated() ), 678 connect( action, SIGNAL( activated() ),
679 mView->viewManager(), SLOT( showTimeSpanView() ) ); 679 mView->viewManager(), SLOT( showTimeSpanView() ) );
680#endif 680#endif
681 681
682 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 682 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
683 this ); 683 this );
684 mNewSubTodoAction->addTo( actionMenu ); 684 mNewSubTodoAction->addTo( actionMenu );
685 connect( mNewSubTodoAction, SIGNAL( activated() ), 685 connect( mNewSubTodoAction, SIGNAL( activated() ),
686 mView, SLOT( newSubTodo() ) ); 686 mView, SLOT( newSubTodo() ) );
687 687
688 actionMenu->insertSeparator(); 688 actionMenu->insertSeparator();
689 689
690 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 690 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
691 mShowAction->addTo( actionMenu ); 691 mShowAction->addTo( actionMenu );
692 connect( mShowAction, SIGNAL( activated() ), 692 connect( mShowAction, SIGNAL( activated() ),
693 mView, SLOT( showIncidence() ) ); 693 mView, SLOT( showIncidence() ) );
694 694
695 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 695 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
696 mEditAction->addTo( actionMenu ); 696 mEditAction->addTo( actionMenu );
697 connect( mEditAction, SIGNAL( activated() ), 697 connect( mEditAction, SIGNAL( activated() ),
698 mView, SLOT( editIncidence() ) ); 698 mView, SLOT( editIncidence() ) );
699 699
700 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 700 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
701 mDeleteAction->addTo( actionMenu ); 701 mDeleteAction->addTo( actionMenu );
702 connect( mDeleteAction, SIGNAL( activated() ), 702 connect( mDeleteAction, SIGNAL( activated() ),
703 mView, SLOT( deleteIncidence() ) ); 703 mView, SLOT( deleteIncidence() ) );
704 704
705 705
706 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 706 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
707 mCloneAction->addTo( actionMenu ); 707 mCloneAction->addTo( actionMenu );
708 connect( mCloneAction, SIGNAL( activated() ), 708 connect( mCloneAction, SIGNAL( activated() ),
709 mView, SLOT( cloneIncidence() ) ); 709 mView, SLOT( cloneIncidence() ) );
710 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 710 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
711 mMoveAction->addTo( actionMenu ); 711 mMoveAction->addTo( actionMenu );
712 connect( mMoveAction, SIGNAL( activated() ), 712 connect( mMoveAction, SIGNAL( activated() ),
713 mView, SLOT( moveIncidence() ) ); 713 mView, SLOT( moveIncidence() ) );
714 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 714 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
715 mBeamAction->addTo( actionMenu ); 715 mBeamAction->addTo( actionMenu );
716 connect( mBeamAction, SIGNAL( activated() ), 716 connect( mBeamAction, SIGNAL( activated() ),
717 mView, SLOT( beamIncidence() ) ); 717 mView, SLOT( beamIncidence() ) );
718 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 718 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
719 mCancelAction->addTo( actionMenu ); 719 mCancelAction->addTo( actionMenu );
720 connect( mCancelAction, SIGNAL( activated() ), 720 connect( mCancelAction, SIGNAL( activated() ),
721 mView, SLOT( toggleCancelIncidence() ) ); 721 mView, SLOT( toggleCancelIncidence() ) );
722 722
723 actionMenu->insertSeparator(); 723 actionMenu->insertSeparator();
724 724
725 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 725 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
726 this ); 726 this );
727 action->addTo( actionMenu ); 727 action->addTo( actionMenu );
728 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 728 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
729 729
730 icon = loadPixmap( pathString + "search" ); 730 icon = loadPixmap( pathString + "search" );
731 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 731 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
732 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 732 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
733 search_action->addTo( actionMenu ); 733 search_action->addTo( actionMenu );
734 connect( search_action, SIGNAL( activated() ), 734 connect( search_action, SIGNAL( activated() ),
735 mView->dialogManager(), SLOT( showSearchDialog() ) ); 735 mView->dialogManager(), SLOT( showSearchDialog() ) );
736 736
737 icon = loadPixmap( pathString + "today" ); 737 icon = loadPixmap( pathString + "today" );
738 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 738 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
739 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 739 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
740 today_action->addTo( actionMenu ); 740 today_action->addTo( actionMenu );
741 connect( today_action, SIGNAL( activated() ), 741 connect( today_action, SIGNAL( activated() ),
742 mView, SLOT( goToday() ) ); 742 mView, SLOT( goToday() ) );
743 743
744 if ( KOPrefs::instance()->mShowFullMenu ) { 744 if ( KOPrefs::instance()->mShowFullMenu ) {
745 actionMenu->insertSeparator(); 745 actionMenu->insertSeparator();
746 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 746 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
747 747
748 } 748 }
749 // actionMenu->insertSeparator(); 749 // actionMenu->insertSeparator();
750 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 750 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
751 this ); 751 this );
752 action->addTo( importMenu ); 752 action->addTo( importMenu );
753 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 753 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
754 action = new QAction( "import_quick", i18n("Import last file"), 0, 754 action = new QAction( "import_quick", i18n("Import last file"), 0,
755 this ); 755 this );
756 action->addTo( importMenu ); 756 action->addTo( importMenu );
757 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 757 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
758 importMenu->insertSeparator(); 758 importMenu->insertSeparator();
759 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 759 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
760 this ); 760 this );
761 action->addTo( importMenu ); 761 action->addTo( importMenu );
762 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 762 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
763#ifndef DESKTOP_VERSION 763#ifndef DESKTOP_VERSION
764 importMenu->insertSeparator(); 764 importMenu->insertSeparator();
765 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 765 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
766 this ); 766 this );
767 action->addTo( importMenu ); 767 action->addTo( importMenu );
768 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 768 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
769#else 769#else
770#ifdef _WIN32_ 770#ifdef _WIN32_
771 importMenu->insertSeparator(); 771 importMenu->insertSeparator();
772 action = new QAction( "import_ol", i18n("Import from OL"), 0, 772 action = new QAction( "import_ol", i18n("Import from OL"), 0,
773 this ); 773 this );
774 action->addTo( importMenu ); 774 action->addTo( importMenu );
775 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 775 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
776#endif 776#endif
777#endif 777#endif
778 778
779 importMenu->insertSeparator(); 779 importMenu->insertSeparator();
780 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 780 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
781 this ); 781 this );
782 action->addTo( importMenu ); 782 action->addTo( importMenu );
783 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 783 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
784 784
785 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 785 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
786 this ); 786 this );
787 action->addTo( importMenu ); 787 action->addTo( importMenu );
788 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 788 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
789 789
790 importMenu->insertSeparator(); 790 importMenu->insertSeparator();
791 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 791 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
792 this ); 792 this );
793 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 793 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
794 794
795 795
796 //LR 796 //LR
797 QPopupMenu *ex2phone = new QPopupMenu( this ); 797 QPopupMenu *ex2phone = new QPopupMenu( this );
798 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 798 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
799 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 799 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
800 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 800 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
801 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 801 importMenu->insertItem( i18n("Export to phone"), ex2phone );
802 802
803 importMenu->insertSeparator(); 803 importMenu->insertSeparator();
804 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 804 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
805 this ); 805 this );
806 action->addTo( importMenu ); 806 action->addTo( importMenu );
807 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 807 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
808#ifndef DESKTOP_VERSION 808#ifndef DESKTOP_VERSION
809 importMenu->insertSeparator(); 809 importMenu->insertSeparator();
810 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 810 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
811 this ); 811 this );
812 brAction->addTo( importMenu ); 812 brAction->addTo( importMenu );
813 brAction->setToggleAction (true ) ; 813 brAction->setToggleAction (true ) ;
814 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 814 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
815 815
816 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 816 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
817 this ); 817 this );
818 action->addTo( importMenu ); 818 action->addTo( importMenu );
819 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 819 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
820 820
821 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 821 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
822 this ); 822 this );
823 action->addTo( importMenu ); 823 action->addTo( importMenu );
824 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 824 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
825#else 825#else
826 importMenu->insertSeparator(); 826 importMenu->insertSeparator();
827 icon = loadPixmap( pathString + "print" ); 827 icon = loadPixmap( pathString + "print" );
828 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 828 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
829 action->addTo( importMenu ); 829 action->addTo( importMenu );
830 connect( action, SIGNAL( activated() ), 830 connect( action, SIGNAL( activated() ),
831 this, SLOT( printCal() ) ); 831 this, SLOT( printCal() ) );
832 832
833 icon = loadPixmap( pathString + "print" ); 833 icon = loadPixmap( pathString + "print" );
834 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 834 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
835 action->addTo( importMenu ); 835 action->addTo( importMenu );
836 connect( action, SIGNAL( activated() ), 836 connect( action, SIGNAL( activated() ),
837 this, SLOT( printSel() ) ); 837 this, SLOT( printSel() ) );
838#endif 838#endif
839 importMenu->insertSeparator(); 839 importMenu->insertSeparator();
840 action = new QAction( "beam all", i18n("Save"), 0, 840 action = new QAction( "beam all", i18n("Save"), 0,
841 this ); 841 this );
842 action->addTo( importMenu ); 842 action->addTo( importMenu );
843 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 843 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
844 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 844 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
845 this ); 845 this );
846 action->addTo( importMenu ); 846 action->addTo( importMenu );
847 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 847 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
848 848
849 //menuBar->insertItem( "Configure",configureMenu ); 849 //menuBar->insertItem( "Configure",configureMenu );
850 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 850 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
851 icon = loadPixmap( "korganizer/korganizer" ); 851 icon = loadPixmap( "korganizer/korganizer" );
852 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 852
853 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
853 action->addTo( helpMenu ); 854 action->addTo( helpMenu );
854 connect( action, SIGNAL( activated() ), 855 connect( action, SIGNAL( activated() ),
855 SLOT( keyBindings() ) ); 856 SLOT( whatsNew() ) );
856 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 857 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
857 action->addTo( helpMenu ); 858 action->addTo( helpMenu );
858 connect( action, SIGNAL( activated() ), 859 connect( action, SIGNAL( activated() ),
859 SLOT( features() ) ); 860 SLOT( features() ) );
861 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
862 action->addTo( helpMenu );
863 connect( action, SIGNAL( activated() ),
864 SLOT( keyBindings() ) );
865 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
866 action->addTo( helpMenu );
867 connect( action, SIGNAL( activated() ),
868 SLOT( synchowto() ) );
869 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
870 action->addTo( helpMenu );
871 connect( action, SIGNAL( activated() ),
872 SLOT( kdesynchowto() ) );
873 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
874 action->addTo( helpMenu );
875 connect( action, SIGNAL( activated() ),
876 SLOT( multisynchowto() ) );
860 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 877 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
861 action->addTo( helpMenu ); 878 action->addTo( helpMenu );
862 connect( action, SIGNAL( activated() ), 879 connect( action, SIGNAL( activated() ),
863 SLOT( aboutAutoSaving() ) ); 880 SLOT( aboutAutoSaving() ) );
864 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 881 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
865 action->addTo( helpMenu ); 882 action->addTo( helpMenu );
866 connect( action, SIGNAL( activated() ), 883 connect( action, SIGNAL( activated() ),
867 SLOT( aboutKnownBugs() ) ); 884 SLOT( aboutKnownBugs() ) );
868 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 885 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
869 action->addTo( helpMenu ); 886 action->addTo( helpMenu );
870 connect( action, SIGNAL( activated() ), 887 connect( action, SIGNAL( activated() ),
871 SLOT( usertrans() ) ); 888 SLOT( usertrans() ) );
872 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
873 action->addTo( helpMenu );
874 connect( action, SIGNAL( activated() ),
875 SLOT( synchowto() ) );
876 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
877 action->addTo( helpMenu );
878 connect( action, SIGNAL( activated() ),
879 SLOT( whatsNew() ) );
880 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 889 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
881 action->addTo( helpMenu ); 890 action->addTo( helpMenu );
882 connect( action, SIGNAL( activated() ), 891 connect( action, SIGNAL( activated() ),
883 SLOT( faq() ) ); 892 SLOT( faq() ) );
884
885
886 action = new QAction( "about", i18n("About..."), 0, this );
887 action->addTo( helpMenu );
888 connect( action, SIGNAL( activated() ),
889 SLOT( about() ) );
890 action = new QAction( "licence", i18n("Licence..."), 0, this ); 893 action = new QAction( "licence", i18n("Licence..."), 0, this );
891 action->addTo( helpMenu ); 894 action->addTo( helpMenu );
892 connect( action, SIGNAL( activated() ), 895 connect( action, SIGNAL( activated() ),
893 SLOT( licence() ) ); 896 SLOT( licence() ) );
897 action = new QAction( "about", i18n("About..."), 0, this );
898 action->addTo( helpMenu );
899 connect( action, SIGNAL( activated() ),
900 SLOT( about() ) );
894 //menuBar->insertSeparator(); 901 //menuBar->insertSeparator();
895 902
896 // ****************************************************** 903 // ******************************************************
897 // menubar icons 904 // menubar icons
898 905
899 906
900 iconToolBar->setHorizontalStretchable (true ); 907 iconToolBar->setHorizontalStretchable (true );
901 //menuBar->insertItem( iconToolBar ); 908 //menuBar->insertItem( iconToolBar );
902 //xdays_action 909 //xdays_action
903 if (p-> mShowIconNewEvent) 910 if (p-> mShowIconNewEvent)
904 ne_action->addTo( iconToolBar ); 911 ne_action->addTo( iconToolBar );
905 if (p->mShowIconNewTodo ) 912 if (p->mShowIconNewTodo )
906 nt_action->addTo( iconToolBar ); 913 nt_action->addTo( iconToolBar );
907 if (p-> mShowIconSearch) 914 if (p-> mShowIconSearch)
908 search_action->addTo( iconToolBar ); 915 search_action->addTo( iconToolBar );
909 if (p-> mShowIconNext) 916 if (p-> mShowIconNext)
910 whatsnext_action->addTo( iconToolBar ); 917 whatsnext_action->addTo( iconToolBar );
911 if (p-> mShowIconNextDays) 918 if (p-> mShowIconNextDays)
912 xdays_action->addTo( iconToolBar ); 919 xdays_action->addTo( iconToolBar );
913 if (p-> mShowIconList) 920 if (p-> mShowIconList)
914 showlist_action->addTo( iconToolBar ); 921 showlist_action->addTo( iconToolBar );
915 if (p-> mShowIconDay1) 922 if (p-> mShowIconDay1)
916 day1_action->addTo( iconToolBar ); 923 day1_action->addTo( iconToolBar );
917 if (p-> mShowIconDay5) 924 if (p-> mShowIconDay5)
918 day5_action->addTo( iconToolBar ); 925 day5_action->addTo( iconToolBar );
919 if (p-> mShowIconDay7) 926 if (p-> mShowIconDay7)
920 day7_action->addTo( iconToolBar ); 927 day7_action->addTo( iconToolBar );
921 if (p-> mShowIconMonth) 928 if (p-> mShowIconMonth)
922 month_action->addTo( iconToolBar ); 929 month_action->addTo( iconToolBar );
923 if (p-> mShowIconTodoview) 930 if (p-> mShowIconTodoview)
924 todoview_action->addTo( iconToolBar ); 931 todoview_action->addTo( iconToolBar );
925 if (p-> mShowIconJournal) 932 if (p-> mShowIconJournal)
926 viewjournal_action->addTo( iconToolBar ); 933 viewjournal_action->addTo( iconToolBar );
927 icon = loadPixmap( pathString + "2leftarrowB" ); 934 icon = loadPixmap( pathString + "2leftarrowB" );
928 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 935 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
929 if (p-> mShowIconBackFast) { 936 if (p-> mShowIconBackFast) {
930 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 937 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
931 connect( action, SIGNAL( activated() ), 938 connect( action, SIGNAL( activated() ),
932 mView, SLOT( goPreviousMonth() ) ); 939 mView, SLOT( goPreviousMonth() ) );
933 action->addTo( iconToolBar ); 940 action->addTo( iconToolBar );
934 } 941 }
935 icon = loadPixmap( pathString + "1leftarrowB" ); 942 icon = loadPixmap( pathString + "1leftarrowB" );
936 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 943 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
937 if (p-> mShowIconBack) { 944 if (p-> mShowIconBack) {
938 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 945 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
939 connect( action, SIGNAL( activated() ), 946 connect( action, SIGNAL( activated() ),
940 mView, SLOT( goPrevious() ) ); 947 mView, SLOT( goPrevious() ) );
941 action->addTo( iconToolBar ); 948 action->addTo( iconToolBar );
942 } 949 }
943 if (p-> mShowIconToday) 950 if (p-> mShowIconToday)
944 today_action->addTo( iconToolBar ); 951 today_action->addTo( iconToolBar );
945 icon = loadPixmap( pathString + "1rightarrowB" ); 952 icon = loadPixmap( pathString + "1rightarrowB" );
946 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 953 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
947 if (p-> mShowIconForward) { 954 if (p-> mShowIconForward) {
948 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 955 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
949 connect( action, SIGNAL( activated() ), 956 connect( action, SIGNAL( activated() ),
950 mView, SLOT( goNext() ) ); 957 mView, SLOT( goNext() ) );
951 action->addTo( iconToolBar ); 958 action->addTo( iconToolBar );
952 } 959 }
953 icon = loadPixmap( pathString + "2rightarrowB" ); 960 icon = loadPixmap( pathString + "2rightarrowB" );
954 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 961 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
955 if (p-> mShowIconForwardFast) { 962 if (p-> mShowIconForwardFast) {
956 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 963 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
957 connect( action, SIGNAL( activated() ), 964 connect( action, SIGNAL( activated() ),
958 mView, SLOT( goNextMonth() ) ); 965 mView, SLOT( goNextMonth() ) );
959 action->addTo( iconToolBar ); 966 action->addTo( iconToolBar );
960 } 967 }
961 968
962 969
963 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 970 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
964 971
965 if (p-> mShowIconNewEvent) 972 if (p-> mShowIconNewEvent)
966 configureToolBarMenu->setItemChecked( 10, true ); 973 configureToolBarMenu->setItemChecked( 10, true );
967 if (p->mShowIconNewTodo ) 974 if (p->mShowIconNewTodo )
968 configureToolBarMenu->setItemChecked( 20, true ); 975 configureToolBarMenu->setItemChecked( 20, true );
969 if (p-> mShowIconSearch) 976 if (p-> mShowIconSearch)
970 configureToolBarMenu->setItemChecked( 120, true ); 977 configureToolBarMenu->setItemChecked( 120, true );
971 if (p-> mShowIconList) 978 if (p-> mShowIconList)
972 configureToolBarMenu->setItemChecked( 30, true ); 979 configureToolBarMenu->setItemChecked( 30, true );
973 if (p-> mShowIconDay1) 980 if (p-> mShowIconDay1)
974 configureToolBarMenu->setItemChecked( 40, true ); 981 configureToolBarMenu->setItemChecked( 40, true );
975 if (p-> mShowIconDay5) 982 if (p-> mShowIconDay5)
976 configureToolBarMenu->setItemChecked( 50, true ); 983 configureToolBarMenu->setItemChecked( 50, true );
977 if (p-> mShowIconDay7) 984 if (p-> mShowIconDay7)
978 configureToolBarMenu->setItemChecked( 60, true ); 985 configureToolBarMenu->setItemChecked( 60, true );
979 if (p-> mShowIconMonth) 986 if (p-> mShowIconMonth)
980 configureToolBarMenu->setItemChecked( 70, true ); 987 configureToolBarMenu->setItemChecked( 70, true );
981 if (p-> mShowIconTodoview) 988 if (p-> mShowIconTodoview)
982 configureToolBarMenu->setItemChecked( 80, true ); 989 configureToolBarMenu->setItemChecked( 80, true );
983 if (p-> mShowIconBackFast) 990 if (p-> mShowIconBackFast)
984 configureToolBarMenu->setItemChecked( 200, true ); 991 configureToolBarMenu->setItemChecked( 200, true );
985 if (p-> mShowIconBack) 992 if (p-> mShowIconBack)
986 configureToolBarMenu->setItemChecked( 210, true ); 993 configureToolBarMenu->setItemChecked( 210, true );
987 if (p-> mShowIconToday) 994 if (p-> mShowIconToday)
988 configureToolBarMenu->setItemChecked( 130, true ); 995 configureToolBarMenu->setItemChecked( 130, true );
989 if (p-> mShowIconForward) 996 if (p-> mShowIconForward)
990 configureToolBarMenu->setItemChecked( 220, true ); 997 configureToolBarMenu->setItemChecked( 220, true );
991 if (p-> mShowIconForwardFast) 998 if (p-> mShowIconForwardFast)
992 configureToolBarMenu->setItemChecked( 230, true ); 999 configureToolBarMenu->setItemChecked( 230, true );
993 if (p-> mShowIconNextDays) 1000 if (p-> mShowIconNextDays)
994 configureToolBarMenu->setItemChecked( 100, true ); 1001 configureToolBarMenu->setItemChecked( 100, true );
995 if (p-> mShowIconNext) 1002 if (p-> mShowIconNext)
996 configureToolBarMenu->setItemChecked( 110, true ); 1003 configureToolBarMenu->setItemChecked( 110, true );
997 if (p-> mShowIconJournal) 1004 if (p-> mShowIconJournal)
998 configureToolBarMenu->setItemChecked( 90, true ); 1005 configureToolBarMenu->setItemChecked( 90, true );
999 if (p-> mShowIconWhatsThis) 1006 if (p-> mShowIconWhatsThis)
1000 configureToolBarMenu->setItemChecked( 300, true ); 1007 configureToolBarMenu->setItemChecked( 300, true );
1001 1008
1002 QLabel* dummy = new QLabel( iconToolBar ); 1009 QLabel* dummy = new QLabel( iconToolBar );
1003 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1010 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1004 if (!p-> mShowIconStretch) 1011 if (!p-> mShowIconStretch)
1005 iconToolBar->setStretchableWidget ( dummy ) ; 1012 iconToolBar->setStretchableWidget ( dummy ) ;
1006 else 1013 else
1007 configureToolBarMenu->setItemChecked( 5, true ); 1014 configureToolBarMenu->setItemChecked( 5, true );
1008 if (p-> mShowIconWhatsThis) 1015 if (p-> mShowIconWhatsThis)
1009 QWhatsThis::whatsThisButton ( iconToolBar ); 1016 QWhatsThis::whatsThisButton ( iconToolBar );
1010 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1017 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1011 configureAgenda( p->mHourSize ); 1018 configureAgenda( p->mHourSize );
1012 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1019 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1013} 1020}
1014 1021
1015void MainWindow::exportToPhone( int mode ) 1022void MainWindow::exportToPhone( int mode )
1016{ 1023{
1017 1024
1018 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1025 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1019 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1026 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1020 KOex2phonePrefs ex2phone; 1027 KOex2phonePrefs ex2phone;
1021 1028
1022 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1029 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1023 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1030 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1024 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1031 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1025 if ( mode == 1 ) 1032 if ( mode == 1 )
1026 ex2phone.setCaption(i18n("Export complete calendar")); 1033 ex2phone.setCaption(i18n("Export complete calendar"));
1027 if ( mode == 2 ) 1034 if ( mode == 2 )
1028 ex2phone.setCaption(i18n("Export filtered calendar")); 1035 ex2phone.setCaption(i18n("Export filtered calendar"));
1029 1036
1030 if ( !ex2phone.exec() ) { 1037 if ( !ex2phone.exec() ) {
1031 return; 1038 return;
1032 } 1039 }
1033 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1040 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1034 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1041 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1035 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1042 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1036 1043
1037 int inFuture = 0; 1044 int inFuture = 0;
1038 if ( ex2phone.mWriteBackFuture->isChecked() ) 1045 if ( ex2phone.mWriteBackFuture->isChecked() )
1039 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1046 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1040 QPtrList<Incidence> delSel; 1047 QPtrList<Incidence> delSel;
1041 if ( mode == 1 ) 1048 if ( mode == 1 )
1042 delSel = mCalendar->rawIncidences(); 1049 delSel = mCalendar->rawIncidences();
1043 if ( mode == 2 ) 1050 if ( mode == 2 )
1044 delSel = mCalendar->incidences(); 1051 delSel = mCalendar->incidences();
1045 CalendarLocal* cal = new CalendarLocal(); 1052 CalendarLocal* cal = new CalendarLocal();
1046 cal->setLocalTime(); 1053 cal->setLocalTime();
1047 Incidence *incidence = delSel.first(); 1054 Incidence *incidence = delSel.first();
1048 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1055 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1049 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1056 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1050 while ( incidence ) { 1057 while ( incidence ) {
1051 if ( incidence->type() != "Journal" ) { 1058 if ( incidence->type() != "Journal" ) {
1052 bool add = true; 1059 bool add = true;
1053 if ( inFuture ) { 1060 if ( inFuture ) {
1054 QDateTime dt; 1061 QDateTime dt;
1055 if ( incidence->type() == "Todo" ) { 1062 if ( incidence->type() == "Todo" ) {
1056 Todo * t = (Todo*)incidence; 1063 Todo * t = (Todo*)incidence;
1057 if ( t->hasDueDate() ) 1064 if ( t->hasDueDate() )
1058 dt = t->dtDue(); 1065 dt = t->dtDue();
1059 else 1066 else
1060 dt = cur.addSecs( 62 ); 1067 dt = cur.addSecs( 62 );
1061 } 1068 }
1062 else { 1069 else {
1063 bool ok; 1070 bool ok;
1064 dt = incidence->getNextOccurence( cur, &ok ); 1071 dt = incidence->getNextOccurence( cur, &ok );
1065 if ( !ok ) 1072 if ( !ok )
1066 dt = cur.addSecs( -62 ); 1073 dt = cur.addSecs( -62 );
1067 } 1074 }
1068 if ( dt < cur || dt > end ) { 1075 if ( dt < cur || dt > end ) {
1069 add = false; 1076 add = false;
1070 } 1077 }
1071 } 1078 }
1072 if ( add ) { 1079 if ( add ) {
1073 Incidence *in = incidence->clone(); 1080 Incidence *in = incidence->clone();
1074 cal->addIncidence( in ); 1081 cal->addIncidence( in );
1075 } 1082 }
1076 } 1083 }
1077 incidence = delSel.next(); 1084 incidence = delSel.next();
1078 } 1085 }
1079 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1086 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1080 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1087 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1081 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1088 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1082 1089
1083 setCaption( i18n("Writing to phone...")); 1090 setCaption( i18n("Writing to phone..."));
1084 if ( PhoneFormat::writeToPhone( cal ) ) 1091 if ( PhoneFormat::writeToPhone( cal ) )
1085 setCaption( i18n("Export to phone successful!")); 1092 setCaption( i18n("Export to phone successful!"));
1086 else 1093 else
1087 setCaption( i18n("Error exporting to phone!")); 1094 setCaption( i18n("Error exporting to phone!"));
1088 delete cal; 1095 delete cal;
1089} 1096}
1090 1097
1091 1098
1092void MainWindow::setDefaultPreferences() 1099void MainWindow::setDefaultPreferences()
1093{ 1100{
1094 KOPrefs *p = KOPrefs::instance(); 1101 KOPrefs *p = KOPrefs::instance();
1095 1102
1096 p->mCompactDialogs = true; 1103 p->mCompactDialogs = true;
1097 p->mConfirm = true; 1104 p->mConfirm = true;
1098 // p->mEnableQuickTodo = false; 1105 // p->mEnableQuickTodo = false;
1099 1106
1100} 1107}
1101 1108
1102QString MainWindow::resourcePath() 1109QString MainWindow::resourcePath()
1103{ 1110{
1104 return KGlobal::iconLoader()->iconPath(); 1111 return KGlobal::iconLoader()->iconPath();
1105} 1112}
1106 1113
1107void MainWindow::displayText( QString text ,QString cap ) 1114void MainWindow::displayText( QString text ,QString cap )
1108{ 1115{
1109 QDialog dia( this, "name", true ); ; 1116 QDialog dia( this, "name", true ); ;
1110 dia.setCaption( cap ); 1117 dia.setCaption( cap );
1111 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1118 QVBoxLayout* lay = new QVBoxLayout( &dia );
1112 lay->setSpacing( 3 ); 1119 lay->setSpacing( 3 );
1113 lay->setMargin( 3 ); 1120 lay->setMargin( 3 );
1114 QTextBrowser tb ( &dia ); 1121 QTextBrowser tb ( &dia );
1115 lay->addWidget( &tb ); 1122 lay->addWidget( &tb );
1116 tb.setText( text ); 1123 tb.setText( text );
1117#ifdef DESKTOP_VERSION 1124#ifdef DESKTOP_VERSION
1118 dia.resize( 640, 480); 1125 dia.resize( 640, 480);
1119#else 1126#else
1120 dia.showMaximized(); 1127 dia.showMaximized();
1121#endif 1128#endif
1122 dia.exec(); 1129 dia.exec();
1123} 1130}
1124void MainWindow::displayFile( QString fn, QString cap ) 1131void MainWindow::displayFile( QString fn, QString cap )
1125{ 1132{
1126 QString fileName = resourcePath() + fn; 1133 QString fileName = resourcePath() + fn;
1127 QString text; 1134 QString text;
1128 QFile file( fileName ); 1135 QFile file( fileName );
1129 if (!file.open( IO_ReadOnly ) ) { 1136 if (!file.open( IO_ReadOnly ) ) {
1130 return ; 1137 return ;
1131 1138
1132 } 1139 }
1133 QTextStream ts( &file ); 1140 QTextStream ts( &file );
1134 text = ts.read(); 1141 text = ts.read();
1135 file.close(); 1142 file.close();
1136 displayText( text, cap); 1143 displayText( text, cap);
1137} 1144}
1138void MainWindow::features() 1145void MainWindow::features()
1139{ 1146{
1140 1147
1141 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1148 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1142} 1149}
1143 1150
1144void MainWindow::usertrans() 1151void MainWindow::usertrans()
1145{ 1152{
1146 1153
1147 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1154 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1148} 1155}
1149 1156
1157void MainWindow::kdesynchowto()
1158{
1159 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1160}
1161void MainWindow::multisynchowto()
1162{
1163 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1164}
1150void MainWindow::synchowto() 1165void MainWindow::synchowto()
1151{ 1166{
1152
1153 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1167 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1154} 1168}
1155void MainWindow::faq() 1169void MainWindow::faq()
1156{ 1170{
1157 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1171 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1158 1172
1159} 1173}
1160void MainWindow::whatsNew() 1174void MainWindow::whatsNew()
1161{ 1175{
1162 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1176 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1163 1177
1164} 1178}
1165void MainWindow::licence() 1179void MainWindow::licence()
1166{ 1180{
1167 KApplication::showLicence(); 1181 KApplication::showLicence();
1168 1182
1169} 1183}
1170void MainWindow::about() 1184void MainWindow::about()
1171{ 1185{
1172 QString version; 1186 QString version;
1173#include <../version> 1187#include <../version>
1174 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1188 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1175 i18n("KOrganizer/Platform-independent\n") + 1189 i18n("KOrganizer/Platform-independent\n") +
1176 "(KO/Pi) " + version + " - " + 1190 "(KO/Pi) " + version + " - " +
1177 1191
1178#ifdef DESKTOP_VERSION 1192#ifdef DESKTOP_VERSION
1179 i18n("Desktop Edition\n") + 1193 i18n("Desktop Edition\n") +
1180#else 1194#else
1181 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1195 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1182#endif 1196#endif
1183 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1197 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1184} 1198}
1185void MainWindow::keyBindings() 1199void MainWindow::keyBindings()
1186{ 1200{
1187 QString cap = i18n("Key bindings KOrganizer/Pi"); 1201 QString cap = i18n("Key bindings KOrganizer/Pi");
1188 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1202 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1189 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1203 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1190 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1204 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1191 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1205 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1192 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1206 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1193 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1207 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1194 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1208 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1195 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1209 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1196 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1210 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1197 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1211 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1198 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1212 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1199 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1213 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1200 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1214 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1201 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1215 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1202 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1216 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1203 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1217 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1204 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1218 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1205 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1219 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1206 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1220 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1207 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1221 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1208 i18n("<p><h3>In agenda view:</h3></p>\n") + 1222 i18n("<p><h3>In agenda view:</h3></p>\n") +
1209 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1223 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1210 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1224 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1211 i18n("<p><h3>In todo view:</h3></p>\n") + 1225 i18n("<p><h3>In todo view:</h3></p>\n") +
1212 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1226 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1213 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1227 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1214 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1228 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1215 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1229 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1216 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1230 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1217 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1231 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1218 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1232 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1219 i18n("<p><h3>In list view:</h3></p>\n") + 1233 i18n("<p><h3>In list view:</h3></p>\n") +
1220 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1234 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1221 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1235 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1222 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1236 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1223 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1237 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1224 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1238 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1225 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1239 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1226 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1240 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1227 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1241 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1228 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1242 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1229 i18n("<p><b>E</b>: Edit item</p>\n") + 1243 i18n("<p><b>E</b>: Edit item</p>\n") +
1230 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1244 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1231 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1245 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1232 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1246 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1233 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1247 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1234 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1248 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1235 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1249 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1236 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1250 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1237 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1251 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1238 i18n("<p><b>White</b>: Item readonly</p>\n"); 1252 i18n("<p><b>White</b>: Item readonly</p>\n");
1239 displayText( text, cap); 1253 displayText( text, cap);
1240 1254
1241} 1255}
1242void MainWindow::aboutAutoSaving() 1256void MainWindow::aboutAutoSaving()
1243{ 1257{
1244 QMessageBox* msg; 1258 QMessageBox* msg;
1245 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1259 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1246 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, 1260 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon,
1247 QMessageBox::Ok, 1261 QMessageBox::Ok,
1248 QMessageBox::NoButton, 1262 QMessageBox::NoButton,
1249 QMessageBox::NoButton); 1263 QMessageBox::NoButton);
1250 msg->exec(); 1264 msg->exec();
1251 delete msg; 1265 delete msg;
1252 1266
1253 1267
1254} 1268}
1255void MainWindow::aboutKnownBugs() 1269void MainWindow::aboutKnownBugs()
1256{ 1270{
1257 QMessageBox* msg; 1271 QMessageBox* msg;
1258 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1272 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1259 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1273 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1260 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1274 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1261 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1275 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1262 i18n("\nor report them in the bugtracker on\n") + 1276 i18n("\nor report them in the bugtracker on\n") +
1263 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1277 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1264 QMessageBox::NoIcon, 1278 QMessageBox::NoIcon,
1265 QMessageBox::Ok, 1279 QMessageBox::Ok,
1266 QMessageBox::NoButton, 1280 QMessageBox::NoButton,
1267 QMessageBox::NoButton); 1281 QMessageBox::NoButton);
1268 msg->exec(); 1282 msg->exec();
1269 delete msg; 1283 delete msg;
1270 1284
1271} 1285}
1272 1286
1273QString MainWindow::defaultFileName() 1287QString MainWindow::defaultFileName()
1274{ 1288{
1275 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1289 return locateLocal( "data", "korganizer/mycalendar.ics" );
1276} 1290}
1277QString MainWindow::syncFileName() 1291QString MainWindow::syncFileName()
1278{ 1292{
1279#ifdef DESKTOP_VERSION 1293#ifdef DESKTOP_VERSION
1280 return locateLocal( "tmp", "synccalendar.ics" ); 1294 return locateLocal( "tmp", "synccalendar.ics" );
1281#else 1295#else
1282 return QString( "/tmp/synccalendar.ics" ); 1296 return QString( "/tmp/synccalendar.ics" );
1283#endif 1297#endif
1284} 1298}
1285 1299
1286void MainWindow::processIncidenceSelection( Incidence *incidence ) 1300void MainWindow::processIncidenceSelection( Incidence *incidence )
1287{ 1301{
1288 if ( !incidence ) { 1302 if ( !incidence ) {
1289 enableIncidenceActions( false ); 1303 enableIncidenceActions( false );
1290 1304
1291 mNewSubTodoAction->setEnabled( false ); 1305 mNewSubTodoAction->setEnabled( false );
1292 setCaptionToDates(); 1306 setCaptionToDates();
1293 return; 1307 return;
1294 1308
1295 } 1309 }
1296 1310
1297 //KGlobal::locale()->formatDateTime(nextA, true); 1311 //KGlobal::locale()->formatDateTime(nextA, true);
1298 QString startString = ""; 1312 QString startString = "";
1299 if ( incidence->type() != "Todo" ) { 1313 if ( incidence->type() != "Todo" ) {
1300 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1314 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1301 if ( incidence->doesFloat() ) { 1315 if ( incidence->doesFloat() ) {
1302 startString += ": "+incidence->dtStartDateStr( true ); 1316 startString += ": "+incidence->dtStartDateStr( true );
1303 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1317 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1304 1318
1305 } else { 1319 } else {
1306 startString = ": "+incidence->dtStartStr(true); 1320 startString = ": "+incidence->dtStartStr(true);
1307 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1321 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1308 1322
1309 } 1323 }
1310 1324
1311 } else { 1325 } else {
1312 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1326 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1313 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1327 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1314 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1328 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1315 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1329 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1316 } 1330 }
1317 1331
1318 } 1332 }
1319 else 1333 else
1320 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1334 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1321 if ( !incidence->location().isEmpty() ) 1335 if ( !incidence->location().isEmpty() )
1322 startString += " (" +incidence->location()+")"; 1336 startString += " (" +incidence->location()+")";
1323 setCaption( incidence->summary()+startString); 1337 setCaption( incidence->summary()+startString);
1324 1338
1325 enableIncidenceActions( true ); 1339 enableIncidenceActions( true );
1326 1340
1327 if ( incidence->type() == "Event" ) { 1341 if ( incidence->type() == "Event" ) {
1328 mShowAction->setText( i18n("Show Event...") ); 1342 mShowAction->setText( i18n("Show Event...") );
1329 mEditAction->setText( i18n("Edit Event...") ); 1343 mEditAction->setText( i18n("Edit Event...") );
1330 mDeleteAction->setText( i18n("Delete Event...") ); 1344 mDeleteAction->setText( i18n("Delete Event...") );
1331 1345
1332 mNewSubTodoAction->setEnabled( false ); 1346 mNewSubTodoAction->setEnabled( false );
1333 } else if ( incidence->type() == "Todo" ) { 1347 } else if ( incidence->type() == "Todo" ) {
1334 mShowAction->setText( i18n("Show Todo...") ); 1348 mShowAction->setText( i18n("Show Todo...") );
1335 mEditAction->setText( i18n("Edit Todo...") ); 1349 mEditAction->setText( i18n("Edit Todo...") );
1336 mDeleteAction->setText( i18n("Delete Todo...") ); 1350 mDeleteAction->setText( i18n("Delete Todo...") );
1337 1351
1338 mNewSubTodoAction->setEnabled( true ); 1352 mNewSubTodoAction->setEnabled( true );
1339 } else { 1353 } else {
1340 mShowAction->setText( i18n("Show...") ); 1354 mShowAction->setText( i18n("Show...") );
1341 mShowAction->setText( i18n("Edit...") ); 1355 mShowAction->setText( i18n("Edit...") );
1342 mShowAction->setText( i18n("Delete...") ); 1356 mShowAction->setText( i18n("Delete...") );
1343 1357
1344 mNewSubTodoAction->setEnabled( false ); 1358 mNewSubTodoAction->setEnabled( false );
1345 } 1359 }
1346} 1360}
1347 1361
1348void MainWindow::enableIncidenceActions( bool enabled ) 1362void MainWindow::enableIncidenceActions( bool enabled )
1349{ 1363{
1350 mShowAction->setEnabled( enabled ); 1364 mShowAction->setEnabled( enabled );
1351 mEditAction->setEnabled( enabled ); 1365 mEditAction->setEnabled( enabled );
1352 mDeleteAction->setEnabled( enabled ); 1366 mDeleteAction->setEnabled( enabled );
1353 1367
1354 mCloneAction->setEnabled( enabled ); 1368 mCloneAction->setEnabled( enabled );
1355 mMoveAction->setEnabled( enabled ); 1369 mMoveAction->setEnabled( enabled );
1356 mBeamAction->setEnabled( enabled ); 1370 mBeamAction->setEnabled( enabled );
1357 mCancelAction->setEnabled( enabled ); 1371 mCancelAction->setEnabled( enabled );
1358} 1372}
1359 1373
1360void MainWindow::importOL() 1374void MainWindow::importOL()
1361{ 1375{
1362#ifdef _WIN32_ 1376#ifdef _WIN32_
1363 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1377 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1364 id->exec(); 1378 id->exec();
1365 delete id; 1379 delete id;
1366 mView->updateView(); 1380 mView->updateView();
1367#endif 1381#endif
1368} 1382}
1369void MainWindow::importBday() 1383void MainWindow::importBday()
1370{ 1384{
1371 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1385 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1372 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1386 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1373 i18n("Import!"), i18n("Cancel"), 0, 1387 i18n("Import!"), i18n("Cancel"), 0,
1374 0, 1 ); 1388 0, 1 );
1375 if ( result == 0 ) { 1389 if ( result == 0 ) {
1376 mView->importBday(); 1390 mView->importBday();
1377 1391
1378 } 1392 }
1379 1393
1380 1394
1381} 1395}
1382void MainWindow::importQtopia() 1396void MainWindow::importQtopia()
1383{ 1397{
1384#ifndef DESKTOP_VERSION 1398#ifndef DESKTOP_VERSION
1385 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1399 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1386 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1400 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1387 i18n("Import!"), i18n("Cancel"), 0, 1401 i18n("Import!"), i18n("Cancel"), 0,
1388 0, 1 ); 1402 0, 1 );
1389 if ( result == 0 ) { 1403 if ( result == 0 ) {
1390 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1404 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1391 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1405 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1392 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1406 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1393 mView->importQtopia( categories, datebook, todolist ); 1407 mView->importQtopia( categories, datebook, todolist );
1394 } 1408 }
1395#else 1409#else
1396 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1410 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1397 i18n("Not supported \non desktop!\n"), 1411 i18n("Not supported \non desktop!\n"),
1398 i18n("Ok"), i18n("Cancel"), 0, 1412 i18n("Ok"), i18n("Cancel"), 0,
1399 0, 1 ); 1413 0, 1 );
1400 1414
1401#endif 1415#endif
1402} 1416}
1403 1417
1404void MainWindow::saveOnClose() 1418void MainWindow::saveOnClose()
1405{ 1419{
1406 KOPrefs *p = KOPrefs::instance(); 1420 KOPrefs *p = KOPrefs::instance();
1407 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1421 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1408 p->mToolBarUp = iconToolBar->x() > width()/2 || 1422 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1409 iconToolBar->y() > height()/2; 1423 iconToolBar->y() > height()/2;
1410 mView->writeSettings(); 1424 mView->writeSettings();
1411 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1425 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1412 save(); 1426 save();
1413} 1427}
1414void MainWindow::slotModifiedChanged( bool changed ) 1428void MainWindow::slotModifiedChanged( bool changed )
1415{ 1429{
1416 if ( mBlockAtStartup ) 1430 if ( mBlockAtStartup )
1417 return; 1431 return;
1418 int msec; 1432 int msec;
1419 // we store the changes after 1 minute, 1433 // we store the changes after 1 minute,
1420 // and for safety reasons after 10 minutes again 1434 // and for safety reasons after 10 minutes again
1421 if ( !mSyncManager->blockSave() ) 1435 if ( !mSyncManager->blockSave() )
1422 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1436 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1423 else 1437 else
1424 msec = 1000 * 600; 1438 msec = 1000 * 600;
1425 mSaveTimer.start( msec, true ); // 1 minute 1439 mSaveTimer.start( msec, true ); // 1 minute
1426 qDebug("KO: Saving File in %d secs!", msec/1000); 1440 qDebug("KO: Saving File in %d secs!", msec/1000);
1427 mCalendarModifiedFlag = true; 1441 mCalendarModifiedFlag = true;
1428} 1442}
1429void MainWindow::save() 1443void MainWindow::save()
1430{ 1444{
1431 if ( mSyncManager->blockSave() ) 1445 if ( mSyncManager->blockSave() )
1432 return; 1446 return;
1433 mSyncManager->setBlockSave(true); 1447 mSyncManager->setBlockSave(true);
1434 if ( mView->checkFileVersion( defaultFileName()) ) { 1448 if ( mView->checkFileVersion( defaultFileName()) ) {
1435 1449
1436 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1450 QTime neededSaveTime = QDateTime::currentDateTime().time();
1437 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1451 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1438 qDebug("KO: Start saving data to file!"); 1452 qDebug("KO: Start saving data to file!");
1439 mView->saveCalendar( defaultFileName() ); 1453 mView->saveCalendar( defaultFileName() );
1440 1454
1441 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1455 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1442 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1456 qDebug("KO: Needed %d ms for saving.",msNeeded );
1443 QString savemes; 1457 QString savemes;
1444 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1458 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1445 setCaption(savemes); 1459 setCaption(savemes);
1446 } else 1460 } else
1447 setCaption(i18n("Saving cancelled!")); 1461 setCaption(i18n("Saving cancelled!"));
1448 mCalendarModifiedFlag = false; 1462 mCalendarModifiedFlag = false;
1449 mSyncManager->setBlockSave( false ); 1463 mSyncManager->setBlockSave( false );
1450} 1464}
1451 1465
1452void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1466void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1453{ 1467{
1454 if ( !e->isAutoRepeat() ) { 1468 if ( !e->isAutoRepeat() ) {
1455 mFlagKeyPressed = false; 1469 mFlagKeyPressed = false;
1456 } 1470 }
1457} 1471}
1458void MainWindow::keyPressEvent ( QKeyEvent * e ) 1472void MainWindow::keyPressEvent ( QKeyEvent * e )
1459{ 1473{
1460 qApp->processEvents(); 1474 qApp->processEvents();
1461 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1475 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1462 e->ignore(); 1476 e->ignore();
1463 // qDebug(" ignore %d",e->isAutoRepeat() ); 1477 // qDebug(" ignore %d",e->isAutoRepeat() );
1464 return; 1478 return;
1465 } 1479 }
1466 if (! e->isAutoRepeat() ) 1480 if (! e->isAutoRepeat() )
1467 mFlagKeyPressed = true; 1481 mFlagKeyPressed = true;
1468 KOPrefs *p = KOPrefs::instance(); 1482 KOPrefs *p = KOPrefs::instance();
1469 bool showSelectedDates = false; 1483 bool showSelectedDates = false;
1470 int size; 1484 int size;
1471 int pro = 0; 1485 int pro = 0;
1472 //qDebug("MainWindow::keyPressEvent "); 1486 //qDebug("MainWindow::keyPressEvent ");
1473 switch ( e->key() ) { 1487 switch ( e->key() ) {
1474 case Qt::Key_Right: 1488 case Qt::Key_Right:
1475 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1489 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1476 mView->goNextMonth(); 1490 mView->goNextMonth();
1477 else 1491 else
1478 mView->goNext(); 1492 mView->goNext();
1479 showSelectedDates = true; 1493 showSelectedDates = true;
1480 break; 1494 break;
1481 case Qt::Key_Left: 1495 case Qt::Key_Left:
1482 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1496 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1483 mView->goPreviousMonth(); 1497 mView->goPreviousMonth();
1484 else 1498 else
1485 mView->goPrevious(); 1499 mView->goPrevious();
1486 showSelectedDates = true; 1500 showSelectedDates = true;
1487 break; 1501 break;
1488 case Qt::Key_Down: 1502 case Qt::Key_Down:
1489 mView->viewManager()->agendaView()->scrollOneHourDown(); 1503 mView->viewManager()->agendaView()->scrollOneHourDown();
1490 break; 1504 break;
1491 case Qt::Key_Up: 1505 case Qt::Key_Up:
1492 mView->viewManager()->agendaView()->scrollOneHourUp(); 1506 mView->viewManager()->agendaView()->scrollOneHourUp();
1493 break; 1507 break;
1494 case Qt::Key_I: 1508 case Qt::Key_I:
1495 mView->showIncidence(); 1509 mView->showIncidence();
1496 break; 1510 break;
1497 case Qt::Key_Delete: 1511 case Qt::Key_Delete:
1498 case Qt::Key_Backspace: 1512 case Qt::Key_Backspace:
1499 mView->deleteIncidence(); 1513 mView->deleteIncidence();
1500 break; 1514 break;
1501 case Qt::Key_D: 1515 case Qt::Key_D:
1502 mView->viewManager()->showDayView(); 1516 mView->viewManager()->showDayView();
1503 showSelectedDates = true; 1517 showSelectedDates = true;
1504 break; 1518 break;
1505 case Qt::Key_O: 1519 case Qt::Key_O:
1506 mView->toggleFilerEnabled( ); 1520 mView->toggleFilerEnabled( );
1507 break; 1521 break;
1508 case Qt::Key_0: 1522 case Qt::Key_0:
1509 case Qt::Key_1: 1523 case Qt::Key_1:
1510 case Qt::Key_2: 1524 case Qt::Key_2:
1511 case Qt::Key_3: 1525 case Qt::Key_3:
1512 case Qt::Key_4: 1526 case Qt::Key_4:
1513 case Qt::Key_5: 1527 case Qt::Key_5:
1514 case Qt::Key_6: 1528 case Qt::Key_6:
1515 case Qt::Key_7: 1529 case Qt::Key_7:
1516 case Qt::Key_8: 1530 case Qt::Key_8:
1517 case Qt::Key_9: 1531 case Qt::Key_9:
1518 pro = e->key()-48; 1532 pro = e->key()-48;
1519 if ( pro == 0 ) 1533 if ( pro == 0 )
1520 pro = 10; 1534 pro = 10;
1521 if ( e->state() == Qt::ControlButton) 1535 if ( e->state() == Qt::ControlButton)
1522 pro += 10; 1536 pro += 10;
1523 break; 1537 break;
1524 case Qt::Key_M: 1538 case Qt::Key_M:
1525 mView->viewManager()->showMonthView(); 1539 mView->viewManager()->showMonthView();
1526 showSelectedDates = true; 1540 showSelectedDates = true;
1527 break; 1541 break;
1528 case Qt::Key_Insert: 1542 case Qt::Key_Insert:
1529 mView->newEvent(); 1543 mView->newEvent();
1530 break; 1544 break;
1531 case Qt::Key_S : 1545 case Qt::Key_S :
1532 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1546 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1533 mView->newSubTodo(); 1547 mView->newSubTodo();
1534 else 1548 else
1535 mView->dialogManager()->showSearchDialog(); 1549 mView->dialogManager()->showSearchDialog();
1536 break; 1550 break;
1537 case Qt::Key_Y : 1551 case Qt::Key_Y :
1538 case Qt::Key_Z : 1552 case Qt::Key_Z :
1539 mView->viewManager()->showWorkWeekView(); 1553 mView->viewManager()->showWorkWeekView();
1540 showSelectedDates = true; 1554 showSelectedDates = true;
1541 break; 1555 break;
1542 case Qt::Key_U : 1556 case Qt::Key_U :
1543 mView->viewManager()->showWeekView(); 1557 mView->viewManager()->showWeekView();
1544 showSelectedDates = true; 1558 showSelectedDates = true;
1545 break; 1559 break;
1546 case Qt::Key_H : 1560 case Qt::Key_H :
1547 keyBindings(); 1561 keyBindings();
1548 break; 1562 break;
1549 case Qt::Key_W: 1563 case Qt::Key_W:
1550 mView->viewManager()->showWhatsNextView(); 1564 mView->viewManager()->showWhatsNextView();
1551 break; 1565 break;
1552 case Qt::Key_L: 1566 case Qt::Key_L:
1553 mView->viewManager()->showListView(); 1567 mView->viewManager()->showListView();
1554 break; 1568 break;
1555 case Qt::Key_N: 1569 case Qt::Key_N:
1556 mView->viewManager()->showNextXView(); 1570 mView->viewManager()->showNextXView();
1557 showSelectedDates = true; 1571 showSelectedDates = true;
1558 break; 1572 break;
1559 case Qt::Key_V: 1573 case Qt::Key_V:
1560 mView->viewManager()->showTodoView(); 1574 mView->viewManager()->showTodoView();
1561 break; 1575 break;
1562 case Qt::Key_C: 1576 case Qt::Key_C:
1563 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1577 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1564 break; 1578 break;
1565 case Qt::Key_P: 1579 case Qt::Key_P:
1566 mView->showDatePicker( ); 1580 mView->showDatePicker( );
1567 break; 1581 break;
1568 case Qt::Key_F: 1582 case Qt::Key_F:
1569 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1583 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1570 mView->editFilters(); 1584 mView->editFilters();
1571 else 1585 else
1572 mView->toggleFilter(); 1586 mView->toggleFilter();
1573 break; 1587 break;
1574 case Qt::Key_X: 1588 case Qt::Key_X:
1575 mView->toggleDateNavigatorWidget(); 1589 mView->toggleDateNavigatorWidget();
1576 break; 1590 break;
1577 case Qt::Key_Space: 1591 case Qt::Key_Space:
1578 mView->toggleExpand(); 1592 mView->toggleExpand();
1579 break; 1593 break;
1580 case Qt::Key_A: 1594 case Qt::Key_A:
1581 mView->toggleAllDaySize(); 1595 mView->toggleAllDaySize();
1582 break; 1596 break;
1583 case Qt::Key_T: 1597 case Qt::Key_T:
1584 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1598 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1585 mView->newTodo(); 1599 mView->newTodo();
1586 else { 1600 else {
1587 mView->goToday(); 1601 mView->goToday();
1588 showSelectedDates = true; 1602 showSelectedDates = true;
1589 } 1603 }
1590 break; 1604 break;
1591 case Qt::Key_J: 1605 case Qt::Key_J:
1592 mView->viewManager()->showJournalView(); 1606 mView->viewManager()->showJournalView();
1593 break; 1607 break;
1594 case Qt::Key_B: 1608 case Qt::Key_B:
1595 mView->editIncidenceDescription();; 1609 mView->editIncidenceDescription();;
1596 break; 1610 break;
1597 // case Qt::Key_Return: 1611 // case Qt::Key_Return:
1598 case Qt::Key_E: 1612 case Qt::Key_E:
1599 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1613 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1600 mView->newEvent(); 1614 mView->newEvent();
1601 else 1615 else
1602 mView->editIncidence(); 1616 mView->editIncidence();
1603 break; 1617 break;
1604 case Qt::Key_Plus: 1618 case Qt::Key_Plus:
1605 size = p->mHourSize +2; 1619 size = p->mHourSize +2;
1606 if ( size <= 18 ) 1620 if ( size <= 18 )
1607 configureAgenda( size ); 1621 configureAgenda( size );
1608 break; 1622 break;
1609 case Qt::Key_Minus: 1623 case Qt::Key_Minus:
1610 size = p->mHourSize - 2; 1624 size = p->mHourSize - 2;
1611 if ( size >= 4 ) 1625 if ( size >= 4 )
1612 configureAgenda( size ); 1626 configureAgenda( size );
1613 break; 1627 break;
1614 1628
1615 1629
1616 default: 1630 default:
1617 e->ignore(); 1631 e->ignore();
1618 } 1632 }
1619 if ( pro > 0 ) { 1633 if ( pro > 0 ) {
1620 mView->selectFilter( pro-1 ); 1634 mView->selectFilter( pro-1 );
1621 } 1635 }
1622 if ( showSelectedDates ) { 1636 if ( showSelectedDates ) {
1623 ;// setCaptionToDates(); 1637 ;// setCaptionToDates();
1624 } 1638 }
1625 1639
1626} 1640}
1627 1641
1628void MainWindow::fillFilterMenu() 1642void MainWindow::fillFilterMenu()
1629{ 1643{
1630 selectFilterMenu->clear(); 1644 selectFilterMenu->clear();
1631 bool disable = false; 1645 bool disable = false;
1632 if ( mView->filterView()->filtersEnabled() ) { 1646 if ( mView->filterView()->filtersEnabled() ) {
1633 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1647 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 );
1634 } 1648 }
1635 else { 1649 else {
1636 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1650 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 );
1637 disable = true; 1651 disable = true;
1638 } 1652 }
1639 selectFilterMenu->insertSeparator(); 1653 selectFilterMenu->insertSeparator();
1640 QPtrList<CalFilter> fili = mView->filters(); 1654 QPtrList<CalFilter> fili = mView->filters();
1641 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1655 CalFilter *curfilter = mView->filterView()->selectedFilter();
1642 CalFilter *filter = fili.first(); 1656 CalFilter *filter = fili.first();
1643 int iii = 1; 1657 int iii = 1;
1644 while(filter) { 1658 while(filter) {
1645 selectFilterMenu->insertItem( filter->name(), iii ); 1659 selectFilterMenu->insertItem( filter->name(), iii );
1646 if ( filter == curfilter) 1660 if ( filter == curfilter)
1647 selectFilterMenu->setItemChecked( iii, true ); 1661 selectFilterMenu->setItemChecked( iii, true );
1648 if ( disable ) 1662 if ( disable )
1649 selectFilterMenu->setItemEnabled( iii, false ); 1663 selectFilterMenu->setItemEnabled( iii, false );
1650 filter = fili.next(); 1664 filter = fili.next();
1651 ++iii; 1665 ++iii;
1652 } 1666 }
1653} 1667}
1654void MainWindow::selectFilter( int fil ) 1668void MainWindow::selectFilter( int fil )
1655{ 1669{
1656 if ( fil == 0 ) { 1670 if ( fil == 0 ) {
1657 mView->toggleFilerEnabled( ); 1671 mView->toggleFilerEnabled( );
1658 } else { 1672 } else {
1659 mView->selectFilter( fil-1 ); 1673 mView->selectFilter( fil-1 );
1660 } 1674 }
1661} 1675}
1662void MainWindow::configureToolBar( int item ) 1676void MainWindow::configureToolBar( int item )
1663{ 1677{
1664 1678
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 0926313..ed65d36 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,138 +1,140 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qtextstream.h> 8#include <qtextstream.h>
9#include <qregexp.h> 9#include <qregexp.h>
10 10
11#include <libkcal/incidence.h> 11#include <libkcal/incidence.h>
12#include "simplealarmclient.h" 12#include "simplealarmclient.h"
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
16#endif 16#endif
17class QAction; 17class QAction;
18class CalendarView; 18class CalendarView;
19class KSyncProfile; 19class KSyncProfile;
20#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
21 21
22#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26 26
27 27
28namespace KCal { 28namespace KCal {
29class CalendarLocal; 29class CalendarLocal;
30} 30}
31 31
32using namespace KCal; 32using namespace KCal;
33 33
34class MainWindow : public QMainWindow 34class MainWindow : public QMainWindow
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 public: 37 public:
38 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 38 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
39 ~MainWindow(); 39 ~MainWindow();
40 bool beamReceiveEnabled(); 40 bool beamReceiveEnabled();
41 public slots: 41 public slots:
42 virtual void showMaximized (); 42 virtual void showMaximized ();
43 void configureAgenda( int ); 43 void configureAgenda( int );
44 void recieve( const QCString& msg, const QByteArray& data ); 44 void recieve( const QCString& msg, const QByteArray& data );
45 static QString defaultFileName(); 45 static QString defaultFileName();
46 static QString syncFileName(); 46 static QString syncFileName();
47 static QString resourcePath(); 47 static QString resourcePath();
48 protected slots: 48 protected slots:
49 void setCaptionToDates(); 49 void setCaptionToDates();
50 void about(); 50 void about();
51 void licence(); 51 void licence();
52 void faq(); 52 void faq();
53 void usertrans(); 53 void usertrans();
54 void features(); 54 void features();
55 void synchowto(); 55 void synchowto();
56 void kdesynchowto();
57 void multisynchowto();
56 void whatsNew(); 58 void whatsNew();
57 void keyBindings(); 59 void keyBindings();
58 void aboutAutoSaving();; 60 void aboutAutoSaving();;
59 void aboutKnownBugs(); 61 void aboutKnownBugs();
60 62
61 void processIncidenceSelection( Incidence * ); 63 void processIncidenceSelection( Incidence * );
62 64
63 void importQtopia(); 65 void importQtopia();
64 void importBday(); 66 void importBday();
65 void importOL(); 67 void importOL();
66 void importIcal(); 68 void importIcal();
67 void importFile( QString, bool ); 69 void importFile( QString, bool );
68 void quickImportIcal(); 70 void quickImportIcal();
69 71
70 void slotModifiedChanged( bool ); 72 void slotModifiedChanged( bool );
71 73
72 void save(); 74 void save();
73 void configureToolBar( int ); 75 void configureToolBar( int );
74 void printSel(); 76 void printSel();
75 void printCal(); 77 void printCal();
76 void saveCalendar(); 78 void saveCalendar();
77 void loadCalendar(); 79 void loadCalendar();
78 void exportVCalendar(); 80 void exportVCalendar();
79 void fillFilterMenu(); 81 void fillFilterMenu();
80 void selectFilter( int ); 82 void selectFilter( int );
81 void exportToPhone( int ); 83 void exportToPhone( int );
82 void toggleBeamReceive(); 84 void toggleBeamReceive();
83 void disableBR(bool); 85 void disableBR(bool);
84 86
85 87
86 protected: 88 protected:
87 void displayText( QString, QString); 89 void displayText( QString, QString);
88 void displayFile( QString, QString); 90 void displayFile( QString, QString);
89 91
90 void enableIncidenceActions( bool ); 92 void enableIncidenceActions( bool );
91 93
92 private slots: 94 private slots:
93 QSocket* piSocket; 95 QSocket* piSocket;
94 QString piFileString; 96 QString piFileString;
95 QTime piTime; 97 QTime piTime;
96 void getFile( bool ); 98 void getFile( bool );
97 void syncFileRequest(); 99 void syncFileRequest();
98 private: 100 private:
99 bool mBRdisabled; 101 bool mBRdisabled;
100#ifndef DESKTOP_VERSION 102#ifndef DESKTOP_VERSION
101 QCopChannel* infrared; 103 QCopChannel* infrared;
102#endif 104#endif
103 QAction* brAction; 105 QAction* brAction;
104 KSyncManager* mSyncManager; 106 KSyncManager* mSyncManager;
105 bool mClosed; 107 bool mClosed;
106 void saveOnClose(); 108 void saveOnClose();
107 bool mFlagKeyPressed; 109 bool mFlagKeyPressed;
108 bool mBlockAtStartup; 110 bool mBlockAtStartup;
109 QPEToolBar *iconToolBar; 111 QPEToolBar *iconToolBar;
110 void initActions(); 112 void initActions();
111 void setDefaultPreferences(); 113 void setDefaultPreferences();
112 void keyPressEvent ( QKeyEvent * ) ; 114 void keyPressEvent ( QKeyEvent * ) ;
113 void keyReleaseEvent ( QKeyEvent * ) ; 115 void keyReleaseEvent ( QKeyEvent * ) ;
114 QPopupMenu *configureToolBarMenu; 116 QPopupMenu *configureToolBarMenu;
115 QPopupMenu *selectFilterMenu; 117 QPopupMenu *selectFilterMenu;
116 QPopupMenu *configureAgendaMenu, *syncMenu; 118 QPopupMenu *configureAgendaMenu, *syncMenu;
117 CalendarLocal *mCalendar; 119 CalendarLocal *mCalendar;
118 CalendarView *mView; 120 CalendarView *mView;
119 QAction *mNewSubTodoAction; 121 QAction *mNewSubTodoAction;
120 122
121 QAction *mShowAction; 123 QAction *mShowAction;
122 QAction *mEditAction; 124 QAction *mEditAction;
123 QAction *mDeleteAction; 125 QAction *mDeleteAction;
124 QAction *mCloneAction; 126 QAction *mCloneAction;
125 QAction *mMoveAction; 127 QAction *mMoveAction;
126 QAction *mBeamAction; 128 QAction *mBeamAction;
127 QAction *mCancelAction; 129 QAction *mCancelAction;
128 130
129 void closeEvent( QCloseEvent* ce ); 131 void closeEvent( QCloseEvent* ce );
130 SimpleAlarmClient mAlarmClient; 132 SimpleAlarmClient mAlarmClient;
131 QTimer mSaveTimer; 133 QTimer mSaveTimer;
132 //bool mBlockSaveFlag; 134 //bool mBlockSaveFlag;
133 bool mCalendarModifiedFlag; 135 bool mCalendarModifiedFlag;
134 QPixmap loadPixmap( QString ); 136 QPixmap loadPixmap( QString );
135}; 137};
136 138
137 139
138#endif 140#endif