-rw-r--r-- | libkcal/calendarlocal.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 8ff8b14..3c572f0 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -91,16 +91,47 @@ void CalendarLocal::close() | |||
91 | mJournalList.clear(); | 91 | mJournalList.clear(); |
92 | 92 | ||
93 | mEventList.setAutoDelete( false ); | 93 | mEventList.setAutoDelete( false ); |
94 | mTodoList.setAutoDelete( false ); | 94 | mTodoList.setAutoDelete( false ); |
95 | mJournalList.setAutoDelete( false ); | 95 | mJournalList.setAutoDelete( false ); |
96 | 96 | ||
97 | setModified( false ); | 97 | setModified( false ); |
98 | } | 98 | } |
99 | |||
100 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) | ||
101 | { | ||
102 | QString cat; | ||
103 | bool isBirthday = true; | ||
104 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { | ||
105 | isBirthday = false; | ||
106 | cat = i18n( "Anniversary" ); | ||
107 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { | ||
108 | isBirthday = true; | ||
109 | cat = i18n( "Birthday" ); | ||
110 | } else { | ||
111 | qDebug("addAnniversaryNoDup called without fitting category! "); | ||
112 | return false; | ||
113 | } | ||
114 | Event * eve; | ||
115 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | ||
116 | if ( !(eve->categories().contains( cat ) )) | ||
117 | continue; | ||
118 | // now we have an event with fitting category | ||
119 | if ( eve->dtStart().date() != event->dtStart().date() ) | ||
120 | continue; | ||
121 | // now we have an event with fitting category+date | ||
122 | if ( eve->summary() != event->summary() ) | ||
123 | continue; | ||
124 | // now we have an event with fitting category+date+summary | ||
125 | return false; | ||
126 | } | ||
127 | return addEvent( event ); | ||
128 | |||
129 | } | ||
99 | bool CalendarLocal::addEventNoDup( Event *event ) | 130 | bool CalendarLocal::addEventNoDup( Event *event ) |
100 | { | 131 | { |
101 | Event * eve; | 132 | Event * eve; |
102 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 133 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
103 | if ( *eve == *event ) { | 134 | if ( *eve == *event ) { |
104 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); | 135 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); |
105 | return false; | 136 | return false; |
106 | } | 137 | } |