summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-26 00:32:18 (UTC)
committer zautrix <zautrix>2005-01-26 00:32:18 (UTC)
commitc3ec0a5a43fb328f2d190b8adee1ef662746fb41 (patch) (unidiff)
treedd34f587205f8567a59bf7abb6161e1ba6667444 /korganizer
parenteeb9059d1cbf2ffb13300d0491b4b61126507373 (diff)
downloadkdepimpi-c3ec0a5a43fb328f2d190b8adee1ef662746fb41.zip
kdepimpi-c3ec0a5a43fb328f2d190b8adee1ef662746fb41.tar.gz
kdepimpi-c3ec0a5a43fb328f2d190b8adee1ef662746fb41.tar.bz2
debug fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp21
-rw-r--r--korganizer/mainwindow.cpp3
2 files changed, 13 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 038da54..06454c2 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -823,756 +823,757 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
823 else 823 else
824 return 2; 824 return 2;
825 break; 825 break;
826 case SYNC_PREF_ASK: 826 case SYNC_PREF_ASK:
827 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 827 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
828 if ( lastSync > remoteMod ) 828 if ( lastSync > remoteMod )
829 return 1; 829 return 1;
830 if ( lastSync > localMod ) 830 if ( lastSync > localMod )
831 return 2; 831 return 2;
832 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 832 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
833 localIsNew = localMod >= remoteMod; 833 localIsNew = localMod >= remoteMod;
834 if ( localIsNew ) 834 if ( localIsNew )
835 getEventViewerDialog()->setColorMode( 1 ); 835 getEventViewerDialog()->setColorMode( 1 );
836 else 836 else
837 getEventViewerDialog()->setColorMode( 2 ); 837 getEventViewerDialog()->setColorMode( 2 );
838 getEventViewerDialog()->setIncidence(local); 838 getEventViewerDialog()->setIncidence(local);
839 if ( localIsNew ) 839 if ( localIsNew )
840 getEventViewerDialog()->setColorMode( 2 ); 840 getEventViewerDialog()->setColorMode( 2 );
841 else 841 else
842 getEventViewerDialog()->setColorMode( 1 ); 842 getEventViewerDialog()->setColorMode( 1 );
843 getEventViewerDialog()->addIncidence(remote); 843 getEventViewerDialog()->addIncidence(remote);
844 getEventViewerDialog()->setColorMode( 0 ); 844 getEventViewerDialog()->setColorMode( 0 );
845 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 845 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
846 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 846 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
847 getEventViewerDialog()->showMe(); 847 getEventViewerDialog()->showMe();
848 result = getEventViewerDialog()->executeS( localIsNew ); 848 result = getEventViewerDialog()->executeS( localIsNew );
849 return result; 849 return result;
850 850
851 break; 851 break;
852 case SYNC_PREF_FORCE_LOCAL: 852 case SYNC_PREF_FORCE_LOCAL:
853 return 1; 853 return 1;
854 break; 854 break;
855 case SYNC_PREF_FORCE_REMOTE: 855 case SYNC_PREF_FORCE_REMOTE:
856 return 2; 856 return 2;
857 break; 857 break;
858 858
859 default: 859 default:
860 // SYNC_PREF_TAKE_BOTH not implemented 860 // SYNC_PREF_TAKE_BOTH not implemented
861 break; 861 break;
862 } 862 }
863 return 0; 863 return 0;
864} 864}
865Event* CalendarView::getLastSyncEvent() 865Event* CalendarView::getLastSyncEvent()
866{ 866{
867 Event* lse; 867 Event* lse;
868 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 868 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
869 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 869 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
870 if (!lse) { 870 if (!lse) {
871 lse = new Event(); 871 lse = new Event();
872 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 872 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
873 QString sum = ""; 873 QString sum = "";
874 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 874 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
875 sum = "E: "; 875 sum = "E: ";
876 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 876 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
877 lse->setDtStart( mLastCalendarSync ); 877 lse->setDtStart( mLastCalendarSync );
878 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 878 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
879 lse->setCategories( i18n("SyncEvent") ); 879 lse->setCategories( i18n("SyncEvent") );
880 lse->setReadOnly( true ); 880 lse->setReadOnly( true );
881 mCalendar->addEvent( lse ); 881 mCalendar->addEvent( lse );
882 } 882 }
883 883
884 return lse; 884 return lse;
885 885
886} 886}
887 887
888// we check, if the to delete event has a id for a profile 888// we check, if the to delete event has a id for a profile
889// if yes, we set this id in the profile to delete 889// if yes, we set this id in the profile to delete
890void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 890void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
891{ 891{
892 if ( lastSync.count() == 0 ) { 892 if ( lastSync.count() == 0 ) {
893 //qDebug(" lastSync.count() == 0"); 893 //qDebug(" lastSync.count() == 0");
894 return; 894 return;
895 } 895 }
896 if ( toDelete->type() == "Journal" ) 896 if ( toDelete->type() == "Journal" )
897 return; 897 return;
898 898
899 Event* eve = lastSync.first(); 899 Event* eve = lastSync.first();
900 900
901 while ( eve ) { 901 while ( eve ) {
902 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 902 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
903 if ( !id.isEmpty() ) { 903 if ( !id.isEmpty() ) {
904 QString des = eve->description(); 904 QString des = eve->description();
905 QString pref = "e"; 905 QString pref = "e";
906 if ( toDelete->type() == "Todo" ) 906 if ( toDelete->type() == "Todo" )
907 pref = "t"; 907 pref = "t";
908 des += pref+ id + ","; 908 des += pref+ id + ",";
909 eve->setReadOnly( false ); 909 eve->setReadOnly( false );
910 eve->setDescription( des ); 910 eve->setDescription( des );
911 //qDebug("setdes %s ", des.latin1()); 911 //qDebug("setdes %s ", des.latin1());
912 eve->setReadOnly( true ); 912 eve->setReadOnly( true );
913 } 913 }
914 eve = lastSync.next(); 914 eve = lastSync.next();
915 } 915 }
916 916
917} 917}
918void CalendarView::checkExternalId( Incidence * inc ) 918void CalendarView::checkExternalId( Incidence * inc )
919{ 919{
920 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 920 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
921 checkExternSyncEvent( lastSync, inc ); 921 checkExternSyncEvent( lastSync, inc );
922 922
923} 923}
924bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 924bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
925{ 925{
926 bool syncOK = true; 926 bool syncOK = true;
927 int addedEvent = 0; 927 int addedEvent = 0;
928 int addedEventR = 0; 928 int addedEventR = 0;
929 int deletedEventR = 0; 929 int deletedEventR = 0;
930 int deletedEventL = 0; 930 int deletedEventL = 0;
931 int changedLocal = 0; 931 int changedLocal = 0;
932 int changedRemote = 0; 932 int changedRemote = 0;
933 int filteredIN = 0; 933 int filteredIN = 0;
934 int filteredOUT = 0; 934 int filteredOUT = 0;
935 //QPtrList<Event> el = local->rawEvents(); 935 //QPtrList<Event> el = local->rawEvents();
936 Event* eventR; 936 Event* eventR;
937 QString uid; 937 QString uid;
938 int take; 938 int take;
939 Event* eventL; 939 Event* eventL;
940 Event* eventRSync; 940 Event* eventRSync;
941 Event* eventLSync; 941 Event* eventLSync;
942 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 942 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
943 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 943 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
944 bool fullDateRange = false; 944 bool fullDateRange = false;
945 local->resetTempSyncStat(); 945 local->resetTempSyncStat();
946 mLastCalendarSync = QDateTime::currentDateTime(); 946 mLastCalendarSync = QDateTime::currentDateTime();
947 if ( mSyncManager->syncWithDesktop() ) { 947 if ( mSyncManager->syncWithDesktop() ) {
948 remote->resetPilotStat(1); 948 remote->resetPilotStat(1);
949 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 949 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
950 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 950 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
951 qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 951 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
952 } else { 952 } else {
953 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 953 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
954 } 954 }
955 } 955 }
956 QDateTime modifiedCalendar = mLastCalendarSync; 956 QDateTime modifiedCalendar = mLastCalendarSync;
957 eventLSync = getLastSyncEvent(); 957 eventLSync = getLastSyncEvent();
958 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 958 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
959 if ( eventR ) { 959 if ( eventR ) {
960 eventRSync = (Event*) eventR->clone(); 960 eventRSync = (Event*) eventR->clone();
961 remote->deleteEvent(eventR ); 961 remote->deleteEvent(eventR );
962 962
963 } else { 963 } else {
964 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 964 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
965 eventRSync = (Event*)eventLSync->clone(); 965 eventRSync = (Event*)eventLSync->clone();
966 } else { 966 } else {
967 fullDateRange = true; 967 fullDateRange = true;
968 eventRSync = new Event(); 968 eventRSync = new Event();
969 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 969 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
970 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 970 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
971 eventRSync->setDtStart( mLastCalendarSync ); 971 eventRSync->setDtStart( mLastCalendarSync );
972 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 972 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
973 eventRSync->setCategories( i18n("SyncEvent") ); 973 eventRSync->setCategories( i18n("SyncEvent") );
974 } 974 }
975 } 975 }
976 if ( eventLSync->dtStart() == mLastCalendarSync ) 976 if ( eventLSync->dtStart() == mLastCalendarSync )
977 fullDateRange = true; 977 fullDateRange = true;
978 978
979 if ( ! fullDateRange ) { 979 if ( ! fullDateRange ) {
980 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 980 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
981 981
982 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 982 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
983 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 983 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
984 fullDateRange = true; 984 fullDateRange = true;
985 } 985 }
986 } 986 }
987 if ( mSyncManager->syncWithDesktop() ) { 987 if ( mSyncManager->syncWithDesktop() ) {
988 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 988 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
989 } 989 }
990 if ( fullDateRange ) 990 if ( fullDateRange )
991 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 991 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
992 else 992 else
993 mLastCalendarSync = eventLSync->dtStart(); 993 mLastCalendarSync = eventLSync->dtStart();
994 // for resyncing if own file has changed 994 // for resyncing if own file has changed
995 if ( mCurrentSyncDevice == "deleteaftersync" ) { 995 if ( mCurrentSyncDevice == "deleteaftersync" ) {
996 mLastCalendarSync = loadedFileVersion; 996 mLastCalendarSync = loadedFileVersion;
997 //qDebug("setting mLastCalendarSync "); 997 //qDebug("setting mLastCalendarSync ");
998 } 998 }
999 //qDebug("*************************** "); 999 //qDebug("*************************** ");
1000 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 1000 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
1001 QPtrList<Incidence> er = remote->rawIncidences(); 1001 QPtrList<Incidence> er = remote->rawIncidences();
1002 Incidence* inR = er.first(); 1002 Incidence* inR = er.first();
1003 Incidence* inL; 1003 Incidence* inL;
1004 QProgressBar bar( er.count(),0 ); 1004 QProgressBar bar( er.count(),0 );
1005 bar.setCaption (i18n("Syncing - close to abort!") ); 1005 bar.setCaption (i18n("Syncing - close to abort!") );
1006 1006
1007 // ************** setting up filter ************* 1007 // ************** setting up filter *************
1008 CalFilter *filterIN = 0; 1008 CalFilter *filterIN = 0;
1009 CalFilter *filterOUT = 0; 1009 CalFilter *filterOUT = 0;
1010 CalFilter *filter = mFilters.first(); 1010 CalFilter *filter = mFilters.first();
1011 while(filter) { 1011 while(filter) {
1012 if ( filter->name() == mSyncManager->mFilterInCal ) 1012 if ( filter->name() == mSyncManager->mFilterInCal )
1013 filterIN = filter; 1013 filterIN = filter;
1014 if ( filter->name() == mSyncManager->mFilterOutCal ) 1014 if ( filter->name() == mSyncManager->mFilterOutCal )
1015 filterOUT = filter; 1015 filterOUT = filter;
1016 filter = mFilters.next(); 1016 filter = mFilters.next();
1017 } 1017 }
1018 int w = 300; 1018 int w = 300;
1019 if ( QApplication::desktop()->width() < 320 ) 1019 if ( QApplication::desktop()->width() < 320 )
1020 w = 220; 1020 w = 220;
1021 int h = bar.sizeHint().height() ; 1021 int h = bar.sizeHint().height() ;
1022 int dw = QApplication::desktop()->width(); 1022 int dw = QApplication::desktop()->width();
1023 int dh = QApplication::desktop()->height(); 1023 int dh = QApplication::desktop()->height();
1024 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1024 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1025 bar.show(); 1025 bar.show();
1026 int modulo = (er.count()/10)+1; 1026 int modulo = (er.count()/10)+1;
1027 int incCounter = 0; 1027 int incCounter = 0;
1028 while ( inR ) { 1028 while ( inR ) {
1029 if ( ! bar.isVisible() ) 1029 if ( ! bar.isVisible() )
1030 return false; 1030 return false;
1031 if ( incCounter % modulo == 0 ) 1031 if ( incCounter % modulo == 0 )
1032 bar.setProgress( incCounter ); 1032 bar.setProgress( incCounter );
1033 ++incCounter; 1033 ++incCounter;
1034 uid = inR->uid(); 1034 uid = inR->uid();
1035 bool skipIncidence = false; 1035 bool skipIncidence = false;
1036 if ( uid.left(15) == QString("last-syncEvent-") ) 1036 if ( uid.left(15) == QString("last-syncEvent-") )
1037 skipIncidence = true; 1037 skipIncidence = true;
1038 QString idS; 1038 QString idS;
1039 qApp->processEvents(); 1039 qApp->processEvents();
1040 if ( !skipIncidence ) { 1040 if ( !skipIncidence ) {
1041 inL = local->incidence( uid ); 1041 inL = local->incidence( uid );
1042 if ( inL ) { // maybe conflict - same uid in both calendars 1042 if ( inL ) { // maybe conflict - same uid in both calendars
1043 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1043 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1044 //qDebug("take %d %s ", take, inL->summary().latin1()); 1044 //qDebug("take %d %s ", take, inL->summary().latin1());
1045 if ( take == 3 ) 1045 if ( take == 3 )
1046 return false; 1046 return false;
1047 if ( take == 1 ) {// take local ********************** 1047 if ( take == 1 ) {// take local **********************
1048 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1048 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1049 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1049 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1050 else 1050 else
1051 idS = inR->IDStr(); 1051 idS = inR->IDStr();
1052 remote->deleteIncidence( inR ); 1052 remote->deleteIncidence( inR );
1053 inR = inL->clone(); 1053 inR = inL->clone();
1054 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1054 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1055 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1055 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1056 inR->setIDStr( idS ); 1056 inR->setIDStr( idS );
1057 remote->addIncidence( inR ); 1057 remote->addIncidence( inR );
1058 if ( mSyncManager->syncWithDesktop() ) 1058 if ( mSyncManager->syncWithDesktop() )
1059 inR->setPilotId( 2 ); 1059 inR->setPilotId( 2 );
1060 ++changedRemote; 1060 ++changedRemote;
1061 } else {// take remote ********************** 1061 } else {// take remote **********************
1062 idS = inL->IDStr(); 1062 idS = inL->IDStr();
1063 int pid = inL->pilotId(); 1063 int pid = inL->pilotId();
1064 local->deleteIncidence( inL ); 1064 local->deleteIncidence( inL );
1065 inL = inR->clone(); 1065 inL = inR->clone();
1066 if ( mSyncManager->syncWithDesktop() ) 1066 if ( mSyncManager->syncWithDesktop() )
1067 inL->setPilotId( pid ); 1067 inL->setPilotId( pid );
1068 inL->setIDStr( idS ); 1068 inL->setIDStr( idS );
1069 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1069 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1070 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1070 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1071 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1071 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1072 } 1072 }
1073 local->addIncidence( inL ); 1073 local->addIncidence( inL );
1074 ++changedLocal; 1074 ++changedLocal;
1075 } 1075 }
1076 } 1076 }
1077 } else { // no conflict ********** add or delete remote 1077 } else { // no conflict ********** add or delete remote
1078 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ 1078 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
1079 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1079 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1080 QString des = eventLSync->description(); 1080 QString des = eventLSync->description();
1081 QString pref = "e"; 1081 QString pref = "e";
1082 if ( inR->type() == "Todo" ) 1082 if ( inR->type() == "Todo" )
1083 pref = "t"; 1083 pref = "t";
1084 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1084 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1085 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1085 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1086 //remote->deleteIncidence( inR ); 1086 //remote->deleteIncidence( inR );
1087 ++deletedEventR; 1087 ++deletedEventR;
1088 } else { 1088 } else {
1089 inR->setLastModified( modifiedCalendar ); 1089 inR->setLastModified( modifiedCalendar );
1090 inL = inR->clone(); 1090 inL = inR->clone();
1091 inL->setIDStr( ":" ); 1091 inL->setIDStr( ":" );
1092 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1092 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1093 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1093 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1094 local->addIncidence( inL ); 1094 local->addIncidence( inL );
1095 ++addedEvent; 1095 ++addedEvent;
1096 1096
1097 } 1097 }
1098 } else { 1098 } else {
1099 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1099 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1100 inR->setLastModified( modifiedCalendar ); 1100 inR->setLastModified( modifiedCalendar );
1101 inL = inR->clone(); 1101 inL = inR->clone();
1102 inL->setIDStr( ":" ); 1102 inL->setIDStr( ":" );
1103 local->addIncidence( inL ); 1103 local->addIncidence( inL );
1104 ++addedEvent; 1104 ++addedEvent;
1105 1105
1106 } else { 1106 } else {
1107 checkExternSyncEvent(eventRSyncSharp, inR); 1107 checkExternSyncEvent(eventRSyncSharp, inR);
1108 remote->deleteIncidence( inR ); 1108 remote->deleteIncidence( inR );
1109 ++deletedEventR; 1109 ++deletedEventR;
1110 } 1110 }
1111 } 1111 }
1112 } else { 1112 } else {
1113 ++filteredIN; 1113 ++filteredIN;
1114 } 1114 }
1115 } 1115 }
1116 } 1116 }
1117 inR = er.next(); 1117 inR = er.next();
1118 } 1118 }
1119 QPtrList<Incidence> el = local->rawIncidences(); 1119 QPtrList<Incidence> el = local->rawIncidences();
1120 inL = el.first(); 1120 inL = el.first();
1121 modulo = (el.count()/10)+1; 1121 modulo = (el.count()/10)+1;
1122 bar.setCaption (i18n("Add / remove events") ); 1122 bar.setCaption (i18n("Add / remove events") );
1123 bar.setTotalSteps ( el.count() ) ; 1123 bar.setTotalSteps ( el.count() ) ;
1124 bar.show(); 1124 bar.show();
1125 incCounter = 0; 1125 incCounter = 0;
1126 1126
1127 while ( inL ) { 1127 while ( inL ) {
1128 1128
1129 qApp->processEvents(); 1129 qApp->processEvents();
1130 if ( ! bar.isVisible() ) 1130 if ( ! bar.isVisible() )
1131 return false; 1131 return false;
1132 if ( incCounter % modulo == 0 ) 1132 if ( incCounter % modulo == 0 )
1133 bar.setProgress( incCounter ); 1133 bar.setProgress( incCounter );
1134 ++incCounter; 1134 ++incCounter;
1135 uid = inL->uid(); 1135 uid = inL->uid();
1136 bool skipIncidence = false; 1136 bool skipIncidence = false;
1137 if ( uid.left(15) == QString("last-syncEvent-") ) 1137 if ( uid.left(15) == QString("last-syncEvent-") )
1138 skipIncidence = true; 1138 skipIncidence = true;
1139 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1139 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1140 skipIncidence = true; 1140 skipIncidence = true;
1141 if ( !skipIncidence ) { 1141 if ( !skipIncidence ) {
1142 inR = remote->incidence( uid ); 1142 inR = remote->incidence( uid );
1143 if ( ! inR ) { 1143 if ( ! inR ) {
1144 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ 1144 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
1145 // no conflict ********** add or delete local 1145 // no conflict ********** add or delete local
1146 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1146 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1147 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1147 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1148 checkExternSyncEvent(eventLSyncSharp, inL); 1148 checkExternSyncEvent(eventLSyncSharp, inL);
1149 local->deleteIncidence( inL ); 1149 local->deleteIncidence( inL );
1150 ++deletedEventL; 1150 ++deletedEventL;
1151 } else { 1151 } else {
1152 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1152 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1153 inL->removeID(mCurrentSyncDevice ); 1153 inL->removeID(mCurrentSyncDevice );
1154 ++addedEventR; 1154 ++addedEventR;
1155 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1155 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1156 inL->setLastModified( modifiedCalendar ); 1156 inL->setLastModified( modifiedCalendar );
1157 inR = inL->clone(); 1157 inR = inL->clone();
1158 inR->setIDStr( ":" ); 1158 inR->setIDStr( ":" );
1159 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1159 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1160 remote->addIncidence( inR ); 1160 remote->addIncidence( inR );
1161 } 1161 }
1162 } 1162 }
1163 } else { 1163 } else {
1164 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1164 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1165 checkExternSyncEvent(eventLSyncSharp, inL); 1165 checkExternSyncEvent(eventLSyncSharp, inL);
1166 local->deleteIncidence( inL ); 1166 local->deleteIncidence( inL );
1167 ++deletedEventL; 1167 ++deletedEventL;
1168 } else { 1168 } else {
1169 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1169 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1170 ++addedEventR; 1170 ++addedEventR;
1171 inL->setLastModified( modifiedCalendar ); 1171 inL->setLastModified( modifiedCalendar );
1172 inR = inL->clone(); 1172 inR = inL->clone();
1173 inR->setIDStr( ":" ); 1173 inR->setIDStr( ":" );
1174 remote->addIncidence( inR ); 1174 remote->addIncidence( inR );
1175 } 1175 }
1176 } 1176 }
1177 } 1177 }
1178 } else { 1178 } else {
1179 ++filteredOUT; 1179 ++filteredOUT;
1180 } 1180 }
1181 } 1181 }
1182 } 1182 }
1183 inL = el.next(); 1183 inL = el.next();
1184 } 1184 }
1185 int delFut = 0; 1185 int delFut = 0;
1186 int remRem = 0; 1186 int remRem = 0;
1187 if ( mSyncManager->mWriteBackInFuture ) { 1187 if ( mSyncManager->mWriteBackInFuture ) {
1188 er = remote->rawIncidences(); 1188 er = remote->rawIncidences();
1189 remRem = er.count(); 1189 remRem = er.count();
1190 inR = er.first(); 1190 inR = er.first();
1191 QDateTime dt; 1191 QDateTime dt;
1192 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); 1192 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1193 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); 1193 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1194 while ( inR ) { 1194 while ( inR ) {
1195 if ( inR->type() == "Todo" ) { 1195 if ( inR->type() == "Todo" ) {
1196 Todo * t = (Todo*)inR; 1196 Todo * t = (Todo*)inR;
1197 if ( t->hasDueDate() ) 1197 if ( t->hasDueDate() )
1198 dt = t->dtDue(); 1198 dt = t->dtDue();
1199 else 1199 else
1200 dt = cur.addSecs( 62 ); 1200 dt = cur.addSecs( 62 );
1201 } 1201 }
1202 else if (inR->type() == "Event" ) { 1202 else if (inR->type() == "Event" ) {
1203 bool ok; 1203 bool ok;
1204 dt = inR->getNextOccurence( cur, &ok ); 1204 dt = inR->getNextOccurence( cur, &ok );
1205 if ( !ok ) 1205 if ( !ok )
1206 dt = cur.addSecs( -62 ); 1206 dt = cur.addSecs( -62 );
1207 } 1207 }
1208 else 1208 else
1209 dt = inR->dtStart(); 1209 dt = inR->dtStart();
1210 if ( dt < cur || dt > end ) { 1210 if ( dt < cur || dt > end ) {
1211 remote->deleteIncidence( inR ); 1211 remote->deleteIncidence( inR );
1212 ++delFut; 1212 ++delFut;
1213 } 1213 }
1214 inR = er.next(); 1214 inR = er.next();
1215 } 1215 }
1216 } 1216 }
1217 bar.hide(); 1217 bar.hide();
1218 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1218 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1219 eventLSync->setReadOnly( false ); 1219 eventLSync->setReadOnly( false );
1220 eventLSync->setDtStart( mLastCalendarSync ); 1220 eventLSync->setDtStart( mLastCalendarSync );
1221 eventRSync->setDtStart( mLastCalendarSync ); 1221 eventRSync->setDtStart( mLastCalendarSync );
1222 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1222 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1223 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1223 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1224 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1224 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1225 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1225 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1226 eventLSync->setReadOnly( true ); 1226 eventLSync->setReadOnly( true );
1227 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() ); 1227 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
1228 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1228 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1229 remote->addEvent( eventRSync ); 1229 remote->addEvent( eventRSync );
1230 else 1230 else
1231 delete eventRSync; 1231 delete eventRSync;
1232 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() );
1232 QString mes; 1233 QString mes;
1233 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 %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); 1234 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 %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT );
1234 QString delmess; 1235 QString delmess;
1235 if ( delFut ) { 1236 if ( delFut ) {
1236 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); 1237 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
1237 mes += delmess; 1238 mes += delmess;
1238 } 1239 }
1239 mes = i18n("Local calendar changed!\n") +mes; 1240 mes = i18n("Local calendar changed!\n") +mes;
1240 mCalendar->checkAlarmForIncidence( 0, true ); 1241 mCalendar->checkAlarmForIncidence( 0, true );
1241 qDebug( mes ); 1242 qDebug( mes );
1242 if ( mSyncManager->mShowSyncSummary ) { 1243 if ( mSyncManager->mShowSyncSummary ) {
1243 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1244 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1244 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1245 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1245 qDebug("cancelled "); 1246 qDebug("KO: WB cancelled ");
1246 return false; 1247 return false;
1247 } 1248 }
1248 } 1249 }
1249 return syncOK; 1250 return syncOK;
1250} 1251}
1251 1252
1252void CalendarView::setSyncDevice( QString s ) 1253void CalendarView::setSyncDevice( QString s )
1253{ 1254{
1254 mCurrentSyncDevice= s; 1255 mCurrentSyncDevice= s;
1255} 1256}
1256void CalendarView::setSyncName( QString s ) 1257void CalendarView::setSyncName( QString s )
1257{ 1258{
1258 mCurrentSyncName= s; 1259 mCurrentSyncName= s;
1259} 1260}
1260bool CalendarView::syncCalendar(QString filename, int mode) 1261bool CalendarView::syncCalendar(QString filename, int mode)
1261{ 1262{
1262 //qDebug("syncCalendar %s ", filename.latin1()); 1263 //qDebug("syncCalendar %s ", filename.latin1());
1263 mGlobalSyncMode = SYNC_MODE_NORMAL; 1264 mGlobalSyncMode = SYNC_MODE_NORMAL;
1264 CalendarLocal* calendar = new CalendarLocal(); 1265 CalendarLocal* calendar = new CalendarLocal();
1265 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1266 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1266 FileStorage* storage = new FileStorage( calendar ); 1267 FileStorage* storage = new FileStorage( calendar );
1267 bool syncOK = false; 1268 bool syncOK = false;
1268 storage->setFileName( filename ); 1269 storage->setFileName( filename );
1269 // qDebug("loading ... "); 1270 // qDebug("loading ... ");
1270 if ( storage->load() ) { 1271 if ( storage->load() ) {
1271 getEventViewerDialog()->setSyncMode( true ); 1272 getEventViewerDialog()->setSyncMode( true );
1272 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1273 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1273 getEventViewerDialog()->setSyncMode( false ); 1274 getEventViewerDialog()->setSyncMode( false );
1274 if ( syncOK ) { 1275 if ( syncOK ) {
1275 if ( mSyncManager->mWriteBackFile ) 1276 if ( mSyncManager->mWriteBackFile )
1276 { 1277 {
1277 storage->setSaveFormat( new ICalFormat() ); 1278 storage->setSaveFormat( new ICalFormat() );
1278 storage->save(); 1279 storage->save();
1279 } 1280 }
1280 } 1281 }
1281 setModified( true ); 1282 setModified( true );
1282 } 1283 }
1283 delete storage; 1284 delete storage;
1284 delete calendar; 1285 delete calendar;
1285 if ( syncOK ) 1286 if ( syncOK )
1286 updateView(); 1287 updateView();
1287 return syncOK; 1288 return syncOK;
1288} 1289}
1289 1290
1290void CalendarView::syncExternal( int mode ) 1291void CalendarView::syncExternal( int mode )
1291{ 1292{
1292 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1293 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1293 1294
1294 qApp->processEvents(); 1295 qApp->processEvents();
1295 CalendarLocal* calendar = new CalendarLocal(); 1296 CalendarLocal* calendar = new CalendarLocal();
1296 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1297 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1297 bool syncOK = false; 1298 bool syncOK = false;
1298 bool loadSuccess = false; 1299 bool loadSuccess = false;
1299 PhoneFormat* phoneFormat = 0; 1300 PhoneFormat* phoneFormat = 0;
1300 emit tempDisableBR(true); 1301 emit tempDisableBR(true);
1301#ifndef DESKTOP_VERSION 1302#ifndef DESKTOP_VERSION
1302 SharpFormat* sharpFormat = 0; 1303 SharpFormat* sharpFormat = 0;
1303 if ( mode == 0 ) { // sharp 1304 if ( mode == 0 ) { // sharp
1304 sharpFormat = new SharpFormat () ; 1305 sharpFormat = new SharpFormat () ;
1305 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1306 loadSuccess = sharpFormat->load( calendar, mCalendar );
1306 1307
1307 } else 1308 } else
1308#endif 1309#endif
1309 if ( mode == 1 ) { // phone 1310 if ( mode == 1 ) { // phone
1310 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1311 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1311 mSyncManager->mPhoneDevice, 1312 mSyncManager->mPhoneDevice,
1312 mSyncManager->mPhoneConnection, 1313 mSyncManager->mPhoneConnection,
1313 mSyncManager->mPhoneModel); 1314 mSyncManager->mPhoneModel);
1314 loadSuccess = phoneFormat->load( calendar,mCalendar); 1315 loadSuccess = phoneFormat->load( calendar,mCalendar);
1315 1316
1316 } else { 1317 } else {
1317 emit tempDisableBR(false); 1318 emit tempDisableBR(false);
1318 return; 1319 return;
1319 } 1320 }
1320 if ( loadSuccess ) { 1321 if ( loadSuccess ) {
1321 getEventViewerDialog()->setSyncMode( true ); 1322 getEventViewerDialog()->setSyncMode( true );
1322 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1323 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1323 getEventViewerDialog()->setSyncMode( false ); 1324 getEventViewerDialog()->setSyncMode( false );
1324 qApp->processEvents(); 1325 qApp->processEvents();
1325 if ( syncOK ) { 1326 if ( syncOK ) {
1326 if ( mSyncManager->mWriteBackFile ) 1327 if ( mSyncManager->mWriteBackFile )
1327 { 1328 {
1328 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1329 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1329 Incidence* inc = iL.first(); 1330 Incidence* inc = iL.first();
1330 if ( phoneFormat ) { 1331 if ( phoneFormat ) {
1331 while ( inc ) { 1332 while ( inc ) {
1332 inc->removeID(mCurrentSyncDevice); 1333 inc->removeID(mCurrentSyncDevice);
1333 inc = iL.next(); 1334 inc = iL.next();
1334 } 1335 }
1335 } 1336 }
1336#ifndef DESKTOP_VERSION 1337#ifndef DESKTOP_VERSION
1337 if ( sharpFormat ) 1338 if ( sharpFormat )
1338 sharpFormat->save(calendar); 1339 sharpFormat->save(calendar);
1339#endif 1340#endif
1340 if ( phoneFormat ) 1341 if ( phoneFormat )
1341 phoneFormat->save(calendar); 1342 phoneFormat->save(calendar);
1342 iL = calendar->rawIncidences(); 1343 iL = calendar->rawIncidences();
1343 inc = iL.first(); 1344 inc = iL.first();
1344 Incidence* loc; 1345 Incidence* loc;
1345 while ( inc ) { 1346 while ( inc ) {
1346 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1347 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1347 loc = mCalendar->incidence(inc->uid() ); 1348 loc = mCalendar->incidence(inc->uid() );
1348 if ( loc ) { 1349 if ( loc ) {
1349 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1350 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1350 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1351 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1351 } 1352 }
1352 } 1353 }
1353 inc = iL.next(); 1354 inc = iL.next();
1354 } 1355 }
1355 Incidence* lse = getLastSyncEvent(); 1356 Incidence* lse = getLastSyncEvent();
1356 if ( lse ) { 1357 if ( lse ) {
1357 lse->setReadOnly( false ); 1358 lse->setReadOnly( false );
1358 lse->setDescription( "" ); 1359 lse->setDescription( "" );
1359 lse->setReadOnly( true ); 1360 lse->setReadOnly( true );
1360 } 1361 }
1361 } 1362 }
1362 } else { 1363 } else {
1363 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 1364 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1364 } 1365 }
1365 setModified( true ); 1366 setModified( true );
1366 } else { 1367 } else {
1367 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1368 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1368 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1369 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1369 question, i18n("Ok")) ; 1370 question, i18n("Ok")) ;
1370 1371
1371 } 1372 }
1372 delete calendar; 1373 delete calendar;
1373 updateView(); 1374 updateView();
1374 emit tempDisableBR(false); 1375 emit tempDisableBR(false);
1375 return ;//syncOK; 1376 return ;//syncOK;
1376 1377
1377} 1378}
1378 1379
1379bool CalendarView::importBday() 1380bool CalendarView::importBday()
1380{ 1381{
1381#ifndef KORG_NOKABC 1382#ifndef KORG_NOKABC
1382 1383
1383#ifdef DESKTOP_VERSION 1384#ifdef DESKTOP_VERSION
1384 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1385 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1385 KABC::AddressBook::Iterator it; 1386 KABC::AddressBook::Iterator it;
1386 int count = 0; 1387 int count = 0;
1387 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1388 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1388 ++count; 1389 ++count;
1389 } 1390 }
1390 QProgressBar bar(count,0 ); 1391 QProgressBar bar(count,0 );
1391 int w = 300; 1392 int w = 300;
1392 if ( QApplication::desktop()->width() < 320 ) 1393 if ( QApplication::desktop()->width() < 320 )
1393 w = 220; 1394 w = 220;
1394 int h = bar.sizeHint().height() ; 1395 int h = bar.sizeHint().height() ;
1395 int dw = QApplication::desktop()->width(); 1396 int dw = QApplication::desktop()->width();
1396 int dh = QApplication::desktop()->height(); 1397 int dh = QApplication::desktop()->height();
1397 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1398 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1398 bar.show(); 1399 bar.show();
1399 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1400 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1400 qApp->processEvents(); 1401 qApp->processEvents();
1401 count = 0; 1402 count = 0;
1402 int addCount = 0; 1403 int addCount = 0;
1403 KCal::Attendee* a = 0; 1404 KCal::Attendee* a = 0;
1404 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1405 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1405 if ( ! bar.isVisible() ) 1406 if ( ! bar.isVisible() )
1406 return false; 1407 return false;
1407 bar.setProgress( count++ ); 1408 bar.setProgress( count++ );
1408 qApp->processEvents(); 1409 qApp->processEvents();
1409 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1410 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1410 if ( (*it).birthday().date().isValid() ){ 1411 if ( (*it).birthday().date().isValid() ){
1411 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1412 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1412 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1413 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1413 ++addCount; 1414 ++addCount;
1414 } 1415 }
1415 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1416 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1416 if ( anni.isValid() ){ 1417 if ( anni.isValid() ){
1417 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1418 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1418 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1419 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1419 ++addCount; 1420 ++addCount;
1420 } 1421 }
1421 } 1422 }
1422 updateView(); 1423 updateView();
1423 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1424 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1424#else //DESKTOP_VERSION 1425#else //DESKTOP_VERSION
1425 1426
1426 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1427 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1427 // the result should now arrive through method insertBirthdays 1428 // the result should now arrive through method insertBirthdays
1428 1429
1429#endif //DESKTOP_VERSION 1430#endif //DESKTOP_VERSION
1430 1431
1431#endif //KORG_NOKABC 1432#endif //KORG_NOKABC
1432 1433
1433 1434
1434 return true; 1435 return true;
1435} 1436}
1436 1437
1437// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1438// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1438void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1439void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1439 const QStringList& anniversaryList, const QStringList& realNameList, 1440 const QStringList& anniversaryList, const QStringList& realNameList,
1440 const QStringList& emailList, const QStringList& assembledNameList, 1441 const QStringList& emailList, const QStringList& assembledNameList,
1441 const QStringList& uidList) 1442 const QStringList& uidList)
1442{ 1443{
1443 qDebug("CalendarView::insertBirthdays"); 1444 //qDebug("KO::CalendarView::insertBirthdays");
1444 if (uid == this->name()) 1445 if (uid == this->name())
1445 { 1446 {
1446 int count = birthdayList.count(); 1447 int count = birthdayList.count();
1447 int addCount = 0; 1448 int addCount = 0;
1448 KCal::Attendee* a = 0; 1449 KCal::Attendee* a = 0;
1449 1450
1450 qDebug("CalView 1 %i", count); 1451 //qDebug("CalView 1 %i", count);
1451 1452
1452 QProgressBar bar(count,0 ); 1453 QProgressBar bar(count,0 );
1453 int w = 300; 1454 int w = 300;
1454 if ( QApplication::desktop()->width() < 320 ) 1455 if ( QApplication::desktop()->width() < 320 )
1455 w = 220; 1456 w = 220;
1456 int h = bar.sizeHint().height() ; 1457 int h = bar.sizeHint().height() ;
1457 int dw = QApplication::desktop()->width(); 1458 int dw = QApplication::desktop()->width();
1458 int dh = QApplication::desktop()->height(); 1459 int dh = QApplication::desktop()->height();
1459 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1460 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1460 bar.show(); 1461 bar.show();
1461 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1462 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1462 qApp->processEvents(); 1463 qApp->processEvents();
1463 1464
1464 QDate birthday; 1465 QDate birthday;
1465 QDate anniversary; 1466 QDate anniversary;
1466 QString realName; 1467 QString realName;
1467 QString email; 1468 QString email;
1468 QString assembledName; 1469 QString assembledName;
1469 QString uid; 1470 QString uid;
1470 bool ok = true; 1471 bool ok = true;
1471 for ( int i = 0; i < count; i++) 1472 for ( int i = 0; i < count; i++)
1472 { 1473 {
1473 if ( ! bar.isVisible() ) 1474 if ( ! bar.isVisible() )
1474 return; 1475 return;
1475 bar.setProgress( i ); 1476 bar.setProgress( i );
1476 qApp->processEvents(); 1477 qApp->processEvents();
1477 1478
1478 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1479 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1479 if (!ok) { 1480 if (!ok) {
1480 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1481 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1481 } 1482 }
1482 1483
1483 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1484 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1484 if (!ok) { 1485 if (!ok) {
1485 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1486 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1486 } 1487 }
1487 realName = realNameList[i]; 1488 realName = realNameList[i];
1488 email = emailList[i]; 1489 email = emailList[i];
1489 assembledName = assembledNameList[i]; 1490 assembledName = assembledNameList[i];
1490 uid = uidList[i]; 1491 uid = uidList[i];
1491 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); 1492 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() );
1492 1493
1493 if ( birthday.isValid() ){ 1494 if ( birthday.isValid() ){
1494 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1495 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1495 KCal::Attendee::ReqParticipant,uid) ; 1496 KCal::Attendee::ReqParticipant,uid) ;
1496 if ( addAnniversary( birthday, assembledName, a, true ) ) 1497 if ( addAnniversary( birthday, assembledName, a, true ) )
1497 ++addCount; 1498 ++addCount;
1498 } 1499 }
1499 1500
1500 if ( anniversary.isValid() ){ 1501 if ( anniversary.isValid() ){
1501 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1502 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1502 KCal::Attendee::ReqParticipant,uid) ; 1503 KCal::Attendee::ReqParticipant,uid) ;
1503 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1504 if ( addAnniversary( anniversary, assembledName, a, false ) )
1504 ++addCount; 1505 ++addCount;
1505 } 1506 }
1506 } 1507 }
1507 1508
1508 updateView(); 1509 updateView();
1509 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1510 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1510 1511
1511 } 1512 }
1512 1513
1513} 1514}
1514 1515
1515 1516
1516 1517
1517bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1518bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1518{ 1519{
1519 //qDebug("addAnni "); 1520 //qDebug("addAnni ");
1520 Event * ev = new Event(); 1521 Event * ev = new Event();
1521 if ( a ) { 1522 if ( a ) {
1522 ev->addAttendee( a ); 1523 ev->addAttendee( a );
1523 } 1524 }
1524 QString kind; 1525 QString kind;
1525 if ( birthday ) 1526 if ( birthday )
1526 kind = i18n( "Birthday" ); 1527 kind = i18n( "Birthday" );
1527 else 1528 else
1528 kind = i18n( "Anniversary" ); 1529 kind = i18n( "Anniversary" );
1529 ev->setSummary( name + " - " + kind ); 1530 ev->setSummary( name + " - " + kind );
1530 ev->setOrganizer(a->email()); 1531 ev->setOrganizer(a->email());
1531 ev->setCategories( kind ); 1532 ev->setCategories( kind );
1532 ev->setDtStart( QDateTime(date) ); 1533 ev->setDtStart( QDateTime(date) );
1533 ev->setDtEnd( QDateTime(date) ); 1534 ev->setDtEnd( QDateTime(date) );
1534 ev->setFloats( true ); 1535 ev->setFloats( true );
1535 Recurrence * rec = ev->recurrence(); 1536 Recurrence * rec = ev->recurrence();
1536 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1537 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1537 rec->addYearlyNum( date.month() ); 1538 rec->addYearlyNum( date.month() );
1538 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1539 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1539 delete ev; 1540 delete ev;
1540 return false; 1541 return false;
1541 } 1542 }
1542 return true; 1543 return true;
1543 1544
1544} 1545}
1545bool CalendarView::importQtopia( const QString &categories, 1546bool CalendarView::importQtopia( const QString &categories,
1546 const QString &datebook, 1547 const QString &datebook,
1547 const QString &todolist ) 1548 const QString &todolist )
1548{ 1549{
1549 1550
1550 QtopiaFormat qtopiaFormat; 1551 QtopiaFormat qtopiaFormat;
1551 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1552 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1552 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1553 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1553 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1554 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1554 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1555 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1555 1556
1556 updateView(); 1557 updateView();
1557 return true; 1558 return true;
1558 1559
1559#if 0 1560#if 0
1560 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1561 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1561 mCurrentSyncDevice = "qtopia-XML"; 1562 mCurrentSyncDevice = "qtopia-XML";
1562 if ( mSyncManager->mAskForPreferences ) 1563 if ( mSyncManager->mAskForPreferences )
1563 edit_sync_options(); 1564 edit_sync_options();
1564 qApp->processEvents(); 1565 qApp->processEvents();
1565 CalendarLocal* calendar = new CalendarLocal(); 1566 CalendarLocal* calendar = new CalendarLocal();
1566 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1567 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1567 bool syncOK = false; 1568 bool syncOK = false;
1568 QtopiaFormat qtopiaFormat; 1569 QtopiaFormat qtopiaFormat;
1569 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1570 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1570 bool loadOk = true; 1571 bool loadOk = true;
1571 if ( !categories.isEmpty() ) 1572 if ( !categories.isEmpty() )
1572 loadOk = qtopiaFormat.load( calendar, categories ); 1573 loadOk = qtopiaFormat.load( calendar, categories );
1573 if ( loadOk && !datebook.isEmpty() ) 1574 if ( loadOk && !datebook.isEmpty() )
1574 loadOk = qtopiaFormat.load( calendar, datebook ); 1575 loadOk = qtopiaFormat.load( calendar, datebook );
1575 if ( loadOk && !todolist.isEmpty() ) 1576 if ( loadOk && !todolist.isEmpty() )
1576 loadOk = qtopiaFormat.load( calendar, todolist ); 1577 loadOk = qtopiaFormat.load( calendar, todolist );
1577 1578
1578 if ( loadOk ) { 1579 if ( loadOk ) {
@@ -2384,272 +2385,272 @@ void CalendarView::beamCalendar()
2384} 2385}
2385void CalendarView::beamFilteredCalendar() 2386void CalendarView::beamFilteredCalendar()
2386{ 2387{
2387 QPtrList<Incidence> delSel = mCalendar->incidences(); 2388 QPtrList<Incidence> delSel = mCalendar->incidences();
2388 //qDebug("beamFilteredCalendar() "); 2389 //qDebug("beamFilteredCalendar() ");
2389 beamIncidenceList( delSel ); 2390 beamIncidenceList( delSel );
2390} 2391}
2391void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2392void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2392{ 2393{
2393 if ( beamDialog->exec () == QDialog::Rejected ) 2394 if ( beamDialog->exec () == QDialog::Rejected )
2394 return; 2395 return;
2395#ifdef DESKTOP_VERSION 2396#ifdef DESKTOP_VERSION
2396 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2397 QString fn = locateLocal( "tmp", "kopibeamfile" );
2397#else 2398#else
2398 QString fn = "/tmp/kopibeamfile"; 2399 QString fn = "/tmp/kopibeamfile";
2399#endif 2400#endif
2400 QString mes; 2401 QString mes;
2401 bool createbup = true; 2402 bool createbup = true;
2402 if ( createbup ) { 2403 if ( createbup ) {
2403 QString description = "\n"; 2404 QString description = "\n";
2404 CalendarLocal* cal = new CalendarLocal(); 2405 CalendarLocal* cal = new CalendarLocal();
2405 if ( beamDialog->beamLocal() ) 2406 if ( beamDialog->beamLocal() )
2406 cal->setLocalTime(); 2407 cal->setLocalTime();
2407 else 2408 else
2408 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2409 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2409 Incidence *incidence = delSel.first(); 2410 Incidence *incidence = delSel.first();
2410 bool addText = false; 2411 bool addText = false;
2411 if ( delSel.count() < 10 ) 2412 if ( delSel.count() < 10 )
2412 addText = true; 2413 addText = true;
2413 else { 2414 else {
2414 description.sprintf(i18n(" %d items?"),delSel.count() ); 2415 description.sprintf(i18n(" %d items?"),delSel.count() );
2415 } 2416 }
2416 while ( incidence ) { 2417 while ( incidence ) {
2417 Incidence *in = incidence->clone(); 2418 Incidence *in = incidence->clone();
2418 if ( ! in->summary().isEmpty() ) { 2419 if ( ! in->summary().isEmpty() ) {
2419 in->setDescription(""); 2420 in->setDescription("");
2420 } else { 2421 } else {
2421 in->setSummary( in->description().left(20)); 2422 in->setSummary( in->description().left(20));
2422 in->setDescription(""); 2423 in->setDescription("");
2423 } 2424 }
2424 if ( addText ) 2425 if ( addText )
2425 description += in->summary() + "\n"; 2426 description += in->summary() + "\n";
2426 cal->addIncidence( in ); 2427 cal->addIncidence( in );
2427 incidence = delSel.next(); 2428 incidence = delSel.next();
2428 } 2429 }
2429 if ( beamDialog->beamVcal() ) { 2430 if ( beamDialog->beamVcal() ) {
2430 fn += ".vcs"; 2431 fn += ".vcs";
2431 FileStorage storage( cal, fn, new VCalFormat ); 2432 FileStorage storage( cal, fn, new VCalFormat );
2432 storage.save(); 2433 storage.save();
2433 } else { 2434 } else {
2434 fn += ".ics"; 2435 fn += ".ics";
2435 FileStorage storage( cal, fn, new ICalFormat( ) ); 2436 FileStorage storage( cal, fn, new ICalFormat( ) );
2436 storage.save(); 2437 storage.save();
2437 } 2438 }
2438 delete cal; 2439 delete cal;
2439 mes = i18n("KO/Pi: Ready for beaming"); 2440 mes = i18n("KO/Pi: Ready for beaming");
2440 topLevelWidget()->setCaption(mes); 2441 topLevelWidget()->setCaption(mes);
2441 KApplication::convert2latin1( fn ); 2442 KApplication::convert2latin1( fn );
2442#ifndef DESKTOP_VERSION 2443#ifndef DESKTOP_VERSION
2443 Ir *ir = new Ir( this ); 2444 Ir *ir = new Ir( this );
2444 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2445 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2445 ir->send( fn, description, "text/x-vCalendar" ); 2446 ir->send( fn, description, "text/x-vCalendar" );
2446#endif 2447#endif
2447 } 2448 }
2448} 2449}
2449void CalendarView::beamDone( Ir *ir ) 2450void CalendarView::beamDone( Ir *ir )
2450{ 2451{
2451#ifndef DESKTOP_VERSION 2452#ifndef DESKTOP_VERSION
2452 delete ir; 2453 delete ir;
2453#endif 2454#endif
2454 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2455 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2455 topLevelWidget()->raise(); 2456 topLevelWidget()->raise();
2456} 2457}
2457 2458
2458void CalendarView::moveIncidence(Incidence * inc ) 2459void CalendarView::moveIncidence(Incidence * inc )
2459{ 2460{
2460 if ( !inc ) return; 2461 if ( !inc ) return;
2461 // qDebug("showDatePickerForIncidence( ) "); 2462 // qDebug("showDatePickerForIncidence( ) ");
2462 if ( mDateFrame->isVisible() ) 2463 if ( mDateFrame->isVisible() )
2463 mDateFrame->hide(); 2464 mDateFrame->hide();
2464 else { 2465 else {
2465 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2466 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2466 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2467 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2467 int dw = QApplication::desktop()->width(); 2468 int dw = QApplication::desktop()->width();
2468 int dh = QApplication::desktop()->height(); 2469 int dh = QApplication::desktop()->height();
2469 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2470 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2470 mDateFrame->show(); 2471 mDateFrame->show();
2471 } 2472 }
2472 mDatePickerMode = 2; 2473 mDatePickerMode = 2;
2473 mMoveIncidence = inc ; 2474 mMoveIncidence = inc ;
2474 QDate da; 2475 QDate da;
2475 if ( mMoveIncidence->type() == "Todo" ) { 2476 if ( mMoveIncidence->type() == "Todo" ) {
2476 Todo * to = (Todo *) mMoveIncidence; 2477 Todo * to = (Todo *) mMoveIncidence;
2477 if ( to->hasDueDate() ) 2478 if ( to->hasDueDate() )
2478 da = to->dtDue().date(); 2479 da = to->dtDue().date();
2479 else 2480 else
2480 da = QDate::currentDate(); 2481 da = QDate::currentDate();
2481 } else { 2482 } else {
2482 da = mMoveIncidence->dtStart().date(); 2483 da = mMoveIncidence->dtStart().date();
2483 } 2484 }
2484 //PENDING set date for recurring incidence to date of recurrence 2485 //PENDING set date for recurring incidence to date of recurrence
2485 //mMoveIncidenceOldDate; 2486 //mMoveIncidenceOldDate;
2486 mDatePicker->setDate( da ); 2487 mDatePicker->setDate( da );
2487} 2488}
2488void CalendarView::showDatePicker( ) 2489void CalendarView::showDatePicker( )
2489{ 2490{
2490 //qDebug("CalendarView::showDatePicker( ) "); 2491 //qDebug("CalendarView::showDatePicker( ) ");
2491 if ( mDateFrame->isVisible() ) 2492 if ( mDateFrame->isVisible() )
2492 mDateFrame->hide(); 2493 mDateFrame->hide();
2493 else { 2494 else {
2494 int w =mDatePicker->sizeHint().width() ; 2495 int w =mDatePicker->sizeHint().width() ;
2495 int h = mDatePicker->sizeHint().height() ; 2496 int h = mDatePicker->sizeHint().height() ;
2496 int dw = QApplication::desktop()->width(); 2497 int dw = QApplication::desktop()->width();
2497 int dh = QApplication::desktop()->height(); 2498 int dh = QApplication::desktop()->height();
2498 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2499 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2499 mDateFrame->show(); 2500 mDateFrame->show();
2500 } 2501 }
2501 mDatePickerMode = 1; 2502 mDatePickerMode = 1;
2502 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2503 mDatePicker->setDate( mNavigator->selectedDates().first() );
2503} 2504}
2504 2505
2505void CalendarView::showEventEditor() 2506void CalendarView::showEventEditor()
2506{ 2507{
2507#ifdef DESKTOP_VERSION 2508#ifdef DESKTOP_VERSION
2508 mEventEditor->show(); 2509 mEventEditor->show();
2509#else 2510#else
2510 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2511 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2511 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2512 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2512 qDebug("CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2513 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2513 delete mEventEditor; 2514 delete mEventEditor;
2514 mEventEditor = mDialogManager->getEventEditor(); 2515 mEventEditor = mDialogManager->getEventEditor();
2515 } 2516 }
2516 mEventEditor->showMaximized(); 2517 mEventEditor->showMaximized();
2517 topLevelWidget()->setCaption( i18n("") ); 2518 topLevelWidget()->setCaption( i18n("") );
2518#endif 2519#endif
2519} 2520}
2520void CalendarView::showTodoEditor() 2521void CalendarView::showTodoEditor()
2521{ 2522{
2522#ifdef DESKTOP_VERSION 2523#ifdef DESKTOP_VERSION
2523 mTodoEditor->show(); 2524 mTodoEditor->show();
2524#else 2525#else
2525 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2526 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2526 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2527 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2527 qDebug("CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2528 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2528 delete mTodoEditor; 2529 delete mTodoEditor;
2529 mTodoEditor = mDialogManager->getTodoEditor(); 2530 mTodoEditor = mDialogManager->getTodoEditor();
2530 } 2531 }
2531 mTodoEditor->showMaximized(); 2532 mTodoEditor->showMaximized();
2532 topLevelWidget()->setCaption( i18n("") ); 2533 topLevelWidget()->setCaption( i18n("") );
2533#endif 2534#endif
2534} 2535}
2535 2536
2536void CalendarView::cloneIncidence() 2537void CalendarView::cloneIncidence()
2537{ 2538{
2538 Incidence *incidence = currentSelection(); 2539 Incidence *incidence = currentSelection();
2539 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2540 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2540 if ( incidence ) { 2541 if ( incidence ) {
2541 cloneIncidence(incidence); 2542 cloneIncidence(incidence);
2542 } 2543 }
2543} 2544}
2544void CalendarView::moveIncidence() 2545void CalendarView::moveIncidence()
2545{ 2546{
2546 Incidence *incidence = currentSelection(); 2547 Incidence *incidence = currentSelection();
2547 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2548 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2548 if ( incidence ) { 2549 if ( incidence ) {
2549 moveIncidence(incidence); 2550 moveIncidence(incidence);
2550 } 2551 }
2551} 2552}
2552void CalendarView::beamIncidence() 2553void CalendarView::beamIncidence()
2553{ 2554{
2554 Incidence *incidence = currentSelection(); 2555 Incidence *incidence = currentSelection();
2555 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2556 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2556 if ( incidence ) { 2557 if ( incidence ) {
2557 beamIncidence(incidence); 2558 beamIncidence(incidence);
2558 } 2559 }
2559} 2560}
2560void CalendarView::toggleCancelIncidence() 2561void CalendarView::toggleCancelIncidence()
2561{ 2562{
2562 Incidence *incidence = currentSelection(); 2563 Incidence *incidence = currentSelection();
2563 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2564 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2564 if ( incidence ) { 2565 if ( incidence ) {
2565 cancelIncidence(incidence); 2566 cancelIncidence(incidence);
2566 } 2567 }
2567} 2568}
2568 2569
2569 2570
2570void CalendarView::cancelIncidence(Incidence * inc ) 2571void CalendarView::cancelIncidence(Incidence * inc )
2571{ 2572{
2572 inc->setCancelled( ! inc->cancelled() ); 2573 inc->setCancelled( ! inc->cancelled() );
2573 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2574 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2574 updateView(); 2575 updateView();
2575} 2576}
2576void CalendarView::cloneIncidence(Incidence * orgInc ) 2577void CalendarView::cloneIncidence(Incidence * orgInc )
2577{ 2578{
2578 Incidence * newInc = orgInc->clone(); 2579 Incidence * newInc = orgInc->clone();
2579 newInc->recreate(); 2580 newInc->recreate();
2580 2581
2581 if ( newInc->type() == "Todo" ) { 2582 if ( newInc->type() == "Todo" ) {
2582 Todo* t = (Todo*) newInc; 2583 Todo* t = (Todo*) newInc;
2583 showTodoEditor(); 2584 showTodoEditor();
2584 mTodoEditor->editTodo( t ); 2585 mTodoEditor->editTodo( t );
2585 if ( mTodoEditor->exec() ) { 2586 if ( mTodoEditor->exec() ) {
2586 mCalendar->addTodo( t ); 2587 mCalendar->addTodo( t );
2587 updateView(); 2588 updateView();
2588 } else { 2589 } else {
2589 delete t; 2590 delete t;
2590 } 2591 }
2591 } 2592 }
2592 else { 2593 else {
2593 Event* e = (Event*) newInc; 2594 Event* e = (Event*) newInc;
2594 showEventEditor(); 2595 showEventEditor();
2595 mEventEditor->editEvent( e ); 2596 mEventEditor->editEvent( e );
2596 if ( mEventEditor->exec() ) { 2597 if ( mEventEditor->exec() ) {
2597 mCalendar->addEvent( e ); 2598 mCalendar->addEvent( e );
2598 updateView(); 2599 updateView();
2599 } else { 2600 } else {
2600 delete e; 2601 delete e;
2601 } 2602 }
2602 } 2603 }
2603} 2604}
2604 2605
2605void CalendarView::newEvent() 2606void CalendarView::newEvent()
2606{ 2607{
2607 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2608 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2608 KOAgendaView *aView = mViewManager->agendaView(); 2609 KOAgendaView *aView = mViewManager->agendaView();
2609 if (aView) { 2610 if (aView) {
2610 if (aView->selectionStart().isValid()) { 2611 if (aView->selectionStart().isValid()) {
2611 if (aView->selectedIsAllDay()) { 2612 if (aView->selectedIsAllDay()) {
2612 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2613 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2613 } else { 2614 } else {
2614 newEvent(aView->selectionStart(),aView->selectionEnd()); 2615 newEvent(aView->selectionStart(),aView->selectionEnd());
2615 } 2616 }
2616 return; 2617 return;
2617 } 2618 }
2618 } 2619 }
2619 2620
2620 QDate date = mNavigator->selectedDates().first(); 2621 QDate date = mNavigator->selectedDates().first();
2621 QDateTime current = QDateTime::currentDateTime(); 2622 QDateTime current = QDateTime::currentDateTime();
2622 if ( date <= current.date() ) { 2623 if ( date <= current.date() ) {
2623 int hour = current.time().hour() +1; 2624 int hour = current.time().hour() +1;
2624 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2625 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2625 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2626 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2626 } else 2627 } else
2627 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2628 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2628 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2629 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2629 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2630 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2630} 2631}
2631 2632
2632void CalendarView::newEvent(QDateTime fh) 2633void CalendarView::newEvent(QDateTime fh)
2633{ 2634{
2634 newEvent(fh, 2635 newEvent(fh,
2635 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2636 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2636} 2637}
2637 2638
2638void CalendarView::newEvent(QDate dt) 2639void CalendarView::newEvent(QDate dt)
2639{ 2640{
2640 newEvent(QDateTime(dt, QTime(0,0,0)), 2641 newEvent(QDateTime(dt, QTime(0,0,0)),
2641 QDateTime(dt, QTime(0,0,0)), true); 2642 QDateTime(dt, QTime(0,0,0)), true);
2642} 2643}
2643 2644
2644void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2645void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2645{ 2646{
2646 2647
2647 showEventEditor(); 2648 showEventEditor();
2648 mEventEditor->newEvent(fromHint,toHint,allDay); 2649 mEventEditor->newEvent(fromHint,toHint,allDay);
2649 if ( mFilterView->filtersEnabled() ) { 2650 if ( mFilterView->filtersEnabled() ) {
2650 CalFilter *filter = mFilterView->selectedFilter(); 2651 CalFilter *filter = mFilterView->selectedFilter();
2651 if (filter && filter->showCategories()) { 2652 if (filter && filter->showCategories()) {
2652 mEventEditor->setCategories(filter->categoryList().join(",") ); 2653 mEventEditor->setCategories(filter->categoryList().join(",") );
2653 } 2654 }
2654 if ( filter ) 2655 if ( filter )
2655 mEventEditor->setSecrecy( filter->getSecrecy() ); 2656 mEventEditor->setSecrecy( filter->getSecrecy() );
@@ -3732,174 +3733,174 @@ void CalendarView::editIncidence()
3732 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3733 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3733 if ( incidence ) { 3734 if ( incidence ) {
3734 EditIncidenceVisitor v; 3735 EditIncidenceVisitor v;
3735 v.act( incidence, this ); 3736 v.act( incidence, this );
3736 } 3737 }
3737} 3738}
3738 3739
3739void CalendarView::deleteIncidence() 3740void CalendarView::deleteIncidence()
3740{ 3741{
3741 Incidence *incidence = currentSelection(); 3742 Incidence *incidence = currentSelection();
3742 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3743 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3743 if ( incidence ) { 3744 if ( incidence ) {
3744 deleteIncidence(incidence); 3745 deleteIncidence(incidence);
3745 } 3746 }
3746} 3747}
3747 3748
3748void CalendarView::showIncidence(Incidence *incidence) 3749void CalendarView::showIncidence(Incidence *incidence)
3749{ 3750{
3750 if ( incidence ) { 3751 if ( incidence ) {
3751 ShowIncidenceVisitor v; 3752 ShowIncidenceVisitor v;
3752 v.act( incidence, this ); 3753 v.act( incidence, this );
3753 } 3754 }
3754} 3755}
3755 3756
3756void CalendarView::editIncidence(Incidence *incidence) 3757void CalendarView::editIncidence(Incidence *incidence)
3757{ 3758{
3758 if ( incidence ) { 3759 if ( incidence ) {
3759 3760
3760 EditIncidenceVisitor v; 3761 EditIncidenceVisitor v;
3761 v.act( incidence, this ); 3762 v.act( incidence, this );
3762 3763
3763 } 3764 }
3764} 3765}
3765 3766
3766void CalendarView::deleteIncidence(Incidence *incidence) 3767void CalendarView::deleteIncidence(Incidence *incidence)
3767{ 3768{
3768 //qDebug(" CalendarView::deleteIncidence "); 3769 //qDebug(" CalendarView::deleteIncidence ");
3769 if ( incidence ) { 3770 if ( incidence ) {
3770 DeleteIncidenceVisitor v; 3771 DeleteIncidenceVisitor v;
3771 v.act( incidence, this ); 3772 v.act( incidence, this );
3772 } 3773 }
3773} 3774}
3774 3775
3775 3776
3776void CalendarView::lookForOutgoingMessages() 3777void CalendarView::lookForOutgoingMessages()
3777{ 3778{
3778 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3779 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3779 ogd->loadMessages(); 3780 ogd->loadMessages();
3780} 3781}
3781 3782
3782void CalendarView::lookForIncomingMessages() 3783void CalendarView::lookForIncomingMessages()
3783{ 3784{
3784 IncomingDialog *icd = mDialogManager->incomingDialog(); 3785 IncomingDialog *icd = mDialogManager->incomingDialog();
3785 icd->retrieve(); 3786 icd->retrieve();
3786} 3787}
3787 3788
3788bool CalendarView::removeCompletedSubTodos( Todo* t ) 3789bool CalendarView::removeCompletedSubTodos( Todo* t )
3789{ 3790{
3790 bool deleteTodo = true; 3791 bool deleteTodo = true;
3791 QPtrList<Incidence> subTodos; 3792 QPtrList<Incidence> subTodos;
3792 Incidence *aTodo; 3793 Incidence *aTodo;
3793 subTodos = t->relations(); 3794 subTodos = t->relations();
3794 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3795 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3795 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3796 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3796 deleteTodo = false; 3797 deleteTodo = false;
3797 } 3798 }
3798 if ( deleteTodo ) { 3799 if ( deleteTodo ) {
3799 if ( t->isCompleted() ) { 3800 if ( t->isCompleted() ) {
3800 checkExternalId( t ); 3801 checkExternalId( t );
3801 mCalendar->deleteTodo( t ); 3802 mCalendar->deleteTodo( t );
3802 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3803 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3803 } 3804 }
3804 else 3805 else
3805 deleteTodo = false; 3806 deleteTodo = false;
3806 } 3807 }
3807 return deleteTodo; 3808 return deleteTodo;
3808 3809
3809} 3810}
3810void CalendarView::purgeCompleted() 3811void CalendarView::purgeCompleted()
3811{ 3812{
3812 int result = KMessageBox::warningContinueCancel(this, 3813 int result = KMessageBox::warningContinueCancel(this,
3813 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3814 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3814 3815
3815 if (result == KMessageBox::Continue) { 3816 if (result == KMessageBox::Continue) {
3816 3817
3817 QPtrList<Todo> todoCal; 3818 QPtrList<Todo> todoCal;
3818 QPtrList<Todo> rootTodos; 3819 QPtrList<Todo> rootTodos;
3819 //QPtrList<Incidence> rel; 3820 //QPtrList<Incidence> rel;
3820 Todo *aTodo;//, *rTodo; 3821 Todo *aTodo;//, *rTodo;
3821 Incidence *rIncidence; 3822 Incidence *rIncidence;
3822 bool childDelete = false; 3823 bool childDelete = false;
3823 bool deletedOne = true; 3824 bool deletedOne = true;
3824 todoCal = calendar()->todos(); 3825 todoCal = calendar()->todos();
3825 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3826 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3826 if ( !aTodo->relatedTo() ) 3827 if ( !aTodo->relatedTo() )
3827 rootTodos.append( aTodo ); 3828 rootTodos.append( aTodo );
3828 } 3829 }
3829 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3830 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3830 removeCompletedSubTodos( aTodo ); 3831 removeCompletedSubTodos( aTodo );
3831 } 3832 }
3832 3833
3833 updateView(); 3834 updateView();
3834 } 3835 }
3835} 3836}
3836 3837
3837void CalendarView::slotCalendarChanged() 3838void CalendarView::slotCalendarChanged()
3838{ 3839{
3839 ; 3840 ;
3840} 3841}
3841 3842
3842NavigatorBar *CalendarView::navigatorBar() 3843NavigatorBar *CalendarView::navigatorBar()
3843{ 3844{
3844 return mNavigatorBar; 3845 return mNavigatorBar;
3845} 3846}
3846 3847
3847 3848
3848 3849
3849void CalendarView::keyPressEvent ( QKeyEvent *e) 3850void CalendarView::keyPressEvent ( QKeyEvent *e)
3850{ 3851{
3851 //qDebug(" alendarView::keyPressEvent "); 3852 //qDebug(" alendarView::keyPressEvent ");
3852 e->ignore(); 3853 e->ignore();
3853} 3854}
3854 3855
3855 3856
3856bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3857bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3857{ 3858{
3858 // mSyncManager = manager; 3859 // mSyncManager = manager;
3859 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 3860 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3860 qDebug("SyncKDE request detected!"); 3861 qDebug("KO: SyncKDE request detected!");
3861 } 3862 }
3862 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3863 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3863 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3864 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3864 return syncCalendar( filename, mode ); 3865 return syncCalendar( filename, mode );
3865} 3866}
3866bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3867bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3867{ 3868{
3868 //mSyncManager = manager; 3869 //mSyncManager = manager;
3869 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3870 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3870 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3871 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3871 if ( resource == "sharp" ) 3872 if ( resource == "sharp" )
3872 syncExternal( 0 ); 3873 syncExternal( 0 );
3873 if ( resource == "phone" ) 3874 if ( resource == "phone" )
3874 syncExternal( 1 ); 3875 syncExternal( 1 );
3875 // pending setmodified 3876 // pending setmodified
3876 return true; 3877 return true;
3877} 3878}
3878void CalendarView::setSyncManager(KSyncManager* manager) 3879void CalendarView::setSyncManager(KSyncManager* manager)
3879{ 3880{
3880 mSyncManager = manager; 3881 mSyncManager = manager;
3881} 3882}
3882 3883
3883void CalendarView::removeSyncInfo( QString syncProfile) 3884void CalendarView::removeSyncInfo( QString syncProfile)
3884{ 3885{
3885 qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); 3886 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
3886 mCalendar->removeSyncInfo( syncProfile ); 3887 mCalendar->removeSyncInfo( syncProfile );
3887 3888
3888} 3889}
3889 3890
3890void CalendarView::undo_delete() 3891void CalendarView::undo_delete()
3891{ 3892{
3892 //qDebug("undo_delete() "); 3893 //qDebug("undo_delete() ");
3893 Incidence* undo = mCalendar->undoIncidence(); 3894 Incidence* undo = mCalendar->undoIncidence();
3894 if ( !undo ) { 3895 if ( !undo ) {
3895 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 3896 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
3896 i18n("KO/Pi")); 3897 i18n("KO/Pi"));
3897 return; 3898 return;
3898 } 3899 }
3899 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 3900 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
3900 i18n("\nAre you sure you want\nto restore this?"), 3901 i18n("\nAre you sure you want\nto restore this?"),
3901 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 3902 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
3902 mCalendar->undoDeleteIncidence(); 3903 mCalendar->undoDeleteIncidence();
3903 updateView(); 3904 updateView();
3904 } 3905 }
3905} 3906}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 26ea1e2..877b6f2 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -482,257 +482,258 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
482 else if ( msg == "-showKO" ) { 482 else if ( msg == "-showKO" ) {
483 mView->viewManager()->showNextXView(); 483 mView->viewManager()->showNextXView();
484 } 484 }
485 else if ( msg == "-showWNext" || msg == "nextView()" ) { 485 else if ( msg == "-showWNext" || msg == "nextView()" ) {
486 mView->viewManager()->showWhatsNextView(); 486 mView->viewManager()->showWhatsNextView();
487 } 487 }
488 else if ( msg == "-showNextXView" ) { 488 else if ( msg == "-showNextXView" ) {
489 mView->viewManager()->showNextXView(); 489 mView->viewManager()->showNextXView();
490 } 490 }
491 491
492 492
493 } 493 }
494 494
495 showMaximized(); 495 showMaximized();
496 raise(); 496 raise();
497} 497}
498 498
499QPixmap MainWindow::loadPixmap( QString name ) 499QPixmap MainWindow::loadPixmap( QString name )
500{ 500{
501 return SmallIcon( name ); 501 return SmallIcon( name );
502 502
503} 503}
504void MainWindow::initActions() 504void MainWindow::initActions()
505{ 505{
506 //KOPrefs::instance()->mShowFullMenu 506 //KOPrefs::instance()->mShowFullMenu
507 iconToolBar->clear(); 507 iconToolBar->clear();
508 KOPrefs *p = KOPrefs::instance(); 508 KOPrefs *p = KOPrefs::instance();
509 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 509 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
510 510
511 QPopupMenu *viewMenu = new QPopupMenu( this ); 511 QPopupMenu *viewMenu = new QPopupMenu( this );
512 QPopupMenu *actionMenu = new QPopupMenu( this ); 512 QPopupMenu *actionMenu = new QPopupMenu( this );
513 QPopupMenu *importMenu = new QPopupMenu( this ); 513 QPopupMenu *importMenu = new QPopupMenu( this );
514 selectFilterMenu = new QPopupMenu( this ); 514 selectFilterMenu = new QPopupMenu( this );
515 selectFilterMenu->setCheckable( true ); 515 selectFilterMenu->setCheckable( true );
516 syncMenu = new QPopupMenu( this ); 516 syncMenu = new QPopupMenu( this );
517 configureAgendaMenu = new QPopupMenu( this ); 517 configureAgendaMenu = new QPopupMenu( this );
518 configureToolBarMenu = new QPopupMenu( this ); 518 configureToolBarMenu = new QPopupMenu( this );
519 QPopupMenu *helpMenu = new QPopupMenu( this ); 519 QPopupMenu *helpMenu = new QPopupMenu( this );
520 if ( KOPrefs::instance()->mShowFullMenu ) { 520 if ( KOPrefs::instance()->mShowFullMenu ) {
521 QMenuBar *menuBar1; 521 QMenuBar *menuBar1;
522 menuBar1 = menuBar(); 522 menuBar1 = menuBar();
523 menuBar1->insertItem( i18n("File"), importMenu ); 523 menuBar1->insertItem( i18n("File"), importMenu );
524 menuBar1->insertItem( i18n("View"), viewMenu ); 524 menuBar1->insertItem( i18n("View"), viewMenu );
525 menuBar1->insertItem( i18n("Actions"), actionMenu ); 525 menuBar1->insertItem( i18n("Actions"), actionMenu );
526 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 526 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
527 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 527 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
528 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 528 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
529 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 529 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
530 menuBar1->insertItem( i18n("Help"), helpMenu ); 530 menuBar1->insertItem( i18n("Help"), helpMenu );
531 } else { 531 } else {
532 QPEMenuBar *menuBar1; 532 QPEMenuBar *menuBar1;
533 menuBar1 = new QPEMenuBar( iconToolBar ); 533 menuBar1 = new QPEMenuBar( iconToolBar );
534 QPopupMenu *menuBar = new QPopupMenu( this ); 534 QPopupMenu *menuBar = new QPopupMenu( this );
535 menuBar1->insertItem( i18n("ME"), menuBar); 535 menuBar1->insertItem( i18n("ME"), menuBar);
536 menuBar->insertItem( i18n("File"), importMenu ); 536 menuBar->insertItem( i18n("File"), importMenu );
537 menuBar->insertItem( i18n("View"), viewMenu ); 537 menuBar->insertItem( i18n("View"), viewMenu );
538 menuBar->insertItem( i18n("Actions"), actionMenu ); 538 menuBar->insertItem( i18n("Actions"), actionMenu );
539 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 539 menuBar->insertItem( i18n("Synchronize"), syncMenu );
540 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 540 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
541 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 541 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
542 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 542 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
543 menuBar->insertItem( i18n("Help"), helpMenu ); 543 menuBar->insertItem( i18n("Help"), helpMenu );
544 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 544 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
545 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 545 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
546 } 546 }
547 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 547 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
548 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 548 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
549 549
550 // ****************** 550 // ******************
551 QAction *action; 551 QAction *action;
552 QIconSet icon; 552 QIconSet icon;
553 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 553 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
554 configureToolBarMenu->setCheckable( true ); 554 configureToolBarMenu->setCheckable( true );
555 555
556 QString pathString = ""; 556 QString pathString = "";
557 if ( !p->mToolBarMiniIcons ) { 557 if ( !p->mToolBarMiniIcons ) {
558 if ( QApplication::desktop()->width() < 480 ) 558 if ( QApplication::desktop()->width() < 480 )
559 pathString += "icons16/"; 559 pathString += "icons16/";
560 } else 560 } else
561 pathString += "iconsmini/"; 561 pathString += "iconsmini/";
562 configureAgendaMenu->setCheckable( true ); 562 configureAgendaMenu->setCheckable( true );
563 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 563 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
564 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 564 configureAgendaMenu->insertItem(i18n("Small"), 6 );
565 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 565 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
566 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 566 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
567 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 567 configureAgendaMenu->insertItem(i18n("Large"), 12 );
568 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 568 configureAgendaMenu->insertItem(i18n("Big"), 14 );
569 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 569 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
570 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 570 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
571 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 571 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
572 572
573 icon = loadPixmap( pathString + "configure" ); 573 icon = loadPixmap( pathString + "configure" );
574 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 574 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
575 action->addTo( actionMenu ); 575 action->addTo( actionMenu );
576 connect( action, SIGNAL( activated() ), 576 connect( action, SIGNAL( activated() ),
577 mView, SLOT( edit_options() ) ); 577 mView, SLOT( edit_options() ) );
578 actionMenu->insertSeparator(); 578 actionMenu->insertSeparator();
579 579
580 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 580 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
581 action->addTo( actionMenu ); 581 action->addTo( actionMenu );
582 connect( action, SIGNAL( activated() ), 582 connect( action, SIGNAL( activated() ),
583 mView, SLOT( undo_delete() ) ); 583 mView, SLOT( undo_delete() ) );
584 actionMenu->insertSeparator(); 584 actionMenu->insertSeparator();
585 585
586 icon = loadPixmap( pathString + "newevent" ); 586 icon = loadPixmap( pathString + "newevent" );
587 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 587 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
588 configureToolBarMenu->insertSeparator(); 588 configureToolBarMenu->insertSeparator();
589 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 589 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
590 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 590 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
591 ne_action->addTo( actionMenu ); 591 ne_action->addTo( actionMenu );
592 connect( ne_action, SIGNAL( activated() ), 592 connect( ne_action, SIGNAL( activated() ),
593 mView, SLOT( newEvent() ) ); 593 mView, SLOT( newEvent() ) );
594 icon = loadPixmap( pathString + "newtodo" ); 594 icon = loadPixmap( pathString + "newtodo" );
595 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 595 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
596 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 596 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
597 nt_action->addTo( actionMenu ); 597 nt_action->addTo( actionMenu );
598 connect( nt_action, SIGNAL( activated() ), 598 connect( nt_action, SIGNAL( activated() ),
599 mView, SLOT( newTodo() ) ); 599 mView, SLOT( newTodo() ) );
600 icon = loadPixmap( pathString + "navi" ); 600 icon = loadPixmap( pathString + "navi" );
601 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 601 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
602 action->addTo( viewMenu ); 602 action->addTo( viewMenu );
603 connect( action, SIGNAL( activated() ), 603 connect( action, SIGNAL( activated() ),
604 mView, SLOT( toggleDateNavigatorWidget() ) ); 604 mView, SLOT( toggleDateNavigatorWidget() ) );
605 icon = loadPixmap( pathString + "filter" ); 605 icon = loadPixmap( pathString + "filter" );
606 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 606 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
607 action->addTo( viewMenu ); 607 action->addTo( viewMenu );
608 connect( action, SIGNAL( activated() ), 608 connect( action, SIGNAL( activated() ),
609 mView, SLOT( toggleFilter() ) ); 609 mView, SLOT( toggleFilter() ) );
610 action = new QAction( i18n("Toggle Allday"), i18n("Toggle Allday"), 0, this ); 610 icon = loadPixmap( pathString + "allday" );
611 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
611 action->addTo( viewMenu ); 612 action->addTo( viewMenu );
612 connect( action, SIGNAL( activated() ), 613 connect( action, SIGNAL( activated() ),
613 mView, SLOT( toggleAllDaySize() ) ); 614 mView, SLOT( toggleAllDaySize() ) );
614 615
615 viewMenu->insertSeparator(); 616 viewMenu->insertSeparator();
616 icon = loadPixmap( pathString + "picker" ); 617 icon = loadPixmap( pathString + "picker" );
617 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 618 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
618 action->addTo( viewMenu ); 619 action->addTo( viewMenu );
619 connect( action, SIGNAL( activated() ), 620 connect( action, SIGNAL( activated() ),
620 mView, SLOT( showDatePicker() ) ); 621 mView, SLOT( showDatePicker() ) );
621 action->addTo( iconToolBar ); 622 action->addTo( iconToolBar );
622 viewMenu->insertSeparator(); 623 viewMenu->insertSeparator();
623 icon = loadPixmap( pathString + "list" ); 624 icon = loadPixmap( pathString + "list" );
624 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 625 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
625 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 626 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
626 showlist_action->addTo( viewMenu ); 627 showlist_action->addTo( viewMenu );
627 connect( showlist_action, SIGNAL( activated() ), 628 connect( showlist_action, SIGNAL( activated() ),
628 mView->viewManager(), SLOT( showListView() ) ); 629 mView->viewManager(), SLOT( showListView() ) );
629 630
630 631
631 icon = loadPixmap( pathString + "day" ); 632 icon = loadPixmap( pathString + "day" );
632 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 633 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
633 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 634 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
634 day1_action->addTo( viewMenu ); 635 day1_action->addTo( viewMenu );
635 // action->addTo( toolBar ); 636 // action->addTo( toolBar );
636 connect( day1_action, SIGNAL( activated() ), 637 connect( day1_action, SIGNAL( activated() ),
637 mView->viewManager(), SLOT( showDayView() ) ); 638 mView->viewManager(), SLOT( showDayView() ) );
638 639
639 icon = loadPixmap( pathString + "workweek" ); 640 icon = loadPixmap( pathString + "workweek" );
640 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 641 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
641 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 642 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
642 day5_action->addTo( viewMenu ); 643 day5_action->addTo( viewMenu );
643 connect( day5_action, SIGNAL( activated() ), 644 connect( day5_action, SIGNAL( activated() ),
644 mView->viewManager(), SLOT( showWorkWeekView() ) ); 645 mView->viewManager(), SLOT( showWorkWeekView() ) );
645 646
646 icon = loadPixmap( pathString + "week" ); 647 icon = loadPixmap( pathString + "week" );
647 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 648 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
648 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 649 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
649 day7_action->addTo( viewMenu ); 650 day7_action->addTo( viewMenu );
650 connect( day7_action, SIGNAL( activated() ), 651 connect( day7_action, SIGNAL( activated() ),
651 mView->viewManager(), SLOT( showWeekView() ) ); 652 mView->viewManager(), SLOT( showWeekView() ) );
652 653
653 icon = loadPixmap( pathString + "month" ); 654 icon = loadPixmap( pathString + "month" );
654 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 655 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
655 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 656 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
656 month_action->addTo( viewMenu ); 657 month_action->addTo( viewMenu );
657 connect( month_action, SIGNAL( activated() ), 658 connect( month_action, SIGNAL( activated() ),
658 mView->viewManager(), SLOT( showMonthView() ) ); 659 mView->viewManager(), SLOT( showMonthView() ) );
659 660
660 icon = loadPixmap( pathString + "todo" ); 661 icon = loadPixmap( pathString + "todo" );
661 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 662 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
662 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 663 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
663 todoview_action->addTo( viewMenu ); 664 todoview_action->addTo( viewMenu );
664 connect( todoview_action, SIGNAL( activated() ), 665 connect( todoview_action, SIGNAL( activated() ),
665 mView->viewManager(), SLOT( showTodoView() ) ); 666 mView->viewManager(), SLOT( showTodoView() ) );
666 667
667 icon = loadPixmap( pathString + "journal" ); 668 icon = loadPixmap( pathString + "journal" );
668 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 669 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
669 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 670 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
670 viewjournal_action->addTo( viewMenu ); 671 viewjournal_action->addTo( viewMenu );
671 connect( viewjournal_action, SIGNAL( activated() ), 672 connect( viewjournal_action, SIGNAL( activated() ),
672 mView->viewManager(), SLOT( showJournalView() ) ); 673 mView->viewManager(), SLOT( showJournalView() ) );
673 674
674 icon = loadPixmap( pathString + "xdays" ); 675 icon = loadPixmap( pathString + "xdays" );
675 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 676 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
676 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 677 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
677 xdays_action->addTo( viewMenu ); 678 xdays_action->addTo( viewMenu );
678 connect( xdays_action, SIGNAL( activated() ), 679 connect( xdays_action, SIGNAL( activated() ),
679 mView->viewManager(), SLOT( showNextXView() ) ); 680 mView->viewManager(), SLOT( showNextXView() ) );
680 681
681 icon = loadPixmap( pathString + "whatsnext" ); 682 icon = loadPixmap( pathString + "whatsnext" );
682 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 683 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
683 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 684 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
684 whatsnext_action->addTo( viewMenu ); 685 whatsnext_action->addTo( viewMenu );
685 connect( whatsnext_action, SIGNAL( activated() ), 686 connect( whatsnext_action, SIGNAL( activated() ),
686 mView->viewManager(), SLOT( showWhatsNextView() ) ); 687 mView->viewManager(), SLOT( showWhatsNextView() ) );
687 688
688#if 0 689#if 0
689 action = new QAction( "view_timespan", "Time Span", 0, this ); 690 action = new QAction( "view_timespan", "Time Span", 0, this );
690 action->addTo( viewMenu ); 691 action->addTo( viewMenu );
691 connect( action, SIGNAL( activated() ), 692 connect( action, SIGNAL( activated() ),
692 mView->viewManager(), SLOT( showTimeSpanView() ) ); 693 mView->viewManager(), SLOT( showTimeSpanView() ) );
693#endif 694#endif
694 695
695 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 696 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
696 this ); 697 this );
697 mNewSubTodoAction->addTo( actionMenu ); 698 mNewSubTodoAction->addTo( actionMenu );
698 connect( mNewSubTodoAction, SIGNAL( activated() ), 699 connect( mNewSubTodoAction, SIGNAL( activated() ),
699 mView, SLOT( newSubTodo() ) ); 700 mView, SLOT( newSubTodo() ) );
700 701
701 actionMenu->insertSeparator(); 702 actionMenu->insertSeparator();
702 703
703 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 704 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
704 mShowAction->addTo( actionMenu ); 705 mShowAction->addTo( actionMenu );
705 connect( mShowAction, SIGNAL( activated() ), 706 connect( mShowAction, SIGNAL( activated() ),
706 mView, SLOT( showIncidence() ) ); 707 mView, SLOT( showIncidence() ) );
707 708
708 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 709 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
709 mEditAction->addTo( actionMenu ); 710 mEditAction->addTo( actionMenu );
710 connect( mEditAction, SIGNAL( activated() ), 711 connect( mEditAction, SIGNAL( activated() ),
711 mView, SLOT( editIncidence() ) ); 712 mView, SLOT( editIncidence() ) );
712 713
713 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 714 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
714 mDeleteAction->addTo( actionMenu ); 715 mDeleteAction->addTo( actionMenu );
715 connect( mDeleteAction, SIGNAL( activated() ), 716 connect( mDeleteAction, SIGNAL( activated() ),
716 mView, SLOT( deleteIncidence() ) ); 717 mView, SLOT( deleteIncidence() ) );
717 718
718 719
719 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 720 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
720 mCloneAction->addTo( actionMenu ); 721 mCloneAction->addTo( actionMenu );
721 connect( mCloneAction, SIGNAL( activated() ), 722 connect( mCloneAction, SIGNAL( activated() ),
722 mView, SLOT( cloneIncidence() ) ); 723 mView, SLOT( cloneIncidence() ) );
723 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 724 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
724 mMoveAction->addTo( actionMenu ); 725 mMoveAction->addTo( actionMenu );
725 connect( mMoveAction, SIGNAL( activated() ), 726 connect( mMoveAction, SIGNAL( activated() ),
726 mView, SLOT( moveIncidence() ) ); 727 mView, SLOT( moveIncidence() ) );
727 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 728 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
728 mBeamAction->addTo( actionMenu ); 729 mBeamAction->addTo( actionMenu );
729 connect( mBeamAction, SIGNAL( activated() ), 730 connect( mBeamAction, SIGNAL( activated() ),
730 mView, SLOT( beamIncidence() ) ); 731 mView, SLOT( beamIncidence() ) );
731 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 732 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
732 mCancelAction->addTo( actionMenu ); 733 mCancelAction->addTo( actionMenu );
733 connect( mCancelAction, SIGNAL( activated() ), 734 connect( mCancelAction, SIGNAL( activated() ),
734 mView, SLOT( toggleCancelIncidence() ) ); 735 mView, SLOT( toggleCancelIncidence() ) );
735 736
736 actionMenu->insertSeparator(); 737 actionMenu->insertSeparator();
737 738
738 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 739 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,