summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-05 08:32:25 (UTC)
committer zautrix <zautrix>2004-10-05 08:32:25 (UTC)
commit701cd3c2b2b713c12797f5bda24c35d3a7889539 (patch) (unidiff)
tree56d07b2f4a050fbc839ab6435b2266e8a52a08ba
parentad859d26b813101adab963f50e694961702561d9 (diff)
downloadkdepimpi-701cd3c2b2b713c12797f5bda24c35d3a7889539.zip
kdepimpi-701cd3c2b2b713c12797f5bda24c35d3a7889539.tar.gz
kdepimpi-701cd3c2b2b713c12797f5bda24c35d3a7889539.tar.bz2
warning dialog fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp17
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/mainwindow.cpp4
3 files changed, 17 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index fecc7e2..687943e 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -758,1545 +758,1558 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
758 if ( mode < SYNC_PREF_ASK ) 758 if ( mode < SYNC_PREF_ASK )
759 mode = SYNC_PREF_ASK; 759 mode = SYNC_PREF_ASK;
760 } else { 760 } else {
761 if ( localMod == remoteMod ) 761 if ( localMod == remoteMod )
762 if ( local->revision() == remote->revision() ) 762 if ( local->revision() == remote->revision() )
763 return 0; 763 return 0;
764 764
765 } 765 }
766 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 766 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
767 767
768 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 768 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
769 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 769 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
770 //full = true; //debug only 770 //full = true; //debug only
771 if ( full ) { 771 if ( full ) {
772 bool equ = false; 772 bool equ = false;
773 if ( local->type() == "Event" ) { 773 if ( local->type() == "Event" ) {
774 equ = (*((Event*) local) == *((Event*) remote)); 774 equ = (*((Event*) local) == *((Event*) remote));
775 } 775 }
776 else if ( local->type() =="Todo" ) 776 else if ( local->type() =="Todo" )
777 equ = (*((Todo*) local) == (*(Todo*) remote)); 777 equ = (*((Todo*) local) == (*(Todo*) remote));
778 else if ( local->type() =="Journal" ) 778 else if ( local->type() =="Journal" )
779 equ = (*((Journal*) local) == *((Journal*) remote)); 779 equ = (*((Journal*) local) == *((Journal*) remote));
780 if ( equ ) { 780 if ( equ ) {
781 //qDebug("equal "); 781 //qDebug("equal ");
782 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 782 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
783 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 783 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
784 } 784 }
785 if ( mode < SYNC_PREF_FORCE_LOCAL ) 785 if ( mode < SYNC_PREF_FORCE_LOCAL )
786 return 0; 786 return 0;
787 787
788 }//else //debug only 788 }//else //debug only
789 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 789 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
790 } 790 }
791 int result; 791 int result;
792 bool localIsNew; 792 bool localIsNew;
793 //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() ); 793 //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() );
794 794
795 if ( full && mode < SYNC_PREF_NEWEST ) 795 if ( full && mode < SYNC_PREF_NEWEST )
796 mode = SYNC_PREF_ASK; 796 mode = SYNC_PREF_ASK;
797 797
798 switch( mode ) { 798 switch( mode ) {
799 case SYNC_PREF_LOCAL: 799 case SYNC_PREF_LOCAL:
800 if ( lastSync > remoteMod ) 800 if ( lastSync > remoteMod )
801 return 1; 801 return 1;
802 if ( lastSync > localMod ) 802 if ( lastSync > localMod )
803 return 2; 803 return 2;
804 return 1; 804 return 1;
805 break; 805 break;
806 case SYNC_PREF_REMOTE: 806 case SYNC_PREF_REMOTE:
807 if ( lastSync > remoteMod ) 807 if ( lastSync > remoteMod )
808 return 1; 808 return 1;
809 if ( lastSync > localMod ) 809 if ( lastSync > localMod )
810 return 2; 810 return 2;
811 return 2; 811 return 2;
812 break; 812 break;
813 case SYNC_PREF_NEWEST: 813 case SYNC_PREF_NEWEST:
814 if ( localMod > remoteMod ) 814 if ( localMod > remoteMod )
815 return 1; 815 return 1;
816 else 816 else
817 return 2; 817 return 2;
818 break; 818 break;
819 case SYNC_PREF_ASK: 819 case SYNC_PREF_ASK:
820 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 820 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
821 if ( lastSync > remoteMod ) 821 if ( lastSync > remoteMod )
822 return 1; 822 return 1;
823 if ( lastSync > localMod ) 823 if ( lastSync > localMod )
824 return 2; 824 return 2;
825 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 825 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
826 localIsNew = localMod >= remoteMod; 826 localIsNew = localMod >= remoteMod;
827 if ( localIsNew ) 827 if ( localIsNew )
828 getEventViewerDialog()->setColorMode( 1 ); 828 getEventViewerDialog()->setColorMode( 1 );
829 else 829 else
830 getEventViewerDialog()->setColorMode( 2 ); 830 getEventViewerDialog()->setColorMode( 2 );
831 getEventViewerDialog()->setIncidence(local); 831 getEventViewerDialog()->setIncidence(local);
832 if ( localIsNew ) 832 if ( localIsNew )
833 getEventViewerDialog()->setColorMode( 2 ); 833 getEventViewerDialog()->setColorMode( 2 );
834 else 834 else
835 getEventViewerDialog()->setColorMode( 1 ); 835 getEventViewerDialog()->setColorMode( 1 );
836 getEventViewerDialog()->addIncidence(remote); 836 getEventViewerDialog()->addIncidence(remote);
837 getEventViewerDialog()->setColorMode( 0 ); 837 getEventViewerDialog()->setColorMode( 0 );
838 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 838 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
839 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 839 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
840 getEventViewerDialog()->showMe(); 840 getEventViewerDialog()->showMe();
841 result = getEventViewerDialog()->executeS( localIsNew ); 841 result = getEventViewerDialog()->executeS( localIsNew );
842 return result; 842 return result;
843 843
844 break; 844 break;
845 case SYNC_PREF_FORCE_LOCAL: 845 case SYNC_PREF_FORCE_LOCAL:
846 return 1; 846 return 1;
847 break; 847 break;
848 case SYNC_PREF_FORCE_REMOTE: 848 case SYNC_PREF_FORCE_REMOTE:
849 return 2; 849 return 2;
850 break; 850 break;
851 851
852 default: 852 default:
853 // SYNC_PREF_TAKE_BOTH not implemented 853 // SYNC_PREF_TAKE_BOTH not implemented
854 break; 854 break;
855 } 855 }
856 return 0; 856 return 0;
857} 857}
858Event* CalendarView::getLastSyncEvent() 858Event* CalendarView::getLastSyncEvent()
859{ 859{
860 Event* lse; 860 Event* lse;
861 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 861 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
862 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 862 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
863 if (!lse) { 863 if (!lse) {
864 lse = new Event(); 864 lse = new Event();
865 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 865 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
866 QString sum = ""; 866 QString sum = "";
867 if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 867 if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
868 sum = "E: "; 868 sum = "E: ";
869 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 869 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
870 lse->setDtStart( mLastCalendarSync ); 870 lse->setDtStart( mLastCalendarSync );
871 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 871 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
872 lse->setCategories( i18n("SyncEvent") ); 872 lse->setCategories( i18n("SyncEvent") );
873 lse->setReadOnly( true ); 873 lse->setReadOnly( true );
874 mCalendar->addEvent( lse ); 874 mCalendar->addEvent( lse );
875 } 875 }
876 876
877 return lse; 877 return lse;
878 878
879} 879}
880// probaly useless 880// probaly useless
881void CalendarView::setupExternSyncProfiles() 881void CalendarView::setupExternSyncProfiles()
882{ 882{
883 Event* lse; 883 Event* lse;
884 mExternLastSyncEvent.clear(); 884 mExternLastSyncEvent.clear();
885 int i; 885 int i;
886 for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { 886 for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) {
887 lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); 887 lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] );
888 if ( lse ) 888 if ( lse )
889 mExternLastSyncEvent.append( lse ); 889 mExternLastSyncEvent.append( lse );
890 else 890 else
891 qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); 891 qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1());
892 } 892 }
893 893
894} 894}
895// we check, if the to delete event has a id for a profile 895// we check, if the to delete event has a id for a profile
896// if yes, we set this id in the profile to delete 896// if yes, we set this id in the profile to delete
897void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 897void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
898{ 898{
899 if ( lastSync.count() == 0 ) { 899 if ( lastSync.count() == 0 ) {
900 //qDebug(" lastSync.count() == 0"); 900 //qDebug(" lastSync.count() == 0");
901 return; 901 return;
902 } 902 }
903 if ( toDelete->type() == "Journal" ) 903 if ( toDelete->type() == "Journal" )
904 return; 904 return;
905 905
906 Event* eve = lastSync.first(); 906 Event* eve = lastSync.first();
907 907
908 while ( eve ) { 908 while ( eve ) {
909 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 909 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
910 if ( !id.isEmpty() ) { 910 if ( !id.isEmpty() ) {
911 QString des = eve->description(); 911 QString des = eve->description();
912 QString pref = "e"; 912 QString pref = "e";
913 if ( toDelete->type() == "Todo" ) 913 if ( toDelete->type() == "Todo" )
914 pref = "t"; 914 pref = "t";
915 des += pref+ id + ","; 915 des += pref+ id + ",";
916 eve->setReadOnly( false ); 916 eve->setReadOnly( false );
917 eve->setDescription( des ); 917 eve->setDescription( des );
918 //qDebug("setdes %s ", des.latin1()); 918 //qDebug("setdes %s ", des.latin1());
919 eve->setReadOnly( true ); 919 eve->setReadOnly( true );
920 } 920 }
921 eve = lastSync.next(); 921 eve = lastSync.next();
922 } 922 }
923 923
924} 924}
925void CalendarView::checkExternalId( Incidence * inc ) 925void CalendarView::checkExternalId( Incidence * inc )
926{ 926{
927 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 927 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
928 checkExternSyncEvent( lastSync, inc ); 928 checkExternSyncEvent( lastSync, inc );
929 929
930} 930}
931bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 931bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
932{ 932{
933 bool syncOK = true; 933 bool syncOK = true;
934 int addedEvent = 0; 934 int addedEvent = 0;
935 int addedEventR = 0; 935 int addedEventR = 0;
936 int deletedEventR = 0; 936 int deletedEventR = 0;
937 int deletedEventL = 0; 937 int deletedEventL = 0;
938 int changedLocal = 0; 938 int changedLocal = 0;
939 int changedRemote = 0; 939 int changedRemote = 0;
940 //QPtrList<Event> el = local->rawEvents(); 940 //QPtrList<Event> el = local->rawEvents();
941 Event* eventR; 941 Event* eventR;
942 QString uid; 942 QString uid;
943 int take; 943 int take;
944 Event* eventL; 944 Event* eventL;
945 Event* eventRSync; 945 Event* eventRSync;
946 Event* eventLSync; 946 Event* eventLSync;
947 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 947 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
948 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 948 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
949 bool fullDateRange = false; 949 bool fullDateRange = false;
950 local->resetTempSyncStat(); 950 local->resetTempSyncStat();
951 mLastCalendarSync = QDateTime::currentDateTime(); 951 mLastCalendarSync = QDateTime::currentDateTime();
952 QDateTime modifiedCalendar = mLastCalendarSync;; 952 QDateTime modifiedCalendar = mLastCalendarSync;;
953 eventLSync = getLastSyncEvent(); 953 eventLSync = getLastSyncEvent();
954 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 954 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
955 if ( eventR ) { 955 if ( eventR ) {
956 eventRSync = (Event*) eventR->clone(); 956 eventRSync = (Event*) eventR->clone();
957 remote->deleteEvent(eventR ); 957 remote->deleteEvent(eventR );
958 958
959 } else { 959 } else {
960 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 960 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
961 eventRSync = (Event*)eventLSync->clone(); 961 eventRSync = (Event*)eventLSync->clone();
962 } else { 962 } else {
963 fullDateRange = true; 963 fullDateRange = true;
964 eventRSync = new Event(); 964 eventRSync = new Event();
965 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 965 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
966 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 966 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
967 eventRSync->setDtStart( mLastCalendarSync ); 967 eventRSync->setDtStart( mLastCalendarSync );
968 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 968 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
969 eventRSync->setCategories( i18n("SyncEvent") ); 969 eventRSync->setCategories( i18n("SyncEvent") );
970 } 970 }
971 } 971 }
972 if ( eventLSync->dtStart() == mLastCalendarSync ) 972 if ( eventLSync->dtStart() == mLastCalendarSync )
973 fullDateRange = true; 973 fullDateRange = true;
974 974
975 if ( ! fullDateRange ) { 975 if ( ! fullDateRange ) {
976 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 976 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
977 977
978 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 978 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
979 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 979 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
980 fullDateRange = true; 980 fullDateRange = true;
981 } 981 }
982 } 982 }
983 if ( fullDateRange ) 983 if ( fullDateRange )
984 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 984 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
985 else 985 else
986 mLastCalendarSync = eventLSync->dtStart(); 986 mLastCalendarSync = eventLSync->dtStart();
987 // for resyncing if own file has changed 987 // for resyncing if own file has changed
988 if ( mCurrentSyncDevice == "deleteaftersync" ) { 988 if ( mCurrentSyncDevice == "deleteaftersync" ) {
989 mLastCalendarSync = loadedFileVersion; 989 mLastCalendarSync = loadedFileVersion;
990 qDebug("setting mLastCalendarSync "); 990 qDebug("setting mLastCalendarSync ");
991 } 991 }
992 //qDebug("*************************** "); 992 //qDebug("*************************** ");
993 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); 993 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() );
994 QPtrList<Incidence> er = remote->rawIncidences(); 994 QPtrList<Incidence> er = remote->rawIncidences();
995 Incidence* inR = er.first(); 995 Incidence* inR = er.first();
996 Incidence* inL; 996 Incidence* inL;
997 QProgressBar bar( er.count(),0 ); 997 QProgressBar bar( er.count(),0 );
998 bar.setCaption (i18n("Syncing - close to abort!") ); 998 bar.setCaption (i18n("Syncing - close to abort!") );
999 999
1000 int w = 300; 1000 int w = 300;
1001 if ( QApplication::desktop()->width() < 320 ) 1001 if ( QApplication::desktop()->width() < 320 )
1002 w = 220; 1002 w = 220;
1003 int h = bar.sizeHint().height() ; 1003 int h = bar.sizeHint().height() ;
1004 int dw = QApplication::desktop()->width(); 1004 int dw = QApplication::desktop()->width();
1005 int dh = QApplication::desktop()->height(); 1005 int dh = QApplication::desktop()->height();
1006 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1006 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1007 bar.show(); 1007 bar.show();
1008 int modulo = (er.count()/10)+1; 1008 int modulo = (er.count()/10)+1;
1009 int incCounter = 0; 1009 int incCounter = 0;
1010 while ( inR ) { 1010 while ( inR ) {
1011 if ( ! bar.isVisible() ) 1011 if ( ! bar.isVisible() )
1012 return false; 1012 return false;
1013 if ( incCounter % modulo == 0 ) 1013 if ( incCounter % modulo == 0 )
1014 bar.setProgress( incCounter ); 1014 bar.setProgress( incCounter );
1015 ++incCounter; 1015 ++incCounter;
1016 uid = inR->uid(); 1016 uid = inR->uid();
1017 bool skipIncidence = false; 1017 bool skipIncidence = false;
1018 if ( uid.left(15) == QString("last-syncEvent-") ) 1018 if ( uid.left(15) == QString("last-syncEvent-") )
1019 skipIncidence = true; 1019 skipIncidence = true;
1020 QString idS; 1020 QString idS;
1021 qApp->processEvents(); 1021 qApp->processEvents();
1022 if ( !skipIncidence ) { 1022 if ( !skipIncidence ) {
1023 inL = local->incidence( uid ); 1023 inL = local->incidence( uid );
1024 if ( inL ) { // maybe conflict - same uid in both calendars 1024 if ( inL ) { // maybe conflict - same uid in both calendars
1025 int maxrev = inL->revision(); 1025 int maxrev = inL->revision();
1026 if ( maxrev < inR->revision() ) 1026 if ( maxrev < inR->revision() )
1027 maxrev = inR->revision(); 1027 maxrev = inR->revision();
1028 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1028 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1029 //qDebug("take %d %s ", take, inL->summary().latin1()); 1029 //qDebug("take %d %s ", take, inL->summary().latin1());
1030 if ( take == 3 ) 1030 if ( take == 3 )
1031 return false; 1031 return false;
1032 if ( take == 1 ) {// take local 1032 if ( take == 1 ) {// take local
1033 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1033 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1034 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1034 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1035 else 1035 else
1036 idS = inR->IDStr(); 1036 idS = inR->IDStr();
1037 remote->deleteIncidence( inR ); 1037 remote->deleteIncidence( inR );
1038 if ( inL->revision() < maxrev ) 1038 if ( inL->revision() < maxrev )
1039 inL->setRevision( maxrev ); 1039 inL->setRevision( maxrev );
1040 inR = inL->clone(); 1040 inR = inL->clone();
1041 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1041 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1042 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1042 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1043 inR->setIDStr( idS ); 1043 inR->setIDStr( idS );
1044 remote->addIncidence( inR ); 1044 remote->addIncidence( inR );
1045 ++changedRemote; 1045 ++changedRemote;
1046 } else { 1046 } else {
1047 if ( inR->revision() < maxrev ) 1047 if ( inR->revision() < maxrev )
1048 inR->setRevision( maxrev ); 1048 inR->setRevision( maxrev );
1049 idS = inL->IDStr(); 1049 idS = inL->IDStr();
1050 local->deleteIncidence( inL ); 1050 local->deleteIncidence( inL );
1051 inL = inR->clone(); 1051 inL = inR->clone();
1052 inL->setIDStr( idS ); 1052 inL->setIDStr( idS );
1053 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1053 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1054 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1054 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1055 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1055 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1056 } 1056 }
1057 local->addIncidence( inL ); 1057 local->addIncidence( inL );
1058 ++changedLocal; 1058 ++changedLocal;
1059 } 1059 }
1060 } 1060 }
1061 } else { // no conflict 1061 } else { // no conflict
1062 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1062 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1063 QString des = eventLSync->description(); 1063 QString des = eventLSync->description();
1064 QString pref = "e"; 1064 QString pref = "e";
1065 if ( inR->type() == "Todo" ) 1065 if ( inR->type() == "Todo" )
1066 pref = "t"; 1066 pref = "t";
1067 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1067 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1068 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1068 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1069 //remote->deleteIncidence( inR ); 1069 //remote->deleteIncidence( inR );
1070 ++deletedEventR; 1070 ++deletedEventR;
1071 } else { 1071 } else {
1072 inR->setLastModified( modifiedCalendar ); 1072 inR->setLastModified( modifiedCalendar );
1073 inL = inR->clone(); 1073 inL = inR->clone();
1074 local->addIncidence( inL ); 1074 local->addIncidence( inL );
1075 ++addedEvent; 1075 ++addedEvent;
1076 } 1076 }
1077 } else { 1077 } else {
1078 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1078 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1079 inR->setLastModified( modifiedCalendar ); 1079 inR->setLastModified( modifiedCalendar );
1080 local->addIncidence( inR->clone() ); 1080 local->addIncidence( inR->clone() );
1081 ++addedEvent; 1081 ++addedEvent;
1082 } else { 1082 } else {
1083 checkExternSyncEvent(eventRSyncSharp, inR); 1083 checkExternSyncEvent(eventRSyncSharp, inR);
1084 remote->deleteIncidence( inR ); 1084 remote->deleteIncidence( inR );
1085 ++deletedEventR; 1085 ++deletedEventR;
1086 } 1086 }
1087 } 1087 }
1088 } 1088 }
1089 } 1089 }
1090 inR = er.next(); 1090 inR = er.next();
1091 } 1091 }
1092 QPtrList<Incidence> el = local->rawIncidences(); 1092 QPtrList<Incidence> el = local->rawIncidences();
1093 inL = el.first(); 1093 inL = el.first();
1094 modulo = (el.count()/10)+1; 1094 modulo = (el.count()/10)+1;
1095 bar.setCaption (i18n("Add / remove events") ); 1095 bar.setCaption (i18n("Add / remove events") );
1096 bar.setTotalSteps ( el.count() ) ; 1096 bar.setTotalSteps ( el.count() ) ;
1097 bar.show(); 1097 bar.show();
1098 incCounter = 0; 1098 incCounter = 0;
1099 1099
1100 while ( inL ) { 1100 while ( inL ) {
1101 1101
1102 qApp->processEvents(); 1102 qApp->processEvents();
1103 if ( ! bar.isVisible() ) 1103 if ( ! bar.isVisible() )
1104 return false; 1104 return false;
1105 if ( incCounter % modulo == 0 ) 1105 if ( incCounter % modulo == 0 )
1106 bar.setProgress( incCounter ); 1106 bar.setProgress( incCounter );
1107 ++incCounter; 1107 ++incCounter;
1108 uid = inL->uid(); 1108 uid = inL->uid();
1109 bool skipIncidence = false; 1109 bool skipIncidence = false;
1110 if ( uid.left(15) == QString("last-syncEvent-") ) 1110 if ( uid.left(15) == QString("last-syncEvent-") )
1111 skipIncidence = true; 1111 skipIncidence = true;
1112 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1112 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1113 skipIncidence = true; 1113 skipIncidence = true;
1114 if ( !skipIncidence ) { 1114 if ( !skipIncidence ) {
1115 inR = remote->incidence( uid ); 1115 inR = remote->incidence( uid );
1116 if ( ! inR ) { 1116 if ( ! inR ) {
1117 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1117 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1118 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1118 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1119 checkExternSyncEvent(eventLSyncSharp, inL); 1119 checkExternSyncEvent(eventLSyncSharp, inL);
1120 local->deleteIncidence( inL ); 1120 local->deleteIncidence( inL );
1121 ++deletedEventL; 1121 ++deletedEventL;
1122 } else { 1122 } else {
1123 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1123 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1124 inL->removeID(mCurrentSyncDevice ); 1124 inL->removeID(mCurrentSyncDevice );
1125 ++addedEventR; 1125 ++addedEventR;
1126 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1126 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1127 inL->setLastModified( modifiedCalendar ); 1127 inL->setLastModified( modifiedCalendar );
1128 inR = inL->clone(); 1128 inR = inL->clone();
1129 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1129 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1130 remote->addIncidence( inR ); 1130 remote->addIncidence( inR );
1131 } 1131 }
1132 } 1132 }
1133 } else { 1133 } else {
1134 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1134 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1135 checkExternSyncEvent(eventLSyncSharp, inL); 1135 checkExternSyncEvent(eventLSyncSharp, inL);
1136 local->deleteIncidence( inL ); 1136 local->deleteIncidence( inL );
1137 ++deletedEventL; 1137 ++deletedEventL;
1138 } else { 1138 } else {
1139 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1139 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1140 ++addedEventR; 1140 ++addedEventR;
1141 inL->setLastModified( modifiedCalendar ); 1141 inL->setLastModified( modifiedCalendar );
1142 remote->addIncidence( inL->clone() ); 1142 remote->addIncidence( inL->clone() );
1143 } 1143 }
1144 } 1144 }
1145 } 1145 }
1146 } 1146 }
1147 } 1147 }
1148 inL = el.next(); 1148 inL = el.next();
1149 } 1149 }
1150 int delFut = 0; 1150 int delFut = 0;
1151 if ( KOPrefs::instance()->mWriteBackInFuture ) { 1151 if ( KOPrefs::instance()->mWriteBackInFuture ) {
1152 er = remote->rawIncidences(); 1152 er = remote->rawIncidences();
1153 inR = er.first(); 1153 inR = er.first();
1154 QDateTime dt; 1154 QDateTime dt;
1155 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1155 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1156 QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 ); 1156 QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 );
1157 while ( inR ) { 1157 while ( inR ) {
1158 if ( inR->type() == "Todo" ) { 1158 if ( inR->type() == "Todo" ) {
1159 Todo * t = (Todo*)inR; 1159 Todo * t = (Todo*)inR;
1160 if ( t->hasDueDate() ) 1160 if ( t->hasDueDate() )
1161 dt = t->dtDue(); 1161 dt = t->dtDue();
1162 else 1162 else
1163 dt = cur.addSecs( 62 ); 1163 dt = cur.addSecs( 62 );
1164 } 1164 }
1165 else if (inR->type() == "Event" ) { 1165 else if (inR->type() == "Event" ) {
1166 bool ok; 1166 bool ok;
1167 dt = inR->getNextOccurence( cur, &ok ); 1167 dt = inR->getNextOccurence( cur, &ok );
1168 if ( !ok ) 1168 if ( !ok )
1169 dt = cur.addSecs( -62 ); 1169 dt = cur.addSecs( -62 );
1170 } 1170 }
1171 else 1171 else
1172 dt = inR->dtStart(); 1172 dt = inR->dtStart();
1173 if ( dt < cur || dt > end ) { 1173 if ( dt < cur || dt > end ) {
1174 remote->deleteIncidence( inR ); 1174 remote->deleteIncidence( inR );
1175 ++delFut; 1175 ++delFut;
1176 } 1176 }
1177 inR = er.next(); 1177 inR = er.next();
1178 } 1178 }
1179 } 1179 }
1180 bar.hide(); 1180 bar.hide();
1181 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1181 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1182 eventLSync->setReadOnly( false ); 1182 eventLSync->setReadOnly( false );
1183 eventLSync->setDtStart( mLastCalendarSync ); 1183 eventLSync->setDtStart( mLastCalendarSync );
1184 eventRSync->setDtStart( mLastCalendarSync ); 1184 eventRSync->setDtStart( mLastCalendarSync );
1185 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1185 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1186 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1186 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1187 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1187 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1188 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1188 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1189 eventLSync->setReadOnly( true ); 1189 eventLSync->setReadOnly( true );
1190 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1190 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
1191 remote->addEvent( eventRSync ); 1191 remote->addEvent( eventRSync );
1192 QString mes; 1192 QString mes;
1193 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 ); 1193 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 );
1194 QString delmess; 1194 QString delmess;
1195 if ( delFut ) { 1195 if ( delFut ) {
1196 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); 1196 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture );
1197 mes += delmess; 1197 mes += delmess;
1198 } 1198 }
1199 if ( KOPrefs::instance()->mShowSyncSummary ) { 1199 if ( KOPrefs::instance()->mShowSyncSummary ) {
1200 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1200 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1201 } 1201 }
1202 qDebug( mes ); 1202 qDebug( mes );
1203 mCalendar->checkAlarmForIncidence( 0, true ); 1203 mCalendar->checkAlarmForIncidence( 0, true );
1204 return syncOK; 1204 return syncOK;
1205} 1205}
1206 1206
1207void CalendarView::setSyncDevice( QString s ) 1207void CalendarView::setSyncDevice( QString s )
1208{ 1208{
1209 mCurrentSyncDevice= s; 1209 mCurrentSyncDevice= s;
1210} 1210}
1211void CalendarView::setSyncName( QString s ) 1211void CalendarView::setSyncName( QString s )
1212{ 1212{
1213 mCurrentSyncName= s; 1213 mCurrentSyncName= s;
1214} 1214}
1215bool CalendarView::syncCalendar(QString filename, int mode) 1215bool CalendarView::syncCalendar(QString filename, int mode)
1216{ 1216{
1217 mGlobalSyncMode = SYNC_MODE_NORMAL; 1217 mGlobalSyncMode = SYNC_MODE_NORMAL;
1218 CalendarLocal* calendar = new CalendarLocal(); 1218 CalendarLocal* calendar = new CalendarLocal();
1219 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1219 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1220 FileStorage* storage = new FileStorage( calendar ); 1220 FileStorage* storage = new FileStorage( calendar );
1221 bool syncOK = false; 1221 bool syncOK = false;
1222 storage->setFileName( filename ); 1222 storage->setFileName( filename );
1223 // qDebug("loading ... "); 1223 // qDebug("loading ... ");
1224 if ( storage->load() ) { 1224 if ( storage->load() ) {
1225 getEventViewerDialog()->setSyncMode( true ); 1225 getEventViewerDialog()->setSyncMode( true );
1226 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1226 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1227 getEventViewerDialog()->setSyncMode( false ); 1227 getEventViewerDialog()->setSyncMode( false );
1228 if ( syncOK ) { 1228 if ( syncOK ) {
1229 if ( KOPrefs::instance()->mWriteBackFile ) 1229 if ( KOPrefs::instance()->mWriteBackFile )
1230 { 1230 {
1231 storage->setSaveFormat( new ICalFormat() ); 1231 storage->setSaveFormat( new ICalFormat() );
1232 storage->save(); 1232 storage->save();
1233 } 1233 }
1234 } 1234 }
1235 setModified( true ); 1235 setModified( true );
1236 } 1236 }
1237 delete storage; 1237 delete storage;
1238 delete calendar; 1238 delete calendar;
1239 if ( syncOK ) 1239 if ( syncOK )
1240 updateView(); 1240 updateView();
1241 return syncOK; 1241 return syncOK;
1242} 1242}
1243void CalendarView::syncPhone() 1243void CalendarView::syncPhone()
1244{ 1244{
1245 syncExternal( 1 ); 1245 syncExternal( 1 );
1246} 1246}
1247void CalendarView::syncExternal( int mode ) 1247void CalendarView::syncExternal( int mode )
1248{ 1248{
1249 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1249 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1250 //mCurrentSyncDevice = "sharp-DTM"; 1250 //mCurrentSyncDevice = "sharp-DTM";
1251 if ( KOPrefs::instance()->mAskForPreferences ) 1251 if ( KOPrefs::instance()->mAskForPreferences )
1252 edit_sync_options(); 1252 edit_sync_options();
1253 qApp->processEvents(); 1253 qApp->processEvents();
1254 CalendarLocal* calendar = new CalendarLocal(); 1254 CalendarLocal* calendar = new CalendarLocal();
1255 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1255 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1256 bool syncOK = false; 1256 bool syncOK = false;
1257 bool loadSuccess = false; 1257 bool loadSuccess = false;
1258 PhoneFormat* phoneFormat = 0; 1258 PhoneFormat* phoneFormat = 0;
1259#ifndef DESKTOP_VERSION 1259#ifndef DESKTOP_VERSION
1260 SharpFormat* sharpFormat = 0; 1260 SharpFormat* sharpFormat = 0;
1261 if ( mode == 0 ) { // sharp 1261 if ( mode == 0 ) { // sharp
1262 sharpFormat = new SharpFormat () ; 1262 sharpFormat = new SharpFormat () ;
1263 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1263 loadSuccess = sharpFormat->load( calendar, mCalendar );
1264 1264
1265 } else 1265 } else
1266#endif 1266#endif
1267 if ( mode == 1 ) { // phone 1267 if ( mode == 1 ) { // phone
1268 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1268 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1269 KOPrefs::instance()->mPhoneDevice, 1269 KOPrefs::instance()->mPhoneDevice,
1270 KOPrefs::instance()->mPhoneConnection, 1270 KOPrefs::instance()->mPhoneConnection,
1271 KOPrefs::instance()->mPhoneModel); 1271 KOPrefs::instance()->mPhoneModel);
1272 loadSuccess = phoneFormat->load( calendar,mCalendar); 1272 loadSuccess = phoneFormat->load( calendar,mCalendar);
1273 1273
1274 } else 1274 } else
1275 return; 1275 return;
1276 if ( loadSuccess ) { 1276 if ( loadSuccess ) {
1277 getEventViewerDialog()->setSyncMode( true ); 1277 getEventViewerDialog()->setSyncMode( true );
1278 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1278 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1279 getEventViewerDialog()->setSyncMode( false ); 1279 getEventViewerDialog()->setSyncMode( false );
1280 qApp->processEvents(); 1280 qApp->processEvents();
1281 if ( syncOK ) { 1281 if ( syncOK ) {
1282 if ( KOPrefs::instance()->mWriteBackFile ) 1282 if ( KOPrefs::instance()->mWriteBackFile )
1283 { 1283 {
1284 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1284 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1285 Incidence* inc = iL.first(); 1285 Incidence* inc = iL.first();
1286 if ( phoneFormat ) { 1286 if ( phoneFormat ) {
1287 while ( inc ) { 1287 while ( inc ) {
1288 inc->removeID(mCurrentSyncDevice); 1288 inc->removeID(mCurrentSyncDevice);
1289 inc = iL.next(); 1289 inc = iL.next();
1290 } 1290 }
1291 } 1291 }
1292#ifndef DESKTOP_VERSION 1292#ifndef DESKTOP_VERSION
1293 if ( sharpFormat ) 1293 if ( sharpFormat )
1294 sharpFormat->save(calendar); 1294 sharpFormat->save(calendar);
1295#endif 1295#endif
1296 if ( phoneFormat ) 1296 if ( phoneFormat )
1297 phoneFormat->save(calendar); 1297 phoneFormat->save(calendar);
1298 iL = calendar->rawIncidences(); 1298 iL = calendar->rawIncidences();
1299 inc = iL.first(); 1299 inc = iL.first();
1300 Incidence* loc; 1300 Incidence* loc;
1301 while ( inc ) { 1301 while ( inc ) {
1302 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1302 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1303 loc = mCalendar->incidence(inc->uid() ); 1303 loc = mCalendar->incidence(inc->uid() );
1304 if ( loc ) { 1304 if ( loc ) {
1305 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1305 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1306 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1306 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1307 } 1307 }
1308 } 1308 }
1309 inc = iL.next(); 1309 inc = iL.next();
1310 } 1310 }
1311 Incidence* lse = getLastSyncEvent(); 1311 Incidence* lse = getLastSyncEvent();
1312 if ( lse ) { 1312 if ( lse ) {
1313 lse->setReadOnly( false ); 1313 lse->setReadOnly( false );
1314 lse->setDescription( "" ); 1314 lse->setDescription( "" );
1315 lse->setReadOnly( true ); 1315 lse->setReadOnly( true );
1316 } 1316 }
1317 } 1317 }
1318 } 1318 }
1319 setModified( true ); 1319 setModified( true );
1320 } else { 1320 } else {
1321 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1321 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1322 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1322 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1323 question, i18n("Ok")) ; 1323 question, i18n("Ok")) ;
1324 1324
1325 } 1325 }
1326 delete calendar; 1326 delete calendar;
1327 updateView(); 1327 updateView();
1328 return ;//syncOK; 1328 return ;//syncOK;
1329 1329
1330} 1330}
1331void CalendarView::syncSharp() 1331void CalendarView::syncSharp()
1332{ 1332{
1333 syncExternal( 0 ); 1333 syncExternal( 0 );
1334 1334
1335} 1335}
1336 1336
1337 1337
1338//#include <kabc/stdaddressbook.h> 1338//#include <kabc/stdaddressbook.h>
1339bool CalendarView::importBday() 1339bool CalendarView::importBday()
1340{ 1340{
1341#if 0 1341#if 0
1342 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1342 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1343 KABC::AddressBook::Iterator it; 1343 KABC::AddressBook::Iterator it;
1344 int count = 0; 1344 int count = 0;
1345 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1345 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1346 ++count; 1346 ++count;
1347 } 1347 }
1348 QProgressBar bar(count,0 ); 1348 QProgressBar bar(count,0 );
1349 int w = 300; 1349 int w = 300;
1350 if ( QApplication::desktop()->width() < 320 ) 1350 if ( QApplication::desktop()->width() < 320 )
1351 w = 220; 1351 w = 220;
1352 int h = bar.sizeHint().height() ; 1352 int h = bar.sizeHint().height() ;
1353 int dw = QApplication::desktop()->width(); 1353 int dw = QApplication::desktop()->width();
1354 int dh = QApplication::desktop()->height(); 1354 int dh = QApplication::desktop()->height();
1355 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1355 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1356 bar.show(); 1356 bar.show();
1357 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1357 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1358 qApp->processEvents(); 1358 qApp->processEvents();
1359 count = 0; 1359 count = 0;
1360 int addCount = 0; 1360 int addCount = 0;
1361 KCal::Attendee* a = 0; 1361 KCal::Attendee* a = 0;
1362 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1362 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1363 if ( ! bar.isVisible() ) 1363 if ( ! bar.isVisible() )
1364 return false; 1364 return false;
1365 bar.setProgress( count++ ); 1365 bar.setProgress( count++ );
1366 qApp->processEvents(); 1366 qApp->processEvents();
1367 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1367 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1368 if ( (*it).birthday().date().isValid() ){ 1368 if ( (*it).birthday().date().isValid() ){
1369 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1369 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1370 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1370 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1371 ++addCount; 1371 ++addCount;
1372 } 1372 }
1373 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1373 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1374 if ( anni.isValid() ){ 1374 if ( anni.isValid() ){
1375 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1375 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1376 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1376 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1377 ++addCount; 1377 ++addCount;
1378 } 1378 }
1379 } 1379 }
1380 updateView(); 1380 updateView();
1381 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1381 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1382#endif 1382#endif
1383 return true; 1383 return true;
1384} 1384}
1385 1385
1386bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1386bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1387{ 1387{
1388 //qDebug("addAnni "); 1388 //qDebug("addAnni ");
1389 Event * ev = new Event(); 1389 Event * ev = new Event();
1390 if ( a ) { 1390 if ( a ) {
1391 ev->addAttendee( a ); 1391 ev->addAttendee( a );
1392 } 1392 }
1393 QString kind; 1393 QString kind;
1394 if ( birthday ) 1394 if ( birthday )
1395 kind = i18n( "Birthday" ); 1395 kind = i18n( "Birthday" );
1396 else 1396 else
1397 kind = i18n( "Anniversary" ); 1397 kind = i18n( "Anniversary" );
1398 ev->setSummary( name + " - " + kind ); 1398 ev->setSummary( name + " - " + kind );
1399 ev->setOrganizer( "nobody@nowhere" ); 1399 ev->setOrganizer( "nobody@nowhere" );
1400 ev->setCategories( kind ); 1400 ev->setCategories( kind );
1401 ev->setDtStart( QDateTime(date) ); 1401 ev->setDtStart( QDateTime(date) );
1402 ev->setDtEnd( QDateTime(date) ); 1402 ev->setDtEnd( QDateTime(date) );
1403 ev->setFloats( true ); 1403 ev->setFloats( true );
1404 Recurrence * rec = ev->recurrence(); 1404 Recurrence * rec = ev->recurrence();
1405 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1405 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1406 rec->addYearlyNum( date.month() ); 1406 rec->addYearlyNum( date.month() );
1407 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1407 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1408 delete ev; 1408 delete ev;
1409 return false; 1409 return false;
1410 } 1410 }
1411 return true; 1411 return true;
1412 1412
1413} 1413}
1414bool CalendarView::importQtopia( const QString &categories, 1414bool CalendarView::importQtopia( const QString &categories,
1415 const QString &datebook, 1415 const QString &datebook,
1416 const QString &todolist ) 1416 const QString &todolist )
1417{ 1417{
1418 1418
1419 QtopiaFormat qtopiaFormat; 1419 QtopiaFormat qtopiaFormat;
1420 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1420 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1421 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1421 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1422 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1422 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1423 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1423 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1424 1424
1425 updateView(); 1425 updateView();
1426 return true; 1426 return true;
1427 1427
1428#if 0 1428#if 0
1429 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1429 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1430 mCurrentSyncDevice = "qtopia-XML"; 1430 mCurrentSyncDevice = "qtopia-XML";
1431 if ( KOPrefs::instance()->mAskForPreferences ) 1431 if ( KOPrefs::instance()->mAskForPreferences )
1432 edit_sync_options(); 1432 edit_sync_options();
1433 qApp->processEvents(); 1433 qApp->processEvents();
1434 CalendarLocal* calendar = new CalendarLocal(); 1434 CalendarLocal* calendar = new CalendarLocal();
1435 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1435 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1436 bool syncOK = false; 1436 bool syncOK = false;
1437 QtopiaFormat qtopiaFormat; 1437 QtopiaFormat qtopiaFormat;
1438 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1438 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1439 bool loadOk = true; 1439 bool loadOk = true;
1440 if ( !categories.isEmpty() ) 1440 if ( !categories.isEmpty() )
1441 loadOk = qtopiaFormat.load( calendar, categories ); 1441 loadOk = qtopiaFormat.load( calendar, categories );
1442 if ( loadOk && !datebook.isEmpty() ) 1442 if ( loadOk && !datebook.isEmpty() )
1443 loadOk = qtopiaFormat.load( calendar, datebook ); 1443 loadOk = qtopiaFormat.load( calendar, datebook );
1444 if ( loadOk && !todolist.isEmpty() ) 1444 if ( loadOk && !todolist.isEmpty() )
1445 loadOk = qtopiaFormat.load( calendar, todolist ); 1445 loadOk = qtopiaFormat.load( calendar, todolist );
1446 1446
1447 if ( loadOk ) { 1447 if ( loadOk ) {
1448 getEventViewerDialog()->setSyncMode( true ); 1448 getEventViewerDialog()->setSyncMode( true );
1449 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1449 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1450 getEventViewerDialog()->setSyncMode( false ); 1450 getEventViewerDialog()->setSyncMode( false );
1451 qApp->processEvents(); 1451 qApp->processEvents();
1452 if ( syncOK ) { 1452 if ( syncOK ) {
1453 if ( KOPrefs::instance()->mWriteBackFile ) 1453 if ( KOPrefs::instance()->mWriteBackFile )
1454 { 1454 {
1455 // write back XML file 1455 // write back XML file
1456 1456
1457 } 1457 }
1458 setModified( true ); 1458 setModified( true );
1459 } 1459 }
1460 } else { 1460 } else {
1461 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1461 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1462 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1462 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1463 question, i18n("Ok")) ; 1463 question, i18n("Ok")) ;
1464 } 1464 }
1465 delete calendar; 1465 delete calendar;
1466 updateView(); 1466 updateView();
1467 return syncOK; 1467 return syncOK;
1468 1468
1469 1469
1470#endif 1470#endif
1471 1471
1472} 1472}
1473 1473
1474void CalendarView::setSyncEventsReadOnly() 1474void CalendarView::setSyncEventsReadOnly()
1475{ 1475{
1476 Event * ev; 1476 Event * ev;
1477 QPtrList<Event> eL = mCalendar->rawEvents(); 1477 QPtrList<Event> eL = mCalendar->rawEvents();
1478 ev = eL.first(); 1478 ev = eL.first();
1479 while ( ev ) { 1479 while ( ev ) {
1480 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1480 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1481 ev->setReadOnly( true ); 1481 ev->setReadOnly( true );
1482 ev = eL.next(); 1482 ev = eL.next();
1483 } 1483 }
1484} 1484}
1485bool CalendarView::openCalendar(QString filename, bool merge) 1485bool CalendarView::openCalendar(QString filename, bool merge)
1486{ 1486{
1487 1487
1488 if (filename.isEmpty()) { 1488 if (filename.isEmpty()) {
1489 return false; 1489 return false;
1490 } 1490 }
1491 1491
1492 if (!QFile::exists(filename)) { 1492 if (!QFile::exists(filename)) {
1493 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1493 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1494 return false; 1494 return false;
1495 } 1495 }
1496 1496
1497 globalFlagBlockAgenda = 1; 1497 globalFlagBlockAgenda = 1;
1498 if (!merge) mCalendar->close(); 1498 if (!merge) mCalendar->close();
1499 1499
1500 mStorage->setFileName( filename ); 1500 mStorage->setFileName( filename );
1501 1501
1502 if ( mStorage->load() ) { 1502 if ( mStorage->load() ) {
1503 if ( merge ) ;//setModified( true ); 1503 if ( merge ) ;//setModified( true );
1504 else { 1504 else {
1505 //setModified( true ); 1505 //setModified( true );
1506 mViewManager->setDocumentId( filename ); 1506 mViewManager->setDocumentId( filename );
1507 mDialogManager->setDocumentId( filename ); 1507 mDialogManager->setDocumentId( filename );
1508 mTodoList->setDocumentId( filename ); 1508 mTodoList->setDocumentId( filename );
1509 } 1509 }
1510 globalFlagBlockAgenda = 2; 1510 globalFlagBlockAgenda = 2;
1511 // if ( getLastSyncEvent() ) 1511 // if ( getLastSyncEvent() )
1512 // getLastSyncEvent()->setReadOnly( true ); 1512 // getLastSyncEvent()->setReadOnly( true );
1513 mCalendar->reInitAlarmSettings(); 1513 mCalendar->reInitAlarmSettings();
1514 setSyncEventsReadOnly(); 1514 setSyncEventsReadOnly();
1515 updateUnmanagedViews(); 1515 updateUnmanagedViews();
1516 updateView(); 1516 updateView();
1517 loadedFileVersion = QDateTime::currentDateTime(); 1517 loadedFileVersion = QDateTime::currentDateTime();
1518 if ( filename != MainWindow::defaultFileName() ) { 1518 if ( filename != MainWindow::defaultFileName() ) {
1519 saveCalendar( MainWindow::defaultFileName() ); 1519 saveCalendar( MainWindow::defaultFileName() );
1520 watchSavedFile(); 1520 watchSavedFile();
1521 } 1521 }
1522 return true; 1522 return true;
1523 } else { 1523 } else {
1524 // while failing to load, the calendar object could 1524 // while failing to load, the calendar object could
1525 // have become partially populated. Clear it out. 1525 // have become partially populated. Clear it out.
1526 if ( !merge ) mCalendar->close(); 1526 if ( !merge ) {
1527 mCalendar->close();
1528 mViewManager->setDocumentId( filename );
1529 mDialogManager->setDocumentId( filename );
1530 mTodoList->setDocumentId( filename );
1531 }
1527 1532
1528 KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1533 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1529 1534
1535 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1530 globalFlagBlockAgenda = 2; 1536 globalFlagBlockAgenda = 2;
1537 mCalendar->reInitAlarmSettings();
1538 setSyncEventsReadOnly();
1539 updateUnmanagedViews();
1531 updateView(); 1540 updateView();
1532 } 1541 }
1533 return false; 1542 return false;
1534} 1543}
1544void CalendarView::showOpenError()
1545{
1546 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
1547}
1535void CalendarView::setLoadedFileVersion(QDateTime dt) 1548void CalendarView::setLoadedFileVersion(QDateTime dt)
1536{ 1549{
1537 loadedFileVersion = dt; 1550 loadedFileVersion = dt;
1538} 1551}
1539bool CalendarView::checkFileChanged(QString fn) 1552bool CalendarView::checkFileChanged(QString fn)
1540{ 1553{
1541 QFileInfo finf ( fn ); 1554 QFileInfo finf ( fn );
1542 if ( !finf.exists() ) 1555 if ( !finf.exists() )
1543 return true; 1556 return true;
1544 QDateTime dt = finf.lastModified (); 1557 QDateTime dt = finf.lastModified ();
1545 if ( dt <= loadedFileVersion ) 1558 if ( dt <= loadedFileVersion )
1546 return false; 1559 return false;
1547 return true; 1560 return true;
1548 1561
1549} 1562}
1550void CalendarView::watchSavedFile() 1563void CalendarView::watchSavedFile()
1551{ 1564{
1552 QFileInfo finf ( MainWindow::defaultFileName()); 1565 QFileInfo finf ( MainWindow::defaultFileName());
1553 if ( !finf.exists() ) 1566 if ( !finf.exists() )
1554 return; 1567 return;
1555 QDateTime dt = finf.lastModified (); 1568 QDateTime dt = finf.lastModified ();
1556 if ( dt < loadedFileVersion ) { 1569 if ( dt < loadedFileVersion ) {
1557 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1570 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1558 return; 1571 return;
1559 } 1572 }
1560 loadedFileVersion = dt; 1573 loadedFileVersion = dt;
1561} 1574}
1562 1575
1563bool CalendarView::checkFileVersion(QString fn) 1576bool CalendarView::checkFileVersion(QString fn)
1564{ 1577{
1565 QFileInfo finf ( fn ); 1578 QFileInfo finf ( fn );
1566 if ( !finf.exists() ) 1579 if ( !finf.exists() )
1567 return true; 1580 return true;
1568 QDateTime dt = finf.lastModified (); 1581 QDateTime dt = finf.lastModified ();
1569 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1582 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1570 //qDebug("file on disk version %s",dt.toString().latin1()); 1583 //qDebug("file on disk version %s",dt.toString().latin1());
1571 if ( dt <= loadedFileVersion ) 1584 if ( dt <= loadedFileVersion )
1572 return true; 1585 return true;
1573 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)) , 1586 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)) ,
1574 i18n("KO/Pi Warning"),i18n("Overwrite"), 1587 i18n("KO/Pi Warning"),i18n("Overwrite"),
1575 i18n("Sync+save")); 1588 i18n("Sync+save"));
1576 1589
1577 if ( km == KMessageBox::Cancel ) 1590 if ( km == KMessageBox::Cancel )
1578 return false; 1591 return false;
1579 if ( km == KMessageBox::Yes ) 1592 if ( km == KMessageBox::Yes )
1580 return true; 1593 return true;
1581 1594
1582 setSyncDevice("deleteaftersync" ); 1595 setSyncDevice("deleteaftersync" );
1583 KOPrefs::instance()->mAskForPreferences = true; 1596 KOPrefs::instance()->mAskForPreferences = true;
1584 KOPrefs::instance()->mSyncAlgoPrefs = 3; 1597 KOPrefs::instance()->mSyncAlgoPrefs = 3;
1585 KOPrefs::instance()->mWriteBackFile = false; 1598 KOPrefs::instance()->mWriteBackFile = false;
1586 KOPrefs::instance()->mWriteBackExistingOnly = false; 1599 KOPrefs::instance()->mWriteBackExistingOnly = false;
1587 KOPrefs::instance()->mShowSyncSummary = false; 1600 KOPrefs::instance()->mShowSyncSummary = false;
1588 syncCalendar( fn, 3 ); 1601 syncCalendar( fn, 3 );
1589 Event * e = getLastSyncEvent(); 1602 Event * e = getLastSyncEvent();
1590 mCalendar->deleteEvent ( e ); 1603 mCalendar->deleteEvent ( e );
1591 updateView(); 1604 updateView();
1592 return true; 1605 return true;
1593} 1606}
1594 1607
1595bool CalendarView::saveCalendar( QString filename ) 1608bool CalendarView::saveCalendar( QString filename )
1596{ 1609{
1597 1610
1598 // Store back all unsaved data into calendar object 1611 // Store back all unsaved data into calendar object
1599 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1612 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1600 if ( mViewManager->currentView() ) 1613 if ( mViewManager->currentView() )
1601 mViewManager->currentView()->flushView(); 1614 mViewManager->currentView()->flushView();
1602 1615
1603 //mStorage->setFileName( filename ); 1616 //mStorage->setFileName( filename );
1604 1617
1605 mStorage->setSaveFormat( new ICalFormat() ); 1618 mStorage->setSaveFormat( new ICalFormat() );
1606 mStorage->setFileName( filename ); 1619 mStorage->setFileName( filename );
1607 bool success; 1620 bool success;
1608 success = mStorage->save(); 1621 success = mStorage->save();
1609 if ( !success ) { 1622 if ( !success ) {
1610 return false; 1623 return false;
1611 } 1624 }
1612 1625
1613 return true; 1626 return true;
1614} 1627}
1615 1628
1616void CalendarView::closeCalendar() 1629void CalendarView::closeCalendar()
1617{ 1630{
1618 1631
1619 // child windows no longer valid 1632 // child windows no longer valid
1620 emit closingDown(); 1633 emit closingDown();
1621 1634
1622 mCalendar->close(); 1635 mCalendar->close();
1623 setModified(false); 1636 setModified(false);
1624 updateView(); 1637 updateView();
1625} 1638}
1626 1639
1627void CalendarView::archiveCalendar() 1640void CalendarView::archiveCalendar()
1628{ 1641{
1629 mDialogManager->showArchiveDialog(); 1642 mDialogManager->showArchiveDialog();
1630} 1643}
1631 1644
1632 1645
1633void CalendarView::readSettings() 1646void CalendarView::readSettings()
1634{ 1647{
1635 1648
1636 1649
1637 // mViewManager->showAgendaView(); 1650 // mViewManager->showAgendaView();
1638 QString str; 1651 QString str;
1639 //qDebug("CalendarView::readSettings() "); 1652 //qDebug("CalendarView::readSettings() ");
1640 // read settings from the KConfig, supplying reasonable 1653 // read settings from the KConfig, supplying reasonable
1641 // defaults where none are to be found 1654 // defaults where none are to be found
1642 KConfig *config = KOGlobals::config(); 1655 KConfig *config = KOGlobals::config();
1643#ifndef KORG_NOSPLITTER 1656#ifndef KORG_NOSPLITTER
1644 config->setGroup("KOrganizer Geometry"); 1657 config->setGroup("KOrganizer Geometry");
1645 1658
1646 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1659 QValueList<int> sizes = config->readIntListEntry("Separator1");
1647 if (sizes.count() != 2) { 1660 if (sizes.count() != 2) {
1648 sizes << mDateNavigator->minimumSizeHint().width(); 1661 sizes << mDateNavigator->minimumSizeHint().width();
1649 sizes << 300; 1662 sizes << 300;
1650 } 1663 }
1651 mPanner->setSizes(sizes); 1664 mPanner->setSizes(sizes);
1652 1665
1653 sizes = config->readIntListEntry("Separator2"); 1666 sizes = config->readIntListEntry("Separator2");
1654 if ( ( mResourceView && sizes.count() == 4 ) || 1667 if ( ( mResourceView && sizes.count() == 4 ) ||
1655 ( !mResourceView && sizes.count() == 3 ) ) { 1668 ( !mResourceView && sizes.count() == 3 ) ) {
1656 mLeftSplitter->setSizes(sizes); 1669 mLeftSplitter->setSizes(sizes);
1657 } 1670 }
1658#endif 1671#endif
1659 globalFlagBlockAgenda = 1; 1672 globalFlagBlockAgenda = 1;
1660 mViewManager->showAgendaView(); 1673 mViewManager->showAgendaView();
1661 //mViewManager->readSettings( config ); 1674 //mViewManager->readSettings( config );
1662 mTodoList->restoreLayout(config,QString("Todo Layout")); 1675 mTodoList->restoreLayout(config,QString("Todo Layout"));
1663 readFilterSettings(config); 1676 readFilterSettings(config);
1664 config->setGroup( "Views" ); 1677 config->setGroup( "Views" );
1665 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1678 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1666 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1679 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1667 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1680 else if ( dateCount == 7 ) mNavigator->selectWeek();
1668 else mNavigator->selectDates( dateCount ); 1681 else mNavigator->selectDates( dateCount );
1669 // mViewManager->readSettings( config ); 1682 // mViewManager->readSettings( config );
1670 updateConfig(); 1683 updateConfig();
1671 globalFlagBlockAgenda = 2; 1684 globalFlagBlockAgenda = 2;
1672 mViewManager->readSettings( config ); 1685 mViewManager->readSettings( config );
1673#ifdef DESKTOP_VERSION 1686#ifdef DESKTOP_VERSION
1674 config->setGroup("WidgetLayout"); 1687 config->setGroup("WidgetLayout");
1675 QStringList list; 1688 QStringList list;
1676 list = config->readListEntry("MainLayout"); 1689 list = config->readListEntry("MainLayout");
1677 int x,y,w,h; 1690 int x,y,w,h;
1678 if ( ! list.isEmpty() ) { 1691 if ( ! list.isEmpty() ) {
1679 x = list[0].toInt(); 1692 x = list[0].toInt();
1680 y = list[1].toInt(); 1693 y = list[1].toInt();
1681 w = list[2].toInt(); 1694 w = list[2].toInt();
1682 h = list[3].toInt(); 1695 h = list[3].toInt();
1683 topLevelWidget()->setGeometry(x,y,w,h); 1696 topLevelWidget()->setGeometry(x,y,w,h);
1684 1697
1685 } else { 1698 } else {
1686 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1699 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1687 } 1700 }
1688 list = config->readListEntry("EditEventLayout"); 1701 list = config->readListEntry("EditEventLayout");
1689 if ( ! list.isEmpty() ) { 1702 if ( ! list.isEmpty() ) {
1690 x = list[0].toInt(); 1703 x = list[0].toInt();
1691 y = list[1].toInt(); 1704 y = list[1].toInt();
1692 w = list[2].toInt(); 1705 w = list[2].toInt();
1693 h = list[3].toInt(); 1706 h = list[3].toInt();
1694 mEventEditor->setGeometry(x,y,w,h); 1707 mEventEditor->setGeometry(x,y,w,h);
1695 1708
1696 } 1709 }
1697 list = config->readListEntry("EditTodoLayout"); 1710 list = config->readListEntry("EditTodoLayout");
1698 if ( ! list.isEmpty() ) { 1711 if ( ! list.isEmpty() ) {
1699 x = list[0].toInt(); 1712 x = list[0].toInt();
1700 y = list[1].toInt(); 1713 y = list[1].toInt();
1701 w = list[2].toInt(); 1714 w = list[2].toInt();
1702 h = list[3].toInt(); 1715 h = list[3].toInt();
1703 mTodoEditor->setGeometry(x,y,w,h); 1716 mTodoEditor->setGeometry(x,y,w,h);
1704 1717
1705 } 1718 }
1706 list = config->readListEntry("ViewerLayout"); 1719 list = config->readListEntry("ViewerLayout");
1707 if ( ! list.isEmpty() ) { 1720 if ( ! list.isEmpty() ) {
1708 x = list[0].toInt(); 1721 x = list[0].toInt();
1709 y = list[1].toInt(); 1722 y = list[1].toInt();
1710 w = list[2].toInt(); 1723 w = list[2].toInt();
1711 h = list[3].toInt(); 1724 h = list[3].toInt();
1712 getEventViewerDialog()->setGeometry(x,y,w,h); 1725 getEventViewerDialog()->setGeometry(x,y,w,h);
1713 } 1726 }
1714#endif 1727#endif
1715 1728
1716} 1729}
1717 1730
1718 1731
1719void CalendarView::writeSettings() 1732void CalendarView::writeSettings()
1720{ 1733{
1721 // kdDebug() << "CalendarView::writeSettings" << endl; 1734 // kdDebug() << "CalendarView::writeSettings" << endl;
1722 1735
1723 KConfig *config = KOGlobals::config(); 1736 KConfig *config = KOGlobals::config();
1724 1737
1725#ifndef KORG_NOSPLITTER 1738#ifndef KORG_NOSPLITTER
1726 config->setGroup("KOrganizer Geometry"); 1739 config->setGroup("KOrganizer Geometry");
1727 1740
1728 QValueList<int> list = mPanner->sizes(); 1741 QValueList<int> list = mPanner->sizes();
1729 config->writeEntry("Separator1",list); 1742 config->writeEntry("Separator1",list);
1730 1743
1731 list = mLeftSplitter->sizes(); 1744 list = mLeftSplitter->sizes();
1732 config->writeEntry("Separator2",list); 1745 config->writeEntry("Separator2",list);
1733#endif 1746#endif
1734 1747
1735 mViewManager->writeSettings( config ); 1748 mViewManager->writeSettings( config );
1736 mTodoList->saveLayout(config,QString("Todo Layout")); 1749 mTodoList->saveLayout(config,QString("Todo Layout"));
1737 mDialogManager->writeSettings( config ); 1750 mDialogManager->writeSettings( config );
1738 //KOPrefs::instance()->usrWriteConfig(); 1751 //KOPrefs::instance()->usrWriteConfig();
1739 KOPrefs::instance()->writeConfig(); 1752 KOPrefs::instance()->writeConfig();
1740 1753
1741 writeFilterSettings(config); 1754 writeFilterSettings(config);
1742 1755
1743 config->setGroup( "Views" ); 1756 config->setGroup( "Views" );
1744 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1757 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1745 1758
1746#ifdef DESKTOP_VERSION 1759#ifdef DESKTOP_VERSION
1747 config->setGroup("WidgetLayout"); 1760 config->setGroup("WidgetLayout");
1748 QStringList list ;//= config->readListEntry("MainLayout"); 1761 QStringList list ;//= config->readListEntry("MainLayout");
1749 int x,y,w,h; 1762 int x,y,w,h;
1750 QWidget* wid; 1763 QWidget* wid;
1751 wid = topLevelWidget(); 1764 wid = topLevelWidget();
1752 x = wid->geometry().x(); 1765 x = wid->geometry().x();
1753 y = wid->geometry().y(); 1766 y = wid->geometry().y();
1754 w = wid->width(); 1767 w = wid->width();
1755 h = wid->height(); 1768 h = wid->height();
1756 list.clear(); 1769 list.clear();
1757 list << QString::number( x ); 1770 list << QString::number( x );
1758 list << QString::number( y ); 1771 list << QString::number( y );
1759 list << QString::number( w ); 1772 list << QString::number( w );
1760 list << QString::number( h ); 1773 list << QString::number( h );
1761 config->writeEntry("MainLayout",list ); 1774 config->writeEntry("MainLayout",list );
1762 1775
1763 wid = mEventEditor; 1776 wid = mEventEditor;
1764 x = wid->geometry().x(); 1777 x = wid->geometry().x();
1765 y = wid->geometry().y(); 1778 y = wid->geometry().y();
1766 w = wid->width(); 1779 w = wid->width();
1767 h = wid->height(); 1780 h = wid->height();
1768 list.clear(); 1781 list.clear();
1769 list << QString::number( x ); 1782 list << QString::number( x );
1770 list << QString::number( y ); 1783 list << QString::number( y );
1771 list << QString::number( w ); 1784 list << QString::number( w );
1772 list << QString::number( h ); 1785 list << QString::number( h );
1773 config->writeEntry("EditEventLayout",list ); 1786 config->writeEntry("EditEventLayout",list );
1774 1787
1775 wid = mTodoEditor; 1788 wid = mTodoEditor;
1776 x = wid->geometry().x(); 1789 x = wid->geometry().x();
1777 y = wid->geometry().y(); 1790 y = wid->geometry().y();
1778 w = wid->width(); 1791 w = wid->width();
1779 h = wid->height(); 1792 h = wid->height();
1780 list.clear(); 1793 list.clear();
1781 list << QString::number( x ); 1794 list << QString::number( x );
1782 list << QString::number( y ); 1795 list << QString::number( y );
1783 list << QString::number( w ); 1796 list << QString::number( w );
1784 list << QString::number( h ); 1797 list << QString::number( h );
1785 config->writeEntry("EditTodoLayout",list ); 1798 config->writeEntry("EditTodoLayout",list );
1786 wid = getEventViewerDialog(); 1799 wid = getEventViewerDialog();
1787 x = wid->geometry().x(); 1800 x = wid->geometry().x();
1788 y = wid->geometry().y(); 1801 y = wid->geometry().y();
1789 w = wid->width(); 1802 w = wid->width();
1790 h = wid->height(); 1803 h = wid->height();
1791 list.clear(); 1804 list.clear();
1792 list << QString::number( x ); 1805 list << QString::number( x );
1793 list << QString::number( y ); 1806 list << QString::number( y );
1794 list << QString::number( w ); 1807 list << QString::number( w );
1795 list << QString::number( h ); 1808 list << QString::number( h );
1796 config->writeEntry("ViewerLayout",list ); 1809 config->writeEntry("ViewerLayout",list );
1797 wid = mDialogManager->getSearchDialog(); 1810 wid = mDialogManager->getSearchDialog();
1798 if ( wid ) { 1811 if ( wid ) {
1799 x = wid->geometry().x(); 1812 x = wid->geometry().x();
1800 y = wid->geometry().y(); 1813 y = wid->geometry().y();
1801 w = wid->width(); 1814 w = wid->width();
1802 h = wid->height(); 1815 h = wid->height();
1803 list.clear(); 1816 list.clear();
1804 list << QString::number( x ); 1817 list << QString::number( x );
1805 list << QString::number( y ); 1818 list << QString::number( y );
1806 list << QString::number( w ); 1819 list << QString::number( w );
1807 list << QString::number( h ); 1820 list << QString::number( h );
1808 config->writeEntry("SearchLayout",list ); 1821 config->writeEntry("SearchLayout",list );
1809 } 1822 }
1810#endif 1823#endif
1811 1824
1812 1825
1813 config->sync(); 1826 config->sync();
1814} 1827}
1815 1828
1816void CalendarView::readFilterSettings(KConfig *config) 1829void CalendarView::readFilterSettings(KConfig *config)
1817{ 1830{
1818 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1831 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1819 1832
1820 mFilters.clear(); 1833 mFilters.clear();
1821 1834
1822 config->setGroup("General"); 1835 config->setGroup("General");
1823 QStringList filterList = config->readListEntry("CalendarFilters"); 1836 QStringList filterList = config->readListEntry("CalendarFilters");
1824 1837
1825 QStringList::ConstIterator it = filterList.begin(); 1838 QStringList::ConstIterator it = filterList.begin();
1826 QStringList::ConstIterator end = filterList.end(); 1839 QStringList::ConstIterator end = filterList.end();
1827 while(it != end) { 1840 while(it != end) {
1828 // kdDebug() << " filter: " << (*it) << endl; 1841 // kdDebug() << " filter: " << (*it) << endl;
1829 1842
1830 CalFilter *filter; 1843 CalFilter *filter;
1831 filter = new CalFilter(*it); 1844 filter = new CalFilter(*it);
1832 config->setGroup("Filter_" + (*it)); 1845 config->setGroup("Filter_" + (*it));
1833 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1846 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1834 filter->setCriteria(config->readNumEntry("Criteria",0)); 1847 filter->setCriteria(config->readNumEntry("Criteria",0));
1835 filter->setCategoryList(config->readListEntry("CategoryList")); 1848 filter->setCategoryList(config->readListEntry("CategoryList"));
1836 mFilters.append(filter); 1849 mFilters.append(filter);
1837 1850
1838 ++it; 1851 ++it;
1839 } 1852 }
1840 1853
1841 if (mFilters.count() == 0) { 1854 if (mFilters.count() == 0) {
1842 CalFilter *filter = new CalFilter(i18n("Default")); 1855 CalFilter *filter = new CalFilter(i18n("Default"));
1843 mFilters.append(filter); 1856 mFilters.append(filter);
1844 } 1857 }
1845 mFilterView->updateFilters(); 1858 mFilterView->updateFilters();
1846 config->setGroup("FilterView"); 1859 config->setGroup("FilterView");
1847 1860
1848 mFilterView->blockSignals(true); 1861 mFilterView->blockSignals(true);
1849 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1862 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1850 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1863 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1851 mFilterView->blockSignals(false); 1864 mFilterView->blockSignals(false);
1852 // We do it manually to avoid it being done twice by the above calls 1865 // We do it manually to avoid it being done twice by the above calls
1853 updateFilter(); 1866 updateFilter();
1854} 1867}
1855 1868
1856void CalendarView::writeFilterSettings(KConfig *config) 1869void CalendarView::writeFilterSettings(KConfig *config)
1857{ 1870{
1858 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1871 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1859 1872
1860 QStringList filterList; 1873 QStringList filterList;
1861 1874
1862 CalFilter *filter = mFilters.first(); 1875 CalFilter *filter = mFilters.first();
1863 while(filter) { 1876 while(filter) {
1864 // kdDebug() << " fn: " << filter->name() << endl; 1877 // kdDebug() << " fn: " << filter->name() << endl;
1865 filterList << filter->name(); 1878 filterList << filter->name();
1866 config->setGroup("Filter_" + filter->name()); 1879 config->setGroup("Filter_" + filter->name());
1867 config->writeEntry("Criteria",filter->criteria()); 1880 config->writeEntry("Criteria",filter->criteria());
1868 config->writeEntry("CategoryList",filter->categoryList()); 1881 config->writeEntry("CategoryList",filter->categoryList());
1869 filter = mFilters.next(); 1882 filter = mFilters.next();
1870 } 1883 }
1871 config->setGroup("General"); 1884 config->setGroup("General");
1872 config->writeEntry("CalendarFilters",filterList); 1885 config->writeEntry("CalendarFilters",filterList);
1873 1886
1874 config->setGroup("FilterView"); 1887 config->setGroup("FilterView");
1875 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1888 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1876 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1889 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1877} 1890}
1878 1891
1879 1892
1880void CalendarView::goToday() 1893void CalendarView::goToday()
1881{ 1894{
1882 mNavigator->selectToday(); 1895 mNavigator->selectToday();
1883} 1896}
1884 1897
1885void CalendarView::goNext() 1898void CalendarView::goNext()
1886{ 1899{
1887 mNavigator->selectNext(); 1900 mNavigator->selectNext();
1888} 1901}
1889 1902
1890void CalendarView::goPrevious() 1903void CalendarView::goPrevious()
1891{ 1904{
1892 mNavigator->selectPrevious(); 1905 mNavigator->selectPrevious();
1893} 1906}
1894void CalendarView::goNextMonth() 1907void CalendarView::goNextMonth()
1895{ 1908{
1896 mNavigator->selectNextMonth(); 1909 mNavigator->selectNextMonth();
1897} 1910}
1898 1911
1899void CalendarView::goPreviousMonth() 1912void CalendarView::goPreviousMonth()
1900{ 1913{
1901 mNavigator->selectPreviousMonth(); 1914 mNavigator->selectPreviousMonth();
1902} 1915}
1903void CalendarView::writeLocale() 1916void CalendarView::writeLocale()
1904{ 1917{
1905 //KPimGlobalPrefs::instance()->setGlobalConfig(); 1918 //KPimGlobalPrefs::instance()->setGlobalConfig();
1906#if 0 1919#if 0
1907 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 1920 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
1908 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 1921 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
1909 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 1922 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
1910 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 1923 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
1911 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1924 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1912 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 1925 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
1913 dummy = KOPrefs::instance()->mUserDateFormatShort; 1926 dummy = KOPrefs::instance()->mUserDateFormatShort;
1914 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 1927 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
1915 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 1928 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
1916 KOPrefs::instance()->mDaylightsavingStart, 1929 KOPrefs::instance()->mDaylightsavingStart,
1917 KOPrefs::instance()->mDaylightsavingEnd ); 1930 KOPrefs::instance()->mDaylightsavingEnd );
1918 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 1931 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
1919#endif 1932#endif
1920} 1933}
1921void CalendarView::updateConfig() 1934void CalendarView::updateConfig()
1922{ 1935{
1923 writeLocale(); 1936 writeLocale();
1924 if ( KOPrefs::instance()->mUseAppColors ) 1937 if ( KOPrefs::instance()->mUseAppColors )
1925 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 1938 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
1926 emit configChanged(); 1939 emit configChanged();
1927 mTodoList->updateConfig(); 1940 mTodoList->updateConfig();
1928 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 1941 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
1929 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1942 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1930 // To make the "fill window" configurations work 1943 // To make the "fill window" configurations work
1931 //mViewManager->raiseCurrentView(); 1944 //mViewManager->raiseCurrentView();
1932} 1945}
1933 1946
1934 1947
1935void CalendarView::eventChanged(Event *event) 1948void CalendarView::eventChanged(Event *event)
1936{ 1949{
1937 changeEventDisplay(event,KOGlobals::EVENTEDITED); 1950 changeEventDisplay(event,KOGlobals::EVENTEDITED);
1938 //updateUnmanagedViews(); 1951 //updateUnmanagedViews();
1939} 1952}
1940 1953
1941void CalendarView::eventAdded(Event *event) 1954void CalendarView::eventAdded(Event *event)
1942{ 1955{
1943 changeEventDisplay(event,KOGlobals::EVENTADDED); 1956 changeEventDisplay(event,KOGlobals::EVENTADDED);
1944} 1957}
1945 1958
1946void CalendarView::eventToBeDeleted(Event *) 1959void CalendarView::eventToBeDeleted(Event *)
1947{ 1960{
1948 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 1961 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
1949} 1962}
1950 1963
1951void CalendarView::eventDeleted() 1964void CalendarView::eventDeleted()
1952{ 1965{
1953 changeEventDisplay(0,KOGlobals::EVENTDELETED); 1966 changeEventDisplay(0,KOGlobals::EVENTDELETED);
1954} 1967}
1955void CalendarView::changeTodoDisplay(Todo *which, int action) 1968void CalendarView::changeTodoDisplay(Todo *which, int action)
1956{ 1969{
1957 changeIncidenceDisplay((Incidence *)which, action); 1970 changeIncidenceDisplay((Incidence *)which, action);
1958 mDateNavigator->updateView(); //LR 1971 mDateNavigator->updateView(); //LR
1959 //mDialogManager->updateSearchDialog(); 1972 //mDialogManager->updateSearchDialog();
1960 1973
1961 if (which) { 1974 if (which) {
1962 mViewManager->updateWNview(); 1975 mViewManager->updateWNview();
1963 //mTodoList->updateView(); 1976 //mTodoList->updateView();
1964 } 1977 }
1965 1978
1966} 1979}
1967 1980
1968void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 1981void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
1969{ 1982{
1970 updateUnmanagedViews(); 1983 updateUnmanagedViews();
1971 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 1984 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
1972 if ( action == KOGlobals::EVENTDELETED ) { //delete 1985 if ( action == KOGlobals::EVENTDELETED ) { //delete
1973 mCalendar->checkAlarmForIncidence( 0, true ); 1986 mCalendar->checkAlarmForIncidence( 0, true );
1974 if ( mEventViewerDialog ) 1987 if ( mEventViewerDialog )
1975 mEventViewerDialog->hide(); 1988 mEventViewerDialog->hide();
1976 } 1989 }
1977 else 1990 else
1978 mCalendar->checkAlarmForIncidence( which , false ); 1991 mCalendar->checkAlarmForIncidence( which , false );
1979} 1992}
1980 1993
1981// most of the changeEventDisplays() right now just call the view's 1994// most of the changeEventDisplays() right now just call the view's
1982// total update mode, but they SHOULD be recoded to be more refresh-efficient. 1995// total update mode, but they SHOULD be recoded to be more refresh-efficient.
1983void CalendarView::changeEventDisplay(Event *which, int action) 1996void CalendarView::changeEventDisplay(Event *which, int action)
1984{ 1997{
1985 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 1998 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
1986 changeIncidenceDisplay((Incidence *)which, action); 1999 changeIncidenceDisplay((Incidence *)which, action);
1987 mDateNavigator->updateView(); 2000 mDateNavigator->updateView();
1988 //mDialogManager->updateSearchDialog(); 2001 //mDialogManager->updateSearchDialog();
1989 2002
1990 if (which) { 2003 if (which) {
1991 // If there is an event view visible update the display 2004 // If there is an event view visible update the display
1992 mViewManager->currentView()->changeEventDisplay(which,action); 2005 mViewManager->currentView()->changeEventDisplay(which,action);
1993 // TODO: check, if update needed 2006 // TODO: check, if update needed
1994 // if (which->getTodoStatus()) { 2007 // if (which->getTodoStatus()) {
1995 mTodoList->updateView(); 2008 mTodoList->updateView();
1996 // } 2009 // }
1997 } else { 2010 } else {
1998 mViewManager->currentView()->updateView(); 2011 mViewManager->currentView()->updateView();
1999 } 2012 }
2000} 2013}
2001 2014
2002 2015
2003void CalendarView::updateTodoViews() 2016void CalendarView::updateTodoViews()
2004{ 2017{
2005 2018
2006 mTodoList->updateView(); 2019 mTodoList->updateView();
2007 mViewManager->currentView()->updateView(); 2020 mViewManager->currentView()->updateView();
2008 2021
2009} 2022}
2010 2023
2011 2024
2012void CalendarView::updateView(const QDate &start, const QDate &end) 2025void CalendarView::updateView(const QDate &start, const QDate &end)
2013{ 2026{
2014 mTodoList->updateView(); 2027 mTodoList->updateView();
2015 mViewManager->updateView(start, end); 2028 mViewManager->updateView(start, end);
2016 //mDateNavigator->updateView(); 2029 //mDateNavigator->updateView();
2017} 2030}
2018 2031
2019void CalendarView::updateView() 2032void CalendarView::updateView()
2020{ 2033{
2021 DateList tmpList = mNavigator->selectedDates(); 2034 DateList tmpList = mNavigator->selectedDates();
2022 2035
2023 // We assume that the navigator only selects consecutive days. 2036 // We assume that the navigator only selects consecutive days.
2024 updateView( tmpList.first(), tmpList.last() ); 2037 updateView( tmpList.first(), tmpList.last() );
2025} 2038}
2026 2039
2027void CalendarView::updateUnmanagedViews() 2040void CalendarView::updateUnmanagedViews()
2028{ 2041{
2029 mDateNavigator->updateDayMatrix(); 2042 mDateNavigator->updateDayMatrix();
2030} 2043}
2031 2044
2032int CalendarView::msgItemDelete() 2045int CalendarView::msgItemDelete()
2033{ 2046{
2034 return KMessageBox::warningContinueCancel(this, 2047 return KMessageBox::warningContinueCancel(this,
2035 i18n("This item will be\npermanently deleted."), 2048 i18n("This item will be\npermanently deleted."),
2036 i18n("KO/Pi Confirmation"),i18n("Delete")); 2049 i18n("KO/Pi Confirmation"),i18n("Delete"));
2037} 2050}
2038 2051
2039 2052
2040void CalendarView::edit_cut() 2053void CalendarView::edit_cut()
2041{ 2054{
2042 Event *anEvent=0; 2055 Event *anEvent=0;
2043 2056
2044 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2057 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2045 2058
2046 if (mViewManager->currentView()->isEventView()) { 2059 if (mViewManager->currentView()->isEventView()) {
2047 if ( incidence && incidence->type() == "Event" ) { 2060 if ( incidence && incidence->type() == "Event" ) {
2048 anEvent = static_cast<Event *>(incidence); 2061 anEvent = static_cast<Event *>(incidence);
2049 } 2062 }
2050 } 2063 }
2051 2064
2052 if (!anEvent) { 2065 if (!anEvent) {
2053 KNotifyClient::beep(); 2066 KNotifyClient::beep();
2054 return; 2067 return;
2055 } 2068 }
2056 DndFactory factory( mCalendar ); 2069 DndFactory factory( mCalendar );
2057 factory.cutEvent(anEvent); 2070 factory.cutEvent(anEvent);
2058 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2071 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2059} 2072}
2060 2073
2061void CalendarView::edit_copy() 2074void CalendarView::edit_copy()
2062{ 2075{
2063 Event *anEvent=0; 2076 Event *anEvent=0;
2064 2077
2065 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2078 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2066 2079
2067 if (mViewManager->currentView()->isEventView()) { 2080 if (mViewManager->currentView()->isEventView()) {
2068 if ( incidence && incidence->type() == "Event" ) { 2081 if ( incidence && incidence->type() == "Event" ) {
2069 anEvent = static_cast<Event *>(incidence); 2082 anEvent = static_cast<Event *>(incidence);
2070 } 2083 }
2071 } 2084 }
2072 2085
2073 if (!anEvent) { 2086 if (!anEvent) {
2074 KNotifyClient::beep(); 2087 KNotifyClient::beep();
2075 return; 2088 return;
2076 } 2089 }
2077 DndFactory factory( mCalendar ); 2090 DndFactory factory( mCalendar );
2078 factory.copyEvent(anEvent); 2091 factory.copyEvent(anEvent);
2079} 2092}
2080 2093
2081void CalendarView::edit_paste() 2094void CalendarView::edit_paste()
2082{ 2095{
2083 QDate date = mNavigator->selectedDates().first(); 2096 QDate date = mNavigator->selectedDates().first();
2084 2097
2085 DndFactory factory( mCalendar ); 2098 DndFactory factory( mCalendar );
2086 Event *pastedEvent = factory.pasteEvent( date ); 2099 Event *pastedEvent = factory.pasteEvent( date );
2087 2100
2088 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2101 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2089} 2102}
2090 2103
2091void CalendarView::edit_options() 2104void CalendarView::edit_options()
2092{ 2105{
2093 mDialogManager->showOptionsDialog(); 2106 mDialogManager->showOptionsDialog();
2094 //writeSettings(); 2107 //writeSettings();
2095} 2108}
2096void CalendarView::edit_sync_options() 2109void CalendarView::edit_sync_options()
2097{ 2110{
2098 //mDialogManager->showSyncOptions(); 2111 //mDialogManager->showSyncOptions();
2099 //KOPrefs::instance()->mSyncAlgoPrefs 2112 //KOPrefs::instance()->mSyncAlgoPrefs
2100 QDialog dia( this, "dia", true ); 2113 QDialog dia( this, "dia", true );
2101 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); 2114 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
2102 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); 2115 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
2103 QVBoxLayout lay ( &dia ); 2116 QVBoxLayout lay ( &dia );
2104 lay.setSpacing( 2 ); 2117 lay.setSpacing( 2 );
2105 lay.setMargin( 3 ); 2118 lay.setMargin( 3 );
2106 lay.addWidget(&gr); 2119 lay.addWidget(&gr);
2107 QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); 2120 QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
2108 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); 2121 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
2109 QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); 2122 QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
2110 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); 2123 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
2111 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); 2124 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
2112 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); 2125 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
2113 //QRadioButton both( i18n("Take both on conflict"), &gr ); 2126 //QRadioButton both( i18n("Take both on conflict"), &gr );
2114 QPushButton pb ( "OK", &dia); 2127 QPushButton pb ( "OK", &dia);
2115 lay.addWidget( &pb ); 2128 lay.addWidget( &pb );
2116 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 2129 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
2117 switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { 2130 switch ( KOPrefs::instance()->mSyncAlgoPrefs ) {
2118 case 0: 2131 case 0:
2119 loc.setChecked( true); 2132 loc.setChecked( true);
2120 break; 2133 break;
2121 case 1: 2134 case 1:
2122 rem.setChecked( true ); 2135 rem.setChecked( true );
2123 break; 2136 break;
2124 case 2: 2137 case 2:
2125 newest.setChecked( true); 2138 newest.setChecked( true);
2126 break; 2139 break;
2127 case 3: 2140 case 3:
2128 ask.setChecked( true); 2141 ask.setChecked( true);
2129 break; 2142 break;
2130 case 4: 2143 case 4:
2131 f_loc.setChecked( true); 2144 f_loc.setChecked( true);
2132 break; 2145 break;
2133 case 5: 2146 case 5:
2134 f_rem.setChecked( true); 2147 f_rem.setChecked( true);
2135 break; 2148 break;
2136 case 6: 2149 case 6:
2137 // both.setChecked( true); 2150 // both.setChecked( true);
2138 break; 2151 break;
2139 default: 2152 default:
2140 break; 2153 break;
2141 } 2154 }
2142 if ( dia.exec() ) { 2155 if ( dia.exec() ) {
2143 KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; 2156 KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
2144 } 2157 }
2145 2158
2146} 2159}
2147 2160
2148void CalendarView::slotSelectPickerDate( QDate d) 2161void CalendarView::slotSelectPickerDate( QDate d)
2149{ 2162{
2150 mDateFrame->hide(); 2163 mDateFrame->hide();
2151 if ( mDatePickerMode == 1 ) { 2164 if ( mDatePickerMode == 1 ) {
2152 mNavigator->slotDaySelect( d ); 2165 mNavigator->slotDaySelect( d );
2153 } else if ( mDatePickerMode == 2 ) { 2166 } else if ( mDatePickerMode == 2 ) {
2154 if ( mMoveIncidence->type() == "Todo" ) { 2167 if ( mMoveIncidence->type() == "Todo" ) {
2155 Todo * to = (Todo *) mMoveIncidence; 2168 Todo * to = (Todo *) mMoveIncidence;
2156 QTime tim; 2169 QTime tim;
2157 if ( to->hasDueDate() ) 2170 if ( to->hasDueDate() )
2158 tim = to->dtDue().time(); 2171 tim = to->dtDue().time();
2159 else { 2172 else {
2160 tim = QTime ( 0,0,0 ); 2173 tim = QTime ( 0,0,0 );
2161 to->setFloats( true ); 2174 to->setFloats( true );
2162 to->setHasDueDate( true ); 2175 to->setHasDueDate( true );
2163 } 2176 }
2164 QDateTime dt ( d,tim ); 2177 QDateTime dt ( d,tim );
2165 to->setDtDue( dt ); 2178 to->setDtDue( dt );
2166 todoChanged( to ); 2179 todoChanged( to );
2167 } else { 2180 } else {
2168 QTime tim = mMoveIncidence->dtStart().time(); 2181 QTime tim = mMoveIncidence->dtStart().time();
2169 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2182 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2170 QDateTime dt ( d,tim ); 2183 QDateTime dt ( d,tim );
2171 mMoveIncidence->setDtStart( dt ); 2184 mMoveIncidence->setDtStart( dt );
2172 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2185 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2173 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2186 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2174 } 2187 }
2175 2188
2176 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2189 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2177 } 2190 }
2178} 2191}
2179 2192
2180void CalendarView::removeCategories() 2193void CalendarView::removeCategories()
2181{ 2194{
2182 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2195 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2183 QStringList catList = KOPrefs::instance()->mCustomCategories; 2196 QStringList catList = KOPrefs::instance()->mCustomCategories;
2184 QStringList catIncList; 2197 QStringList catIncList;
2185 QStringList newCatList; 2198 QStringList newCatList;
2186 Incidence* inc = incList.first(); 2199 Incidence* inc = incList.first();
2187 int i; 2200 int i;
2188 int count = 0; 2201 int count = 0;
2189 while ( inc ) { 2202 while ( inc ) {
2190 newCatList.clear(); 2203 newCatList.clear();
2191 catIncList = inc->categories() ; 2204 catIncList = inc->categories() ;
2192 for( i = 0; i< catIncList.count(); ++i ) { 2205 for( i = 0; i< catIncList.count(); ++i ) {
2193 if ( catList.contains (catIncList[i])) 2206 if ( catList.contains (catIncList[i]))
2194 newCatList.append( catIncList[i] ); 2207 newCatList.append( catIncList[i] );
2195 } 2208 }
2196 newCatList.sort(); 2209 newCatList.sort();
2197 inc->setCategories( newCatList.join(",") ); 2210 inc->setCategories( newCatList.join(",") );
2198 inc = incList.next(); 2211 inc = incList.next();
2199 } 2212 }
2200} 2213}
2201 2214
2202int CalendarView::addCategories() 2215int CalendarView::addCategories()
2203{ 2216{
2204 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2217 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2205 QStringList catList = KOPrefs::instance()->mCustomCategories; 2218 QStringList catList = KOPrefs::instance()->mCustomCategories;
2206 QStringList catIncList; 2219 QStringList catIncList;
2207 Incidence* inc = incList.first(); 2220 Incidence* inc = incList.first();
2208 int i; 2221 int i;
2209 int count = 0; 2222 int count = 0;
2210 while ( inc ) { 2223 while ( inc ) {
2211 catIncList = inc->categories() ; 2224 catIncList = inc->categories() ;
2212 for( i = 0; i< catIncList.count(); ++i ) { 2225 for( i = 0; i< catIncList.count(); ++i ) {
2213 if ( !catList.contains (catIncList[i])) { 2226 if ( !catList.contains (catIncList[i])) {
2214 catList.append( catIncList[i] ); 2227 catList.append( catIncList[i] );
2215 //qDebug("add cat %s ", catIncList[i].latin1()); 2228 //qDebug("add cat %s ", catIncList[i].latin1());
2216 ++count; 2229 ++count;
2217 } 2230 }
2218 } 2231 }
2219 inc = incList.next(); 2232 inc = incList.next();
2220 } 2233 }
2221 catList.sort(); 2234 catList.sort();
2222 KOPrefs::instance()->mCustomCategories = catList; 2235 KOPrefs::instance()->mCustomCategories = catList;
2223 return count; 2236 return count;
2224} 2237}
2225 2238
2226void CalendarView::manageCategories() 2239void CalendarView::manageCategories()
2227{ 2240{
2228 KOCatPrefs* cp = new KOCatPrefs(); 2241 KOCatPrefs* cp = new KOCatPrefs();
2229 cp->show(); 2242 cp->show();
2230 int w =cp->sizeHint().width() ; 2243 int w =cp->sizeHint().width() ;
2231 int h = cp->sizeHint().height() ; 2244 int h = cp->sizeHint().height() ;
2232 int dw = QApplication::desktop()->width(); 2245 int dw = QApplication::desktop()->width();
2233 int dh = QApplication::desktop()->height(); 2246 int dh = QApplication::desktop()->height();
2234 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2247 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2235 if ( !cp->exec() ) { 2248 if ( !cp->exec() ) {
2236 delete cp; 2249 delete cp;
2237 return; 2250 return;
2238 } 2251 }
2239 int count = 0; 2252 int count = 0;
2240 if ( cp->addCat() ) { 2253 if ( cp->addCat() ) {
2241 count = addCategories(); 2254 count = addCategories();
2242 if ( count ) { 2255 if ( count ) {
2243 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2256 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2244 writeSettings(); 2257 writeSettings();
2245 } 2258 }
2246 } else { 2259 } else {
2247 removeCategories(); 2260 removeCategories();
2248 updateView(); 2261 updateView();
2249 } 2262 }
2250 delete cp; 2263 delete cp;
2251} 2264}
2252 2265
2253void CalendarView::beamIncidence(Incidence * Inc) 2266void CalendarView::beamIncidence(Incidence * Inc)
2254{ 2267{
2255 QPtrList<Incidence> delSel ; 2268 QPtrList<Incidence> delSel ;
2256 delSel.append(Inc); 2269 delSel.append(Inc);
2257 beamIncidenceList( delSel ); 2270 beamIncidenceList( delSel );
2258} 2271}
2259void CalendarView::beamCalendar() 2272void CalendarView::beamCalendar()
2260{ 2273{
2261 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2274 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2262 //qDebug("beamCalendar() "); 2275 //qDebug("beamCalendar() ");
2263 beamIncidenceList( delSel ); 2276 beamIncidenceList( delSel );
2264} 2277}
2265void CalendarView::beamFilteredCalendar() 2278void CalendarView::beamFilteredCalendar()
2266{ 2279{
2267 QPtrList<Incidence> delSel = mCalendar->incidences(); 2280 QPtrList<Incidence> delSel = mCalendar->incidences();
2268 //qDebug("beamFilteredCalendar() "); 2281 //qDebug("beamFilteredCalendar() ");
2269 beamIncidenceList( delSel ); 2282 beamIncidenceList( delSel );
2270} 2283}
2271void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2284void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2272{ 2285{
2273 if ( beamDialog->exec () == QDialog::Rejected ) 2286 if ( beamDialog->exec () == QDialog::Rejected )
2274 return; 2287 return;
2275 2288
2276 QString fn = "/tmp/kopibeamfile"; 2289 QString fn = "/tmp/kopibeamfile";
2277 QString mes; 2290 QString mes;
2278 bool createbup = true; 2291 bool createbup = true;
2279 if ( createbup ) { 2292 if ( createbup ) {
2280 QString description = "\n"; 2293 QString description = "\n";
2281 CalendarLocal* cal = new CalendarLocal(); 2294 CalendarLocal* cal = new CalendarLocal();
2282 if ( beamDialog->beamLocal() ) 2295 if ( beamDialog->beamLocal() )
2283 cal->setLocalTime(); 2296 cal->setLocalTime();
2284 else 2297 else
2285 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2298 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
2286 Incidence *incidence = delSel.first(); 2299 Incidence *incidence = delSel.first();
2287 bool addText = false; 2300 bool addText = false;
2288 if ( delSel.count() < 10 ) 2301 if ( delSel.count() < 10 )
2289 addText = true; 2302 addText = true;
2290 else { 2303 else {
2291 description.sprintf(i18n(" %d items?"),delSel.count() ); 2304 description.sprintf(i18n(" %d items?"),delSel.count() );
2292 } 2305 }
2293 while ( incidence ) { 2306 while ( incidence ) {
2294 Incidence *in = incidence->clone(); 2307 Incidence *in = incidence->clone();
2295 if ( addText ) 2308 if ( addText )
2296 description += in->summary() + "\n"; 2309 description += in->summary() + "\n";
2297 cal->addIncidence( in ); 2310 cal->addIncidence( in );
2298 incidence = delSel.next(); 2311 incidence = delSel.next();
2299 } 2312 }
2300 if ( beamDialog->beamVcal() ) { 2313 if ( beamDialog->beamVcal() ) {
2301 fn += ".vcs"; 2314 fn += ".vcs";
2302 FileStorage storage( cal, fn, new VCalFormat ); 2315 FileStorage storage( cal, fn, new VCalFormat );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 355bb84..cd54685 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,591 +1,592 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42 42
43#include <korganizer/calendarviewbase.h> 43#include <korganizer/calendarviewbase.h>
44 44
45class QWidgetStack; 45class QWidgetStack;
46class QSplitter; 46class QSplitter;
47 47
48class CalPrinter; 48class CalPrinter;
49class KOFilterView; 49class KOFilterView;
50class KOViewManager; 50class KOViewManager;
51class KODialogManager; 51class KODialogManager;
52class KOTodoView; 52class KOTodoView;
53class KDateNavigator; 53class KDateNavigator;
54class DateNavigator; 54class DateNavigator;
55class KOIncidenceEditor; 55class KOIncidenceEditor;
56class KDatePicker; 56class KDatePicker;
57class ResourceView; 57class ResourceView;
58class NavigatorBar; 58class NavigatorBar;
59class KOEventEditor; 59class KOEventEditor;
60class KOTodoEditor ; 60class KOTodoEditor ;
61class KOEventViewerDialog; 61class KOEventViewerDialog;
62class KOBeamPrefs; 62class KOBeamPrefs;
63class KSyncProfile; 63class KSyncProfile;
64class AlarmDialog; 64class AlarmDialog;
65class KCal::Attendee; 65class KCal::Attendee;
66 66
67namespace KCal { class FileStorage; } 67namespace KCal { class FileStorage; }
68 68
69using namespace KCal; 69using namespace KCal;
70 70
71/** 71/**
72 This is the main calendar widget. It provides the different vies on t he 72 This is the main calendar widget. It provides the different vies on t he
73 calendar data as well as the date navigator. It also handles synchronisation 73 calendar data as well as the date navigator. It also handles synchronisation
74 of the different views and controls the different dialogs like preferences, 74 of the different views and controls the different dialogs like preferences,
75 event editor, search dialog etc. 75 event editor, search dialog etc.
76 76
77 @short main calendar view widget 77 @short main calendar view widget
78 @author Cornelius Schumacher 78 @author Cornelius Schumacher
79*/ 79*/
80class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer 80class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer
81{ 81{
82 Q_OBJECT 82 Q_OBJECT
83 public: 83 public:
84 /** 84 /**
85 Constructs a new calendar view widget. 85 Constructs a new calendar view widget.
86 86
87 @param calendar calendar document 87 @param calendar calendar document
88 @param parent parent window 88 @param parent parent window
89 @param name Qt internal widget object name 89 @param name Qt internal widget object name
90 */ 90 */
91 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 91 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
92 const char *name = 0 ); 92 const char *name = 0 );
93 CalendarView( Calendar *calendar, QWidget *parent = 0, 93 CalendarView( Calendar *calendar, QWidget *parent = 0,
94 const char *name = 0 ); 94 const char *name = 0 );
95 virtual ~CalendarView(); 95 virtual ~CalendarView();
96 96
97 Calendar *calendar() { return mCalendar; } 97 Calendar *calendar() { return mCalendar; }
98 98
99 KOViewManager *viewManager(); 99 KOViewManager *viewManager();
100 KODialogManager *dialogManager(); 100 KODialogManager *dialogManager();
101 101
102 QDate startDate(); 102 QDate startDate();
103 QDate endDate(); 103 QDate endDate();
104 104
105 QWidgetStack *viewStack(); 105 QWidgetStack *viewStack();
106 QWidget *leftFrame(); 106 QWidget *leftFrame();
107 NavigatorBar *navigatorBar(); 107 NavigatorBar *navigatorBar();
108 108
109 DateNavigator *dateNavigator(); 109 DateNavigator *dateNavigator();
110 KDateNavigator *dateNavigatorWidget(); 110 KDateNavigator *dateNavigatorWidget();
111 111
112 void addView(KOrg::BaseView *); 112 void addView(KOrg::BaseView *);
113 void showView(KOrg::BaseView *); 113 void showView(KOrg::BaseView *);
114 KOEventViewerDialog* getEventViewerDialog(); 114 KOEventViewerDialog* getEventViewerDialog();
115 Incidence *currentSelection(); 115 Incidence *currentSelection();
116 void setupExternSyncProfiles(); 116 void setupExternSyncProfiles();
117 117
118 signals: 118 signals:
119 /** This todo has been modified */ 119 /** This todo has been modified */
120 void todoModified(Todo *, int); 120 void todoModified(Todo *, int);
121 121
122 /** when change is made to options dialog, the topwidget will catch this 122 /** when change is made to options dialog, the topwidget will catch this
123 * and emit this signal which notifies all widgets which have registered 123 * and emit this signal which notifies all widgets which have registered
124 * for notification to update their settings. */ 124 * for notification to update their settings. */
125 void configChanged(); 125 void configChanged();
126 /** emitted when the topwidget is closing down, so that any attached 126 /** emitted when the topwidget is closing down, so that any attached
127 child windows can also close. */ 127 child windows can also close. */
128 void closingDown(); 128 void closingDown();
129 /** emitted right before we die */ 129 /** emitted right before we die */
130 void closed(QWidget *); 130 void closed(QWidget *);
131 131
132 /** Emitted when state of modified flag changes */ 132 /** Emitted when state of modified flag changes */
133 void modifiedChanged(bool); 133 void modifiedChanged(bool);
134 void signalmodified(); 134 void signalmodified();
135 135
136 /** Emitted when state of read-only flag changes */ 136 /** Emitted when state of read-only flag changes */
137 void readOnlyChanged(bool); 137 void readOnlyChanged(bool);
138 138
139 /** Emitted when the unit of navigation changes */ 139 /** Emitted when the unit of navigation changes */
140 void changeNavStringPrev(const QString &); 140 void changeNavStringPrev(const QString &);
141 void changeNavStringNext(const QString &); 141 void changeNavStringNext(const QString &);
142 142
143 /** Emitted when state of events selection has changed and user is organizer*/ 143 /** Emitted when state of events selection has changed and user is organizer*/
144 void organizerEventsSelected(bool); 144 void organizerEventsSelected(bool);
145 /** Emitted when state of events selection has changed and user is attendee*/ 145 /** Emitted when state of events selection has changed and user is attendee*/
146 void groupEventsSelected(bool); 146 void groupEventsSelected(bool);
147 /** 147 /**
148 Emitted when an incidence gets selected. If the selection is cleared the 148 Emitted when an incidence gets selected. If the selection is cleared the
149 signal is emitted with 0 as argument. 149 signal is emitted with 0 as argument.
150 */ 150 */
151 void incidenceSelected( Incidence * ); 151 void incidenceSelected( Incidence * );
152 /** Emitted, when a todoitem is selected or deselected. */ 152 /** Emitted, when a todoitem is selected or deselected. */
153 void todoSelected( bool ); 153 void todoSelected( bool );
154 154
155 /** 155 /**
156 Emitted, when clipboard content changes. Parameter indicates if paste 156 Emitted, when clipboard content changes. Parameter indicates if paste
157 is possible or not. 157 is possible or not.
158 */ 158 */
159 void pasteEnabled(bool); 159 void pasteEnabled(bool);
160 160
161 /** Emitted, when the number of incoming messages has changed. */ 161 /** Emitted, when the number of incoming messages has changed. */
162 void numIncomingChanged(int); 162 void numIncomingChanged(int);
163 163
164 /** Emitted, when the number of outgoing messages has changed. */ 164 /** Emitted, when the number of outgoing messages has changed. */
165 void numOutgoingChanged(int); 165 void numOutgoingChanged(int);
166 166
167 /** Send status message, which can e.g. be displayed in the status bar. */ 167 /** Send status message, which can e.g. be displayed in the status bar. */
168 void statusMessage(const QString &); 168 void statusMessage(const QString &);
169 169
170 void calendarViewExpanded( bool ); 170 void calendarViewExpanded( bool );
171 void updateSearchDialog(); 171 void updateSearchDialog();
172 172
173 173
174 public slots: 174 public slots:
175 void showOpenError();
175 void watchSavedFile(); 176 void watchSavedFile();
176 void recheckTimerAlarm(); 177 void recheckTimerAlarm();
177 void checkNextTimerAlarm(); 178 void checkNextTimerAlarm();
178 void addAlarm(const QDateTime &qdt, const QString &noti ); 179 void addAlarm(const QDateTime &qdt, const QString &noti );
179 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 180 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
180 void removeAlarm(const QDateTime &qdt, const QString &noti ); 181 void removeAlarm(const QDateTime &qdt, const QString &noti );
181 182
182 /** options dialog made a changed to the configuration. we catch this 183 /** options dialog made a changed to the configuration. we catch this
183 * and notify all widgets which need to update their configuration. */ 184 * and notify all widgets which need to update their configuration. */
184 void updateConfig(); 185 void updateConfig();
185 186
186 /** 187 /**
187 Load calendar from file \a filename. If \a merge is true, load 188 Load calendar from file \a filename. If \a merge is true, load
188 calendar into existing one, if it is false, clear calendar, before 189 calendar into existing one, if it is false, clear calendar, before
189 loading. Return true, if calendar could be successfully loaded. 190 loading. Return true, if calendar could be successfully loaded.
190 */ 191 */
191 bool openCalendar(QString filename, bool merge=false); 192 bool openCalendar(QString filename, bool merge=false);
192 bool syncCalendar(QString filename,int mode = 0 ); 193 bool syncCalendar(QString filename,int mode = 0 );
193 194
194 /** 195 /**
195 Save calendar data to file. Return true if calendar could be 196 Save calendar data to file. Return true if calendar could be
196 successfully saved. 197 successfully saved.
197 */ 198 */
198 bool saveCalendar(QString filename); 199 bool saveCalendar(QString filename);
199 200
200 /** 201 /**
201 Close calendar. Clear calendar data and reset views to display an empty 202 Close calendar. Clear calendar data and reset views to display an empty
202 calendar. 203 calendar.
203 */ 204 */
204 void closeCalendar(); 205 void closeCalendar();
205 206
206 /** Archive old events of calendar */ 207 /** Archive old events of calendar */
207 void archiveCalendar(); 208 void archiveCalendar();
208 209
209 void showIncidence(); 210 void showIncidence();
210 void editIncidence(); 211 void editIncidence();
211 void editIncidenceDescription(); 212 void editIncidenceDescription();
212 void deleteIncidence(); 213 void deleteIncidence();
213 214
214 /** create an editeventwin with supplied date/time, and if bool is true, 215 /** create an editeventwin with supplied date/time, and if bool is true,
215 * make the event take all day. */ 216 * make the event take all day. */
216 void newEvent(QDateTime, QDateTime, bool allDay = false); 217 void newEvent(QDateTime, QDateTime, bool allDay = false);
217 void newEvent(QDateTime fh); 218 void newEvent(QDateTime fh);
218 void newEvent(QDate dt); 219 void newEvent(QDate dt);
219 /** create new event without having a date hint. Takes current date as 220 /** create new event without having a date hint. Takes current date as
220 default hint. */ 221 default hint. */
221 void newEvent(); 222 void newEvent();
222 void newFloatingEvent(); 223 void newFloatingEvent();
223 224
224 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 225 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
225 void showIncidence(Incidence *); 226 void showIncidence(Incidence *);
226 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 227 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
227 void editIncidence(Incidence *); 228 void editIncidence(Incidence *);
228 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 229 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
229 void deleteIncidence(Incidence *); 230 void deleteIncidence(Incidence *);
230 void cloneIncidence(Incidence *); 231 void cloneIncidence(Incidence *);
231 void cancelIncidence(Incidence *); 232 void cancelIncidence(Incidence *);
232 /** Create an editor for the supplied event. */ 233 /** Create an editor for the supplied event. */
233 void editEvent(Event *); 234 void editEvent(Event *);
234 /** Delete the supplied event. */ 235 /** Delete the supplied event. */
235 void deleteEvent(Event *); 236 void deleteEvent(Event *);
236 /** Delete the event with the given unique ID. Returns false, if event wasn't 237 /** Delete the event with the given unique ID. Returns false, if event wasn't
237 found. */ 238 found. */
238 bool deleteEvent(const QString &uid); 239 bool deleteEvent(const QString &uid);
239 /** Create a read-only viewer dialog for the supplied event. */ 240 /** Create a read-only viewer dialog for the supplied event. */
240 void showEvent(Event *); 241 void showEvent(Event *);
241 242
242 void editJournal(Journal *); 243 void editJournal(Journal *);
243 void showJournal(Journal *); 244 void showJournal(Journal *);
244 void deleteJournal(Journal *); 245 void deleteJournal(Journal *);
245 /** Create an editor dialog for a todo */ 246 /** Create an editor dialog for a todo */
246 void editTodo(Todo *); 247 void editTodo(Todo *);
247 /** Create a read-only viewer dialog for the supplied todo */ 248 /** Create a read-only viewer dialog for the supplied todo */
248 void showTodo(Todo *); 249 void showTodo(Todo *);
249 /** create new todo */ 250 /** create new todo */
250 void newTodo(); 251 void newTodo();
251 /** create new todo with a parent todo */ 252 /** create new todo with a parent todo */
252 void newSubTodo(); 253 void newSubTodo();
253 /** create new todo with a parent todo */ 254 /** create new todo with a parent todo */
254 void newSubTodo(Todo *); 255 void newSubTodo(Todo *);
255 /** Delete todo */ 256 /** Delete todo */
256 void deleteTodo(Todo *); 257 void deleteTodo(Todo *);
257 258
258 259
259 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 260 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
260 * emitted as result. */ 261 * emitted as result. */
261 void checkClipboard(); 262 void checkClipboard();
262 263
263 /** using the KConfig associated with the kapp variable, read in the 264 /** using the KConfig associated with the kapp variable, read in the
264 * settings from the config file. 265 * settings from the config file.
265 */ 266 */
266 void readSettings(); 267 void readSettings();
267 268
268 /** write current state to config file. */ 269 /** write current state to config file. */
269 void writeSettings(); 270 void writeSettings();
270 271
271 /** read settings for calendar filters */ 272 /** read settings for calendar filters */
272 void readFilterSettings(KConfig *config); 273 void readFilterSettings(KConfig *config);
273 274
274 /** write settings for calendar filters */ 275 /** write settings for calendar filters */
275 void writeFilterSettings(KConfig *config); 276 void writeFilterSettings(KConfig *config);
276 277
277 /** passes on the message that an event has changed to the currently 278 /** passes on the message that an event has changed to the currently
278 * activated view so that it can make appropriate display changes. */ 279 * activated view so that it can make appropriate display changes. */
279 void changeEventDisplay(Event *, int); 280 void changeEventDisplay(Event *, int);
280 void changeIncidenceDisplay(Incidence *, int); 281 void changeIncidenceDisplay(Incidence *, int);
281 void changeTodoDisplay(Todo *, int); 282 void changeTodoDisplay(Todo *, int);
282 283
283 void eventAdded(Event *); 284 void eventAdded(Event *);
284 void eventChanged(Event *); 285 void eventChanged(Event *);
285 void eventToBeDeleted(Event *); 286 void eventToBeDeleted(Event *);
286 void eventDeleted(); 287 void eventDeleted();
287 288
288 void todoAdded(Todo *); 289 void todoAdded(Todo *);
289 void todoChanged(Todo *); 290 void todoChanged(Todo *);
290 void todoToBeDeleted(Todo *); 291 void todoToBeDeleted(Todo *);
291 void todoDeleted(); 292 void todoDeleted();
292 293
293 void updateView(const QDate &start, const QDate &end); 294 void updateView(const QDate &start, const QDate &end);
294 void updateView(); 295 void updateView();
295 296
296 /** Full update of visible todo views */ 297 /** Full update of visible todo views */
297 void updateTodoViews(); 298 void updateTodoViews();
298 299
299 void updateUnmanagedViews(); 300 void updateUnmanagedViews();
300 301
301 /** cut the current appointment to the clipboard */ 302 /** cut the current appointment to the clipboard */
302 void edit_cut(); 303 void edit_cut();
303 304
304 /** copy the current appointment(s) to the clipboard */ 305 /** copy the current appointment(s) to the clipboard */
305 void edit_copy(); 306 void edit_copy();
306 307
307 /** paste the current vobject(s) in the clipboard buffer into calendar */ 308 /** paste the current vobject(s) in the clipboard buffer into calendar */
308 void edit_paste(); 309 void edit_paste();
309 310
310 /** edit viewing and configuration options. */ 311 /** edit viewing and configuration options. */
311 void edit_options(); 312 void edit_options();
312 void edit_sync_options(); 313 void edit_sync_options();
313 /** 314 /**
314 Functions for printing, previewing a print, and setting up printing 315 Functions for printing, previewing a print, and setting up printing
315 parameters. 316 parameters.
316 */ 317 */
317 void print(); 318 void print();
318 void printSetup(); 319 void printSetup();
319 void printPreview(); 320 void printPreview();
320 321
321 /** Export as iCalendar file */ 322 /** Export as iCalendar file */
322 void exportICalendar(); 323 void exportICalendar();
323 324
324 /** Export as vCalendar file */ 325 /** Export as vCalendar file */
325 bool exportVCalendar( QString fn); 326 bool exportVCalendar( QString fn);
326 327
327 /** pop up a dialog to show an existing appointment. */ 328 /** pop up a dialog to show an existing appointment. */
328 void appointment_show(); 329 void appointment_show();
329 /** 330 /**
330 * pop up an Appointment Dialog to edit an existing appointment.Get 331 * pop up an Appointment Dialog to edit an existing appointment.Get
331 * information on the appointment from the list of unique IDs that is 332 * information on the appointment from the list of unique IDs that is
332 * currently in the View, called currIds. 333 * currently in the View, called currIds.
333 */ 334 */
334 void appointment_edit(); 335 void appointment_edit();
335 /** 336 /**
336 * pop up dialog confirming deletion of currently selected event in the 337 * pop up dialog confirming deletion of currently selected event in the
337 * View. 338 * View.
338 */ 339 */
339 void appointment_delete(); 340 void appointment_delete();
340 341
341 /** mails the currently selected event to a particular user as a vCalendar 342 /** mails the currently selected event to a particular user as a vCalendar
342 attachment. */ 343 attachment. */
343 void action_mail(); 344 void action_mail();
344 345
345 /* frees a subtodo from it's relation */ 346 /* frees a subtodo from it's relation */
346 void todo_unsub( Todo * ); 347 void todo_unsub( Todo * );
347 348
348 /** Take ownership of selected event. */ 349 /** Take ownership of selected event. */
349 void takeOverEvent(); 350 void takeOverEvent();
350 351
351 /** Take ownership of all events in calendar. */ 352 /** Take ownership of all events in calendar. */
352 void takeOverCalendar(); 353 void takeOverCalendar();
353 354
354 /** query whether or not the calendar is "dirty". */ 355 /** query whether or not the calendar is "dirty". */
355 bool isModified(); 356 bool isModified();
356 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 357 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
357 void setModified(bool modified=true); 358 void setModified(bool modified=true);
358 359
359 /** query if the calendar is read-only. */ 360 /** query if the calendar is read-only. */
360 bool isReadOnly(); 361 bool isReadOnly();
361 /** set state of calendar to read-only */ 362 /** set state of calendar to read-only */
362 void setReadOnly(bool readOnly=true); 363 void setReadOnly(bool readOnly=true);
363 364
364 void eventUpdated(Incidence *); 365 void eventUpdated(Incidence *);
365 366
366 /* iTIP scheduling actions */ 367 /* iTIP scheduling actions */
367 void schedule_publish(Incidence *incidence = 0); 368 void schedule_publish(Incidence *incidence = 0);
368 void schedule_request(Incidence *incidence = 0); 369 void schedule_request(Incidence *incidence = 0);
369 void schedule_refresh(Incidence *incidence = 0); 370 void schedule_refresh(Incidence *incidence = 0);
370 void schedule_cancel(Incidence *incidence = 0); 371 void schedule_cancel(Incidence *incidence = 0);
371 void schedule_add(Incidence *incidence = 0); 372 void schedule_add(Incidence *incidence = 0);
372 void schedule_reply(Incidence *incidence = 0); 373 void schedule_reply(Incidence *incidence = 0);
373 void schedule_counter(Incidence *incidence = 0); 374 void schedule_counter(Incidence *incidence = 0);
374 void schedule_declinecounter(Incidence *incidence = 0); 375 void schedule_declinecounter(Incidence *incidence = 0);
375 void schedule_publish_freebusy(int daysToPublish = 30); 376 void schedule_publish_freebusy(int daysToPublish = 30);
376 377
377 void openAddressbook(); 378 void openAddressbook();
378 379
379 void editFilters(); 380 void editFilters();
380 void toggleFilerEnabled(); 381 void toggleFilerEnabled();
381 QPtrList<CalFilter> filters(); 382 QPtrList<CalFilter> filters();
382 void toggleFilter(); 383 void toggleFilter();
383 void showFilter(bool visible); 384 void showFilter(bool visible);
384 void updateFilter(); 385 void updateFilter();
385 void filterEdited(); 386 void filterEdited();
386 void selectFilter( int ); 387 void selectFilter( int );
387 KOFilterView *filterView(); 388 KOFilterView *filterView();
388 389
389 void showIntro(); 390 void showIntro();
390 391
391 /** Move the curdatepient view date to today */ 392 /** Move the curdatepient view date to today */
392 void goToday(); 393 void goToday();
393 394
394 /** Move to the next date(s) in the current view */ 395 /** Move to the next date(s) in the current view */
395 void goNext(); 396 void goNext();
396 397
397 /** Move to the previous date(s) in the current view */ 398 /** Move to the previous date(s) in the current view */
398 void goPrevious(); 399 void goPrevious();
399 /** Move to the next date(s) in the current view */ 400 /** Move to the next date(s) in the current view */
400 void goNextMonth(); 401 void goNextMonth();
401 402
402 /** Move to the previous date(s) in the current view */ 403 /** Move to the previous date(s) in the current view */
403 void goPreviousMonth(); 404 void goPreviousMonth();
404 405
405 void toggleExpand(); 406 void toggleExpand();
406 void toggleDateNavigatorWidget(); 407 void toggleDateNavigatorWidget();
407 void toggleAllDaySize(); 408 void toggleAllDaySize();
408 void dialogClosing(Incidence *); 409 void dialogClosing(Incidence *);
409 410
410 /** Look for new messages in the inbox */ 411 /** Look for new messages in the inbox */
411 void lookForIncomingMessages(); 412 void lookForIncomingMessages();
412 /** Look for new messages in the outbox */ 413 /** Look for new messages in the outbox */
413 void lookForOutgoingMessages(); 414 void lookForOutgoingMessages();
414 415
415 void processMainViewSelection( Incidence * ); 416 void processMainViewSelection( Incidence * );
416 void processTodoListSelection( Incidence * ); 417 void processTodoListSelection( Incidence * );
417 418
418 void processIncidenceSelection( Incidence * ); 419 void processIncidenceSelection( Incidence * );
419 420
420 void purgeCompleted(); 421 void purgeCompleted();
421 bool removeCompletedSubTodos( Todo* ); 422 bool removeCompletedSubTodos( Todo* );
422 void slotCalendarChanged(); 423 void slotCalendarChanged();
423 bool importBday(); 424 bool importBday();
424 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 425 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
425 bool importQtopia( const QString &categoriesFile, 426 bool importQtopia( const QString &categoriesFile,
426 const QString &datebookFile, 427 const QString &datebookFile,
427 const QString &tasklistFile ); 428 const QString &tasklistFile );
428 void syncSharp( ); 429 void syncSharp( );
429 void syncPhone( ); 430 void syncPhone( );
430 void syncExternal( int mode ); 431 void syncExternal( int mode );
431 void slotSelectPickerDate( QDate ) ; 432 void slotSelectPickerDate( QDate ) ;
432 void showDatePicker( ) ; 433 void showDatePicker( ) ;
433 void moveIncidence(Incidence *) ; 434 void moveIncidence(Incidence *) ;
434 void beamIncidence(Incidence *) ; 435 void beamIncidence(Incidence *) ;
435 void beamCalendar() ; 436 void beamCalendar() ;
436 void beamFilteredCalendar() ; 437 void beamFilteredCalendar() ;
437 void beamIncidenceList(QPtrList<Incidence>) ; 438 void beamIncidenceList(QPtrList<Incidence>) ;
438 void manageCategories(); 439 void manageCategories();
439 int addCategories(); 440 int addCategories();
440 void removeCategories(); 441 void removeCategories();
441 void setSyncDevice( QString ); 442 void setSyncDevice( QString );
442 void setSyncName( QString ); 443 void setSyncName( QString );
443 protected slots: 444 protected slots:
444 void timerAlarm(); 445 void timerAlarm();
445 void suspendAlarm(); 446 void suspendAlarm();
446 void beamDone( Ir *ir ); 447 void beamDone( Ir *ir );
447 /** Select a view or adapt the current view to display the specified dates. */ 448 /** Select a view or adapt the current view to display the specified dates. */
448 void showDates( const KCal::DateList & ); 449 void showDates( const KCal::DateList & );
449 void selectWeekNum ( int ); 450 void selectWeekNum ( int );
450 451
451 public: 452 public:
452 // show a standard warning 453 // show a standard warning
453 // returns KMsgBox::yesNoCancel() 454 // returns KMsgBox::yesNoCancel()
454 int msgCalModified(); 455 int msgCalModified();
455 void confSync(); 456 void confSync();
456 void setLoadedFileVersion(QDateTime); 457 void setLoadedFileVersion(QDateTime);
457 bool checkFileVersion(QString fn); 458 bool checkFileVersion(QString fn);
458 bool checkFileChanged(QString fn); 459 bool checkFileChanged(QString fn);
459 Event* getLastSyncEvent(); 460 Event* getLastSyncEvent();
460 /** Adapt navigation units correpsonding to step size of navigation of the 461 /** Adapt navigation units correpsonding to step size of navigation of the
461 * current view. 462 * current view.
462 */ 463 */
463 void adaptNavigationUnits(); 464 void adaptNavigationUnits();
464 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 465 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
465 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 466 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
466 //Attendee* getYourAttendee(Event *event); 467 //Attendee* getYourAttendee(Event *event);
467 protected: 468 protected:
468 void schedule(Scheduler::Method, Incidence *incidence = 0); 469 void schedule(Scheduler::Method, Incidence *incidence = 0);
469 470
470 // returns KMsgBox::OKCandel() 471 // returns KMsgBox::OKCandel()
471 int msgItemDelete(); 472 int msgItemDelete();
472 void showEventEditor(); 473 void showEventEditor();
473 void showTodoEditor(); 474 void showTodoEditor();
474 void writeLocale(); 475 void writeLocale();
475 Todo *selectedTodo(); 476 Todo *selectedTodo();
476 477
477 private: 478 private:
478 AlarmDialog * mAlarmDialog; 479 AlarmDialog * mAlarmDialog;
479 QString mAlarmNotification; 480 QString mAlarmNotification;
480 QString mSuspendAlarmNotification; 481 QString mSuspendAlarmNotification;
481 QTimer* mSuspendTimer; 482 QTimer* mSuspendTimer;
482 QTimer* mAlarmTimer; 483 QTimer* mAlarmTimer;
483 QTimer* mRecheckAlarmTimer; 484 QTimer* mRecheckAlarmTimer;
484 void computeAlarm( QString ); 485 void computeAlarm( QString );
485 void startAlarm( QString, QString ); 486 void startAlarm( QString, QString );
486 void setSyncEventsReadOnly(); 487 void setSyncEventsReadOnly();
487 488
488 QDateTime loadedFileVersion; 489 QDateTime loadedFileVersion;
489 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 490 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
490 void checkExternalId( Incidence * inc ); 491 void checkExternalId( Incidence * inc );
491 int mGlobalSyncMode; 492 int mGlobalSyncMode;
492 QString mCurrentSyncDevice; 493 QString mCurrentSyncDevice;
493 QString mCurrentSyncName; 494 QString mCurrentSyncName;
494 KOBeamPrefs* beamDialog; 495 KOBeamPrefs* beamDialog;
495 void init(); 496 void init();
496 int mDatePickerMode; 497 int mDatePickerMode;
497 bool mFlagEditDescription; 498 bool mFlagEditDescription;
498 QDateTime mLastCalendarSync; 499 QDateTime mLastCalendarSync;
499 void createPrinter(); 500 void createPrinter();
500 501
501 void calendarModified( bool, Calendar * ); 502 void calendarModified( bool, Calendar * );
502 503
503 CalPrinter *mCalPrinter; 504 CalPrinter *mCalPrinter;
504 505
505 QSplitter *mPanner; 506 QSplitter *mPanner;
506 QSplitter *mLeftSplitter; 507 QSplitter *mLeftSplitter;
507 QWidget *mLeftFrame; 508 QWidget *mLeftFrame;
508 QWidgetStack *mRightFrame; 509 QWidgetStack *mRightFrame;
509 510
510 KDatePicker* mDatePicker; 511 KDatePicker* mDatePicker;
511 QVBox* mDateFrame; 512 QVBox* mDateFrame;
512 NavigatorBar *mNavigatorBar; 513 NavigatorBar *mNavigatorBar;
513 514
514 KDateNavigator *mDateNavigator; // widget showing small month view. 515 KDateNavigator *mDateNavigator; // widget showing small month view.
515 516
516 KOFilterView *mFilterView; 517 KOFilterView *mFilterView;
517 518
518 ResourceView *mResourceView; 519 ResourceView *mResourceView;
519 520
520 // calendar object for this viewing instance 521 // calendar object for this viewing instance
521 Calendar *mCalendar; 522 Calendar *mCalendar;
522 523
523 CalendarResourceManager *mResourceManager; 524 CalendarResourceManager *mResourceManager;
524 525
525 FileStorage *mStorage; 526 FileStorage *mStorage;
526 527
527 DateNavigator *mNavigator; 528 DateNavigator *mNavigator;
528 529
529 KOViewManager *mViewManager; 530 KOViewManager *mViewManager;
530 KODialogManager *mDialogManager; 531 KODialogManager *mDialogManager;
531 532
532 // Calendar filters 533 // Calendar filters
533 QPtrList<CalFilter> mFilters; 534 QPtrList<CalFilter> mFilters;
534 535
535 // various housekeeping variables. 536 // various housekeeping variables.
536 bool mModified; // flag indicating if calendar is modified 537 bool mModified; // flag indicating if calendar is modified
537 bool mReadOnly; // flag indicating if calendar is read-only 538 bool mReadOnly; // flag indicating if calendar is read-only
538 QDate mSaveSingleDate; 539 QDate mSaveSingleDate;
539 540
540 Incidence *mSelectedIncidence; 541 Incidence *mSelectedIncidence;
541 Incidence *mMoveIncidence; 542 Incidence *mMoveIncidence;
542 QPtrList<Event> mExternLastSyncEvent; 543 QPtrList<Event> mExternLastSyncEvent;
543 KOTodoView *mTodoList; 544 KOTodoView *mTodoList;
544 KOEventEditor * mEventEditor; 545 KOEventEditor * mEventEditor;
545 KOTodoEditor * mTodoEditor; 546 KOTodoEditor * mTodoEditor;
546 KOEventViewerDialog * mEventViewerDialog; 547 KOEventViewerDialog * mEventViewerDialog;
547 void keyPressEvent ( QKeyEvent *e) ; 548 void keyPressEvent ( QKeyEvent *e) ;
548 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 549 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
549}; 550};
550 551
551 552
552class CalendarViewVisitor : public Incidence::Visitor 553class CalendarViewVisitor : public Incidence::Visitor
553{ 554{
554 public: 555 public:
555 CalendarViewVisitor() : mView( 0 ) {} 556 CalendarViewVisitor() : mView( 0 ) {}
556 557
557 bool act( Incidence *incidence, CalendarView *view ) 558 bool act( Incidence *incidence, CalendarView *view )
558 { 559 {
559 mView = view; 560 mView = view;
560 return incidence->accept( *this ); 561 return incidence->accept( *this );
561 } 562 }
562 563
563 protected: 564 protected:
564 CalendarView *mView; 565 CalendarView *mView;
565}; 566};
566 567
567class ShowIncidenceVisitor : public CalendarViewVisitor 568class ShowIncidenceVisitor : public CalendarViewVisitor
568{ 569{
569 protected: 570 protected:
570 bool visit( Event *event ) { mView->showEvent( event ); return true; } 571 bool visit( Event *event ) { mView->showEvent( event ); return true; }
571 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 572 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
572 bool visit( Journal * j ) { mView->showJournal( j );return true; } 573 bool visit( Journal * j ) { mView->showJournal( j );return true; }
573}; 574};
574 575
575class EditIncidenceVisitor : public CalendarViewVisitor 576class EditIncidenceVisitor : public CalendarViewVisitor
576{ 577{
577 protected: 578 protected:
578 bool visit( Event *event ) { mView->editEvent( event ); return true; } 579 bool visit( Event *event ) { mView->editEvent( event ); return true; }
579 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 580 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
580 bool visit( Journal *j ) { mView->editJournal( j); return true; } 581 bool visit( Journal *j ) { mView->editJournal( j); return true; }
581}; 582};
582 583
583class DeleteIncidenceVisitor : public CalendarViewVisitor 584class DeleteIncidenceVisitor : public CalendarViewVisitor
584{ 585{
585 protected: 586 protected:
586 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 587 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
587 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 588 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
588 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 589 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
589}; 590};
590 591
591#endif 592#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 43ee2d7..7b666d1 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,942 +1,940 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qmap.h> 16#include <qmap.h>
17#include <qwmatrix.h> 17#include <qwmatrix.h>
18#include <qtextbrowser.h> 18#include <qtextbrowser.h>
19#include <qtextstream.h> 19#include <qtextstream.h>
20#ifndef DESKTOP_VERSION 20#ifndef DESKTOP_VERSION
21#include <qpe/global.h> 21#include <qpe/global.h>
22#include <qpe/qpemenubar.h> 22#include <qpe/qpemenubar.h>
23#include <qpe/qpetoolbar.h> 23#include <qpe/qpetoolbar.h>
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qtopia/alarmserver.h> 26#include <qtopia/alarmserver.h>
27#include <qtopia/qcopenvelope_qws.h> 27#include <qtopia/qcopenvelope_qws.h>
28#include <unistd.h> // for sleep 28#include <unistd.h> // for sleep
29#else 29#else
30#include <qmenubar.h> 30#include <qmenubar.h>
31#include <qtoolbar.h> 31#include <qtoolbar.h>
32#include <qapplication.h> 32#include <qapplication.h>
33//#include <resource.h> 33//#include <resource.h>
34 34
35#endif 35#endif
36#include <libkcal/calendarlocal.h> 36#include <libkcal/calendarlocal.h>
37#include <libkcal/todo.h> 37#include <libkcal/todo.h>
38#include <libkdepim/ksyncprofile.h> 38#include <libkdepim/ksyncprofile.h>
39#include <libkcal/kincidenceformatter.h> 39#include <libkcal/kincidenceformatter.h>
40#include <libkdepim/kpimglobalprefs.h> 40#include <libkdepim/kpimglobalprefs.h>
41 41
42#include "calendarview.h" 42#include "calendarview.h"
43#include "koviewmanager.h" 43#include "koviewmanager.h"
44#include "datenavigator.h" 44#include "datenavigator.h"
45#include "koagendaview.h" 45#include "koagendaview.h"
46#include "koagenda.h" 46#include "koagenda.h"
47#include "kodialogmanager.h" 47#include "kodialogmanager.h"
48#include "kdialogbase.h" 48#include "kdialogbase.h"
49#include "kapplication.h" 49#include "kapplication.h"
50#include "kofilterview.h" 50#include "kofilterview.h"
51#include "kstandarddirs.h" 51#include "kstandarddirs.h"
52#include "koprefs.h" 52#include "koprefs.h"
53#include "kfiledialog.h" 53#include "kfiledialog.h"
54#include "koglobals.h" 54#include "koglobals.h"
55#include "kglobal.h" 55#include "kglobal.h"
56#include "klocale.h" 56#include "klocale.h"
57#include "kconfig.h" 57#include "kconfig.h"
58#include "simplealarmclient.h" 58#include "simplealarmclient.h"
59#include "externalapphandler.h" 59#include "externalapphandler.h"
60 60
61using namespace KCal; 61using namespace KCal;
62#ifndef _WIN32_ 62#ifndef _WIN32_
63#include <unistd.h> 63#include <unistd.h>
64#else 64#else
65#include "koimportoldialog.h" 65#include "koimportoldialog.h"
66#endif 66#endif
67#include "mainwindow.h" 67#include "mainwindow.h"
68 68
69int globalFlagBlockStartup; 69int globalFlagBlockStartup;
70MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 70MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
71 QMainWindow( parent, name ) 71 QMainWindow( parent, name )
72{ 72{
73 mPassWordPiSync = "abc"; 73 mPassWordPiSync = "abc";
74#ifdef DESKTOP_VERSION 74#ifdef DESKTOP_VERSION
75 setFont( QFont("Arial"), 14 ); 75 setFont( QFont("Arial"), 14 );
76#endif 76#endif
77 mSyncActionDialog = 0; 77 mSyncActionDialog = 0;
78 mServerSocket = 0; 78 mServerSocket = 0;
79 mClosed = false; 79 mClosed = false;
80 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 80 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
81 QString confFile = locateLocal("config","korganizerrc"); 81 QString confFile = locateLocal("config","korganizerrc");
82 QFileInfo finf ( confFile ); 82 QFileInfo finf ( confFile );
83 bool showWarning = !finf.exists(); 83 bool showWarning = !finf.exists();
84 setIcon(SmallIcon( "ko24" ) ); 84 setIcon(SmallIcon( "ko24" ) );
85 mBlockAtStartup = true; 85 mBlockAtStartup = true;
86 mFlagKeyPressed = false; 86 mFlagKeyPressed = false;
87 setCaption("KOrganizer/Pi"); 87 setCaption("KOrganizer/Pi");
88 KOPrefs *p = KOPrefs::instance(); 88 KOPrefs *p = KOPrefs::instance();
89 KPimGlobalPrefs::instance()->setGlobalConfig(); 89 KPimGlobalPrefs::instance()->setGlobalConfig();
90 // if ( QApplication::desktop()->height() > 480 ) { 90 // if ( QApplication::desktop()->height() > 480 ) {
91// if ( p->mHourSize == 4 ) 91// if ( p->mHourSize == 4 )
92// p->mHourSize = 6; 92// p->mHourSize = 6;
93// } 93// }
94 if ( p->mHourSize > 18 ) 94 if ( p->mHourSize > 18 )
95 p->mHourSize = 18; 95 p->mHourSize = 18;
96 QMainWindow::ToolBarDock tbd; 96 QMainWindow::ToolBarDock tbd;
97 if ( p->mToolBarHor ) { 97 if ( p->mToolBarHor ) {
98 if ( p->mToolBarUp ) 98 if ( p->mToolBarUp )
99 tbd = Bottom; 99 tbd = Bottom;
100 else 100 else
101 tbd = Top; 101 tbd = Top;
102 } 102 }
103 else { 103 else {
104 if ( p->mToolBarUp ) 104 if ( p->mToolBarUp )
105 tbd = Right; 105 tbd = Right;
106 else 106 else
107 tbd = Left; 107 tbd = Left;
108 } 108 }
109 if ( KOPrefs::instance()->mUseAppColors ) 109 if ( KOPrefs::instance()->mUseAppColors )
110 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 110 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
111 globalFlagBlockStartup = 1; 111 globalFlagBlockStartup = 1;
112 iconToolBar = new QPEToolBar( this ); 112 iconToolBar = new QPEToolBar( this );
113 addToolBar (iconToolBar , tbd ); 113 addToolBar (iconToolBar , tbd );
114 mBlockSaveFlag = false; 114 mBlockSaveFlag = false;
115 mCalendarModifiedFlag = false; 115 mCalendarModifiedFlag = false;
116 116
117 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 117 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
118 splash->setAlignment ( AlignCenter ); 118 splash->setAlignment ( AlignCenter );
119 setCentralWidget( splash ); 119 setCentralWidget( splash );
120#ifndef DESKTOP_VERSION 120#ifndef DESKTOP_VERSION
121 showMaximized(); 121 showMaximized();
122#endif 122#endif
123 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 123 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
124 setDefaultPreferences(); 124 setDefaultPreferences();
125 mCalendar = new CalendarLocal(); 125 mCalendar = new CalendarLocal();
126 mView = new CalendarView( mCalendar, this,"mCalendar " ); 126 mView = new CalendarView( mCalendar, this,"mCalendar " );
127 mView->hide(); 127 mView->hide();
128 //mView->resize(splash->size() ); 128 //mView->resize(splash->size() );
129 initActions(); 129 initActions();
130#ifndef DESKTOP_VERSION 130#ifndef DESKTOP_VERSION
131 iconToolBar->show(); 131 iconToolBar->show();
132 qApp->processEvents(); 132 qApp->processEvents();
133#endif 133#endif
134 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 134 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
135 int vh = height() ; 135 int vh = height() ;
136 int vw = width(); 136 int vw = width();
137 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 137 //qDebug("Toolbar hei %d ",iconToolBar->height() );
138 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 138 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
139 vh -= iconToolBar->height(); 139 vh -= iconToolBar->height();
140 } else { 140 } else {
141 vw -= iconToolBar->height(); 141 vw -= iconToolBar->height();
142 } 142 }
143 //mView->setMaximumSize( splash->size() ); 143 //mView->setMaximumSize( splash->size() );
144 //mView->resize( splash->size() ); 144 //mView->resize( splash->size() );
145 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 145 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
146 mView->readSettings(); 146 mView->readSettings();
147 bool oldOpened = false;
148 bool newFile = false; 147 bool newFile = false;
149 if( !QFile::exists( defaultFileName() ) ) { 148 if( !QFile::exists( defaultFileName() ) ) {
150 QFileInfo finfo ( defaultFileName() ); 149 QFileInfo finfo ( defaultFileName() );
151 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 150 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
152 qDebug("oldfile %s ", oldFile.latin1()); 151 qDebug("oldfile %s ", oldFile.latin1());
153 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 152 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
154 finfo.setFile( oldFile ); 153 finfo.setFile( oldFile );
155 if (finfo.exists() ) { 154 if (finfo.exists() ) {
156 KMessageBox::information( this, message); 155 KMessageBox::information( this, message);
157 mView->openCalendar( oldFile ); 156 mView->openCalendar( oldFile );
158 qApp->processEvents(); 157 qApp->processEvents();
159 } else { 158 } else {
160 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 159 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
161 finfo.setFile( oldFile ); 160 finfo.setFile( oldFile );
162 if (finfo.exists() ) { 161 if (finfo.exists() ) {
163 KMessageBox::information( this, message); 162 KMessageBox::information( this, message);
164 mView->openCalendar( oldFile ); 163 mView->openCalendar( oldFile );
165 qApp->processEvents(); 164 qApp->processEvents();
166 } 165 }
167 } 166 }
168 mView->saveCalendar( defaultFileName() ); 167 mView->saveCalendar( defaultFileName() );
169 newFile = true; 168 newFile = true;
170 } 169 }
171 170
172 QTime neededSaveTime = QDateTime::currentDateTime().time(); 171 QTime neededSaveTime = QDateTime::currentDateTime().time();
173 if ( ! oldOpened ) 172 mView->openCalendar( defaultFileName() );
174 mView->openCalendar( defaultFileName() );
175 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 173 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
176 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 174 qDebug("KO: Calendar loading time: %d ms",msNeeded );
177 175
178 if ( KOPrefs::instance()->mLanguageChanged ) { 176 if ( KOPrefs::instance()->mLanguageChanged ) {
179 KOPrefs::instance()->setCategoryDefaults(); 177 KOPrefs::instance()->setCategoryDefaults();
180 int count = mView->addCategories(); 178 int count = mView->addCategories();
181 KOPrefs::instance()->mLanguageChanged = false; 179 KOPrefs::instance()->mLanguageChanged = false;
182 } 180 }
183 processIncidenceSelection( 0 ); 181 processIncidenceSelection( 0 );
184 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 182 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
185 SLOT( processIncidenceSelection( Incidence * ) ) ); 183 SLOT( processIncidenceSelection( Incidence * ) ) );
186 connect( mView, SIGNAL( modifiedChanged( bool ) ), 184 connect( mView, SIGNAL( modifiedChanged( bool ) ),
187 SLOT( slotModifiedChanged( bool ) ) ); 185 SLOT( slotModifiedChanged( bool ) ) );
188 186
189 187
190 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 188 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
191 mView->setModified( false ); 189 mView->setModified( false );
192 mBlockAtStartup = false; 190 mBlockAtStartup = false;
193 mView->setModified( false ); 191 mView->setModified( false );
194 setCentralWidget( mView ); 192 setCentralWidget( mView );
195 globalFlagBlockStartup = 0; 193 globalFlagBlockStartup = 0;
196 mView->show(); 194 mView->show();
197 delete splash; 195 delete splash;
198 if ( newFile ) 196 if ( newFile )
199 mView->updateConfig(); 197 mView->updateConfig();
200 // qApp->processEvents(); 198 // qApp->processEvents();
201 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 199 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
202 fillSyncMenu(); 200 fillSyncMenu();
203 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 201 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
204 if ( showWarning ) { 202 if ( showWarning ) {
205 KMessageBox::information( this, 203 KMessageBox::information( this,
206 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 204 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
207 qApp->processEvents(); 205 qApp->processEvents();
208 mView->dialogManager()->showSyncOptions(); 206 mView->dialogManager()->showSyncOptions();
209 } 207 }
210 208
211 //US listen for result adressed from Ka/Pi 209 //US listen for result adressed from Ka/Pi
212#ifndef DESKTOP_VERSION 210#ifndef DESKTOP_VERSION
213 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 211 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
214#endif 212#endif
215} 213}
216MainWindow::~MainWindow() 214MainWindow::~MainWindow()
217{ 215{
218 //qDebug("MainWindow::~MainWindow() "); 216 //qDebug("MainWindow::~MainWindow() ");
219 //save toolbar location 217 //save toolbar location
220 delete mServerSocket; 218 delete mServerSocket;
221 delete mCalendar; 219 delete mCalendar;
222 delete KOPrefs::instance(); 220 delete KOPrefs::instance();
223 delete KIncidenceFormatter::instance(); 221 delete KIncidenceFormatter::instance();
224 222
225 223
226} 224}
227void MainWindow::showMaximized () 225void MainWindow::showMaximized ()
228{ 226{
229#ifndef DESKTOP_VERSION 227#ifndef DESKTOP_VERSION
230 if ( ! globalFlagBlockStartup ) 228 if ( ! globalFlagBlockStartup )
231 if ( mClosed ) 229 if ( mClosed )
232 mView->goToday(); 230 mView->goToday();
233#endif 231#endif
234 QWidget::showMaximized () ; 232 QWidget::showMaximized () ;
235 mClosed = false; 233 mClosed = false;
236} 234}
237void MainWindow::closeEvent( QCloseEvent* ce ) 235void MainWindow::closeEvent( QCloseEvent* ce )
238{ 236{
239 237
240 238
241 239
242 if ( ! KOPrefs::instance()->mAskForQuit ) { 240 if ( ! KOPrefs::instance()->mAskForQuit ) {
243 saveOnClose(); 241 saveOnClose();
244 mClosed = true; 242 mClosed = true;
245 ce->accept(); 243 ce->accept();
246 return; 244 return;
247 245
248 } 246 }
249 247
250 switch( QMessageBox::information( this, "KO/Pi", 248 switch( QMessageBox::information( this, "KO/Pi",
251 i18n("Do you really want\nto close KO/Pi?"), 249 i18n("Do you really want\nto close KO/Pi?"),
252 i18n("Close"), i18n("No"), 250 i18n("Close"), i18n("No"),
253 0, 0 ) ) { 251 0, 0 ) ) {
254 case 0: 252 case 0:
255 saveOnClose(); 253 saveOnClose();
256 mClosed = true; 254 mClosed = true;
257 ce->accept(); 255 ce->accept();
258 break; 256 break;
259 case 1: 257 case 1:
260 ce->ignore(); 258 ce->ignore();
261 break; 259 break;
262 case 2: 260 case 2:
263 261
264 default: 262 default:
265 break; 263 break;
266 } 264 }
267 265
268 266
269} 267}
270 268
271void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 269void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
272{ 270{
273 QDataStream stream( data, IO_ReadOnly ); 271 QDataStream stream( data, IO_ReadOnly );
274 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 272 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
275 //QString datamess; 273 //QString datamess;
276 //qDebug("message "); 274 //qDebug("message ");
277 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 275 qDebug("KO: QCOP message received: %s ", cmsg.data() );
278 276
279 if ( cmsg == "-writeFile" ) { 277 if ( cmsg == "-writeFile" ) {
280 // I made from the "-writeFile" an "-writeAlarm" 278 // I made from the "-writeFile" an "-writeAlarm"
281 mView->viewManager()->showWhatsNextView(); 279 mView->viewManager()->showWhatsNextView();
282 mCalendar->checkAlarmForIncidence( 0, true); 280 mCalendar->checkAlarmForIncidence( 0, true);
283 showMaximized(); 281 showMaximized();
284 raise(); 282 raise();
285 return; 283 return;
286 } 284 }
287 285
288 if ( cmsg == "-writeFile" ) { 286 if ( cmsg == "-writeFile" ) {
289 // I made from the "-writeFile" an "-writeAlarm" 287 // I made from the "-writeFile" an "-writeAlarm"
290 mView->viewManager()->showWhatsNextView(); 288 mView->viewManager()->showWhatsNextView();
291 mCalendar->checkAlarmForIncidence( 0, true); 289 mCalendar->checkAlarmForIncidence( 0, true);
292 showMaximized(); 290 showMaximized();
293 raise(); 291 raise();
294 return; 292 return;
295 293
296 } 294 }
297 if ( cmsg == "-writeFileSilent" ) { 295 if ( cmsg == "-writeFileSilent" ) {
298 // I made from the "-writeFile" an "-writeAlarm" 296 // I made from the "-writeFile" an "-writeAlarm"
299 // mView->viewManager()->showWhatsNextView(); 297 // mView->viewManager()->showWhatsNextView();
300 mCalendar->checkAlarmForIncidence( 0, true); 298 mCalendar->checkAlarmForIncidence( 0, true);
301 //showMaximized(); 299 //showMaximized();
302 //raise(); 300 //raise();
303 hide(); 301 hide();
304 return; 302 return;
305 } 303 }
306 if ( cmsg == "-newCountdown" ) { 304 if ( cmsg == "-newCountdown" ) {
307 qDebug("newCountdown "); 305 qDebug("newCountdown ");
308 306
309 } 307 }
310 QString msg ; 308 QString msg ;
311 QString allmsg = cmsg; 309 QString allmsg = cmsg;
312 while ( allmsg.length() > 0 ) { 310 while ( allmsg.length() > 0 ) {
313 int nextC = allmsg.find( "-", 1 ); 311 int nextC = allmsg.find( "-", 1 );
314 if ( nextC == -1 ) { 312 if ( nextC == -1 ) {
315 msg = allmsg; 313 msg = allmsg;
316 allmsg = ""; 314 allmsg = "";
317 } else{ 315 } else{
318 msg = allmsg.left( nextC ); 316 msg = allmsg.left( nextC );
319 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 317 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
320 } 318 }
321 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 319 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
322 if ( msg == "-newEvent" ) { 320 if ( msg == "-newEvent" ) {
323 mView->newEvent(); 321 mView->newEvent();
324 } 322 }
325 if ( msg == "-newTodo" ) { 323 if ( msg == "-newTodo" ) {
326 mView->newTodo(); 324 mView->newTodo();
327 325
328 } 326 }
329 if ( msg == "-showWN" ) { 327 if ( msg == "-showWN" ) {
330 mView->viewManager()->showWhatsNextView(); 328 mView->viewManager()->showWhatsNextView();
331 } 329 }
332 if ( msg == "-showTodo" ) { 330 if ( msg == "-showTodo" ) {
333 mView->viewManager()->showTodoView(); 331 mView->viewManager()->showTodoView();
334 } 332 }
335 if ( msg == "-showList" ) { 333 if ( msg == "-showList" ) {
336 mView->viewManager()->showListView(); 334 mView->viewManager()->showListView();
337 } 335 }
338 else if ( msg == "-showDay" ) { 336 else if ( msg == "-showDay" ) {
339 mView->viewManager()->showDayView(); 337 mView->viewManager()->showDayView();
340 } 338 }
341 else if ( msg == "-showWWeek" ) { 339 else if ( msg == "-showWWeek" ) {
342 mView->viewManager()->showWorkWeekView(); 340 mView->viewManager()->showWorkWeekView();
343 } 341 }
344 else if ( msg == "-ringSync" ) { 342 else if ( msg == "-ringSync" ) {
345 multiSync( false ); 343 multiSync( false );
346 } 344 }
347 else if ( msg == "-showWeek" ) { 345 else if ( msg == "-showWeek" ) {
348 mView->viewManager()->showWeekView(); 346 mView->viewManager()->showWeekView();
349 } 347 }
350 else if ( msg == "-showTodo" ) { 348 else if ( msg == "-showTodo" ) {
351 mView->viewManager()->showTodoView(); 349 mView->viewManager()->showTodoView();
352 } 350 }
353 else if ( msg == "-showJournal" ) { 351 else if ( msg == "-showJournal" ) {
354 mView->dateNavigator()->selectDates( 1 ); 352 mView->dateNavigator()->selectDates( 1 );
355 mView->dateNavigator()->selectToday(); 353 mView->dateNavigator()->selectToday();
356 mView->viewManager()->showJournalView(); 354 mView->viewManager()->showJournalView();
357 } 355 }
358 else if ( msg == "-showKO" ) { 356 else if ( msg == "-showKO" ) {
359 mView->viewManager()->showNextXView(); 357 mView->viewManager()->showNextXView();
360 } 358 }
361 else if ( msg == "-showWNext" || msg == "nextView()" ) { 359 else if ( msg == "-showWNext" || msg == "nextView()" ) {
362 mView->viewManager()->showWhatsNextView(); 360 mView->viewManager()->showWhatsNextView();
363 } 361 }
364 else if ( msg == "-showNextXView" ) { 362 else if ( msg == "-showNextXView" ) {
365 mView->viewManager()->showNextXView(); 363 mView->viewManager()->showNextXView();
366 } 364 }
367 365
368 366
369 } 367 }
370 368
371 showMaximized(); 369 showMaximized();
372 raise(); 370 raise();
373} 371}
374 372
375QPixmap MainWindow::loadPixmap( QString name ) 373QPixmap MainWindow::loadPixmap( QString name )
376{ 374{
377 return SmallIcon( name ); 375 return SmallIcon( name );
378 376
379} 377}
380void MainWindow::initActions() 378void MainWindow::initActions()
381{ 379{
382 //KOPrefs::instance()->mShowFullMenu 380 //KOPrefs::instance()->mShowFullMenu
383 iconToolBar->clear(); 381 iconToolBar->clear();
384 KOPrefs *p = KOPrefs::instance(); 382 KOPrefs *p = KOPrefs::instance();
385 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 383 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
386 384
387 QPopupMenu *viewMenu = new QPopupMenu( this ); 385 QPopupMenu *viewMenu = new QPopupMenu( this );
388 QPopupMenu *actionMenu = new QPopupMenu( this ); 386 QPopupMenu *actionMenu = new QPopupMenu( this );
389 QPopupMenu *importMenu = new QPopupMenu( this ); 387 QPopupMenu *importMenu = new QPopupMenu( this );
390 selectFilterMenu = new QPopupMenu( this ); 388 selectFilterMenu = new QPopupMenu( this );
391 selectFilterMenu->setCheckable( true ); 389 selectFilterMenu->setCheckable( true );
392 syncMenu = new QPopupMenu( this ); 390 syncMenu = new QPopupMenu( this );
393 configureAgendaMenu = new QPopupMenu( this ); 391 configureAgendaMenu = new QPopupMenu( this );
394 configureToolBarMenu = new QPopupMenu( this ); 392 configureToolBarMenu = new QPopupMenu( this );
395 QPopupMenu *helpMenu = new QPopupMenu( this ); 393 QPopupMenu *helpMenu = new QPopupMenu( this );
396 if ( KOPrefs::instance()->mShowFullMenu ) { 394 if ( KOPrefs::instance()->mShowFullMenu ) {
397 QMenuBar *menuBar1; 395 QMenuBar *menuBar1;
398 menuBar1 = menuBar(); 396 menuBar1 = menuBar();
399 menuBar1->insertItem( i18n("File"), importMenu ); 397 menuBar1->insertItem( i18n("File"), importMenu );
400 menuBar1->insertItem( i18n("View"), viewMenu ); 398 menuBar1->insertItem( i18n("View"), viewMenu );
401 menuBar1->insertItem( i18n("Actions"), actionMenu ); 399 menuBar1->insertItem( i18n("Actions"), actionMenu );
402 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 400 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
403 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 401 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
404 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 402 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
405 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 403 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
406 menuBar1->insertItem( i18n("Help"), helpMenu ); 404 menuBar1->insertItem( i18n("Help"), helpMenu );
407 } else { 405 } else {
408 QPEMenuBar *menuBar1; 406 QPEMenuBar *menuBar1;
409 menuBar1 = new QPEMenuBar( iconToolBar ); 407 menuBar1 = new QPEMenuBar( iconToolBar );
410 QPopupMenu *menuBar = new QPopupMenu( this ); 408 QPopupMenu *menuBar = new QPopupMenu( this );
411 menuBar1->insertItem( i18n("ME"), menuBar); 409 menuBar1->insertItem( i18n("ME"), menuBar);
412 menuBar->insertItem( i18n("File"), importMenu ); 410 menuBar->insertItem( i18n("File"), importMenu );
413 menuBar->insertItem( i18n("View"), viewMenu ); 411 menuBar->insertItem( i18n("View"), viewMenu );
414 menuBar->insertItem( i18n("Actions"), actionMenu ); 412 menuBar->insertItem( i18n("Actions"), actionMenu );
415 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 413 menuBar->insertItem( i18n("Synchronize"), syncMenu );
416 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 414 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
417 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 415 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
418 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 416 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
419 menuBar->insertItem( i18n("Help"), helpMenu ); 417 menuBar->insertItem( i18n("Help"), helpMenu );
420 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 418 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
421 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 419 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
422 } 420 }
423 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); 421 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
424 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 422 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
425 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 423 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
426 424
427 // ****************** 425 // ******************
428 QAction *action; 426 QAction *action;
429 QIconSet icon; 427 QIconSet icon;
430 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 428 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
431 configureToolBarMenu->setCheckable( true ); 429 configureToolBarMenu->setCheckable( true );
432 430
433 QString pathString = ""; 431 QString pathString = "";
434 if ( !p->mToolBarMiniIcons ) { 432 if ( !p->mToolBarMiniIcons ) {
435 if ( QApplication::desktop()->width() < 480 ) 433 if ( QApplication::desktop()->width() < 480 )
436 pathString += "icons16/"; 434 pathString += "icons16/";
437 } else 435 } else
438 pathString += "iconsmini/"; 436 pathString += "iconsmini/";
439 configureAgendaMenu->setCheckable( true ); 437 configureAgendaMenu->setCheckable( true );
440 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 438 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
441 configureAgendaMenu->insertSeparator(); 439 configureAgendaMenu->insertSeparator();
442 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 440 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
443 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 441 configureAgendaMenu->insertItem(i18n("Small"), 6 );
444 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 442 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
445 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 443 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
446 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 444 configureAgendaMenu->insertItem(i18n("Large"), 12 );
447 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 445 configureAgendaMenu->insertItem(i18n("Big"), 14 );
448 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 446 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
449 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 447 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
450 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 448 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
451 449
452 icon = loadPixmap( pathString + "configure" ); 450 icon = loadPixmap( pathString + "configure" );
453 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 451 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
454 action->addTo( actionMenu ); 452 action->addTo( actionMenu );
455 connect( action, SIGNAL( activated() ), 453 connect( action, SIGNAL( activated() ),
456 mView, SLOT( edit_options() ) ); 454 mView, SLOT( edit_options() ) );
457 actionMenu->insertSeparator(); 455 actionMenu->insertSeparator();
458 icon = loadPixmap( pathString + "newevent" ); 456 icon = loadPixmap( pathString + "newevent" );
459 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 457 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
460 configureToolBarMenu->insertSeparator(); 458 configureToolBarMenu->insertSeparator();
461 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 459 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
462 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 460 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
463 ne_action->addTo( actionMenu ); 461 ne_action->addTo( actionMenu );
464 connect( ne_action, SIGNAL( activated() ), 462 connect( ne_action, SIGNAL( activated() ),
465 mView, SLOT( newEvent() ) ); 463 mView, SLOT( newEvent() ) );
466 icon = loadPixmap( pathString + "newtodo" ); 464 icon = loadPixmap( pathString + "newtodo" );
467 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 465 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
468 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 466 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
469 nt_action->addTo( actionMenu ); 467 nt_action->addTo( actionMenu );
470 connect( nt_action, SIGNAL( activated() ), 468 connect( nt_action, SIGNAL( activated() ),
471 mView, SLOT( newTodo() ) ); 469 mView, SLOT( newTodo() ) );
472 icon = loadPixmap( pathString + "navi" ); 470 icon = loadPixmap( pathString + "navi" );
473 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 471 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
474 action->addTo( viewMenu ); 472 action->addTo( viewMenu );
475 connect( action, SIGNAL( activated() ), 473 connect( action, SIGNAL( activated() ),
476 mView, SLOT( toggleDateNavigatorWidget() ) ); 474 mView, SLOT( toggleDateNavigatorWidget() ) );
477 icon = loadPixmap( pathString + "filter" ); 475 icon = loadPixmap( pathString + "filter" );
478 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 476 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
479 action->addTo( viewMenu ); 477 action->addTo( viewMenu );
480 connect( action, SIGNAL( activated() ), 478 connect( action, SIGNAL( activated() ),
481 mView, SLOT( toggleFilter() ) ); 479 mView, SLOT( toggleFilter() ) );
482 480
483 481
484 viewMenu->insertSeparator(); 482 viewMenu->insertSeparator();
485 icon = loadPixmap( pathString + "picker" ); 483 icon = loadPixmap( pathString + "picker" );
486 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 484 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
487 action->addTo( viewMenu ); 485 action->addTo( viewMenu );
488 connect( action, SIGNAL( activated() ), 486 connect( action, SIGNAL( activated() ),
489 mView, SLOT( showDatePicker() ) ); 487 mView, SLOT( showDatePicker() ) );
490 action->addTo( iconToolBar ); 488 action->addTo( iconToolBar );
491 viewMenu->insertSeparator(); 489 viewMenu->insertSeparator();
492 icon = loadPixmap( pathString + "list" ); 490 icon = loadPixmap( pathString + "list" );
493 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 491 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
494 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 492 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
495 showlist_action->addTo( viewMenu ); 493 showlist_action->addTo( viewMenu );
496 connect( showlist_action, SIGNAL( activated() ), 494 connect( showlist_action, SIGNAL( activated() ),
497 mView->viewManager(), SLOT( showListView() ) ); 495 mView->viewManager(), SLOT( showListView() ) );
498 496
499 497
500 icon = loadPixmap( pathString + "day" ); 498 icon = loadPixmap( pathString + "day" );
501 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 499 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
502 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 500 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
503 day1_action->addTo( viewMenu ); 501 day1_action->addTo( viewMenu );
504 // action->addTo( toolBar ); 502 // action->addTo( toolBar );
505 connect( day1_action, SIGNAL( activated() ), 503 connect( day1_action, SIGNAL( activated() ),
506 mView->viewManager(), SLOT( showDayView() ) ); 504 mView->viewManager(), SLOT( showDayView() ) );
507 505
508 icon = loadPixmap( pathString + "workweek" ); 506 icon = loadPixmap( pathString + "workweek" );
509 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 507 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
510 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 508 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
511 day5_action->addTo( viewMenu ); 509 day5_action->addTo( viewMenu );
512 connect( day5_action, SIGNAL( activated() ), 510 connect( day5_action, SIGNAL( activated() ),
513 mView->viewManager(), SLOT( showWorkWeekView() ) ); 511 mView->viewManager(), SLOT( showWorkWeekView() ) );
514 512
515 icon = loadPixmap( pathString + "week" ); 513 icon = loadPixmap( pathString + "week" );
516 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 514 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
517 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 515 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
518 day7_action->addTo( viewMenu ); 516 day7_action->addTo( viewMenu );
519 connect( day7_action, SIGNAL( activated() ), 517 connect( day7_action, SIGNAL( activated() ),
520 mView->viewManager(), SLOT( showWeekView() ) ); 518 mView->viewManager(), SLOT( showWeekView() ) );
521 519
522 icon = loadPixmap( pathString + "month" ); 520 icon = loadPixmap( pathString + "month" );
523 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 521 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
524 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 522 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
525 month_action->addTo( viewMenu ); 523 month_action->addTo( viewMenu );
526 connect( month_action, SIGNAL( activated() ), 524 connect( month_action, SIGNAL( activated() ),
527 mView->viewManager(), SLOT( showMonthView() ) ); 525 mView->viewManager(), SLOT( showMonthView() ) );
528 526
529 icon = loadPixmap( pathString + "todo" ); 527 icon = loadPixmap( pathString + "todo" );
530 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 528 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
531 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 529 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
532 todoview_action->addTo( viewMenu ); 530 todoview_action->addTo( viewMenu );
533 connect( todoview_action, SIGNAL( activated() ), 531 connect( todoview_action, SIGNAL( activated() ),
534 mView->viewManager(), SLOT( showTodoView() ) ); 532 mView->viewManager(), SLOT( showTodoView() ) );
535 533
536 icon = loadPixmap( pathString + "journal" ); 534 icon = loadPixmap( pathString + "journal" );
537 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 535 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
538 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 536 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
539 viewjournal_action->addTo( viewMenu ); 537 viewjournal_action->addTo( viewMenu );
540 connect( viewjournal_action, SIGNAL( activated() ), 538 connect( viewjournal_action, SIGNAL( activated() ),
541 mView->viewManager(), SLOT( showJournalView() ) ); 539 mView->viewManager(), SLOT( showJournalView() ) );
542 540
543 icon = loadPixmap( pathString + "xdays" ); 541 icon = loadPixmap( pathString + "xdays" );
544 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 542 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
545 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 543 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
546 xdays_action->addTo( viewMenu ); 544 xdays_action->addTo( viewMenu );
547 connect( xdays_action, SIGNAL( activated() ), 545 connect( xdays_action, SIGNAL( activated() ),
548 mView->viewManager(), SLOT( showNextXView() ) ); 546 mView->viewManager(), SLOT( showNextXView() ) );
549 547
550 icon = loadPixmap( pathString + "whatsnext" ); 548 icon = loadPixmap( pathString + "whatsnext" );
551 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 549 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
552 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 550 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
553 whatsnext_action->addTo( viewMenu ); 551 whatsnext_action->addTo( viewMenu );
554 connect( whatsnext_action, SIGNAL( activated() ), 552 connect( whatsnext_action, SIGNAL( activated() ),
555 mView->viewManager(), SLOT( showWhatsNextView() ) ); 553 mView->viewManager(), SLOT( showWhatsNextView() ) );
556 554
557#if 0 555#if 0
558 action = new QAction( "view_timespan", "Time Span", 0, this ); 556 action = new QAction( "view_timespan", "Time Span", 0, this );
559 action->addTo( viewMenu ); 557 action->addTo( viewMenu );
560 connect( action, SIGNAL( activated() ), 558 connect( action, SIGNAL( activated() ),
561 mView->viewManager(), SLOT( showTimeSpanView() ) ); 559 mView->viewManager(), SLOT( showTimeSpanView() ) );
562#endif 560#endif
563 561
564 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 562 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
565 this ); 563 this );
566 mNewSubTodoAction->addTo( actionMenu ); 564 mNewSubTodoAction->addTo( actionMenu );
567 connect( mNewSubTodoAction, SIGNAL( activated() ), 565 connect( mNewSubTodoAction, SIGNAL( activated() ),
568 mView, SLOT( newSubTodo() ) ); 566 mView, SLOT( newSubTodo() ) );
569 567
570 actionMenu->insertSeparator(); 568 actionMenu->insertSeparator();
571 569
572 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 570 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
573 mShowAction->addTo( actionMenu ); 571 mShowAction->addTo( actionMenu );
574 connect( mShowAction, SIGNAL( activated() ), 572 connect( mShowAction, SIGNAL( activated() ),
575 mView, SLOT( showIncidence() ) ); 573 mView, SLOT( showIncidence() ) );
576 574
577 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 575 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
578 mEditAction->addTo( actionMenu ); 576 mEditAction->addTo( actionMenu );
579 connect( mEditAction, SIGNAL( activated() ), 577 connect( mEditAction, SIGNAL( activated() ),
580 mView, SLOT( editIncidence() ) ); 578 mView, SLOT( editIncidence() ) );
581 579
582 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 580 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
583 mDeleteAction->addTo( actionMenu ); 581 mDeleteAction->addTo( actionMenu );
584 connect( mDeleteAction, SIGNAL( activated() ), 582 connect( mDeleteAction, SIGNAL( activated() ),
585 mView, SLOT( deleteIncidence() ) ); 583 mView, SLOT( deleteIncidence() ) );
586 584
587 actionMenu->insertSeparator(); 585 actionMenu->insertSeparator();
588 586
589 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 587 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
590 this ); 588 this );
591 action->addTo( actionMenu ); 589 action->addTo( actionMenu );
592 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 590 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
593 591
594 icon = loadPixmap( pathString + "search" ); 592 icon = loadPixmap( pathString + "search" );
595 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 593 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
596 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 594 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
597 search_action->addTo( actionMenu ); 595 search_action->addTo( actionMenu );
598 connect( search_action, SIGNAL( activated() ), 596 connect( search_action, SIGNAL( activated() ),
599 mView->dialogManager(), SLOT( showSearchDialog() ) ); 597 mView->dialogManager(), SLOT( showSearchDialog() ) );
600 598
601 icon = loadPixmap( pathString + "today" ); 599 icon = loadPixmap( pathString + "today" );
602 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 600 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
603 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 601 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
604 today_action->addTo( actionMenu ); 602 today_action->addTo( actionMenu );
605 connect( today_action, SIGNAL( activated() ), 603 connect( today_action, SIGNAL( activated() ),
606 mView, SLOT( goToday() ) ); 604 mView, SLOT( goToday() ) );
607 605
608 if ( KOPrefs::instance()->mShowFullMenu ) { 606 if ( KOPrefs::instance()->mShowFullMenu ) {
609 actionMenu->insertSeparator(); 607 actionMenu->insertSeparator();
610 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 608 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
611 609
612 } 610 }
613 // actionMenu->insertSeparator(); 611 // actionMenu->insertSeparator();
614 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 612 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
615 this ); 613 this );
616 action->addTo( importMenu ); 614 action->addTo( importMenu );
617 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 615 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
618 action = new QAction( "import_quick", i18n("Import last file"), 0, 616 action = new QAction( "import_quick", i18n("Import last file"), 0,
619 this ); 617 this );
620 action->addTo( importMenu ); 618 action->addTo( importMenu );
621 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 619 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
622 importMenu->insertSeparator(); 620 importMenu->insertSeparator();
623 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 621 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
624 this ); 622 this );
625 action->addTo( importMenu ); 623 action->addTo( importMenu );
626 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 624 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
627#ifndef DESKTOP_VERSION 625#ifndef DESKTOP_VERSION
628 importMenu->insertSeparator(); 626 importMenu->insertSeparator();
629 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 627 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
630 this ); 628 this );
631 action->addTo( importMenu ); 629 action->addTo( importMenu );
632 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 630 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
633#else 631#else
634#ifdef _WIN32_ 632#ifdef _WIN32_
635 importMenu->insertSeparator(); 633 importMenu->insertSeparator();
636 action = new QAction( "import_ol", i18n("Import from OL"), 0, 634 action = new QAction( "import_ol", i18n("Import from OL"), 0,
637 this ); 635 this );
638 action->addTo( importMenu ); 636 action->addTo( importMenu );
639 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 637 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
640#endif 638#endif
641#endif 639#endif
642 640
643 importMenu->insertSeparator(); 641 importMenu->insertSeparator();
644 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 642 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
645 this ); 643 this );
646 action->addTo( importMenu ); 644 action->addTo( importMenu );
647 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 645 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
648 646
649 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 647 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
650 this ); 648 this );
651 action->addTo( importMenu ); 649 action->addTo( importMenu );
652 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 650 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
653 651
654 importMenu->insertSeparator(); 652 importMenu->insertSeparator();
655 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 653 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
656 this ); 654 this );
657 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 655 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
658 importMenu->insertSeparator(); 656 importMenu->insertSeparator();
659 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 657 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
660 this ); 658 this );
661 action->addTo( importMenu ); 659 action->addTo( importMenu );
662 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 660 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
663#ifndef DESKTOP_VERSION 661#ifndef DESKTOP_VERSION
664 importMenu->insertSeparator(); 662 importMenu->insertSeparator();
665 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 663 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
666 this ); 664 this );
667 action->addTo( importMenu ); 665 action->addTo( importMenu );
668 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 666 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
669 667
670 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 668 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
671 this ); 669 this );
672 action->addTo( importMenu ); 670 action->addTo( importMenu );
673 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 671 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
674#else 672#else
675 importMenu->insertSeparator(); 673 importMenu->insertSeparator();
676 icon = loadPixmap( pathString + "print" ); 674 icon = loadPixmap( pathString + "print" );
677 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 675 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
678 action->addTo( importMenu ); 676 action->addTo( importMenu );
679 connect( action, SIGNAL( activated() ), 677 connect( action, SIGNAL( activated() ),
680 this, SLOT( printCal() ) ); 678 this, SLOT( printCal() ) );
681 679
682 icon = loadPixmap( pathString + "print" ); 680 icon = loadPixmap( pathString + "print" );
683 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 681 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
684 action->addTo( importMenu ); 682 action->addTo( importMenu );
685 connect( action, SIGNAL( activated() ), 683 connect( action, SIGNAL( activated() ),
686 this, SLOT( printSel() ) ); 684 this, SLOT( printSel() ) );
687#endif 685#endif
688 importMenu->insertSeparator(); 686 importMenu->insertSeparator();
689 action = new QAction( "beam all", i18n("Save"), 0, 687 action = new QAction( "beam all", i18n("Save"), 0,
690 this ); 688 this );
691 action->addTo( importMenu ); 689 action->addTo( importMenu );
692 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 690 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
693 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 691 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
694 this ); 692 this );
695 action->addTo( importMenu ); 693 action->addTo( importMenu );
696 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 694 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
697 695
698 //menuBar->insertItem( "Configure",configureMenu ); 696 //menuBar->insertItem( "Configure",configureMenu );
699 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 697 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
700 icon = loadPixmap( "korganizer/korganizer" ); 698 icon = loadPixmap( "korganizer/korganizer" );
701 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 699 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
702 action->addTo( helpMenu ); 700 action->addTo( helpMenu );
703 connect( action, SIGNAL( activated() ), 701 connect( action, SIGNAL( activated() ),
704 SLOT( keyBindings() ) ); 702 SLOT( keyBindings() ) );
705 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 703 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
706 action->addTo( helpMenu ); 704 action->addTo( helpMenu );
707 connect( action, SIGNAL( activated() ), 705 connect( action, SIGNAL( activated() ),
708 SLOT( features() ) ); 706 SLOT( features() ) );
709 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 707 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
710 action->addTo( helpMenu ); 708 action->addTo( helpMenu );
711 connect( action, SIGNAL( activated() ), 709 connect( action, SIGNAL( activated() ),
712 SLOT( aboutAutoSaving() ) ); 710 SLOT( aboutAutoSaving() ) );
713 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 711 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
714 action->addTo( helpMenu ); 712 action->addTo( helpMenu );
715 connect( action, SIGNAL( activated() ), 713 connect( action, SIGNAL( activated() ),
716 SLOT( aboutKnownBugs() ) ); 714 SLOT( aboutKnownBugs() ) );
717 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 715 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
718 action->addTo( helpMenu ); 716 action->addTo( helpMenu );
719 connect( action, SIGNAL( activated() ), 717 connect( action, SIGNAL( activated() ),
720 SLOT( usertrans() ) ); 718 SLOT( usertrans() ) );
721 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 719 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
722 action->addTo( helpMenu ); 720 action->addTo( helpMenu );
723 connect( action, SIGNAL( activated() ), 721 connect( action, SIGNAL( activated() ),
724 SLOT( synchowto() ) ); 722 SLOT( synchowto() ) );
725 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 723 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
726 action->addTo( helpMenu ); 724 action->addTo( helpMenu );
727 connect( action, SIGNAL( activated() ), 725 connect( action, SIGNAL( activated() ),
728 SLOT( whatsNew() ) ); 726 SLOT( whatsNew() ) );
729 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 727 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
730 action->addTo( helpMenu ); 728 action->addTo( helpMenu );
731 connect( action, SIGNAL( activated() ), 729 connect( action, SIGNAL( activated() ),
732 SLOT( faq() ) ); 730 SLOT( faq() ) );
733 731
734 732
735 action = new QAction( "about", i18n("About..."), 0, this ); 733 action = new QAction( "about", i18n("About..."), 0, this );
736 action->addTo( helpMenu ); 734 action->addTo( helpMenu );
737 connect( action, SIGNAL( activated() ), 735 connect( action, SIGNAL( activated() ),
738 SLOT( about() ) ); 736 SLOT( about() ) );
739 action = new QAction( "licence", i18n("Licence..."), 0, this ); 737 action = new QAction( "licence", i18n("Licence..."), 0, this );
740 action->addTo( helpMenu ); 738 action->addTo( helpMenu );
741 connect( action, SIGNAL( activated() ), 739 connect( action, SIGNAL( activated() ),
742 SLOT( licence() ) ); 740 SLOT( licence() ) );
743 //menuBar->insertSeparator(); 741 //menuBar->insertSeparator();
744 742
745 // ****************************************************** 743 // ******************************************************
746 // menubar icons 744 // menubar icons
747 745
748 746
749 iconToolBar->setHorizontalStretchable (true ); 747 iconToolBar->setHorizontalStretchable (true );
750 //menuBar->insertItem( iconToolBar ); 748 //menuBar->insertItem( iconToolBar );
751 //xdays_action 749 //xdays_action
752 if (p-> mShowIconNewEvent) 750 if (p-> mShowIconNewEvent)
753 ne_action->addTo( iconToolBar ); 751 ne_action->addTo( iconToolBar );
754 if (p->mShowIconNewTodo ) 752 if (p->mShowIconNewTodo )
755 nt_action->addTo( iconToolBar ); 753 nt_action->addTo( iconToolBar );
756 if (p-> mShowIconSearch) 754 if (p-> mShowIconSearch)
757 search_action->addTo( iconToolBar ); 755 search_action->addTo( iconToolBar );
758 if (p-> mShowIconNext) 756 if (p-> mShowIconNext)
759 whatsnext_action->addTo( iconToolBar ); 757 whatsnext_action->addTo( iconToolBar );
760 if (p-> mShowIconNextDays) 758 if (p-> mShowIconNextDays)
761 xdays_action->addTo( iconToolBar ); 759 xdays_action->addTo( iconToolBar );
762 if (p-> mShowIconList) 760 if (p-> mShowIconList)
763 showlist_action->addTo( iconToolBar ); 761 showlist_action->addTo( iconToolBar );
764 if (p-> mShowIconDay1) 762 if (p-> mShowIconDay1)
765 day1_action->addTo( iconToolBar ); 763 day1_action->addTo( iconToolBar );
766 if (p-> mShowIconDay5) 764 if (p-> mShowIconDay5)
767 day5_action->addTo( iconToolBar ); 765 day5_action->addTo( iconToolBar );
768 if (p-> mShowIconDay7) 766 if (p-> mShowIconDay7)
769 day7_action->addTo( iconToolBar ); 767 day7_action->addTo( iconToolBar );
770 if (p-> mShowIconMonth) 768 if (p-> mShowIconMonth)
771 month_action->addTo( iconToolBar ); 769 month_action->addTo( iconToolBar );
772 if (p-> mShowIconTodoview) 770 if (p-> mShowIconTodoview)
773 todoview_action->addTo( iconToolBar ); 771 todoview_action->addTo( iconToolBar );
774 if (p-> mShowIconJournal) 772 if (p-> mShowIconJournal)
775 viewjournal_action->addTo( iconToolBar ); 773 viewjournal_action->addTo( iconToolBar );
776 icon = loadPixmap( pathString + "2leftarrowB" ); 774 icon = loadPixmap( pathString + "2leftarrowB" );
777 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 775 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
778 if (p-> mShowIconBackFast) { 776 if (p-> mShowIconBackFast) {
779 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 777 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
780 connect( action, SIGNAL( activated() ), 778 connect( action, SIGNAL( activated() ),
781 mView, SLOT( goPreviousMonth() ) ); 779 mView, SLOT( goPreviousMonth() ) );
782 action->addTo( iconToolBar ); 780 action->addTo( iconToolBar );
783 } 781 }
784 icon = loadPixmap( pathString + "1leftarrowB" ); 782 icon = loadPixmap( pathString + "1leftarrowB" );
785 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 783 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
786 if (p-> mShowIconBack) { 784 if (p-> mShowIconBack) {
787 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 785 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
788 connect( action, SIGNAL( activated() ), 786 connect( action, SIGNAL( activated() ),
789 mView, SLOT( goPrevious() ) ); 787 mView, SLOT( goPrevious() ) );
790 action->addTo( iconToolBar ); 788 action->addTo( iconToolBar );
791 } 789 }
792 if (p-> mShowIconToday) 790 if (p-> mShowIconToday)
793 today_action->addTo( iconToolBar ); 791 today_action->addTo( iconToolBar );
794 icon = loadPixmap( pathString + "1rightarrowB" ); 792 icon = loadPixmap( pathString + "1rightarrowB" );
795 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 793 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
796 if (p-> mShowIconForward) { 794 if (p-> mShowIconForward) {
797 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 795 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
798 connect( action, SIGNAL( activated() ), 796 connect( action, SIGNAL( activated() ),
799 mView, SLOT( goNext() ) ); 797 mView, SLOT( goNext() ) );
800 action->addTo( iconToolBar ); 798 action->addTo( iconToolBar );
801 } 799 }
802 icon = loadPixmap( pathString + "2rightarrowB" ); 800 icon = loadPixmap( pathString + "2rightarrowB" );
803 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 801 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
804 if (p-> mShowIconForwardFast) { 802 if (p-> mShowIconForwardFast) {
805 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 803 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
806 connect( action, SIGNAL( activated() ), 804 connect( action, SIGNAL( activated() ),
807 mView, SLOT( goNextMonth() ) ); 805 mView, SLOT( goNextMonth() ) );
808 action->addTo( iconToolBar ); 806 action->addTo( iconToolBar );
809 } 807 }
810 808
811 809
812 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 810 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
813 811
814 if (p-> mShowIconNewEvent) 812 if (p-> mShowIconNewEvent)
815 configureToolBarMenu->setItemChecked( 10, true ); 813 configureToolBarMenu->setItemChecked( 10, true );
816 if (p->mShowIconNewTodo ) 814 if (p->mShowIconNewTodo )
817 configureToolBarMenu->setItemChecked( 20, true ); 815 configureToolBarMenu->setItemChecked( 20, true );
818 if (p-> mShowIconSearch) 816 if (p-> mShowIconSearch)
819 configureToolBarMenu->setItemChecked( 120, true ); 817 configureToolBarMenu->setItemChecked( 120, true );
820 if (p-> mShowIconList) 818 if (p-> mShowIconList)
821 configureToolBarMenu->setItemChecked( 30, true ); 819 configureToolBarMenu->setItemChecked( 30, true );
822 if (p-> mShowIconDay1) 820 if (p-> mShowIconDay1)
823 configureToolBarMenu->setItemChecked( 40, true ); 821 configureToolBarMenu->setItemChecked( 40, true );
824 if (p-> mShowIconDay5) 822 if (p-> mShowIconDay5)
825 configureToolBarMenu->setItemChecked( 50, true ); 823 configureToolBarMenu->setItemChecked( 50, true );
826 if (p-> mShowIconDay7) 824 if (p-> mShowIconDay7)
827 configureToolBarMenu->setItemChecked( 60, true ); 825 configureToolBarMenu->setItemChecked( 60, true );
828 if (p-> mShowIconMonth) 826 if (p-> mShowIconMonth)
829 configureToolBarMenu->setItemChecked( 70, true ); 827 configureToolBarMenu->setItemChecked( 70, true );
830 if (p-> mShowIconTodoview) 828 if (p-> mShowIconTodoview)
831 configureToolBarMenu->setItemChecked( 80, true ); 829 configureToolBarMenu->setItemChecked( 80, true );
832 if (p-> mShowIconBackFast) 830 if (p-> mShowIconBackFast)
833 configureToolBarMenu->setItemChecked( 200, true ); 831 configureToolBarMenu->setItemChecked( 200, true );
834 if (p-> mShowIconBack) 832 if (p-> mShowIconBack)
835 configureToolBarMenu->setItemChecked( 210, true ); 833 configureToolBarMenu->setItemChecked( 210, true );
836 if (p-> mShowIconToday) 834 if (p-> mShowIconToday)
837 configureToolBarMenu->setItemChecked( 130, true ); 835 configureToolBarMenu->setItemChecked( 130, true );
838 if (p-> mShowIconForward) 836 if (p-> mShowIconForward)
839 configureToolBarMenu->setItemChecked( 220, true ); 837 configureToolBarMenu->setItemChecked( 220, true );
840 if (p-> mShowIconForwardFast) 838 if (p-> mShowIconForwardFast)
841 configureToolBarMenu->setItemChecked( 230, true ); 839 configureToolBarMenu->setItemChecked( 230, true );
842 if (p-> mShowIconNextDays) 840 if (p-> mShowIconNextDays)
843 configureToolBarMenu->setItemChecked( 100, true ); 841 configureToolBarMenu->setItemChecked( 100, true );
844 if (p-> mShowIconNext) 842 if (p-> mShowIconNext)
845 configureToolBarMenu->setItemChecked( 110, true ); 843 configureToolBarMenu->setItemChecked( 110, true );
846 if (p-> mShowIconJournal) 844 if (p-> mShowIconJournal)
847 configureToolBarMenu->setItemChecked( 90, true ); 845 configureToolBarMenu->setItemChecked( 90, true );
848 if (p-> mShowIconWhatsThis) 846 if (p-> mShowIconWhatsThis)
849 configureToolBarMenu->setItemChecked( 300, true ); 847 configureToolBarMenu->setItemChecked( 300, true );
850 848
851 QLabel* dummy = new QLabel( iconToolBar ); 849 QLabel* dummy = new QLabel( iconToolBar );
852 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 850 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
853 if (!p-> mShowIconStretch) 851 if (!p-> mShowIconStretch)
854 iconToolBar->setStretchableWidget ( dummy ) ; 852 iconToolBar->setStretchableWidget ( dummy ) ;
855 else 853 else
856 configureToolBarMenu->setItemChecked( 5, true ); 854 configureToolBarMenu->setItemChecked( 5, true );
857 if (p-> mShowIconWhatsThis) 855 if (p-> mShowIconWhatsThis)
858 QWhatsThis::whatsThisButton ( iconToolBar ); 856 QWhatsThis::whatsThisButton ( iconToolBar );
859 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 857 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
860 configureAgenda( p->mHourSize ); 858 configureAgenda( p->mHourSize );
861 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 859 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
862} 860}
863void MainWindow::fillSyncMenu() 861void MainWindow::fillSyncMenu()
864{ 862{
865 if ( syncMenu->count() ) 863 if ( syncMenu->count() )
866 syncMenu->clear(); 864 syncMenu->clear();
867 syncMenu->insertItem( i18n("Configure..."), 0 ); 865 syncMenu->insertItem( i18n("Configure..."), 0 );
868 syncMenu->insertSeparator(); 866 syncMenu->insertSeparator();
869 if ( mServerSocket == 0 ) { 867 if ( mServerSocket == 0 ) {
870 syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); 868 syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
871 } else { 869 } else {
872 syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); 870 syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
873 } 871 }
874 syncMenu->insertSeparator(); 872 syncMenu->insertSeparator();
875 syncMenu->insertItem( i18n("Multiple sync"), 1 ); 873 syncMenu->insertItem( i18n("Multiple sync"), 1 );
876 syncMenu->insertSeparator(); 874 syncMenu->insertSeparator();
877 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 875 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
878 config.setGroup("General"); 876 config.setGroup("General");
879 QStringList prof = config.readListEntry("SyncProfileNames"); 877 QStringList prof = config.readListEntry("SyncProfileNames");
880 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 878 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
881 if ( prof.count() < 3 ) { 879 if ( prof.count() < 3 ) {
882 prof.clear(); 880 prof.clear();
883 prof << i18n("Sharp_DTM"); 881 prof << i18n("Sharp_DTM");
884 prof << i18n("Local_file"); 882 prof << i18n("Local_file");
885 prof << i18n("Last_file"); 883 prof << i18n("Last_file");
886 KSyncProfile* temp = new KSyncProfile (); 884 KSyncProfile* temp = new KSyncProfile ();
887 temp->setName( prof[0] ); 885 temp->setName( prof[0] );
888 temp->writeConfig(&config); 886 temp->writeConfig(&config);
889 temp->setName( prof[1] ); 887 temp->setName( prof[1] );
890 temp->writeConfig(&config); 888 temp->writeConfig(&config);
891 temp->setName( prof[2] ); 889 temp->setName( prof[2] );
892 temp->writeConfig(&config); 890 temp->writeConfig(&config);
893 config.setGroup("General"); 891 config.setGroup("General");
894 config.writeEntry("SyncProfileNames",prof); 892 config.writeEntry("SyncProfileNames",prof);
895 config.writeEntry("ExternSyncProfiles","Sharp_DTM"); 893 config.writeEntry("ExternSyncProfiles","Sharp_DTM");
896 config.sync(); 894 config.sync();
897 delete temp; 895 delete temp;
898 } 896 }
899 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); 897 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
900 KOPrefs::instance()->mSyncProfileNames = prof; 898 KOPrefs::instance()->mSyncProfileNames = prof;
901 int i; 899 int i;
902 for ( i = 0; i < prof.count(); ++i ) { 900 for ( i = 0; i < prof.count(); ++i ) {
903 901
904 syncMenu->insertItem( prof[i], 1000+i ); 902 syncMenu->insertItem( prof[i], 1000+i );
905 if ( i == 2 ) 903 if ( i == 2 )
906 syncMenu->insertSeparator(); 904 syncMenu->insertSeparator();
907 } 905 }
908 QDir app_dir; 906 QDir app_dir;
909 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 907 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
910 syncMenu->setItemEnabled( false , 1000 ); 908 syncMenu->setItemEnabled( false , 1000 );
911 } 909 }
912 mView->setupExternSyncProfiles(); 910 mView->setupExternSyncProfiles();
913} 911}
914 912
915int MainWindow::ringSync() 913int MainWindow::ringSync()
916{ 914{
917 int syncedProfiles = 0; 915 int syncedProfiles = 0;
918 int i; 916 int i;
919 QTime timer; 917 QTime timer;
920 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 918 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
921 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; 919 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
922 KSyncProfile* temp = new KSyncProfile (); 920 KSyncProfile* temp = new KSyncProfile ();
923 KOPrefs::instance()->mAskForPreferences = false; 921 KOPrefs::instance()->mAskForPreferences = false;
924 for ( i = 0; i < syncProfileNames.count(); ++i ) { 922 for ( i = 0; i < syncProfileNames.count(); ++i ) {
925 mCurrentSyncProfile = i; 923 mCurrentSyncProfile = i;
926 temp->setName(syncProfileNames[mCurrentSyncProfile]); 924 temp->setName(syncProfileNames[mCurrentSyncProfile]);
927 temp->readConfig(&config); 925 temp->readConfig(&config);
928 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { 926 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
929 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 927 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
930 ++syncedProfiles; 928 ++syncedProfiles;
931 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 929 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
932 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 930 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
933 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 931 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
934 KOPrefs::instance()->mWriteBackInFuture = 0; 932 KOPrefs::instance()->mWriteBackInFuture = 0;
935 if ( temp->getWriteBackFuture() ) 933 if ( temp->getWriteBackFuture() )
936 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 934 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
937 KOPrefs::instance()->mShowSyncSummary = false; 935 KOPrefs::instance()->mShowSyncSummary = false;
938 mView->setSyncDevice(syncProfileNames[i] ); 936 mView->setSyncDevice(syncProfileNames[i] );
939 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 937 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
940 if ( i == 0 ) { 938 if ( i == 0 ) {
941 syncSharp(); 939 syncSharp();
942 } else { 940 } else {