summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-11-25 22:51:38 (UTC)
committer zautrix <zautrix>2005-11-25 22:51:38 (UTC)
commit0e18027f386280bf427ef9d0ffec61a5516cebda (patch) (unidiff)
tree91f93d724d141b9f087e4cef0c1a11e354ee389a /libkcal
parentb71ee5442df23bb9900d3db6e6244773ee34ef13 (diff)
downloadkdepimpi-0e18027f386280bf427ef9d0ffec61a5516cebda.zip
kdepimpi-0e18027f386280bf427ef9d0ffec61a5516cebda.tar.gz
kdepimpi-0e18027f386280bf427ef9d0ffec61a5516cebda.tar.bz2
sync
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index c33581c..c82ea92 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -860,221 +860,221 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
860 found = true; 860 found = true;
861 } 861 }
862 } 862 }
863 863
864 /* 864 /*
865 // crap !!! 865 // crap !!!
866 if ( rStart <= end ) { // Start date not after range 866 if ( rStart <= end ) { // Start date not after range
867 if ( rStart >= start ) { // Start date within range 867 if ( rStart >= start ) { // Start date within range
868 found = true; 868 found = true;
869 } else if ( event->recurrence()->duration() == -1 ) { // Recurs forever 869 } else if ( event->recurrence()->duration() == -1 ) { // Recurs forever
870 found = true; 870 found = true;
871 } else if ( event->recurrence()->duration() == 0 ) { // End date set 871 } else if ( event->recurrence()->duration() == 0 ) { // End date set
872 QDate rEnd = event->recurrence()->endDate(); 872 QDate rEnd = event->recurrence()->endDate();
873 if ( rEnd >= start && rEnd <= end ) { // End date within range 873 if ( rEnd >= start && rEnd <= end ) { // End date within range
874 found = true; 874 found = true;
875 } 875 }
876 } else { // Duration set 876 } else { // Duration set
877 // TODO: Calculate end date from duration. Should be done in Event 877 // TODO: Calculate end date from duration. Should be done in Event
878 // For now include all events with a duration. 878 // For now include all events with a duration.
879 found = true; 879 found = true;
880 } 880 }
881 } 881 }
882 */ 882 */
883 883
884 } 884 }
885 885
886 if ( found ) eventList.append( event ); 886 if ( found ) eventList.append( event );
887 } else { 887 } else {
888 QDate s = event->dtStart().date(); 888 QDate s = event->dtStart().date();
889 QDate e = event->dtEnd().date(); 889 QDate e = event->dtEnd().date();
890 890
891 if ( inclusive ) { 891 if ( inclusive ) {
892 if ( s >= start && e <= end ) { 892 if ( s >= start && e <= end ) {
893 eventList.append( event ); 893 eventList.append( event );
894 } 894 }
895 } else { 895 } else {
896 if ( ( e >= start && s <= end ) ) { 896 if ( ( e >= start && s <= end ) ) {
897 eventList.append( event ); 897 eventList.append( event );
898 } 898 }
899 } 899 }
900 } 900 }
901 } 901 }
902 902
903 return eventList; 903 return eventList;
904} 904}
905 905
906QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) 906QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt )
907{ 907{
908 return rawEventsForDate( qdt.date() ); 908 return rawEventsForDate( qdt.date() );
909} 909}
910 910
911QPtrList<Event> CalendarLocal::rawEvents() 911QPtrList<Event> CalendarLocal::rawEvents()
912{ 912{
913 QPtrList<Event> el; 913 QPtrList<Event> el;
914 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 914 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
915 if ( it->calEnabled() ) el.append( it ); 915 if ( it->calEnabled() ) el.append( it );
916 return el; 916 return el;
917} 917}
918 918
919bool CalendarLocal::addJournal(Journal *journal) 919bool CalendarLocal::addJournal(Journal *journal)
920{ 920{
921 mJournalList.append(journal); 921 mJournalList.append(journal);
922 922
923 journal->registerObserver( this ); 923 journal->registerObserver( this );
924 924
925 setModified( true ); 925 setModified( true );
926 if ( journal->calID() == 0 ) 926 if ( journal->calID() == 0 )
927 journal->setCalID( mDefaultCalendar ); 927 journal->setCalID( mDefaultCalendar );
928 journal->setCalEnabled( true ); 928 journal->setCalEnabled( true );
929 return true; 929 return true;
930} 930}
931 931
932void CalendarLocal::deleteJournal( Journal *journal ) 932void CalendarLocal::deleteJournal( Journal *journal )
933{ 933{
934 clearUndo(journal); 934 clearUndo(journal);
935 if ( mJournalList.removeRef(journal) ) { 935 if ( mJournalList.removeRef(journal) ) {
936 setModified( true ); 936 setModified( true );
937 } 937 }
938} 938}
939 939
940QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) 940QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date )
941{ 941{
942 QPtrList<Journal> el; 942 QPtrList<Journal> el;
943 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 943 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
944 if ( it->calEnabled() && it->dtStart().date() == date) el.append( it ); 944 if ( it->calEnabled() && it->dtStart().date() == date) el.append( it );
945 return el; 945 return el;
946} 946}
947Journal *CalendarLocal::journal( const QDate &date ) 947Journal *CalendarLocal::journal( const QDate &date )
948{ 948{
949// kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; 949// kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl;
950 950
951 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 951 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
952 if ( it->calEnabled() && it->dtStart().date() == date ) 952 if ( it->calEnabled() && it->dtStart().date() == date )
953 return it; 953 return it;
954 954
955 return 0; 955 return 0;
956} 956}
957 957
958Journal *CalendarLocal::journal( const QString &uid ) 958Journal *CalendarLocal::journal( const QString &uid )
959{ 959{
960 Journal * retVal = 0; 960 Journal * retVal = 0;
961 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 961 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
962 if ( it->calEnabled() && it->uid() == uid ) { 962 if ( it->calEnabled() && it->uid() == uid ) {
963 if ( retVal ) { 963 if ( retVal ) {
964 if ( retVal->calID() > it->calID() ) { 964 if ( retVal->calID() > it->calID() ) {
965 retVal = it; 965 retVal = it;
966 } 966 }
967 } else { 967 } else {
968 retVal = it; 968 retVal = it;
969 } 969 }
970 } 970 }
971 return retVal; 971 return retVal;
972} 972}
973 973
974QPtrList<Journal> CalendarLocal::journals() 974QPtrList<Journal> CalendarLocal::journals()
975{ 975{
976 QPtrList<Journal> el; 976 QPtrList<Journal> el;
977 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 977 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
978 if ( it->calEnabled() ) el.append( it ); 978 if ( it->calEnabled() ) el.append( it );
979 return el; 979 return el;
980} 980}
981void CalendarLocal::setCalendarRemove( int id ) 981void CalendarLocal::setCalendarRemove( int id )
982{ 982{
983 983
984 { 984 {
985 QPtrList<Event> EventList = mEventList; 985 QPtrList<Event> EventList = mEventList;
986 Event * ev = EventList.first(); 986 Event * ev = EventList.first();
987 while ( ev ) { 987 while ( ev ) {
988 if ( ev->calID() == id ) 988 if ( ev->calID() == id && ev->uid().left( 15 ) != QString("last-syncEvent-") )
989 deleteEvent( ev ); 989 deleteEvent( ev );
990 ev = EventList.next(); 990 ev = EventList.next();
991 } 991 }
992 } 992 }
993 { 993 {
994 994
995 QPtrList<Todo> TodoList = mTodoList; 995 QPtrList<Todo> TodoList = mTodoList;
996 Todo * ev = TodoList.first(); 996 Todo * ev = TodoList.first();
997 while ( ev ) { 997 while ( ev ) {
998 if ( ev->calID() == id ) 998 if ( ev->calID() == id )
999 deleteTodo( ev ); 999 deleteTodo( ev );
1000 ev = TodoList.next(); 1000 ev = TodoList.next();
1001 } 1001 }
1002 } 1002 }
1003 { 1003 {
1004 QPtrList<Journal> JournalList = mJournalList; 1004 QPtrList<Journal> JournalList = mJournalList;
1005 Journal * ev = JournalList.first(); 1005 Journal * ev = JournalList.first();
1006 while ( ev ) { 1006 while ( ev ) {
1007 if ( ev->calID() == id ) 1007 if ( ev->calID() == id )
1008 deleteJournal( ev ); 1008 deleteJournal( ev );
1009 ev = JournalList.next(); 1009 ev = JournalList.next();
1010 } 1010 }
1011 } 1011 }
1012 1012
1013 clearUndo(0); 1013 clearUndo(0);
1014 1014
1015} 1015}
1016 1016
1017void CalendarLocal::setAllCalendarEnabled( bool enable ) 1017void CalendarLocal::setAllCalendarEnabled( bool enable )
1018{ 1018{
1019 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 1019 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
1020 it->setCalEnabled( enable ); 1020 it->setCalEnabled( enable );
1021 1021
1022 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 1022 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
1023 it->setCalEnabled( enable ); 1023 it->setCalEnabled( enable );
1024 1024
1025 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 1025 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
1026 it->setCalEnabled( enable ); 1026 it->setCalEnabled( enable );
1027 1027
1028 1028
1029} 1029}
1030void CalendarLocal::setCalendarEnabled( int id, bool enable ) 1030void CalendarLocal::setCalendarEnabled( int id, bool enable )
1031{ 1031{
1032 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 1032 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
1033 if ( it->calID() == id ) it->setCalEnabled( enable ); 1033 if ( it->calID() == id ) it->setCalEnabled( enable );
1034 1034
1035 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 1035 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
1036 if ( it->calID() == id ) it->setCalEnabled( enable ); 1036 if ( it->calID() == id ) it->setCalEnabled( enable );
1037 1037
1038 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 1038 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
1039 if ( it->calID() == id ) it->setCalEnabled( enable ); 1039 if ( it->calID() == id ) it->setCalEnabled( enable );
1040 1040
1041} 1041}
1042 1042
1043void CalendarLocal::setReadOnly( int id, bool enable ) 1043void CalendarLocal::setReadOnly( int id, bool enable )
1044{ 1044{
1045 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 1045 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
1046 if ( it->calID() == id ) it->setReadOnly( enable ); 1046 if ( it->calID() == id ) it->setReadOnly( enable );
1047 1047
1048 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 1048 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
1049 if ( it->calID() == id ) it->setReadOnly( enable ); 1049 if ( it->calID() == id ) it->setReadOnly( enable );
1050 1050
1051 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 1051 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
1052 if ( it->calID() == id ) it->setReadOnly( enable ); 1052 if ( it->calID() == id ) it->setReadOnly( enable );
1053 1053
1054} 1054}
1055 1055
1056void CalendarLocal::setAlarmEnabled( int id, bool enable ) 1056void CalendarLocal::setAlarmEnabled( int id, bool enable )
1057{ 1057{
1058 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 1058 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
1059 if ( it->calID() == id ) it->setAlarmEnabled( enable ); 1059 if ( it->calID() == id ) it->setAlarmEnabled( enable );
1060 1060
1061 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 1061 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
1062 if ( it->calID() == id ) it->setAlarmEnabled( enable ); 1062 if ( it->calID() == id ) it->setAlarmEnabled( enable );
1063 1063
1064 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 1064 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
1065 if ( it->calID() == id ) it->setAlarmEnabled( enable ); 1065 if ( it->calID() == id ) it->setAlarmEnabled( enable );
1066 reInitAlarmSettings(); 1066 reInitAlarmSettings();
1067 1067
1068} 1068}
1069void CalendarLocal::setDefaultCalendarEnabledOnly() 1069void CalendarLocal::setDefaultCalendarEnabledOnly()
1070{ 1070{
1071 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 1071 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
1072 it->setCalEnabled( it->calID() == mDefaultCalendar ); 1072 it->setCalEnabled( it->calID() == mDefaultCalendar );
1073 1073
1074 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 1074 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
1075 it->setCalEnabled( it->calID() == mDefaultCalendar); 1075 it->setCalEnabled( it->calID() == mDefaultCalendar);
1076 1076
1077 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 1077 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
1078 it->setCalEnabled( it->calID() == mDefaultCalendar); 1078 it->setCalEnabled( it->calID() == mDefaultCalendar);
1079 1079
1080} 1080}