author | zautrix <zautrix> | 2005-07-09 10:40:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-09 10:40:57 (UTC) |
commit | b51db424f4b1e558ab8c7c723859bb564c99d83b (patch) (unidiff) | |
tree | 2de26e6455c6b07b17cb169ef23e4170387a5fcc /libkcal/calendarlocal.cpp | |
parent | f731dd9fc5b3f14c44d4de26eb5370a79c63887c (diff) | |
download | kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.zip kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.tar.gz kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/calendarlocal.cpp | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 3e42ec0..e37a7ad 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -1,337 +1,356 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 1998 Preston Brown | 4 | Copyright (c) 1998 Preston Brown |
5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> | 5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
11 | 11 | ||
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <qdatetime.h> | 23 | #include <qdatetime.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qptrlist.h> | 25 | #include <qptrlist.h> |
26 | 26 | ||
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #include <klocale.h> | 30 | #include <klocale.h> |
31 | 31 | ||
32 | #include "vcaldrag.h" | 32 | #include "vcaldrag.h" |
33 | #include "vcalformat.h" | 33 | #include "vcalformat.h" |
34 | #include "icalformat.h" | 34 | #include "icalformat.h" |
35 | #include "exceptions.h" | 35 | #include "exceptions.h" |
36 | #include "incidence.h" | 36 | #include "incidence.h" |
37 | #include "journal.h" | 37 | #include "journal.h" |
38 | #include "filestorage.h" | 38 | #include "filestorage.h" |
39 | #include "calfilter.h" | 39 | #include "calfilter.h" |
40 | 40 | ||
41 | #include "calendarlocal.h" | 41 | #include "calendarlocal.h" |
42 | 42 | ||
43 | // #ifndef DESKTOP_VERSION | 43 | // #ifndef DESKTOP_VERSION |
44 | // #include <qtopia/alarmserver.h> | 44 | // #include <qtopia/alarmserver.h> |
45 | // #endif | 45 | // #endif |
46 | using namespace KCal; | 46 | using namespace KCal; |
47 | 47 | ||
48 | CalendarLocal::CalendarLocal() | 48 | CalendarLocal::CalendarLocal() |
49 | : Calendar() | 49 | : Calendar() |
50 | { | 50 | { |
51 | init(); | 51 | init(); |
52 | } | 52 | } |
53 | 53 | ||
54 | CalendarLocal::CalendarLocal(const QString &timeZoneId) | 54 | CalendarLocal::CalendarLocal(const QString &timeZoneId) |
55 | : Calendar(timeZoneId) | 55 | : Calendar(timeZoneId) |
56 | { | 56 | { |
57 | init(); | 57 | init(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void CalendarLocal::init() | 60 | void CalendarLocal::init() |
61 | { | 61 | { |
62 | mNextAlarmIncidence = 0; | 62 | mNextAlarmIncidence = 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | CalendarLocal::~CalendarLocal() | 66 | CalendarLocal::~CalendarLocal() |
67 | { | 67 | { |
68 | if ( mDeleteIncidencesOnClose ) | 68 | if ( mDeleteIncidencesOnClose ) |
69 | close(); | 69 | close(); |
70 | } | 70 | } |
71 | bool CalendarLocal::mergeCalendarFile( QString name ) | 71 | bool CalendarLocal::mergeCalendarFile( QString name ) |
72 | { | 72 | { |
73 | CalendarLocal calendar( timeZoneId() ); | 73 | CalendarLocal calendar( timeZoneId() ); |
74 | calendar.setDefaultCalendar( 1 ); | 74 | calendar.setDefaultCalendar( 1 ); |
75 | if ( calendar.load( name ) ) { | 75 | if ( calendar.load( name ) ) { |
76 | mergeCalendar( &calendar ); | 76 | mergeCalendar( &calendar ); |
77 | return true; | 77 | return true; |
78 | } | 78 | } |
79 | return false; | 79 | return false; |
80 | } | 80 | } |
81 | 81 | ||
82 | Incidence* CalendarLocal::incidenceForUid( const QString& uid ) | 82 | Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates) |
83 | { | 83 | { |
84 | Todo *todo;; | 84 | Todo *todo;; |
85 | Incidence *retVal = 0; | 85 | Incidence *retVal = 0; |
86 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 86 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
87 | if ( todo->uid() == uid ) { | 87 | if ( todo->uid() == uid ) { |
88 | if ( doNotCheckDuplicates ) return todo; | ||
88 | if ( retVal ) { | 89 | if ( retVal ) { |
89 | if ( retVal->calID() > todo->calID() ) { | 90 | if ( retVal->calID() > todo->calID() ) { |
90 | retVal = todo; | 91 | retVal = todo; |
91 | } | 92 | } |
92 | } else { | 93 | } else { |
93 | retVal = todo; | 94 | retVal = todo; |
94 | } | 95 | } |
95 | } | 96 | } |
96 | } | 97 | } |
97 | if ( retVal ) return retVal; | 98 | if ( retVal ) return retVal; |
98 | Event *event; | 99 | Event *event; |
99 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 100 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
100 | if ( event->uid() == uid ) { | 101 | if ( event->uid() == uid ) { |
102 | if ( doNotCheckDuplicates ) return event; | ||
101 | if ( retVal ) { | 103 | if ( retVal ) { |
102 | if ( retVal->calID() > event->calID() ) { | 104 | if ( retVal->calID() > event->calID() ) { |
103 | retVal = event; | 105 | retVal = event; |
104 | } | 106 | } |
105 | } else { | 107 | } else { |
106 | retVal = event; | 108 | retVal = event; |
107 | } | 109 | } |
108 | } | 110 | } |
109 | } | 111 | } |
110 | if ( retVal ) return retVal; | 112 | if ( retVal ) return retVal; |
111 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 113 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
112 | if ( it->uid() == uid ) { | 114 | if ( it->uid() == uid ) { |
115 | if ( doNotCheckDuplicates ) return it; | ||
113 | if ( retVal ) { | 116 | if ( retVal ) { |
114 | if ( retVal->calID() > it->calID() ) { | 117 | if ( retVal->calID() > it->calID() ) { |
115 | retVal = it; | 118 | retVal = it; |
116 | } | 119 | } |
117 | } else { | 120 | } else { |
118 | retVal = it; | 121 | retVal = it; |
119 | } | 122 | } |
120 | } | 123 | } |
121 | return retVal; | 124 | return retVal; |
122 | } | 125 | } |
123 | 126 | ||
124 | bool CalendarLocal::mergeCalendar( Calendar* remote ) | 127 | bool CalendarLocal::mergeCalendar( Calendar* remote ) |
125 | { | 128 | { |
129 | // 1 look for raw inc in local | ||
130 | // if inc not in remote, delete in local | ||
131 | // 2 look for raw inc in remote | ||
132 | // if inc in local, replace it | ||
133 | // if not in local, add it to default calendar | ||
134 | QPtrList<Incidence> localInc = rawIncidences(); | ||
135 | Incidence* inL = localInc.first(); | ||
136 | while ( inL ) { | ||
137 | if ( ! inL->isReadOnly () ) | ||
138 | if ( !remote->incidenceForUid( inL->uid(), true )) | ||
139 | deleteIncidence( inL ); | ||
140 | inL = localInc.next(); | ||
141 | } | ||
126 | QPtrList<Incidence> er = remote->rawIncidences(); | 142 | QPtrList<Incidence> er = remote->rawIncidences(); |
127 | Incidence* inR = er.first(); | 143 | Incidence* inR = er.first(); |
128 | Incidence* inL; | ||
129 | while ( inR ) { | 144 | while ( inR ) { |
130 | inL = incidenceForUid( inR->uid() ); | 145 | inL = incidenceForUid( inR->uid(),false ); |
131 | if ( inL ) { | 146 | if ( inL ) { |
132 | int calID = inL->calID(); | 147 | if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) { |
133 | deleteIncidence( inL ); | 148 | int calID = inL->calID(); |
134 | inL = inR->clone(); | 149 | deleteIncidence( inL ); |
135 | inL->setCalID( calID ); | 150 | inL = inR->clone(); |
136 | addIncidence( inL ); | 151 | inL->setCalID( calID ); |
152 | addIncidence( inL ); | ||
153 | } | ||
137 | } else { | 154 | } else { |
138 | inL = inR->clone(); | 155 | inL = inR->clone(); |
139 | inL->setCalID( 0 );// add to default cal | 156 | inL->setCalID( 0 );// add to default cal |
140 | addIncidence( inL ); | 157 | addIncidence( inL ); |
141 | } | 158 | } |
142 | inR = er.next(); | 159 | inR = er.next(); |
143 | } | 160 | } |
144 | return true; | 161 | return true; |
145 | } | 162 | } |
163 | |||
164 | |||
146 | bool CalendarLocal::addCalendarFile( QString name, int id ) | 165 | bool CalendarLocal::addCalendarFile( QString name, int id ) |
147 | { | 166 | { |
148 | CalendarLocal calendar( timeZoneId() ); | 167 | CalendarLocal calendar( timeZoneId() ); |
149 | calendar.setDefaultCalendar( id ); | 168 | calendar.setDefaultCalendar( id ); |
150 | if ( calendar.load( name ) ) { | 169 | if ( calendar.load( name ) ) { |
151 | addCalendar( &calendar ); | 170 | addCalendar( &calendar ); |
152 | return true; | 171 | return true; |
153 | } | 172 | } |
154 | return false; | 173 | return false; |
155 | } | 174 | } |
156 | void CalendarLocal::setSyncEventsReadOnly() | 175 | void CalendarLocal::setSyncEventsReadOnly() |
157 | { | 176 | { |
158 | Event * ev; | 177 | Event * ev; |
159 | ev = mEventList.first(); | 178 | ev = mEventList.first(); |
160 | while ( ev ) { | 179 | while ( ev ) { |
161 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 180 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
162 | ev->setReadOnly( true ); | 181 | ev->setReadOnly( true ); |
163 | ev = mEventList.next(); | 182 | ev = mEventList.next(); |
164 | } | 183 | } |
165 | } | 184 | } |
166 | void CalendarLocal::addCalendar( Calendar* cal ) | 185 | void CalendarLocal::addCalendar( Calendar* cal ) |
167 | { | 186 | { |
168 | cal->setDontDeleteIncidencesOnClose(); | 187 | cal->setDontDeleteIncidencesOnClose(); |
169 | { | 188 | { |
170 | QPtrList<Event> EventList = cal->rawEvents(); | 189 | QPtrList<Event> EventList = cal->rawEvents(); |
171 | Event * ev = EventList.first(); | 190 | Event * ev = EventList.first(); |
172 | while ( ev ) { | 191 | while ( ev ) { |
173 | ev->unRegisterObserver( cal ); | 192 | ev->unRegisterObserver( cal ); |
174 | ev->registerObserver( this ); | 193 | ev->registerObserver( this ); |
175 | mEventList.append( ev ); | 194 | mEventList.append( ev ); |
176 | ev = EventList.next(); | 195 | ev = EventList.next(); |
177 | } | 196 | } |
178 | } | 197 | } |
179 | { | 198 | { |
180 | 199 | ||
181 | QPtrList<Todo> TodoList = cal->rawTodos(); | 200 | QPtrList<Todo> TodoList = cal->rawTodos(); |
182 | Todo * ev = TodoList.first(); | 201 | Todo * ev = TodoList.first(); |
183 | while ( ev ) { | 202 | while ( ev ) { |
184 | QString rel = ev->relatedToUid(); | 203 | QString rel = ev->relatedToUid(); |
185 | if ( !rel.isEmpty() ){ | 204 | if ( !rel.isEmpty() ){ |
186 | ev->setRelatedTo ( 0 ); | 205 | ev->setRelatedTo ( 0 ); |
187 | ev->setRelatedToUid( rel ); | 206 | ev->setRelatedToUid( rel ); |
188 | } | 207 | } |
189 | ev = TodoList.next(); | 208 | ev = TodoList.next(); |
190 | } | 209 | } |
191 | //TodoList = cal->rawTodos(); | 210 | //TodoList = cal->rawTodos(); |
192 | ev = TodoList.first(); | 211 | ev = TodoList.first(); |
193 | while ( ev ) { | 212 | while ( ev ) { |
194 | ev->unRegisterObserver( cal ); | 213 | ev->unRegisterObserver( cal ); |
195 | ev->registerObserver( this ); | 214 | ev->registerObserver( this ); |
196 | mTodoList.append( ev ); | 215 | mTodoList.append( ev ); |
197 | setupRelations( ev ); | 216 | setupRelations( ev ); |
198 | ev = TodoList.next(); | 217 | ev = TodoList.next(); |
199 | } | 218 | } |
200 | } | 219 | } |
201 | { | 220 | { |
202 | QPtrList<Journal> JournalList = cal->journals(); | 221 | QPtrList<Journal> JournalList = cal->journals(); |
203 | Journal * ev = JournalList.first(); | 222 | Journal * ev = JournalList.first(); |
204 | while ( ev ) { | 223 | while ( ev ) { |
205 | ev->unRegisterObserver( cal ); | 224 | ev->unRegisterObserver( cal ); |
206 | ev->registerObserver( this ); | 225 | ev->registerObserver( this ); |
207 | mJournalList.append( ev ); | 226 | mJournalList.append( ev ); |
208 | ev = JournalList.next(); | 227 | ev = JournalList.next(); |
209 | } | 228 | } |
210 | } | 229 | } |
211 | setModified( true ); | 230 | setModified( true ); |
212 | } | 231 | } |
213 | bool CalendarLocal::load( const QString &fileName ) | 232 | bool CalendarLocal::load( const QString &fileName ) |
214 | { | 233 | { |
215 | FileStorage storage( this, fileName ); | 234 | FileStorage storage( this, fileName ); |
216 | return storage.load(); | 235 | return storage.load(); |
217 | } | 236 | } |
218 | 237 | ||
219 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) | 238 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) |
220 | { | 239 | { |
221 | FileStorage storage( this, fileName, format ); | 240 | FileStorage storage( this, fileName, format ); |
222 | return storage.save(); | 241 | return storage.save(); |
223 | } | 242 | } |
224 | 243 | ||
225 | void CalendarLocal::stopAllTodos() | 244 | void CalendarLocal::stopAllTodos() |
226 | { | 245 | { |
227 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 246 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
228 | it->setRunning( false ); | 247 | it->setRunning( false ); |
229 | 248 | ||
230 | } | 249 | } |
231 | void CalendarLocal::close() | 250 | void CalendarLocal::close() |
232 | { | 251 | { |
233 | 252 | ||
234 | Todo * i; | 253 | Todo * i; |
235 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); | 254 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); |
236 | 255 | ||
237 | mEventList.setAutoDelete( true ); | 256 | mEventList.setAutoDelete( true ); |
238 | mTodoList.setAutoDelete( true ); | 257 | mTodoList.setAutoDelete( true ); |
239 | mJournalList.setAutoDelete( false ); | 258 | mJournalList.setAutoDelete( false ); |
240 | 259 | ||
241 | mEventList.clear(); | 260 | mEventList.clear(); |
242 | mTodoList.clear(); | 261 | mTodoList.clear(); |
243 | mJournalList.clear(); | 262 | mJournalList.clear(); |
244 | 263 | ||
245 | mEventList.setAutoDelete( false ); | 264 | mEventList.setAutoDelete( false ); |
246 | mTodoList.setAutoDelete( false ); | 265 | mTodoList.setAutoDelete( false ); |
247 | mJournalList.setAutoDelete( false ); | 266 | mJournalList.setAutoDelete( false ); |
248 | 267 | ||
249 | setModified( false ); | 268 | setModified( false ); |
250 | } | 269 | } |
251 | 270 | ||
252 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) | 271 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) |
253 | { | 272 | { |
254 | QString cat; | 273 | QString cat; |
255 | bool isBirthday = true; | 274 | bool isBirthday = true; |
256 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { | 275 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { |
257 | isBirthday = false; | 276 | isBirthday = false; |
258 | cat = i18n( "Anniversary" ); | 277 | cat = i18n( "Anniversary" ); |
259 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { | 278 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { |
260 | isBirthday = true; | 279 | isBirthday = true; |
261 | cat = i18n( "Birthday" ); | 280 | cat = i18n( "Birthday" ); |
262 | } else { | 281 | } else { |
263 | qDebug("addAnniversaryNoDup called without fitting category! "); | 282 | qDebug("addAnniversaryNoDup called without fitting category! "); |
264 | return false; | 283 | return false; |
265 | } | 284 | } |
266 | Event * eve; | 285 | Event * eve; |
267 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 286 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
268 | if ( !(eve->categories().contains( cat ) )) | 287 | if ( !(eve->categories().contains( cat ) )) |
269 | continue; | 288 | continue; |
270 | // now we have an event with fitting category | 289 | // now we have an event with fitting category |
271 | if ( eve->dtStart().date() != event->dtStart().date() ) | 290 | if ( eve->dtStart().date() != event->dtStart().date() ) |
272 | continue; | 291 | continue; |
273 | // now we have an event with fitting category+date | 292 | // now we have an event with fitting category+date |
274 | if ( eve->summary() != event->summary() ) | 293 | if ( eve->summary() != event->summary() ) |
275 | continue; | 294 | continue; |
276 | // now we have an event with fitting category+date+summary | 295 | // now we have an event with fitting category+date+summary |
277 | return false; | 296 | return false; |
278 | } | 297 | } |
279 | return addEvent( event ); | 298 | return addEvent( event ); |
280 | 299 | ||
281 | } | 300 | } |
282 | bool CalendarLocal::addEventNoDup( Event *event ) | 301 | bool CalendarLocal::addEventNoDup( Event *event ) |
283 | { | 302 | { |
284 | Event * eve; | 303 | Event * eve; |
285 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 304 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
286 | if ( *eve == *event ) { | 305 | if ( *eve == *event ) { |
287 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); | 306 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); |
288 | return false; | 307 | return false; |
289 | } | 308 | } |
290 | } | 309 | } |
291 | return addEvent( event ); | 310 | return addEvent( event ); |
292 | } | 311 | } |
293 | 312 | ||
294 | bool CalendarLocal::addEvent( Event *event ) | 313 | bool CalendarLocal::addEvent( Event *event ) |
295 | { | 314 | { |
296 | insertEvent( event ); | 315 | insertEvent( event ); |
297 | 316 | ||
298 | event->registerObserver( this ); | 317 | event->registerObserver( this ); |
299 | 318 | ||
300 | setModified( true ); | 319 | setModified( true ); |
301 | if ( event->calID() == 0 ) | 320 | if ( event->calID() == 0 ) |
302 | event->setCalID( mDefaultCalendar ); | 321 | event->setCalID( mDefaultCalendar ); |
303 | event->setCalEnabled( true ); | 322 | event->setCalEnabled( true ); |
304 | 323 | ||
305 | return true; | 324 | return true; |
306 | } | 325 | } |
307 | 326 | ||
308 | void CalendarLocal::deleteEvent( Event *event ) | 327 | void CalendarLocal::deleteEvent( Event *event ) |
309 | { | 328 | { |
310 | if ( mUndoIncidence ) delete mUndoIncidence; | 329 | if ( mUndoIncidence ) delete mUndoIncidence; |
311 | mUndoIncidence = event->clone(); | 330 | mUndoIncidence = event->clone(); |
312 | if ( mEventList.removeRef( event ) ) { | 331 | if ( mEventList.removeRef( event ) ) { |
313 | setModified( true ); | 332 | setModified( true ); |
314 | } | 333 | } |
315 | } | 334 | } |
316 | 335 | ||
317 | 336 | ||
318 | Event *CalendarLocal::event( const QString &uid ) | 337 | Event *CalendarLocal::event( const QString &uid ) |
319 | { | 338 | { |
320 | Event *event; | 339 | Event *event; |
321 | Event *retVal = 0; | 340 | Event *retVal = 0; |
322 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 341 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
323 | if ( event->calEnabled() && event->uid() == uid ) { | 342 | if ( event->calEnabled() && event->uid() == uid ) { |
324 | if ( retVal ) { | 343 | if ( retVal ) { |
325 | if ( retVal->calID() > event->calID() ) { | 344 | if ( retVal->calID() > event->calID() ) { |
326 | retVal = event; | 345 | retVal = event; |
327 | } | 346 | } |
328 | } else { | 347 | } else { |
329 | retVal = event; | 348 | retVal = event; |
330 | } | 349 | } |
331 | } | 350 | } |
332 | } | 351 | } |
333 | return retVal; | 352 | return retVal; |
334 | } | 353 | } |
335 | bool CalendarLocal::addTodoNoDup( Todo *todo ) | 354 | bool CalendarLocal::addTodoNoDup( Todo *todo ) |
336 | { | 355 | { |
337 | Todo * eve; | 356 | Todo * eve; |