-rw-r--r-- | korganizer/calendarview.cpp | 76 | ||||
-rw-r--r-- | korganizer/calendarview.h | 5 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 27 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 3 | ||||
-rw-r--r-- | libkcal/calendar.h | 2 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 14 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 2 |
8 files changed, 87 insertions, 43 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index cfc6b10..9160e1d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -805,310 +805,336 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
805 | if ( local->lastModified() > remote->lastModified() ) | 805 | if ( local->lastModified() > remote->lastModified() ) |
806 | return 1; | 806 | return 1; |
807 | else | 807 | else |
808 | return 2; | 808 | return 2; |
809 | break; | 809 | break; |
810 | case SYNC_PREF_ASK: | 810 | case SYNC_PREF_ASK: |
811 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 811 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
812 | if ( lastSync > remote->lastModified() ) | 812 | if ( lastSync > remote->lastModified() ) |
813 | return 1; | 813 | return 1; |
814 | if ( lastSync > local->lastModified() ) | 814 | if ( lastSync > local->lastModified() ) |
815 | return 2; | 815 | return 2; |
816 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 816 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
817 | localIsNew = local->lastModified() > remote->lastModified(); | 817 | localIsNew = local->lastModified() > remote->lastModified(); |
818 | if ( localIsNew ) | 818 | if ( localIsNew ) |
819 | getEventViewerDialog()->setColorMode( 1 ); | 819 | getEventViewerDialog()->setColorMode( 1 ); |
820 | else | 820 | else |
821 | getEventViewerDialog()->setColorMode( 2 ); | 821 | getEventViewerDialog()->setColorMode( 2 ); |
822 | getEventViewerDialog()->setIncidence(local); | 822 | getEventViewerDialog()->setIncidence(local); |
823 | if ( localIsNew ) | 823 | if ( localIsNew ) |
824 | getEventViewerDialog()->setColorMode( 2 ); | 824 | getEventViewerDialog()->setColorMode( 2 ); |
825 | else | 825 | else |
826 | getEventViewerDialog()->setColorMode( 1 ); | 826 | getEventViewerDialog()->setColorMode( 1 ); |
827 | getEventViewerDialog()->addIncidence(remote); | 827 | getEventViewerDialog()->addIncidence(remote); |
828 | getEventViewerDialog()->setColorMode( 0 ); | 828 | getEventViewerDialog()->setColorMode( 0 ); |
829 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 829 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
830 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 830 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
831 | getEventViewerDialog()->showMe(); | 831 | getEventViewerDialog()->showMe(); |
832 | result = getEventViewerDialog()->executeS( localIsNew ); | 832 | result = getEventViewerDialog()->executeS( localIsNew ); |
833 | return result; | 833 | return result; |
834 | 834 | ||
835 | break; | 835 | break; |
836 | case SYNC_PREF_FORCE_LOCAL: | 836 | case SYNC_PREF_FORCE_LOCAL: |
837 | return 1; | 837 | return 1; |
838 | break; | 838 | break; |
839 | case SYNC_PREF_FORCE_REMOTE: | 839 | case SYNC_PREF_FORCE_REMOTE: |
840 | return 2; | 840 | return 2; |
841 | break; | 841 | break; |
842 | 842 | ||
843 | default: | 843 | default: |
844 | // SYNC_PREF_TAKE_BOTH not implemented | 844 | // SYNC_PREF_TAKE_BOTH not implemented |
845 | break; | 845 | break; |
846 | } | 846 | } |
847 | return 0; | 847 | return 0; |
848 | } | 848 | } |
849 | Event* CalendarView::getLastSyncEvent() | 849 | Event* CalendarView::getLastSyncEvent() |
850 | { | 850 | { |
851 | Event* lse; | 851 | Event* lse; |
852 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 852 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
853 | lse = mCalendar->event( "last-syncEvent-device-"+mCurrentSyncDevice ); | 853 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
854 | if (!lse) { | 854 | if (!lse) { |
855 | lse = new Event(); | 855 | lse = new Event(); |
856 | lse->setUid( "last-syncEvent-device-"+mCurrentSyncDevice ); | 856 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
857 | lse->setSummary(mCurrentSyncDevice + i18n(" - sync event")); | 857 | QString sum = ""; |
858 | if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | ||
859 | sum = "E: "; | ||
860 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | ||
858 | lse->setDtStart( mLastCalendarSync ); | 861 | lse->setDtStart( mLastCalendarSync ); |
859 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 862 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
860 | lse->setCategories( i18n("SyncEvent") ); | 863 | lse->setCategories( i18n("SyncEvent") ); |
861 | lse->setReadOnly( true ); | 864 | lse->setReadOnly( true ); |
862 | mCalendar->addEvent( lse ); | 865 | mCalendar->addEvent( lse ); |
863 | } | 866 | } |
864 | 867 | ||
865 | return lse; | 868 | return lse; |
866 | 869 | ||
867 | } | 870 | } |
868 | void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete ) | 871 | void CalendarView::setupExternSyncProfiles() |
869 | { | 872 | { |
870 | if ( ! lastSync ) | 873 | Event* lse; |
871 | return; | 874 | mExternLastSyncEvent.clear(); |
872 | if ( toDelete->zaurusId() < 0 ) | 875 | int i; |
876 | for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { | ||
877 | lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); | ||
878 | if ( lse ) | ||
879 | mExternLastSyncEvent.append( lse ); | ||
880 | else | ||
881 | qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); | ||
882 | } | ||
883 | |||
884 | } | ||
885 | // we check, if the to delete event has a id for a profile | ||
886 | // if yes, we set this id in the profile to delete | ||
887 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | ||
888 | { | ||
889 | if ( ! lastSync.count() == 0 ) | ||
873 | return; | 890 | return; |
874 | if ( toDelete->type() == "Journal" ) | 891 | if ( toDelete->type() == "Journal" ) |
875 | return; | 892 | return; |
876 | QString des = lastSync->description(); | 893 | |
877 | QString pref = "e"; | 894 | Event* eve = lastSync.first(); |
878 | if ( toDelete->type() == "Todo" ) | 895 | |
879 | pref = "t"; | 896 | while ( eve ) { |
880 | des += pref+ QString::number ( toDelete->zaurusId() ) + ","; | 897 | int id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
881 | lastSync->setReadOnly( false ); | 898 | if ( id >= 0 ) { |
882 | lastSync->setDescription( des ); | 899 | QString des = eve->description(); |
883 | lastSync->setReadOnly( true ); | 900 | QString pref = "e"; |
901 | if ( toDelete->type() == "Todo" ) | ||
902 | pref = "t"; | ||
903 | des += pref+ QString::number ( id ) + ","; | ||
904 | eve->setReadOnly( false ); | ||
905 | eve->setDescription( des ); | ||
906 | eve->setReadOnly( true ); | ||
907 | } | ||
908 | eve = lastSync.next(); | ||
909 | } | ||
884 | 910 | ||
885 | } | 911 | } |
886 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 912 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
887 | { | 913 | { |
888 | bool syncOK = true; | 914 | bool syncOK = true; |
889 | int addedEvent = 0; | 915 | int addedEvent = 0; |
890 | int addedEventR = 0; | 916 | int addedEventR = 0; |
891 | int deletedEventR = 0; | 917 | int deletedEventR = 0; |
892 | int deletedEventL = 0; | 918 | int deletedEventL = 0; |
893 | int changedLocal = 0; | 919 | int changedLocal = 0; |
894 | int changedRemote = 0; | 920 | int changedRemote = 0; |
895 | //QPtrList<Event> el = local->rawEvents(); | 921 | //QPtrList<Event> el = local->rawEvents(); |
896 | Event* eventR; | 922 | Event* eventR; |
897 | QString uid; | 923 | QString uid; |
898 | int take; | 924 | int take; |
899 | Event* eventL; | 925 | Event* eventL; |
900 | Event* eventRSync; | 926 | Event* eventRSync; |
901 | Event* eventLSync; | 927 | Event* eventLSync; |
902 | Event* eventRSyncSharp = remote->event( "last-syncEvent-device-Sharp-DTM"); | 928 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
903 | Event* eventLSyncSharp = local->event( "last-syncEvent-device-Sharp-DTM"); | 929 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
904 | bool fullDateRange = false; | 930 | bool fullDateRange = false; |
905 | mLastCalendarSync = QDateTime::currentDateTime(); | 931 | mLastCalendarSync = QDateTime::currentDateTime(); |
906 | QDateTime modifiedCalendar = mLastCalendarSync;; | 932 | QDateTime modifiedCalendar = mLastCalendarSync;; |
907 | eventR = remote->event("last-syncEvent-device-"+mCurrentSyncName ); | 933 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
908 | if ( eventR ) { | 934 | if ( eventR ) { |
909 | eventRSync = (Event*) eventR->clone(); | 935 | eventRSync = (Event*) eventR->clone(); |
910 | remote->deleteEvent(eventR ); | 936 | remote->deleteEvent(eventR ); |
911 | 937 | ||
912 | } else { | 938 | } else { |
913 | fullDateRange = true; | 939 | fullDateRange = true; |
914 | eventRSync = new Event(); | 940 | eventRSync = new Event(); |
915 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 941 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
916 | eventRSync->setUid("last-syncEvent-device-"+mCurrentSyncName ); | 942 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
917 | eventRSync->setDtStart( mLastCalendarSync ); | 943 | eventRSync->setDtStart( mLastCalendarSync ); |
918 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 944 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
919 | eventRSync->setCategories( i18n("SyncEvent") ); | 945 | eventRSync->setCategories( i18n("SyncEvent") ); |
920 | } | 946 | } |
921 | eventLSync = getLastSyncEvent(); | 947 | eventLSync = getLastSyncEvent(); |
922 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 948 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
923 | fullDateRange = true; | 949 | fullDateRange = true; |
924 | 950 | ||
925 | if ( ! fullDateRange ) { | 951 | if ( ! fullDateRange ) { |
926 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 952 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
927 | 953 | ||
928 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 954 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
929 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 955 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
930 | fullDateRange = true; | 956 | fullDateRange = true; |
931 | } | 957 | } |
932 | } | 958 | } |
933 | if ( fullDateRange ) | 959 | if ( fullDateRange ) |
934 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 960 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
935 | else | 961 | else |
936 | mLastCalendarSync = eventLSync->dtStart(); | 962 | mLastCalendarSync = eventLSync->dtStart(); |
937 | // for resyncing if own file has changed | 963 | // for resyncing if own file has changed |
938 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 964 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
939 | mLastCalendarSync = loadedFileVersion; | 965 | mLastCalendarSync = loadedFileVersion; |
940 | qDebug("setting mLastCalendarSync "); | 966 | qDebug("setting mLastCalendarSync "); |
941 | } | 967 | } |
942 | //qDebug("*************************** "); | 968 | //qDebug("*************************** "); |
943 | qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); | 969 | qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); |
944 | QPtrList<Incidence> er = remote->rawIncidences(); | 970 | QPtrList<Incidence> er = remote->rawIncidences(); |
945 | Incidence* inR = er.first(); | 971 | Incidence* inR = er.first(); |
946 | Incidence* inL; | 972 | Incidence* inL; |
947 | QProgressBar bar( er.count(),0 ); | 973 | QProgressBar bar( er.count(),0 ); |
948 | bar.setCaption (i18n("Syncing - close to abort!") ); | 974 | bar.setCaption (i18n("Syncing - close to abort!") ); |
949 | 975 | ||
950 | int w = 300; | 976 | int w = 300; |
951 | if ( QApplication::desktop()->width() < 320 ) | 977 | if ( QApplication::desktop()->width() < 320 ) |
952 | w = 220; | 978 | w = 220; |
953 | int h = bar.sizeHint().height() ; | 979 | int h = bar.sizeHint().height() ; |
954 | int dw = QApplication::desktop()->width(); | 980 | int dw = QApplication::desktop()->width(); |
955 | int dh = QApplication::desktop()->height(); | 981 | int dh = QApplication::desktop()->height(); |
956 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 982 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
957 | bar.show(); | 983 | bar.show(); |
958 | int modulo = (er.count()/10)+1; | 984 | int modulo = (er.count()/10)+1; |
959 | int incCounter = 0; | 985 | int incCounter = 0; |
960 | while ( inR ) { | 986 | while ( inR ) { |
961 | if ( ! bar.isVisible() ) | 987 | if ( ! bar.isVisible() ) |
962 | return false; | 988 | return false; |
963 | if ( incCounter % modulo == 0 ) | 989 | if ( incCounter % modulo == 0 ) |
964 | bar.setProgress( incCounter ); | 990 | bar.setProgress( incCounter ); |
965 | ++incCounter; | 991 | ++incCounter; |
966 | uid = inR->uid(); | 992 | uid = inR->uid(); |
967 | bool skipIncidence = false; | 993 | bool skipIncidence = false; |
968 | if ( uid.left(21) == QString("last-syncEvent-device") ) | 994 | if ( uid.left(15) == QString("last-syncEvent-") ) |
969 | skipIncidence = true; | 995 | skipIncidence = true; |
970 | 996 | ||
971 | qApp->processEvents(); | 997 | qApp->processEvents(); |
972 | if ( !skipIncidence ) { | 998 | if ( !skipIncidence ) { |
973 | inL = local->incidence( uid ); | 999 | inL = local->incidence( uid ); |
974 | if ( inL ) { // maybe conflict - same uid in both calendars | 1000 | if ( inL ) { // maybe conflict - same uid in both calendars |
975 | int maxrev = inL->revision(); | 1001 | int maxrev = inL->revision(); |
976 | if ( maxrev < inR->revision() ) | 1002 | if ( maxrev < inR->revision() ) |
977 | maxrev = inR->revision(); | 1003 | maxrev = inR->revision(); |
978 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1004 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
979 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1005 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
980 | if ( take == 3 ) | 1006 | if ( take == 3 ) |
981 | return false; | 1007 | return false; |
982 | if ( take == 1 ) {// take local | 1008 | if ( take == 1 ) {// take local |
983 | inL->setZaurusUid( inR->zaurusUid() ); | 1009 | inL->setZaurusUid( inR->zaurusUid() ); |
984 | remote->deleteIncidence( inR ); | 1010 | remote->deleteIncidence( inR ); |
985 | if ( inL->revision() < maxrev ) | 1011 | if ( inL->revision() < maxrev ) |
986 | inL->setRevision( maxrev ); | 1012 | inL->setRevision( maxrev ); |
987 | remote->addIncidence( inL->clone() ); | 1013 | remote->addIncidence( inL->clone() ); |
988 | ++changedRemote; | 1014 | ++changedRemote; |
989 | } else { | 1015 | } else { |
990 | if ( inR->revision() < maxrev ) | 1016 | if ( inR->revision() < maxrev ) |
991 | inR->setRevision( maxrev ); | 1017 | inR->setRevision( maxrev ); |
992 | local->deleteIncidence( inL ); | 1018 | local->deleteIncidence( inL ); |
993 | local->addIncidence( inR->clone() ); | 1019 | local->addIncidence( inR->clone() ); |
994 | ++changedLocal; | 1020 | ++changedLocal; |
995 | } | 1021 | } |
996 | } | 1022 | } |
997 | } else { // no conflict | 1023 | } else { // no conflict |
998 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1024 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
999 | QString des = eventLSync->description(); | 1025 | QString des = eventLSync->description(); |
1000 | QString pref = "e"; | 1026 | QString pref = "e"; |
1001 | if ( inR->type() == "Todo" ) | 1027 | if ( inR->type() == "Todo" ) |
1002 | pref = "t"; | 1028 | pref = "t"; |
1003 | if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it | 1029 | if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it |
1004 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1030 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1005 | //remote->deleteIncidence( inR ); | 1031 | //remote->deleteIncidence( inR ); |
1006 | ++deletedEventR; | 1032 | ++deletedEventR; |
1007 | } else { | 1033 | } else { |
1008 | inR->setLastModified( modifiedCalendar ); | 1034 | inR->setLastModified( modifiedCalendar ); |
1009 | local->addIncidence( inR->clone() ); | 1035 | local->addIncidence( inR->clone() ); |
1010 | ++addedEvent; | 1036 | ++addedEvent; |
1011 | } | 1037 | } |
1012 | } else { | 1038 | } else { |
1013 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1039 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1014 | inR->setLastModified( modifiedCalendar ); | 1040 | inR->setLastModified( modifiedCalendar ); |
1015 | local->addIncidence( inR->clone() ); | 1041 | local->addIncidence( inR->clone() ); |
1016 | ++addedEvent; | 1042 | ++addedEvent; |
1017 | } else { | 1043 | } else { |
1018 | checkSharpEvent(eventRSyncSharp, inR); | 1044 | checkExternSyncEvent(eventRSyncSharp, inR); |
1019 | remote->deleteIncidence( inR ); | 1045 | remote->deleteIncidence( inR ); |
1020 | ++deletedEventR; | 1046 | ++deletedEventR; |
1021 | } | 1047 | } |
1022 | } | 1048 | } |
1023 | } | 1049 | } |
1024 | } | 1050 | } |
1025 | inR = er.next(); | 1051 | inR = er.next(); |
1026 | } | 1052 | } |
1027 | QPtrList<Incidence> el = local->rawIncidences(); | 1053 | QPtrList<Incidence> el = local->rawIncidences(); |
1028 | inL = el.first(); | 1054 | inL = el.first(); |
1029 | modulo = (el.count()/10)+1; | 1055 | modulo = (el.count()/10)+1; |
1030 | bar.setCaption (i18n("Add / remove events") ); | 1056 | bar.setCaption (i18n("Add / remove events") ); |
1031 | bar.setTotalSteps ( el.count() ) ; | 1057 | bar.setTotalSteps ( el.count() ) ; |
1032 | bar.show(); | 1058 | bar.show(); |
1033 | incCounter = 0; | 1059 | incCounter = 0; |
1034 | 1060 | ||
1035 | while ( inL ) { | 1061 | while ( inL ) { |
1036 | 1062 | ||
1037 | qApp->processEvents(); | 1063 | qApp->processEvents(); |
1038 | if ( ! bar.isVisible() ) | 1064 | if ( ! bar.isVisible() ) |
1039 | return false; | 1065 | return false; |
1040 | if ( incCounter % modulo == 0 ) | 1066 | if ( incCounter % modulo == 0 ) |
1041 | bar.setProgress( incCounter ); | 1067 | bar.setProgress( incCounter ); |
1042 | ++incCounter; | 1068 | ++incCounter; |
1043 | uid = inL->uid(); | 1069 | uid = inL->uid(); |
1044 | bool skipIncidence = false; | 1070 | bool skipIncidence = false; |
1045 | if ( uid.left(21) == QString("last-syncEvent-device") ) | 1071 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1046 | skipIncidence = true; | 1072 | skipIncidence = true; |
1047 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1073 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1048 | skipIncidence = true; | 1074 | skipIncidence = true; |
1049 | if ( !skipIncidence ) { | 1075 | if ( !skipIncidence ) { |
1050 | inR = remote->incidence( uid ); | 1076 | inR = remote->incidence( uid ); |
1051 | if ( ! inR ) { | 1077 | if ( ! inR ) { |
1052 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1078 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1053 | if ( inL->zaurusId() >= 0 && mode != 4 ) { | 1079 | if ( inL->zaurusId() >= 0 && mode != 4 ) { |
1054 | local->deleteIncidence( inL ); | 1080 | local->deleteIncidence( inL ); |
1055 | ++deletedEventL; | 1081 | ++deletedEventL; |
1056 | } else { | 1082 | } else { |
1057 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1083 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1058 | inL->setZaurusId( -1 ); | 1084 | inL->setZaurusId( -1 ); |
1059 | ++addedEventR; | 1085 | ++addedEventR; |
1060 | inL->setLastModified( modifiedCalendar ); | 1086 | inL->setLastModified( modifiedCalendar ); |
1061 | remote->addIncidence( inL->clone() ); | 1087 | remote->addIncidence( inL->clone() ); |
1062 | } | 1088 | } |
1063 | } | 1089 | } |
1064 | } else { | 1090 | } else { |
1065 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1091 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1066 | checkSharpEvent(eventLSyncSharp, inL); | 1092 | checkExternSyncEvent(eventLSyncSharp, inL); |
1067 | local->deleteIncidence( inL ); | 1093 | local->deleteIncidence( inL ); |
1068 | ++deletedEventL; | 1094 | ++deletedEventL; |
1069 | } else { | 1095 | } else { |
1070 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1096 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1071 | ++addedEventR; | 1097 | ++addedEventR; |
1072 | inL->setLastModified( modifiedCalendar ); | 1098 | inL->setLastModified( modifiedCalendar ); |
1073 | remote->addIncidence( inL->clone() ); | 1099 | remote->addIncidence( inL->clone() ); |
1074 | } | 1100 | } |
1075 | } | 1101 | } |
1076 | } | 1102 | } |
1077 | } | 1103 | } |
1078 | } | 1104 | } |
1079 | inL = el.next(); | 1105 | inL = el.next(); |
1080 | } | 1106 | } |
1081 | 1107 | ||
1082 | bar.hide(); | 1108 | bar.hide(); |
1083 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1109 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1084 | eventLSync->setReadOnly( false ); | 1110 | eventLSync->setReadOnly( false ); |
1085 | eventLSync->setDtStart( mLastCalendarSync ); | 1111 | eventLSync->setDtStart( mLastCalendarSync ); |
1086 | eventRSync->setDtStart( mLastCalendarSync ); | 1112 | eventRSync->setDtStart( mLastCalendarSync ); |
1087 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1113 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1088 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1114 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1089 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1115 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1090 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1116 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1091 | eventLSync->setReadOnly( true ); | 1117 | eventLSync->setReadOnly( true ); |
1092 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 1118 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
1093 | remote->addEvent( eventRSync ); | 1119 | remote->addEvent( eventRSync ); |
1094 | QString mes; | 1120 | QString mes; |
1095 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1121 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1096 | if ( KOPrefs::instance()->mShowSyncSummary ) { | 1122 | if ( KOPrefs::instance()->mShowSyncSummary ) { |
1097 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1123 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); |
1098 | } | 1124 | } |
1099 | qDebug( mes ); | 1125 | qDebug( mes ); |
1100 | mCalendar->checkAlarmForIncidence( 0, true ); | 1126 | mCalendar->checkAlarmForIncidence( 0, true ); |
1101 | return syncOK; | 1127 | return syncOK; |
1102 | } | 1128 | } |
1103 | 1129 | ||
1104 | void CalendarView::setSyncDevice( QString s ) | 1130 | void CalendarView::setSyncDevice( QString s ) |
1105 | { | 1131 | { |
1106 | mCurrentSyncDevice= s; | 1132 | mCurrentSyncDevice= s; |
1107 | } | 1133 | } |
1108 | void CalendarView::setSyncName( QString s ) | 1134 | void CalendarView::setSyncName( QString s ) |
1109 | { | 1135 | { |
1110 | mCurrentSyncName= s; | 1136 | mCurrentSyncName= s; |
1111 | } | 1137 | } |
1112 | bool CalendarView::syncCalendar(QString filename, int mode) | 1138 | bool CalendarView::syncCalendar(QString filename, int mode) |
1113 | { | 1139 | { |
1114 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1140 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
@@ -1297,97 +1323,97 @@ bool CalendarView::importQtopia( const QString &categories, | |||
1297 | edit_sync_options(); | 1323 | edit_sync_options(); |
1298 | qApp->processEvents(); | 1324 | qApp->processEvents(); |
1299 | CalendarLocal* calendar = new CalendarLocal(); | 1325 | CalendarLocal* calendar = new CalendarLocal(); |
1300 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1326 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1301 | bool syncOK = false; | 1327 | bool syncOK = false; |
1302 | QtopiaFormat qtopiaFormat; | 1328 | QtopiaFormat qtopiaFormat; |
1303 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1329 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1304 | bool loadOk = true; | 1330 | bool loadOk = true; |
1305 | if ( !categories.isEmpty() ) | 1331 | if ( !categories.isEmpty() ) |
1306 | loadOk = qtopiaFormat.load( calendar, categories ); | 1332 | loadOk = qtopiaFormat.load( calendar, categories ); |
1307 | if ( loadOk && !datebook.isEmpty() ) | 1333 | if ( loadOk && !datebook.isEmpty() ) |
1308 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1334 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1309 | if ( loadOk && !todolist.isEmpty() ) | 1335 | if ( loadOk && !todolist.isEmpty() ) |
1310 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1336 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1311 | 1337 | ||
1312 | if ( loadOk ) { | 1338 | if ( loadOk ) { |
1313 | getEventViewerDialog()->setSyncMode( true ); | 1339 | getEventViewerDialog()->setSyncMode( true ); |
1314 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1340 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1315 | getEventViewerDialog()->setSyncMode( false ); | 1341 | getEventViewerDialog()->setSyncMode( false ); |
1316 | qApp->processEvents(); | 1342 | qApp->processEvents(); |
1317 | if ( syncOK ) { | 1343 | if ( syncOK ) { |
1318 | if ( KOPrefs::instance()->mWriteBackFile ) | 1344 | if ( KOPrefs::instance()->mWriteBackFile ) |
1319 | { | 1345 | { |
1320 | // write back XML file | 1346 | // write back XML file |
1321 | 1347 | ||
1322 | } | 1348 | } |
1323 | setModified( true ); | 1349 | setModified( true ); |
1324 | } | 1350 | } |
1325 | } else { | 1351 | } else { |
1326 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1352 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1327 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1353 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1328 | question, i18n("Ok")) ; | 1354 | question, i18n("Ok")) ; |
1329 | } | 1355 | } |
1330 | delete calendar; | 1356 | delete calendar; |
1331 | updateView(); | 1357 | updateView(); |
1332 | return syncOK; | 1358 | return syncOK; |
1333 | 1359 | ||
1334 | 1360 | ||
1335 | #endif | 1361 | #endif |
1336 | 1362 | ||
1337 | } | 1363 | } |
1338 | 1364 | ||
1339 | void CalendarView::setSyncEventsReadOnly() | 1365 | void CalendarView::setSyncEventsReadOnly() |
1340 | { | 1366 | { |
1341 | Event * ev; | 1367 | Event * ev; |
1342 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1368 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1343 | ev = eL.first(); | 1369 | ev = eL.first(); |
1344 | while ( ev ) { | 1370 | while ( ev ) { |
1345 | if ( ev->uid().left(21) == QString("last-syncEvent-device") ) | 1371 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1346 | ev->setReadOnly( true ); | 1372 | ev->setReadOnly( true ); |
1347 | ev = eL.next(); | 1373 | ev = eL.next(); |
1348 | } | 1374 | } |
1349 | } | 1375 | } |
1350 | bool CalendarView::openCalendar(QString filename, bool merge) | 1376 | bool CalendarView::openCalendar(QString filename, bool merge) |
1351 | { | 1377 | { |
1352 | 1378 | ||
1353 | if (filename.isEmpty()) { | 1379 | if (filename.isEmpty()) { |
1354 | return false; | 1380 | return false; |
1355 | } | 1381 | } |
1356 | 1382 | ||
1357 | if (!QFile::exists(filename)) { | 1383 | if (!QFile::exists(filename)) { |
1358 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1384 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1359 | return false; | 1385 | return false; |
1360 | } | 1386 | } |
1361 | 1387 | ||
1362 | globalFlagBlockAgenda = 1; | 1388 | globalFlagBlockAgenda = 1; |
1363 | if (!merge) mCalendar->close(); | 1389 | if (!merge) mCalendar->close(); |
1364 | 1390 | ||
1365 | mStorage->setFileName( filename ); | 1391 | mStorage->setFileName( filename ); |
1366 | 1392 | ||
1367 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1393 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1368 | if ( merge ) ;//setModified( true ); | 1394 | if ( merge ) ;//setModified( true ); |
1369 | else { | 1395 | else { |
1370 | //setModified( true ); | 1396 | //setModified( true ); |
1371 | mViewManager->setDocumentId( filename ); | 1397 | mViewManager->setDocumentId( filename ); |
1372 | mDialogManager->setDocumentId( filename ); | 1398 | mDialogManager->setDocumentId( filename ); |
1373 | mTodoList->setDocumentId( filename ); | 1399 | mTodoList->setDocumentId( filename ); |
1374 | } | 1400 | } |
1375 | globalFlagBlockAgenda = 2; | 1401 | globalFlagBlockAgenda = 2; |
1376 | // if ( getLastSyncEvent() ) | 1402 | // if ( getLastSyncEvent() ) |
1377 | // getLastSyncEvent()->setReadOnly( true ); | 1403 | // getLastSyncEvent()->setReadOnly( true ); |
1378 | mCalendar->reInitAlarmSettings(); | 1404 | mCalendar->reInitAlarmSettings(); |
1379 | setSyncEventsReadOnly(); | 1405 | setSyncEventsReadOnly(); |
1380 | updateUnmanagedViews(); | 1406 | updateUnmanagedViews(); |
1381 | updateView(); | 1407 | updateView(); |
1382 | if ( filename != MainWindow::defaultFileName() ) | 1408 | if ( filename != MainWindow::defaultFileName() ) |
1383 | saveCalendar( MainWindow::defaultFileName() ); | 1409 | saveCalendar( MainWindow::defaultFileName() ); |
1384 | loadedFileVersion = QDateTime::currentDateTime(); | 1410 | loadedFileVersion = QDateTime::currentDateTime(); |
1385 | return true; | 1411 | return true; |
1386 | } else { | 1412 | } else { |
1387 | // while failing to load, the calendar object could | 1413 | // while failing to load, the calendar object could |
1388 | // have become partially populated. Clear it out. | 1414 | // have become partially populated. Clear it out. |
1389 | if ( !merge ) mCalendar->close(); | 1415 | if ( !merge ) mCalendar->close(); |
1390 | 1416 | ||
1391 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1417 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1392 | 1418 | ||
1393 | globalFlagBlockAgenda = 2; | 1419 | globalFlagBlockAgenda = 2; |
@@ -1761,97 +1787,97 @@ void CalendarView::writeLocale() | |||
1761 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 1787 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
1762 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 1788 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
1763 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 1789 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
1764 | KOPrefs::instance()->mDaylightsavingStart, | 1790 | KOPrefs::instance()->mDaylightsavingStart, |
1765 | KOPrefs::instance()->mDaylightsavingEnd ); | 1791 | KOPrefs::instance()->mDaylightsavingEnd ); |
1766 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); | 1792 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); |
1767 | } | 1793 | } |
1768 | void CalendarView::updateConfig() | 1794 | void CalendarView::updateConfig() |
1769 | { | 1795 | { |
1770 | writeLocale(); | 1796 | writeLocale(); |
1771 | if ( KOPrefs::instance()->mUseAppColors ) | 1797 | if ( KOPrefs::instance()->mUseAppColors ) |
1772 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 1798 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
1773 | emit configChanged(); | 1799 | emit configChanged(); |
1774 | mTodoList->updateConfig(); | 1800 | mTodoList->updateConfig(); |
1775 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 1801 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
1776 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1802 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1777 | // To make the "fill window" configurations work | 1803 | // To make the "fill window" configurations work |
1778 | //mViewManager->raiseCurrentView(); | 1804 | //mViewManager->raiseCurrentView(); |
1779 | } | 1805 | } |
1780 | 1806 | ||
1781 | 1807 | ||
1782 | void CalendarView::eventChanged(Event *event) | 1808 | void CalendarView::eventChanged(Event *event) |
1783 | { | 1809 | { |
1784 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 1810 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
1785 | //updateUnmanagedViews(); | 1811 | //updateUnmanagedViews(); |
1786 | } | 1812 | } |
1787 | 1813 | ||
1788 | void CalendarView::eventAdded(Event *event) | 1814 | void CalendarView::eventAdded(Event *event) |
1789 | { | 1815 | { |
1790 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 1816 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
1791 | } | 1817 | } |
1792 | 1818 | ||
1793 | void CalendarView::eventToBeDeleted(Event *) | 1819 | void CalendarView::eventToBeDeleted(Event *) |
1794 | { | 1820 | { |
1795 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 1821 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
1796 | } | 1822 | } |
1797 | 1823 | ||
1798 | void CalendarView::eventDeleted() | 1824 | void CalendarView::eventDeleted() |
1799 | { | 1825 | { |
1800 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 1826 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
1801 | } | 1827 | } |
1802 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 1828 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
1803 | { | 1829 | { |
1804 | changeIncidenceDisplay((Incidence *)which, action); | 1830 | changeIncidenceDisplay((Incidence *)which, action); |
1805 | } | 1831 | } |
1806 | void CalendarView::checkZaurusId( int id, bool todo ) | 1832 | void CalendarView::checkZaurusId( int id, bool todo ) |
1807 | { | 1833 | { |
1808 | if ( id >= 0 ) { | 1834 | if ( id >= 0 ) { |
1809 | Incidence* lse = mCalendar->event( "last-syncEvent-device-Sharp-DTM"); | 1835 | Incidence* lse = mCalendar->event( "last-syncEvent-Sharp-DTM"); |
1810 | if ( lse ) { | 1836 | if ( lse ) { |
1811 | QString des = lse->description(); | 1837 | QString des = lse->description(); |
1812 | QString pref = "e"; | 1838 | QString pref = "e"; |
1813 | if ( todo ) | 1839 | if ( todo ) |
1814 | pref = "t"; | 1840 | pref = "t"; |
1815 | des += pref+ QString::number ( id ) + ","; | 1841 | des += pref+ QString::number ( id ) + ","; |
1816 | lse->setReadOnly( false ); | 1842 | lse->setReadOnly( false ); |
1817 | lse->setDescription( des ); | 1843 | lse->setDescription( des ); |
1818 | lse->setReadOnly( true ); | 1844 | lse->setReadOnly( true ); |
1819 | } | 1845 | } |
1820 | } | 1846 | } |
1821 | } | 1847 | } |
1822 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 1848 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
1823 | { | 1849 | { |
1824 | updateUnmanagedViews(); | 1850 | updateUnmanagedViews(); |
1825 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 1851 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
1826 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 1852 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
1827 | mCalendar->checkAlarmForIncidence( 0, true ); | 1853 | mCalendar->checkAlarmForIncidence( 0, true ); |
1828 | if ( mEventViewerDialog ) | 1854 | if ( mEventViewerDialog ) |
1829 | mEventViewerDialog->hide(); | 1855 | mEventViewerDialog->hide(); |
1830 | } | 1856 | } |
1831 | else | 1857 | else |
1832 | mCalendar->checkAlarmForIncidence( which , false ); | 1858 | mCalendar->checkAlarmForIncidence( which , false ); |
1833 | } | 1859 | } |
1834 | 1860 | ||
1835 | // most of the changeEventDisplays() right now just call the view's | 1861 | // most of the changeEventDisplays() right now just call the view's |
1836 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 1862 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
1837 | void CalendarView::changeEventDisplay(Event *which, int action) | 1863 | void CalendarView::changeEventDisplay(Event *which, int action) |
1838 | { | 1864 | { |
1839 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 1865 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
1840 | changeIncidenceDisplay((Incidence *)which, action); | 1866 | changeIncidenceDisplay((Incidence *)which, action); |
1841 | mDateNavigator->updateView(); | 1867 | mDateNavigator->updateView(); |
1842 | //mDialogManager->updateSearchDialog(); | 1868 | //mDialogManager->updateSearchDialog(); |
1843 | 1869 | ||
1844 | if (which) { | 1870 | if (which) { |
1845 | // If there is an event view visible update the display | 1871 | // If there is an event view visible update the display |
1846 | mViewManager->currentView()->changeEventDisplay(which,action); | 1872 | mViewManager->currentView()->changeEventDisplay(which,action); |
1847 | // TODO: check, if update needed | 1873 | // TODO: check, if update needed |
1848 | // if (which->getTodoStatus()) { | 1874 | // if (which->getTodoStatus()) { |
1849 | mTodoList->updateView(); | 1875 | mTodoList->updateView(); |
1850 | // } | 1876 | // } |
1851 | } else { | 1877 | } else { |
1852 | mViewManager->currentView()->updateView(); | 1878 | mViewManager->currentView()->updateView(); |
1853 | } | 1879 | } |
1854 | } | 1880 | } |
1855 | 1881 | ||
1856 | 1882 | ||
1857 | void CalendarView::updateTodoViews() | 1883 | void CalendarView::updateTodoViews() |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 8aa5e1c..557554f 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -68,96 +68,97 @@ namespace KCal { class FileStorage; } | |||
68 | 68 | ||
69 | using namespace KCal; | 69 | using namespace KCal; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | This is the main calendar widget. It provides the different vies on t he | 72 | This is the main calendar widget. It provides the different vies on t he |
73 | calendar data as well as the date navigator. It also handles synchronisation | 73 | calendar data as well as the date navigator. It also handles synchronisation |
74 | of the different views and controls the different dialogs like preferences, | 74 | of the different views and controls the different dialogs like preferences, |
75 | event editor, search dialog etc. | 75 | event editor, search dialog etc. |
76 | 76 | ||
77 | @short main calendar view widget | 77 | @short main calendar view widget |
78 | @author Cornelius Schumacher | 78 | @author Cornelius Schumacher |
79 | */ | 79 | */ |
80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer | 80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer |
81 | { | 81 | { |
82 | Q_OBJECT | 82 | Q_OBJECT |
83 | public: | 83 | public: |
84 | /** | 84 | /** |
85 | Constructs a new calendar view widget. | 85 | Constructs a new calendar view widget. |
86 | 86 | ||
87 | @param calendar calendar document | 87 | @param calendar calendar document |
88 | @param parent parent window | 88 | @param parent parent window |
89 | @param name Qt internal widget object name | 89 | @param name Qt internal widget object name |
90 | */ | 90 | */ |
91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
92 | const char *name = 0 ); | 92 | const char *name = 0 ); |
93 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 93 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
94 | const char *name = 0 ); | 94 | const char *name = 0 ); |
95 | virtual ~CalendarView(); | 95 | virtual ~CalendarView(); |
96 | 96 | ||
97 | Calendar *calendar() { return mCalendar; } | 97 | Calendar *calendar() { return mCalendar; } |
98 | 98 | ||
99 | KOViewManager *viewManager(); | 99 | KOViewManager *viewManager(); |
100 | KODialogManager *dialogManager(); | 100 | KODialogManager *dialogManager(); |
101 | 101 | ||
102 | QDate startDate(); | 102 | QDate startDate(); |
103 | QDate endDate(); | 103 | QDate endDate(); |
104 | 104 | ||
105 | QWidgetStack *viewStack(); | 105 | QWidgetStack *viewStack(); |
106 | QWidget *leftFrame(); | 106 | QWidget *leftFrame(); |
107 | NavigatorBar *navigatorBar(); | 107 | NavigatorBar *navigatorBar(); |
108 | 108 | ||
109 | DateNavigator *dateNavigator(); | 109 | DateNavigator *dateNavigator(); |
110 | KDateNavigator *dateNavigatorWidget(); | 110 | KDateNavigator *dateNavigatorWidget(); |
111 | 111 | ||
112 | void addView(KOrg::BaseView *); | 112 | void addView(KOrg::BaseView *); |
113 | void showView(KOrg::BaseView *); | 113 | void showView(KOrg::BaseView *); |
114 | KOEventViewerDialog* getEventViewerDialog(); | 114 | KOEventViewerDialog* getEventViewerDialog(); |
115 | Incidence *currentSelection(); | 115 | Incidence *currentSelection(); |
116 | void setupExternSyncProfiles(); | ||
116 | 117 | ||
117 | signals: | 118 | signals: |
118 | /** This todo has been modified */ | 119 | /** This todo has been modified */ |
119 | void todoModified(Todo *, int); | 120 | void todoModified(Todo *, int); |
120 | 121 | ||
121 | /** when change is made to options dialog, the topwidget will catch this | 122 | /** when change is made to options dialog, the topwidget will catch this |
122 | * and emit this signal which notifies all widgets which have registered | 123 | * and emit this signal which notifies all widgets which have registered |
123 | * for notification to update their settings. */ | 124 | * for notification to update their settings. */ |
124 | void configChanged(); | 125 | void configChanged(); |
125 | /** emitted when the topwidget is closing down, so that any attached | 126 | /** emitted when the topwidget is closing down, so that any attached |
126 | child windows can also close. */ | 127 | child windows can also close. */ |
127 | void closingDown(); | 128 | void closingDown(); |
128 | /** emitted right before we die */ | 129 | /** emitted right before we die */ |
129 | void closed(QWidget *); | 130 | void closed(QWidget *); |
130 | 131 | ||
131 | /** Emitted when state of modified flag changes */ | 132 | /** Emitted when state of modified flag changes */ |
132 | void modifiedChanged(bool); | 133 | void modifiedChanged(bool); |
133 | void signalmodified(); | 134 | void signalmodified(); |
134 | 135 | ||
135 | /** Emitted when state of read-only flag changes */ | 136 | /** Emitted when state of read-only flag changes */ |
136 | void readOnlyChanged(bool); | 137 | void readOnlyChanged(bool); |
137 | 138 | ||
138 | /** Emitted when the unit of navigation changes */ | 139 | /** Emitted when the unit of navigation changes */ |
139 | void changeNavStringPrev(const QString &); | 140 | void changeNavStringPrev(const QString &); |
140 | void changeNavStringNext(const QString &); | 141 | void changeNavStringNext(const QString &); |
141 | 142 | ||
142 | /** Emitted when state of events selection has changed and user is organizer*/ | 143 | /** Emitted when state of events selection has changed and user is organizer*/ |
143 | void organizerEventsSelected(bool); | 144 | void organizerEventsSelected(bool); |
144 | /** Emitted when state of events selection has changed and user is attendee*/ | 145 | /** Emitted when state of events selection has changed and user is attendee*/ |
145 | void groupEventsSelected(bool); | 146 | void groupEventsSelected(bool); |
146 | /** | 147 | /** |
147 | Emitted when an incidence gets selected. If the selection is cleared the | 148 | Emitted when an incidence gets selected. If the selection is cleared the |
148 | signal is emitted with 0 as argument. | 149 | signal is emitted with 0 as argument. |
149 | */ | 150 | */ |
150 | void incidenceSelected( Incidence * ); | 151 | void incidenceSelected( Incidence * ); |
151 | /** Emitted, when a todoitem is selected or deselected. */ | 152 | /** Emitted, when a todoitem is selected or deselected. */ |
152 | void todoSelected( bool ); | 153 | void todoSelected( bool ); |
153 | 154 | ||
154 | /** | 155 | /** |
155 | Emitted, when clipboard content changes. Parameter indicates if paste | 156 | Emitted, when clipboard content changes. Parameter indicates if paste |
156 | is possible or not. | 157 | is possible or not. |
157 | */ | 158 | */ |
158 | void pasteEnabled(bool); | 159 | void pasteEnabled(bool); |
159 | 160 | ||
160 | /** Emitted, when the number of incoming messages has changed. */ | 161 | /** Emitted, when the number of incoming messages has changed. */ |
161 | void numIncomingChanged(int); | 162 | void numIncomingChanged(int); |
162 | 163 | ||
163 | /** Emitted, when the number of outgoing messages has changed. */ | 164 | /** Emitted, when the number of outgoing messages has changed. */ |
@@ -436,150 +437,150 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
436 | void setSyncDevice( QString ); | 437 | void setSyncDevice( QString ); |
437 | void setSyncName( QString ); | 438 | void setSyncName( QString ); |
438 | protected slots: | 439 | protected slots: |
439 | void timerAlarm(); | 440 | void timerAlarm(); |
440 | void suspendAlarm(); | 441 | void suspendAlarm(); |
441 | void beamDone( Ir *ir ); | 442 | void beamDone( Ir *ir ); |
442 | /** Select a view or adapt the current view to display the specified dates. */ | 443 | /** Select a view or adapt the current view to display the specified dates. */ |
443 | void showDates( const KCal::DateList & ); | 444 | void showDates( const KCal::DateList & ); |
444 | void selectWeekNum ( int ); | 445 | void selectWeekNum ( int ); |
445 | 446 | ||
446 | public: | 447 | public: |
447 | // show a standard warning | 448 | // show a standard warning |
448 | // returns KMsgBox::yesNoCancel() | 449 | // returns KMsgBox::yesNoCancel() |
449 | int msgCalModified(); | 450 | int msgCalModified(); |
450 | void confSync(); | 451 | void confSync(); |
451 | void setLoadedFileVersion(QDateTime); | 452 | void setLoadedFileVersion(QDateTime); |
452 | bool checkFileVersion(QString fn); | 453 | bool checkFileVersion(QString fn); |
453 | bool checkFileChanged(QString fn); | 454 | bool checkFileChanged(QString fn); |
454 | Event* getLastSyncEvent(); | 455 | Event* getLastSyncEvent(); |
455 | /** Adapt navigation units correpsonding to step size of navigation of the | 456 | /** Adapt navigation units correpsonding to step size of navigation of the |
456 | * current view. | 457 | * current view. |
457 | */ | 458 | */ |
458 | void adaptNavigationUnits(); | 459 | void adaptNavigationUnits(); |
459 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 460 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
460 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 461 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
461 | //Attendee* getYourAttendee(Event *event); | 462 | //Attendee* getYourAttendee(Event *event); |
462 | protected: | 463 | protected: |
463 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 464 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
464 | 465 | ||
465 | // returns KMsgBox::OKCandel() | 466 | // returns KMsgBox::OKCandel() |
466 | int msgItemDelete(); | 467 | int msgItemDelete(); |
467 | void showEventEditor(); | 468 | void showEventEditor(); |
468 | void showTodoEditor(); | 469 | void showTodoEditor(); |
469 | void writeLocale(); | 470 | void writeLocale(); |
470 | Todo *selectedTodo(); | 471 | Todo *selectedTodo(); |
471 | 472 | ||
472 | private: | 473 | private: |
473 | AlarmDialog * mAlarmDialog; | 474 | AlarmDialog * mAlarmDialog; |
474 | QString mAlarmNotification; | 475 | QString mAlarmNotification; |
475 | QString mSuspendAlarmNotification; | 476 | QString mSuspendAlarmNotification; |
476 | QTimer* mSuspendTimer; | 477 | QTimer* mSuspendTimer; |
477 | QTimer* mAlarmTimer; | 478 | QTimer* mAlarmTimer; |
478 | QTimer* mRecheckAlarmTimer; | 479 | QTimer* mRecheckAlarmTimer; |
479 | void computeAlarm( QString ); | 480 | void computeAlarm( QString ); |
480 | void startAlarm( QString, QString ); | 481 | void startAlarm( QString, QString ); |
481 | void setSyncEventsReadOnly(); | 482 | void setSyncEventsReadOnly(); |
482 | 483 | ||
483 | QDateTime loadedFileVersion; | 484 | QDateTime loadedFileVersion; |
484 | void checkSharpEvent( Event* lastSync, Incidence* toDelete ); | 485 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
485 | void checkZaurusId( int id, bool todo = false ); | 486 | void checkZaurusId( int id, bool todo = false ); |
486 | int mGlobalSyncMode; | 487 | int mGlobalSyncMode; |
487 | QString mCurrentSyncDevice; | 488 | QString mCurrentSyncDevice; |
488 | QString mCurrentSyncName; | 489 | QString mCurrentSyncName; |
489 | KOBeamPrefs* beamDialog; | 490 | KOBeamPrefs* beamDialog; |
490 | void init(); | 491 | void init(); |
491 | int mDatePickerMode; | 492 | int mDatePickerMode; |
492 | bool mFlagEditDescription; | 493 | bool mFlagEditDescription; |
493 | QDateTime mLastCalendarSync; | 494 | QDateTime mLastCalendarSync; |
494 | void createPrinter(); | 495 | void createPrinter(); |
495 | 496 | ||
496 | void calendarModified( bool, Calendar * ); | 497 | void calendarModified( bool, Calendar * ); |
497 | 498 | ||
498 | CalPrinter *mCalPrinter; | 499 | CalPrinter *mCalPrinter; |
499 | 500 | ||
500 | QSplitter *mPanner; | 501 | QSplitter *mPanner; |
501 | QSplitter *mLeftSplitter; | 502 | QSplitter *mLeftSplitter; |
502 | QWidget *mLeftFrame; | 503 | QWidget *mLeftFrame; |
503 | QWidgetStack *mRightFrame; | 504 | QWidgetStack *mRightFrame; |
504 | 505 | ||
505 | KDatePicker* mDatePicker; | 506 | KDatePicker* mDatePicker; |
506 | QVBox* mDateFrame; | 507 | QVBox* mDateFrame; |
507 | NavigatorBar *mNavigatorBar; | 508 | NavigatorBar *mNavigatorBar; |
508 | 509 | ||
509 | KDateNavigator *mDateNavigator; // widget showing small month view. | 510 | KDateNavigator *mDateNavigator; // widget showing small month view. |
510 | 511 | ||
511 | KOFilterView *mFilterView; | 512 | KOFilterView *mFilterView; |
512 | 513 | ||
513 | ResourceView *mResourceView; | 514 | ResourceView *mResourceView; |
514 | 515 | ||
515 | // calendar object for this viewing instance | 516 | // calendar object for this viewing instance |
516 | Calendar *mCalendar; | 517 | Calendar *mCalendar; |
517 | 518 | ||
518 | CalendarResourceManager *mResourceManager; | 519 | CalendarResourceManager *mResourceManager; |
519 | 520 | ||
520 | FileStorage *mStorage; | 521 | FileStorage *mStorage; |
521 | 522 | ||
522 | DateNavigator *mNavigator; | 523 | DateNavigator *mNavigator; |
523 | 524 | ||
524 | KOViewManager *mViewManager; | 525 | KOViewManager *mViewManager; |
525 | KODialogManager *mDialogManager; | 526 | KODialogManager *mDialogManager; |
526 | 527 | ||
527 | // Calendar filters | 528 | // Calendar filters |
528 | QPtrList<CalFilter> mFilters; | 529 | QPtrList<CalFilter> mFilters; |
529 | 530 | ||
530 | // various housekeeping variables. | 531 | // various housekeeping variables. |
531 | bool mModified; // flag indicating if calendar is modified | 532 | bool mModified; // flag indicating if calendar is modified |
532 | bool mReadOnly; // flag indicating if calendar is read-only | 533 | bool mReadOnly; // flag indicating if calendar is read-only |
533 | QDate mSaveSingleDate; | 534 | QDate mSaveSingleDate; |
534 | 535 | ||
535 | Incidence *mSelectedIncidence; | 536 | Incidence *mSelectedIncidence; |
536 | Incidence *mMoveIncidence; | 537 | Incidence *mMoveIncidence; |
537 | 538 | QPtrList<Event> mExternLastSyncEvent; | |
538 | KOTodoView *mTodoList; | 539 | KOTodoView *mTodoList; |
539 | KOEventEditor * mEventEditor; | 540 | KOEventEditor * mEventEditor; |
540 | KOTodoEditor * mTodoEditor; | 541 | KOTodoEditor * mTodoEditor; |
541 | KOEventViewerDialog * mEventViewerDialog; | 542 | KOEventViewerDialog * mEventViewerDialog; |
542 | void keyPressEvent ( QKeyEvent *e) ; | 543 | void keyPressEvent ( QKeyEvent *e) ; |
543 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 544 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
544 | }; | 545 | }; |
545 | 546 | ||
546 | 547 | ||
547 | class CalendarViewVisitor : public Incidence::Visitor | 548 | class CalendarViewVisitor : public Incidence::Visitor |
548 | { | 549 | { |
549 | public: | 550 | public: |
550 | CalendarViewVisitor() : mView( 0 ) {} | 551 | CalendarViewVisitor() : mView( 0 ) {} |
551 | 552 | ||
552 | bool act( Incidence *incidence, CalendarView *view ) | 553 | bool act( Incidence *incidence, CalendarView *view ) |
553 | { | 554 | { |
554 | mView = view; | 555 | mView = view; |
555 | return incidence->accept( *this ); | 556 | return incidence->accept( *this ); |
556 | } | 557 | } |
557 | 558 | ||
558 | protected: | 559 | protected: |
559 | CalendarView *mView; | 560 | CalendarView *mView; |
560 | }; | 561 | }; |
561 | 562 | ||
562 | class ShowIncidenceVisitor : public CalendarViewVisitor | 563 | class ShowIncidenceVisitor : public CalendarViewVisitor |
563 | { | 564 | { |
564 | protected: | 565 | protected: |
565 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 566 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
566 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 567 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
567 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 568 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
568 | }; | 569 | }; |
569 | 570 | ||
570 | class EditIncidenceVisitor : public CalendarViewVisitor | 571 | class EditIncidenceVisitor : public CalendarViewVisitor |
571 | { | 572 | { |
572 | protected: | 573 | protected: |
573 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 574 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
574 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 575 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
575 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 576 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
576 | }; | 577 | }; |
577 | 578 | ||
578 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 579 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
579 | { | 580 | { |
580 | protected: | 581 | protected: |
581 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 582 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
582 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 583 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
583 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 584 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
584 | }; | 585 | }; |
585 | 586 | ||
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 3ba5ab2..f3231ff 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -132,121 +132,122 @@ KOPrefs::KOPrefs() : | |||
132 | addItemBool("Html With Save",&mHtmlWithSave,false); | 132 | addItemBool("Html With Save",&mHtmlWithSave,false); |
133 | 133 | ||
134 | KPrefs::setCurrentGroup("Personal Settings"); | 134 | KPrefs::setCurrentGroup("Personal Settings"); |
135 | 135 | ||
136 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 136 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
137 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 137 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
138 | addItemBool("Bcc",&mBcc,false); | 138 | addItemBool("Bcc",&mBcc,false); |
139 | 139 | ||
140 | KPrefs::setCurrentGroup("Time & Date"); | 140 | KPrefs::setCurrentGroup("Time & Date"); |
141 | 141 | ||
142 | // addItemString("Time Zone",&mTimeZone,"+0100"); | 142 | // addItemString("Time Zone",&mTimeZone,"+0100"); |
143 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); | 143 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); |
144 | // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); | 144 | // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); |
145 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 145 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
146 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 146 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
147 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 147 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
148 | 148 | ||
149 | 149 | ||
150 | addItemInt("Default Start Time",&mStartTime,10); | 150 | addItemInt("Default Start Time",&mStartTime,10); |
151 | addItemInt("Default Duration",&mDefaultDuration,2); | 151 | addItemInt("Default Duration",&mDefaultDuration,2); |
152 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 152 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
153 | addItemInt("Daylight Savings",&mDaylightSavings,0); | 153 | addItemInt("Daylight Savings",&mDaylightSavings,0); |
154 | KPrefs::setCurrentGroup("AlarmSettings"); | 154 | KPrefs::setCurrentGroup("AlarmSettings"); |
155 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 155 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
156 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 156 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
157 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 157 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
158 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 158 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
159 | 159 | ||
160 | 160 | ||
161 | KPrefs::setCurrentGroup("Calendar"); | 161 | KPrefs::setCurrentGroup("Calendar"); |
162 | 162 | ||
163 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 163 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
164 | 164 | ||
165 | KPrefs::setCurrentGroup("Fonts"); | 165 | KPrefs::setCurrentGroup("Fonts"); |
166 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 166 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
167 | addItemFont("TimeBar Font",&mTimeBarFont); | 167 | addItemFont("TimeBar Font",&mTimeBarFont); |
168 | addItemFont("MonthView Font",&mMonthViewFont); | 168 | addItemFont("MonthView Font",&mMonthViewFont); |
169 | addItemFont("AgendaView Font",&mAgendaViewFont); | 169 | addItemFont("AgendaView Font",&mAgendaViewFont); |
170 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | 170 | addItemFont("MarcusBains Font",&mMarcusBainsFont); |
171 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | 171 | addItemFont("TimeLabels Font",&mTimeLabelsFont); |
172 | addItemFont("TodoView Font",&mTodoViewFont); | 172 | addItemFont("TodoView Font",&mTodoViewFont); |
173 | addItemFont("ListView Font",&mListViewFont); | 173 | addItemFont("ListView Font",&mListViewFont); |
174 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | 174 | addItemFont("DateNavigator Font",&mDateNavigatorFont); |
175 | addItemFont("EditBox Font",&mEditBoxFont); | 175 | addItemFont("EditBox Font",&mEditBoxFont); |
176 | addItemFont("JournalView Font",&mJornalViewFont); | 176 | addItemFont("JournalView Font",&mJornalViewFont); |
177 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | 177 | addItemFont("WhatsNextView Font",&mWhatsNextFont); |
178 | addItemFont("EventView Font",&mEventViewFont); | 178 | addItemFont("EventView Font",&mEventViewFont); |
179 | 179 | ||
180 | KPrefs::setCurrentGroup("SyncProfiles"); | 180 | // KPrefs::setCurrentGroup("SyncProfiles"); |
181 | addItemString("LocalMachineName",&mLocalMachineName, "undefined"); | 181 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); |
182 | addItemStringList("SyncProfileNames",&mSyncProfileNames); | 182 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); |
183 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); | ||
183 | 184 | ||
184 | KPrefs::setCurrentGroup("RemoteSyncing"); | 185 | KPrefs::setCurrentGroup("RemoteSyncing"); |
185 | addItemBool("UsePasswd",&mUsePassWd,false); | 186 | // addItemBool("UsePasswd",&mUsePassWd,false); |
186 | addItemBool("WriteBackFile",&mWriteBackFile,true); | 187 | // addItemBool("WriteBackFile",&mWriteBackFile,true); |
187 | addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); | 188 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); |
188 | addItemBool("AskForPreferences",&mAskForPreferences,true); | 189 | // addItemBool("AskForPreferences",&mAskForPreferences,true); |
189 | addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | 190 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); |
190 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 191 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
191 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 192 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
192 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); | 193 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); |
193 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | 194 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); |
194 | 195 | ||
195 | #ifdef _WIN32_ | 196 | #ifdef _WIN32_ |
196 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 197 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
197 | #else | 198 | #else |
198 | QString hdp= locateLocal("data","korganizer")+"/"; | 199 | QString hdp= locateLocal("data","korganizer")+"/"; |
199 | #endif | 200 | #endif |
200 | addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); | 201 | // addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); |
201 | addItemString("RemoteUser",&mRemoteUser, "zaurus"); | 202 | // addItemString("RemoteUser",&mRemoteUser, "zaurus"); |
202 | addItemString("RemotePassWd",&mRemotePassWd, ""); | 203 | // addItemString("RemotePassWd",&mRemotePassWd, ""); |
203 | addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); | 204 | // addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); |
204 | addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); | 205 | // addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); |
205 | 206 | ||
206 | 207 | ||
207 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 208 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
208 | 209 | ||
209 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 210 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
210 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 211 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
211 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 212 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
212 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 213 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
213 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | 214 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); |
214 | 215 | ||
215 | 216 | ||
216 | KPrefs::setCurrentGroup("Locale"); | 217 | KPrefs::setCurrentGroup("Locale"); |
217 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 218 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
218 | addItemInt("PreferredTime",&mPreferredTime,0); | 219 | addItemInt("PreferredTime",&mPreferredTime,0); |
219 | addItemInt("PreferredDate",&mPreferredDate,0); | 220 | addItemInt("PreferredDate",&mPreferredDate,0); |
220 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 221 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
221 | addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); | 222 | addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); |
222 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 223 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
223 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | 224 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); |
224 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 225 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
225 | 226 | ||
226 | 227 | ||
227 | KPrefs::setCurrentGroup("Colors"); | 228 | KPrefs::setCurrentGroup("Colors"); |
228 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 229 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
229 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 230 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
230 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 231 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
231 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 232 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
232 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 233 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
233 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 234 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
234 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 235 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
235 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 236 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
236 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 237 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
237 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 238 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
238 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 239 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
239 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 240 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
240 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 241 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
241 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 242 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
242 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 243 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
243 | addItemBool("UseAppColors",&mUseAppColors,false); | 244 | addItemBool("UseAppColors",&mUseAppColors,false); |
244 | 245 | ||
245 | 246 | ||
246 | 247 | ||
247 | KPrefs::setCurrentGroup("Views"); | 248 | KPrefs::setCurrentGroup("Views"); |
248 | addItemInt("Hour Size",&mHourSize,8); | 249 | addItemInt("Hour Size",&mHourSize,8); |
249 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 250 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
250 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 251 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
251 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 252 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
252 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 253 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index fe044e6..424fa98 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -170,96 +170,97 @@ class KOPrefs : public KPimPrefs | |||
170 | 170 | ||
171 | bool mCompactDialogs; | 171 | bool mCompactDialogs; |
172 | bool mVerticalScreen; | 172 | bool mVerticalScreen; |
173 | 173 | ||
174 | bool mShowIconNewTodo; | 174 | bool mShowIconNewTodo; |
175 | bool mShowIconNewEvent; | 175 | bool mShowIconNewEvent; |
176 | bool mShowIconSearch; | 176 | bool mShowIconSearch; |
177 | bool mShowIconList; | 177 | bool mShowIconList; |
178 | bool mShowIconDay1; | 178 | bool mShowIconDay1; |
179 | bool mShowIconDay5; | 179 | bool mShowIconDay5; |
180 | bool mShowIconDay7; | 180 | bool mShowIconDay7; |
181 | bool mShowIconMonth; | 181 | bool mShowIconMonth; |
182 | bool mShowIconTodoview; | 182 | bool mShowIconTodoview; |
183 | bool mShowIconBackFast; | 183 | bool mShowIconBackFast; |
184 | bool mShowIconBack; | 184 | bool mShowIconBack; |
185 | bool mShowIconToday; | 185 | bool mShowIconToday; |
186 | bool mShowIconForward; | 186 | bool mShowIconForward; |
187 | bool mShowIconForwardFast; | 187 | bool mShowIconForwardFast; |
188 | bool mShowIconWhatsThis; | 188 | bool mShowIconWhatsThis; |
189 | bool mShowIconNextDays; | 189 | bool mShowIconNextDays; |
190 | bool mShowIconNext; | 190 | bool mShowIconNext; |
191 | bool mShowIconJournal; | 191 | bool mShowIconJournal; |
192 | 192 | ||
193 | bool mShowIconStretch; | 193 | bool mShowIconStretch; |
194 | 194 | ||
195 | bool mToolBarHor; | 195 | bool mToolBarHor; |
196 | bool mToolBarUp; | 196 | bool mToolBarUp; |
197 | bool mToolBarMiniIcons; | 197 | bool mToolBarMiniIcons; |
198 | 198 | ||
199 | bool mAskForQuit; | 199 | bool mAskForQuit; |
200 | bool mUsePassWd; | 200 | bool mUsePassWd; |
201 | bool mWriteBackFile; | 201 | bool mWriteBackFile; |
202 | bool mAskForPreferences; | 202 | bool mAskForPreferences; |
203 | bool mShowSyncSummary; | 203 | bool mShowSyncSummary; |
204 | bool mShowSyncEvents; | 204 | bool mShowSyncEvents; |
205 | bool mShowTodoInAgenda; | 205 | bool mShowTodoInAgenda; |
206 | bool mWriteBackExistingOnly; | 206 | bool mWriteBackExistingOnly; |
207 | 207 | ||
208 | QString mRemoteIP; | 208 | QString mRemoteIP; |
209 | QString mRemoteUser; | 209 | QString mRemoteUser; |
210 | QString mRemotePassWd; | 210 | QString mRemotePassWd; |
211 | QString mRemoteFile; | 211 | QString mRemoteFile; |
212 | QString mLocalTempFile; | 212 | QString mLocalTempFile; |
213 | 213 | ||
214 | int mLastSyncTime; | 214 | int mLastSyncTime; |
215 | int mSyncAlgoPrefs; | 215 | int mSyncAlgoPrefs; |
216 | int mRingSyncAlgoPrefs; | 216 | int mRingSyncAlgoPrefs; |
217 | QStringList mSyncProfileNames; | 217 | QStringList mSyncProfileNames; |
218 | QStringList mExternSyncProfiles; | ||
218 | QString mLocalMachineName; | 219 | QString mLocalMachineName; |
219 | void setCategoryColor(QString cat,const QColor & color); | 220 | void setCategoryColor(QString cat,const QColor & color); |
220 | QColor *categoryColor(QString cat); | 221 | QColor *categoryColor(QString cat); |
221 | 222 | ||
222 | QString mArchiveFile; | 223 | QString mArchiveFile; |
223 | QString mHtmlExportFile; | 224 | QString mHtmlExportFile; |
224 | bool mHtmlWithSave; | 225 | bool mHtmlWithSave; |
225 | 226 | ||
226 | QStringList mSelectedPlugins; | 227 | QStringList mSelectedPlugins; |
227 | 228 | ||
228 | QString mLastImportFile; | 229 | QString mLastImportFile; |
229 | QString mLastVcalFile; | 230 | QString mLastVcalFile; |
230 | QString mLastSaveFile; | 231 | QString mLastSaveFile; |
231 | QString mLastLoadFile; | 232 | QString mLastLoadFile; |
232 | QString mLastSyncedLocalFile; | 233 | QString mLastSyncedLocalFile; |
233 | 234 | ||
234 | 235 | ||
235 | QString mDefaultAlarmFile; | 236 | QString mDefaultAlarmFile; |
236 | int mIMIPScheduler; | 237 | int mIMIPScheduler; |
237 | int mIMIPSend; | 238 | int mIMIPSend; |
238 | QStringList mAdditionalMails; | 239 | QStringList mAdditionalMails; |
239 | int mIMIPAutoRefresh; | 240 | int mIMIPAutoRefresh; |
240 | int mIMIPAutoInsertReply; | 241 | int mIMIPAutoInsertReply; |
241 | int mIMIPAutoInsertRequest; | 242 | int mIMIPAutoInsertRequest; |
242 | int mIMIPAutoFreeBusy; | 243 | int mIMIPAutoFreeBusy; |
243 | int mIMIPAutoFreeBusyReply; | 244 | int mIMIPAutoFreeBusyReply; |
244 | 245 | ||
245 | QStringList mTodoTemplates; | 246 | QStringList mTodoTemplates; |
246 | QStringList mEventTemplates; | 247 | QStringList mEventTemplates; |
247 | 248 | ||
248 | int mDestination; | 249 | int mDestination; |
249 | 250 | ||
250 | 251 | ||
251 | bool mEditOnDoubleClick; | 252 | bool mEditOnDoubleClick; |
252 | bool mViewChangeHoldFullscreen; | 253 | bool mViewChangeHoldFullscreen; |
253 | bool mViewChangeHoldNonFullscreen; | 254 | bool mViewChangeHoldNonFullscreen; |
254 | bool mCenterOnCurrentTime; | 255 | bool mCenterOnCurrentTime; |
255 | bool mSetTimeToDayStartAt; | 256 | bool mSetTimeToDayStartAt; |
256 | bool mHighlightCurrentDay; | 257 | bool mHighlightCurrentDay; |
257 | bool mUseHighlightLightColor; | 258 | bool mUseHighlightLightColor; |
258 | bool mListViewMonthTimespan; | 259 | bool mListViewMonthTimespan; |
259 | bool mWNViewShowsParents; | 260 | bool mWNViewShowsParents; |
260 | bool mWNViewShowLocation; | 261 | bool mWNViewShowLocation; |
261 | bool mTodoViewShowsPercentage; | 262 | bool mTodoViewShowsPercentage; |
262 | bool mTodoViewUsesCatColors; | 263 | bool mTodoViewUsesCatColors; |
263 | bool mTodoViewUsesSmallFont; | 264 | bool mTodoViewUsesSmallFont; |
264 | bool mTodoViewUsesForegroundColor; | 265 | bool mTodoViewUsesForegroundColor; |
265 | bool mMonthViewUsesForegroundColor; | 266 | bool mMonthViewUsesForegroundColor; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 44b1264..6020a46 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -791,111 +791,114 @@ void MainWindow::initActions() | |||
791 | if (p-> mShowIconForwardFast) | 791 | if (p-> mShowIconForwardFast) |
792 | configureToolBarMenu->setItemChecked( 230, true ); | 792 | configureToolBarMenu->setItemChecked( 230, true ); |
793 | if (p-> mShowIconNextDays) | 793 | if (p-> mShowIconNextDays) |
794 | configureToolBarMenu->setItemChecked( 100, true ); | 794 | configureToolBarMenu->setItemChecked( 100, true ); |
795 | if (p-> mShowIconNext) | 795 | if (p-> mShowIconNext) |
796 | configureToolBarMenu->setItemChecked( 110, true ); | 796 | configureToolBarMenu->setItemChecked( 110, true ); |
797 | if (p-> mShowIconJournal) | 797 | if (p-> mShowIconJournal) |
798 | configureToolBarMenu->setItemChecked( 90, true ); | 798 | configureToolBarMenu->setItemChecked( 90, true ); |
799 | if (p-> mShowIconWhatsThis) | 799 | if (p-> mShowIconWhatsThis) |
800 | configureToolBarMenu->setItemChecked( 300, true ); | 800 | configureToolBarMenu->setItemChecked( 300, true ); |
801 | 801 | ||
802 | QLabel* dummy = new QLabel( iconToolBar ); | 802 | QLabel* dummy = new QLabel( iconToolBar ); |
803 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 803 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
804 | if (!p-> mShowIconStretch) | 804 | if (!p-> mShowIconStretch) |
805 | iconToolBar->setStretchableWidget ( dummy ) ; | 805 | iconToolBar->setStretchableWidget ( dummy ) ; |
806 | else | 806 | else |
807 | configureToolBarMenu->setItemChecked( 5, true ); | 807 | configureToolBarMenu->setItemChecked( 5, true ); |
808 | if (p-> mShowIconWhatsThis) | 808 | if (p-> mShowIconWhatsThis) |
809 | QWhatsThis::whatsThisButton ( iconToolBar ); | 809 | QWhatsThis::whatsThisButton ( iconToolBar ); |
810 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 810 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
811 | configureAgenda( p->mHourSize ); | 811 | configureAgenda( p->mHourSize ); |
812 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 812 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
813 | } | 813 | } |
814 | void MainWindow::fillSyncMenu() | 814 | void MainWindow::fillSyncMenu() |
815 | { | 815 | { |
816 | syncMenu->clear(); | 816 | syncMenu->clear(); |
817 | syncMenu->insertItem( i18n("Configure..."), 0 ); | 817 | syncMenu->insertItem( i18n("Configure..."), 0 ); |
818 | syncMenu->insertSeparator(); | 818 | syncMenu->insertSeparator(); |
819 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | 819 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); |
820 | syncMenu->insertSeparator(); | 820 | syncMenu->insertSeparator(); |
821 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 821 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
822 | config.setGroup("General"); | 822 | config.setGroup("General"); |
823 | QStringList prof = config.readListEntry("SyncProfileNames"); | 823 | QStringList prof = config.readListEntry("SyncProfileNames"); |
824 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 824 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
825 | if ( prof.count() < 3 ) { | 825 | if ( prof.count() < 3 ) { |
826 | prof.clear(); | 826 | prof.clear(); |
827 | prof << i18n("Sharp_DTM"); | 827 | prof << i18n("Sharp_DTM"); |
828 | prof << i18n("Local_file"); | 828 | prof << i18n("Local_file"); |
829 | prof << i18n("Last_file"); | 829 | prof << i18n("Last_file"); |
830 | KSyncProfile* temp = new KSyncProfile (); | 830 | KSyncProfile* temp = new KSyncProfile (); |
831 | temp->setName( prof[0] ); | 831 | temp->setName( prof[0] ); |
832 | temp->writeConfig(&config); | 832 | temp->writeConfig(&config); |
833 | temp->setName( prof[1] ); | 833 | temp->setName( prof[1] ); |
834 | temp->writeConfig(&config); | 834 | temp->writeConfig(&config); |
835 | temp->setName( prof[2] ); | 835 | temp->setName( prof[2] ); |
836 | temp->writeConfig(&config); | 836 | temp->writeConfig(&config); |
837 | config.setGroup("General"); | 837 | config.setGroup("General"); |
838 | config.writeEntry("SyncProfileNames",prof); | 838 | config.writeEntry("SyncProfileNames",prof); |
839 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | ||
839 | config.sync(); | 840 | config.sync(); |
840 | delete temp; | 841 | delete temp; |
841 | } | 842 | } |
843 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | ||
842 | KOPrefs::instance()->mSyncProfileNames = prof; | 844 | KOPrefs::instance()->mSyncProfileNames = prof; |
843 | int i; | 845 | int i; |
844 | for ( i = 0; i < prof.count(); ++i ) { | 846 | for ( i = 0; i < prof.count(); ++i ) { |
845 | 847 | ||
846 | syncMenu->insertItem( prof[i], 1000+i ); | 848 | syncMenu->insertItem( prof[i], 1000+i ); |
847 | if ( i == 2 ) | 849 | if ( i == 2 ) |
848 | syncMenu->insertSeparator(); | 850 | syncMenu->insertSeparator(); |
849 | } | 851 | } |
850 | QDir app_dir; | 852 | QDir app_dir; |
851 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 853 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
852 | syncMenu->setItemEnabled( false , 1000 ); | 854 | syncMenu->setItemEnabled( false , 1000 ); |
853 | } | 855 | } |
856 | mView->setupExternSyncProfiles(); | ||
854 | } | 857 | } |
855 | 858 | ||
856 | int MainWindow::ringSync() | 859 | int MainWindow::ringSync() |
857 | { | 860 | { |
858 | int syncedProfiles = 0; | 861 | int syncedProfiles = 0; |
859 | int i; | 862 | int i; |
860 | QTime timer; | 863 | QTime timer; |
861 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 864 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
862 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; | 865 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; |
863 | KSyncProfile* temp = new KSyncProfile (); | 866 | KSyncProfile* temp = new KSyncProfile (); |
864 | KOPrefs::instance()->mAskForPreferences = false; | 867 | KOPrefs::instance()->mAskForPreferences = false; |
865 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 868 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
866 | mCurrentSyncProfile = i; | 869 | mCurrentSyncProfile = i; |
867 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 870 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
868 | temp->readConfig(&config); | 871 | temp->readConfig(&config); |
869 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { | 872 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { |
870 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 873 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
871 | ++syncedProfiles; | 874 | ++syncedProfiles; |
872 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 875 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
873 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 876 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
874 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 877 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
875 | KOPrefs::instance()->mShowSyncSummary = false; | 878 | KOPrefs::instance()->mShowSyncSummary = false; |
876 | mView->setSyncDevice(syncProfileNames[i] ); | 879 | mView->setSyncDevice(syncProfileNames[i] ); |
877 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 880 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
878 | if ( i == 0 ) { | 881 | if ( i == 0 ) { |
879 | syncSharp(); | 882 | syncSharp(); |
880 | } else { | 883 | } else { |
881 | if ( temp->getIsLocalFileSync() ) { | 884 | if ( temp->getIsLocalFileSync() ) { |
882 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) | 885 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) |
883 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 886 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
884 | } else { | 887 | } else { |
885 | syncRemote( temp, false ); | 888 | syncRemote( temp, false ); |
886 | 889 | ||
887 | } | 890 | } |
888 | } | 891 | } |
889 | timer.start(); | 892 | timer.start(); |
890 | setCaption(i18n("Multiple sync in progress ... please wait!") ); | 893 | setCaption(i18n("Multiple sync in progress ... please wait!") ); |
891 | while ( timer.elapsed () < 2000 ) { | 894 | while ( timer.elapsed () < 2000 ) { |
892 | qApp->processEvents(); | 895 | qApp->processEvents(); |
893 | #ifndef _WIN32_ | 896 | #ifndef _WIN32_ |
894 | sleep (1); | 897 | sleep (1); |
895 | #endif | 898 | #endif |
896 | } | 899 | } |
897 | 900 | ||
898 | } | 901 | } |
899 | 902 | ||
900 | } | 903 | } |
901 | delete temp; | 904 | delete temp; |
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 7d23619..df5bbcf 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -30,97 +30,97 @@ | |||
30 | 30 | ||
31 | #include "customproperties.h" | 31 | #include "customproperties.h" |
32 | #include "event.h" | 32 | #include "event.h" |
33 | #include "todo.h" | 33 | #include "todo.h" |
34 | #include "journal.h" | 34 | #include "journal.h" |
35 | 35 | ||
36 | #define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ | 36 | #define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ |
37 | 37 | ||
38 | class KConfig; | 38 | class KConfig; |
39 | 39 | ||
40 | namespace KCal { | 40 | namespace KCal { |
41 | 41 | ||
42 | class CalFilter; | 42 | class CalFilter; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | This is the main "calendar" object class for KOrganizer. It holds | 45 | This is the main "calendar" object class for KOrganizer. It holds |
46 | information like all appointments/events, user information, etc. etc. | 46 | information like all appointments/events, user information, etc. etc. |
47 | one calendar is associated with each CalendarView (@see calendarview.h). | 47 | one calendar is associated with each CalendarView (@see calendarview.h). |
48 | This is an abstract base class defining the interface to a calendar. It is | 48 | This is an abstract base class defining the interface to a calendar. It is |
49 | implemented by subclasses like @see CalendarLocal, which use different | 49 | implemented by subclasses like @see CalendarLocal, which use different |
50 | methods to store and access the data. | 50 | methods to store and access the data. |
51 | 51 | ||
52 | Ownership of events etc. is handled by the following policy: As soon as an | 52 | Ownership of events etc. is handled by the following policy: As soon as an |
53 | event (or any other subclass of IncidenceBase) object is added to the | 53 | event (or any other subclass of IncidenceBase) object is added to the |
54 | Calendar by addEvent() it is owned by the Calendar object. The Calendar takes | 54 | Calendar by addEvent() it is owned by the Calendar object. The Calendar takes |
55 | care of deleting it. All Events returned by the query functions are returned | 55 | care of deleting it. All Events returned by the query functions are returned |
56 | as pointers, that means all changes to the returned events are immediately | 56 | as pointers, that means all changes to the returned events are immediately |
57 | visible in the Calendar. You shouldn't delete any Event object you get from | 57 | visible in the Calendar. You shouldn't delete any Event object you get from |
58 | Calendar. | 58 | Calendar. |
59 | */ | 59 | */ |
60 | class Calendar : public QObject, public CustomProperties, | 60 | class Calendar : public QObject, public CustomProperties, |
61 | public IncidenceBase::Observer | 61 | public IncidenceBase::Observer |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | Calendar(); | 65 | Calendar(); |
66 | Calendar(const QString &timeZoneId); | 66 | Calendar(const QString &timeZoneId); |
67 | virtual ~Calendar(); | 67 | virtual ~Calendar(); |
68 | void deleteIncidence(Incidence *in); | 68 | void deleteIncidence(Incidence *in); |
69 | /** | 69 | /** |
70 | Clears out the current calendar, freeing all used memory etc. | 70 | Clears out the current calendar, freeing all used memory etc. |
71 | */ | 71 | */ |
72 | virtual void close() = 0; | 72 | virtual void close() = 0; |
73 | 73 | ||
74 | /** | 74 | /** |
75 | Sync changes in memory to persistant storage. | 75 | Sync changes in memory to persistant storage. |
76 | */ | 76 | */ |
77 | virtual void save() = 0; | 77 | virtual void save() = 0; |
78 | 78 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | |
79 | virtual bool isSaving() { return false; } | 79 | virtual bool isSaving() { return false; } |
80 | 80 | ||
81 | /** | 81 | /** |
82 | Return the owner of the calendar's full name. | 82 | Return the owner of the calendar's full name. |
83 | */ | 83 | */ |
84 | const QString &getOwner() const; | 84 | const QString &getOwner() const; |
85 | /** | 85 | /** |
86 | Set the owner of the calendar. Should be owner's full name. | 86 | Set the owner of the calendar. Should be owner's full name. |
87 | */ | 87 | */ |
88 | void setOwner( const QString &os ); | 88 | void setOwner( const QString &os ); |
89 | /** | 89 | /** |
90 | Return the email address of the calendar owner. | 90 | Return the email address of the calendar owner. |
91 | */ | 91 | */ |
92 | const QString &getEmail(); | 92 | const QString &getEmail(); |
93 | /** | 93 | /** |
94 | Set the email address of the calendar owner. | 94 | Set the email address of the calendar owner. |
95 | */ | 95 | */ |
96 | void setEmail( const QString & ); | 96 | void setEmail( const QString & ); |
97 | 97 | ||
98 | /** | 98 | /** |
99 | Set time zone from a timezone string (e.g. -2:00) | 99 | Set time zone from a timezone string (e.g. -2:00) |
100 | */ | 100 | */ |
101 | void setTimeZone( const QString &tz ); | 101 | void setTimeZone( const QString &tz ); |
102 | /** | 102 | /** |
103 | Set time zone from a minutes value (e.g. -60) | 103 | Set time zone from a minutes value (e.g. -60) |
104 | */ | 104 | */ |
105 | void setTimeZone( int tz ); | 105 | void setTimeZone( int tz ); |
106 | /** | 106 | /** |
107 | Return time zone as offest in minutes. | 107 | Return time zone as offest in minutes. |
108 | */ | 108 | */ |
109 | int getTimeZone() const; | 109 | int getTimeZone() const; |
110 | /** | 110 | /** |
111 | Compute an ISO 8601 format string from the time zone. | 111 | Compute an ISO 8601 format string from the time zone. |
112 | */ | 112 | */ |
113 | QString getTimeZoneStr() const; | 113 | QString getTimeZoneStr() const; |
114 | /** | 114 | /** |
115 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal | 115 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal |
116 | values). | 116 | values). |
117 | */ | 117 | */ |
118 | void setTimeZoneId( const QString & ); | 118 | void setTimeZoneId( const QString & ); |
119 | /** | 119 | /** |
120 | Return time zone id. | 120 | Return time zone id. |
121 | */ | 121 | */ |
122 | QString timeZoneId() const; | 122 | QString timeZoneId() const; |
123 | /** | 123 | /** |
124 | Use local time, not UTC or a time zone. | 124 | Use local time, not UTC or a time zone. |
125 | */ | 125 | */ |
126 | void setLocalTime(); | 126 | void setLocalTime(); |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 3c572f0..09ce9f0 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -177,96 +177,109 @@ bool CalendarLocal::addTodoNoDup( Todo *todo ) | |||
177 | { | 177 | { |
178 | Todo * eve; | 178 | Todo * eve; |
179 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { | 179 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { |
180 | if ( *eve == *todo ) { | 180 | if ( *eve == *todo ) { |
181 | //qDebug("duplicate todo found! not inserted! "); | 181 | //qDebug("duplicate todo found! not inserted! "); |
182 | return false; | 182 | return false; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | return addTodo( todo ); | 185 | return addTodo( todo ); |
186 | } | 186 | } |
187 | bool CalendarLocal::addTodo( Todo *todo ) | 187 | bool CalendarLocal::addTodo( Todo *todo ) |
188 | { | 188 | { |
189 | mTodoList.append( todo ); | 189 | mTodoList.append( todo ); |
190 | 190 | ||
191 | todo->registerObserver( this ); | 191 | todo->registerObserver( this ); |
192 | 192 | ||
193 | // Set up subtask relations | 193 | // Set up subtask relations |
194 | setupRelations( todo ); | 194 | setupRelations( todo ); |
195 | 195 | ||
196 | setModified( true ); | 196 | setModified( true ); |
197 | 197 | ||
198 | return true; | 198 | return true; |
199 | } | 199 | } |
200 | 200 | ||
201 | void CalendarLocal::deleteTodo( Todo *todo ) | 201 | void CalendarLocal::deleteTodo( Todo *todo ) |
202 | { | 202 | { |
203 | // Handle orphaned children | 203 | // Handle orphaned children |
204 | removeRelations( todo ); | 204 | removeRelations( todo ); |
205 | 205 | ||
206 | if ( mTodoList.removeRef( todo ) ) { | 206 | if ( mTodoList.removeRef( todo ) ) { |
207 | setModified( true ); | 207 | setModified( true ); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | QPtrList<Todo> CalendarLocal::rawTodos() | 211 | QPtrList<Todo> CalendarLocal::rawTodos() |
212 | { | 212 | { |
213 | return mTodoList; | 213 | return mTodoList; |
214 | } | 214 | } |
215 | Todo *CalendarLocal::todo( int id ) | 215 | Todo *CalendarLocal::todo( int id ) |
216 | { | 216 | { |
217 | Todo *todo; | 217 | Todo *todo; |
218 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 218 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
219 | if ( todo->zaurusId() == id ) return todo; | 219 | if ( todo->zaurusId() == id ) return todo; |
220 | } | 220 | } |
221 | 221 | ||
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | 224 | ||
225 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() | ||
226 | { | ||
227 | QPtrList<Event> el; | ||
228 | Event *todo; | ||
229 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | ||
230 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | ||
231 | if ( todo->summary().left(3) == "E: " ) | ||
232 | el.append( todo ); | ||
233 | } | ||
234 | |||
235 | return el; | ||
236 | |||
237 | } | ||
225 | Event *CalendarLocal::event( int id ) | 238 | Event *CalendarLocal::event( int id ) |
226 | { | 239 | { |
227 | Event *todo; | 240 | Event *todo; |
228 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 241 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
229 | if ( todo->zaurusId() == id ) return todo; | 242 | if ( todo->zaurusId() == id ) return todo; |
230 | } | 243 | } |
231 | 244 | ||
232 | return 0; | 245 | return 0; |
233 | } | 246 | } |
234 | Todo *CalendarLocal::todo( const QString &uid ) | 247 | Todo *CalendarLocal::todo( const QString &uid ) |
235 | { | 248 | { |
236 | Todo *todo; | 249 | Todo *todo; |
237 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 250 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
238 | if ( todo->uid() == uid ) return todo; | 251 | if ( todo->uid() == uid ) return todo; |
239 | } | 252 | } |
240 | 253 | ||
241 | return 0; | 254 | return 0; |
242 | } | 255 | } |
243 | QString CalendarLocal::nextSummary() const | 256 | QString CalendarLocal::nextSummary() const |
244 | { | 257 | { |
245 | return mNextSummary; | 258 | return mNextSummary; |
246 | } | 259 | } |
247 | QDateTime CalendarLocal::nextAlarmEventDateTime() const | 260 | QDateTime CalendarLocal::nextAlarmEventDateTime() const |
248 | { | 261 | { |
249 | return mNextAlarmEventDateTime; | 262 | return mNextAlarmEventDateTime; |
250 | } | 263 | } |
251 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) | 264 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) |
252 | { | 265 | { |
253 | //mNextAlarmIncidence | 266 | //mNextAlarmIncidence |
254 | //mNextAlarmDateTime | 267 | //mNextAlarmDateTime |
255 | //return mNextSummary; | 268 | //return mNextSummary; |
256 | //return mNextAlarmEventDateTime; | 269 | //return mNextAlarmEventDateTime; |
257 | bool newNextAlarm = false; | 270 | bool newNextAlarm = false; |
258 | bool computeNextAlarm = false; | 271 | bool computeNextAlarm = false; |
259 | bool ok; | 272 | bool ok; |
260 | int offset; | 273 | int offset; |
261 | QDateTime nextA; | 274 | QDateTime nextA; |
262 | // QString nextSum; | 275 | // QString nextSum; |
263 | //QDateTime nextEvent; | 276 | //QDateTime nextEvent; |
264 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { | 277 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { |
265 | computeNextAlarm = true; | 278 | computeNextAlarm = true; |
266 | } else { | 279 | } else { |
267 | if ( ! deleted ) { | 280 | if ( ! deleted ) { |
268 | nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; | 281 | nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; |
269 | if ( ok ) { | 282 | if ( ok ) { |
270 | if ( nextA < mNextAlarmDateTime ) { | 283 | if ( nextA < mNextAlarmDateTime ) { |
271 | deRegisterAlarm(); | 284 | deRegisterAlarm(); |
272 | mNextAlarmDateTime = nextA; | 285 | mNextAlarmDateTime = nextA; |
@@ -275,97 +288,96 @@ void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted | |||
275 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 288 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
276 | newNextAlarm = true; | 289 | newNextAlarm = true; |
277 | mNextAlarmIncidence = incidence; | 290 | mNextAlarmIncidence = incidence; |
278 | } else { | 291 | } else { |
279 | if ( incidence == mNextAlarmIncidence ) { | 292 | if ( incidence == mNextAlarmIncidence ) { |
280 | computeNextAlarm = true; | 293 | computeNextAlarm = true; |
281 | } | 294 | } |
282 | } | 295 | } |
283 | } else { | 296 | } else { |
284 | if ( mNextAlarmIncidence == incidence ) { | 297 | if ( mNextAlarmIncidence == incidence ) { |
285 | computeNextAlarm = true; | 298 | computeNextAlarm = true; |
286 | } | 299 | } |
287 | } | 300 | } |
288 | } else { // deleted | 301 | } else { // deleted |
289 | if ( incidence == mNextAlarmIncidence ) { | 302 | if ( incidence == mNextAlarmIncidence ) { |
290 | computeNextAlarm = true; | 303 | computeNextAlarm = true; |
291 | } | 304 | } |
292 | } | 305 | } |
293 | } | 306 | } |
294 | if ( computeNextAlarm ) { | 307 | if ( computeNextAlarm ) { |
295 | deRegisterAlarm(); | 308 | deRegisterAlarm(); |
296 | nextA = nextAlarm( 1000 ); | 309 | nextA = nextAlarm( 1000 ); |
297 | if (! mNextAlarmIncidence ) { | 310 | if (! mNextAlarmIncidence ) { |
298 | return; | 311 | return; |
299 | } | 312 | } |
300 | newNextAlarm = true; | 313 | newNextAlarm = true; |
301 | } | 314 | } |
302 | if ( newNextAlarm ) | 315 | if ( newNextAlarm ) |
303 | registerAlarm(); | 316 | registerAlarm(); |
304 | } | 317 | } |
305 | QString CalendarLocal:: getAlarmNotification() | 318 | QString CalendarLocal:: getAlarmNotification() |
306 | { | 319 | { |
307 | QString ret; | 320 | QString ret; |
308 | // this should not happen | 321 | // this should not happen |
309 | if (! mNextAlarmIncidence ) | 322 | if (! mNextAlarmIncidence ) |
310 | return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; | 323 | return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; |
311 | Alarm* alarm = mNextAlarmIncidence->alarms().first(); | 324 | Alarm* alarm = mNextAlarmIncidence->alarms().first(); |
312 | if ( alarm->type() == Alarm::Procedure ) { | 325 | if ( alarm->type() == Alarm::Procedure ) { |
313 | ret = "proc_alarm" + alarm->programFile()+"+++"; | 326 | ret = "proc_alarm" + alarm->programFile()+"+++"; |
314 | } else { | 327 | } else { |
315 | ret = "audio_alarm" +alarm->audioFile() +"+++"; | 328 | ret = "audio_alarm" +alarm->audioFile() +"+++"; |
316 | } | 329 | } |
317 | ret += "cal_alarm"+ mNextSummary.left( 25 ); | 330 | ret += "cal_alarm"+ mNextSummary.left( 25 ); |
318 | if ( mNextSummary.length() > 25 ) | 331 | if ( mNextSummary.length() > 25 ) |
319 | ret += "\n" + mNextSummary.mid(25, 25 ); | 332 | ret += "\n" + mNextSummary.mid(25, 25 ); |
320 | ret+= "\n"+mNextAlarmEventDateTimeString; | 333 | ret+= "\n"+mNextAlarmEventDateTimeString; |
321 | return ret; | 334 | return ret; |
322 | } | 335 | } |
323 | |||
324 | void CalendarLocal::registerAlarm() | 336 | void CalendarLocal::registerAlarm() |
325 | { | 337 | { |
326 | mLastAlarmNotificationString = getAlarmNotification(); | 338 | mLastAlarmNotificationString = getAlarmNotification(); |
327 | // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); | 339 | // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); |
328 | emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); | 340 | emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); |
329 | // #ifndef DESKTOP_VERSION | 341 | // #ifndef DESKTOP_VERSION |
330 | // AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); | 342 | // AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); |
331 | // #endif | 343 | // #endif |
332 | } | 344 | } |
333 | void CalendarLocal::deRegisterAlarm() | 345 | void CalendarLocal::deRegisterAlarm() |
334 | { | 346 | { |
335 | if ( mLastAlarmNotificationString.isNull() ) | 347 | if ( mLastAlarmNotificationString.isNull() ) |
336 | return; | 348 | return; |
337 | //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); | 349 | //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); |
338 | 350 | ||
339 | emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); | 351 | emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); |
340 | // #ifndef DESKTOP_VERSION | 352 | // #ifndef DESKTOP_VERSION |
341 | // AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); | 353 | // AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); |
342 | // #endif | 354 | // #endif |
343 | } | 355 | } |
344 | 356 | ||
345 | QPtrList<Todo> CalendarLocal::todos( const QDate &date ) | 357 | QPtrList<Todo> CalendarLocal::todos( const QDate &date ) |
346 | { | 358 | { |
347 | QPtrList<Todo> todos; | 359 | QPtrList<Todo> todos; |
348 | 360 | ||
349 | Todo *todo; | 361 | Todo *todo; |
350 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 362 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
351 | if ( todo->hasDueDate() && todo->dtDue().date() == date ) { | 363 | if ( todo->hasDueDate() && todo->dtDue().date() == date ) { |
352 | todos.append( todo ); | 364 | todos.append( todo ); |
353 | } | 365 | } |
354 | } | 366 | } |
355 | 367 | ||
356 | filter()->apply( &todos ); | 368 | filter()->apply( &todos ); |
357 | return todos; | 369 | return todos; |
358 | } | 370 | } |
359 | void CalendarLocal::reInitAlarmSettings() | 371 | void CalendarLocal::reInitAlarmSettings() |
360 | { | 372 | { |
361 | if ( !mNextAlarmIncidence ) { | 373 | if ( !mNextAlarmIncidence ) { |
362 | nextAlarm( 1000 ); | 374 | nextAlarm( 1000 ); |
363 | } | 375 | } |
364 | deRegisterAlarm(); | 376 | deRegisterAlarm(); |
365 | mNextAlarmIncidence = 0; | 377 | mNextAlarmIncidence = 0; |
366 | checkAlarmForIncidence( 0, false ); | 378 | checkAlarmForIncidence( 0, false ); |
367 | 379 | ||
368 | } | 380 | } |
369 | 381 | ||
370 | 382 | ||
371 | 383 | ||
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index a2e50e3..3257198 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -40,97 +40,97 @@ class CalendarLocal : public Calendar | |||
40 | CalendarLocal(); | 40 | CalendarLocal(); |
41 | /** | 41 | /** |
42 | Constructs a new calendar, with variables initialized to sane values. | 42 | Constructs a new calendar, with variables initialized to sane values. |
43 | */ | 43 | */ |
44 | CalendarLocal( const QString &timeZoneId ); | 44 | CalendarLocal( const QString &timeZoneId ); |
45 | ~CalendarLocal(); | 45 | ~CalendarLocal(); |
46 | 46 | ||
47 | /** | 47 | /** |
48 | Loads a calendar on disk in vCalendar or iCalendar format into the current | 48 | Loads a calendar on disk in vCalendar or iCalendar format into the current |
49 | calendar. Any information already present is lost. | 49 | calendar. Any information already present is lost. |
50 | @return true, if successfull, false on error. | 50 | @return true, if successfull, false on error. |
51 | @param fileName the name of the calendar on disk. | 51 | @param fileName the name of the calendar on disk. |
52 | */ | 52 | */ |
53 | bool load( const QString &fileName ); | 53 | bool load( const QString &fileName ); |
54 | /** | 54 | /** |
55 | Writes out the calendar to disk in the specified \a format. | 55 | Writes out the calendar to disk in the specified \a format. |
56 | CalendarLocal takes ownership of the CalFormat object. | 56 | CalendarLocal takes ownership of the CalFormat object. |
57 | @return true, if successfull, false on error. | 57 | @return true, if successfull, false on error. |
58 | @param fileName the name of the file | 58 | @param fileName the name of the file |
59 | */ | 59 | */ |
60 | bool save( const QString &fileName, CalFormat *format = 0 ); | 60 | bool save( const QString &fileName, CalFormat *format = 0 ); |
61 | 61 | ||
62 | /** | 62 | /** |
63 | Clears out the current calendar, freeing all used memory etc. etc. | 63 | Clears out the current calendar, freeing all used memory etc. etc. |
64 | */ | 64 | */ |
65 | void close(); | 65 | void close(); |
66 | 66 | ||
67 | void save() {} | 67 | void save() {} |
68 | 68 | ||
69 | /** | 69 | /** |
70 | Add Event to calendar. | 70 | Add Event to calendar. |
71 | */ | 71 | */ |
72 | bool addAnniversaryNoDup( Event *event ); | 72 | bool addAnniversaryNoDup( Event *event ); |
73 | bool addEventNoDup( Event *event ); | 73 | bool addEventNoDup( Event *event ); |
74 | bool addEvent( Event *event ); | 74 | bool addEvent( Event *event ); |
75 | /** | 75 | /** |
76 | Deletes an event from this calendar. | 76 | Deletes an event from this calendar. |
77 | */ | 77 | */ |
78 | void deleteEvent( Event *event ); | 78 | void deleteEvent( Event *event ); |
79 | 79 | ||
80 | /** | 80 | /** |
81 | Retrieves an event on the basis of the unique string ID. | 81 | Retrieves an event on the basis of the unique string ID. |
82 | */ | 82 | */ |
83 | Event *event( const QString &uid ); | 83 | Event *event( const QString &uid ); |
84 | /** | 84 | /** |
85 | Return unfiltered list of all events in calendar. | 85 | Return unfiltered list of all events in calendar. |
86 | */ | 86 | */ |
87 | QPtrList<Event> rawEvents(); | 87 | QPtrList<Event> rawEvents(); |
88 | 88 | QPtrList<Event> getExternLastSyncEvents(); | |
89 | /** | 89 | /** |
90 | Add a todo to the todolist. | 90 | Add a todo to the todolist. |
91 | */ | 91 | */ |
92 | bool addTodo( Todo *todo ); | 92 | bool addTodo( Todo *todo ); |
93 | bool addTodoNoDup( Todo *todo ); | 93 | bool addTodoNoDup( Todo *todo ); |
94 | /** | 94 | /** |
95 | Remove a todo from the todolist. | 95 | Remove a todo from the todolist. |
96 | */ | 96 | */ |
97 | void deleteTodo( Todo * ); | 97 | void deleteTodo( Todo * ); |
98 | /** | 98 | /** |
99 | Searches todolist for an event with this unique string identifier, | 99 | Searches todolist for an event with this unique string identifier, |
100 | returns a pointer or null. | 100 | returns a pointer or null. |
101 | */ | 101 | */ |
102 | Todo *todo( const QString &uid ); | 102 | Todo *todo( const QString &uid ); |
103 | /** | 103 | /** |
104 | Return list of all todos. | 104 | Return list of all todos. |
105 | */ | 105 | */ |
106 | QPtrList<Todo> rawTodos(); | 106 | QPtrList<Todo> rawTodos(); |
107 | /** | 107 | /** |
108 | Returns list of todos due on the specified date. | 108 | Returns list of todos due on the specified date. |
109 | */ | 109 | */ |
110 | QPtrList<Todo> todos( const QDate &date ); | 110 | QPtrList<Todo> todos( const QDate &date ); |
111 | /** | 111 | /** |
112 | Return list of all todos. | 112 | Return list of all todos. |
113 | 113 | ||
114 | Workaround because compiler does not recognize function of base class. | 114 | Workaround because compiler does not recognize function of base class. |
115 | */ | 115 | */ |
116 | QPtrList<Todo> todos() { return Calendar::todos(); } | 116 | QPtrList<Todo> todos() { return Calendar::todos(); } |
117 | 117 | ||
118 | /** | 118 | /** |
119 | Add a Journal entry to calendar. | 119 | Add a Journal entry to calendar. |
120 | */ | 120 | */ |
121 | bool addJournal( Journal * ); | 121 | bool addJournal( Journal * ); |
122 | /** | 122 | /** |
123 | Remove a Journal from the calendar. | 123 | Remove a Journal from the calendar. |
124 | */ | 124 | */ |
125 | void deleteJournal( Journal * ); | 125 | void deleteJournal( Journal * ); |
126 | /** | 126 | /** |
127 | Return Journal for given date. | 127 | Return Journal for given date. |
128 | */ | 128 | */ |
129 | Journal *journal( const QDate & ); | 129 | Journal *journal( const QDate & ); |
130 | /** | 130 | /** |
131 | Return Journal with given UID. | 131 | Return Journal with given UID. |
132 | */ | 132 | */ |
133 | Journal *journal( const QString &uid ); | 133 | Journal *journal( const QString &uid ); |
134 | /** | 134 | /** |
135 | Return list of all Journals stored in calendar. | 135 | Return list of all Journals stored in calendar. |
136 | */ | 136 | */ |