author | zautrix <zautrix> | 2004-10-26 22:19:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-26 22:19:18 (UTC) |
commit | 6385f303bef3cbcd19d097a7b05c30e144d5dd6e (patch) (unidiff) | |
tree | 770795d94ea6ec1dc8bcaa67cc174a9c0add564a /libkcal/calendarlocal.cpp | |
parent | 13e996beddabc5e88f4f2fe49b2ce6cb8408eb30 (diff) | |
download | kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.zip kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.tar.gz kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.tar.bz2 |
implemented remove sync info for kopi and kapi
-rw-r--r-- | libkcal/calendarlocal.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 21b4aaf..3f46d53 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -176,97 +176,118 @@ Event *CalendarLocal::event( const QString &uid ) | |||
176 | bool CalendarLocal::addTodoNoDup( Todo *todo ) | 176 | 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( QString syncProf, QString id ) | 215 | Todo *CalendarLocal::todo( QString syncProf, QString 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->getID( syncProf ) == id ) return todo; | 219 | if ( todo->getID( syncProf ) == id ) return todo; |
220 | } | 220 | } |
221 | 221 | ||
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | 224 | void CalendarLocal::removeSyncInfo( QString syncProfile) | |
225 | { | ||
226 | QPtrList<Incidence> all = rawIncidences() ; | ||
227 | Incidence *inc; | ||
228 | for ( inc = all.first(); inc; inc = all.next() ) { | ||
229 | inc->removeID( syncProfile ); | ||
230 | } | ||
231 | if ( syncProfile.isEmpty() ) { | ||
232 | QPtrList<Event> el; | ||
233 | Event *todo; | ||
234 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | ||
235 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | ||
236 | el.append( todo ); | ||
237 | } | ||
238 | for ( todo = el.first(); todo; todo = el.next() ) { | ||
239 | deleteIncidence ( todo ); | ||
240 | } | ||
241 | } else { | ||
242 | Event *lse = event( "last-syncEvent-"+ syncProfile); | ||
243 | deleteIncidence ( lse ); | ||
244 | } | ||
245 | } | ||
225 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() | 246 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() |
226 | { | 247 | { |
227 | QPtrList<Event> el; | 248 | QPtrList<Event> el; |
228 | Event *todo; | 249 | Event *todo; |
229 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 250 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
230 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 251 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
231 | if ( todo->summary().left(3) == "E: " ) | 252 | if ( todo->summary().left(3) == "E: " ) |
232 | el.append( todo ); | 253 | el.append( todo ); |
233 | } | 254 | } |
234 | 255 | ||
235 | return el; | 256 | return el; |
236 | 257 | ||
237 | } | 258 | } |
238 | Event *CalendarLocal::event( QString syncProf, QString id ) | 259 | Event *CalendarLocal::event( QString syncProf, QString id ) |
239 | { | 260 | { |
240 | Event *todo; | 261 | Event *todo; |
241 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 262 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
242 | if ( todo->getID( syncProf ) == id ) return todo; | 263 | if ( todo->getID( syncProf ) == id ) return todo; |
243 | } | 264 | } |
244 | 265 | ||
245 | return 0; | 266 | return 0; |
246 | } | 267 | } |
247 | Todo *CalendarLocal::todo( const QString &uid ) | 268 | Todo *CalendarLocal::todo( const QString &uid ) |
248 | { | 269 | { |
249 | Todo *todo; | 270 | Todo *todo; |
250 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 271 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
251 | if ( todo->uid() == uid ) return todo; | 272 | if ( todo->uid() == uid ) return todo; |
252 | } | 273 | } |
253 | 274 | ||
254 | return 0; | 275 | return 0; |
255 | } | 276 | } |
256 | QString CalendarLocal::nextSummary() const | 277 | QString CalendarLocal::nextSummary() const |
257 | { | 278 | { |
258 | return mNextSummary; | 279 | return mNextSummary; |
259 | } | 280 | } |
260 | QDateTime CalendarLocal::nextAlarmEventDateTime() const | 281 | QDateTime CalendarLocal::nextAlarmEventDateTime() const |
261 | { | 282 | { |
262 | return mNextAlarmEventDateTime; | 283 | return mNextAlarmEventDateTime; |
263 | } | 284 | } |
264 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) | 285 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) |
265 | { | 286 | { |
266 | //mNextAlarmIncidence | 287 | //mNextAlarmIncidence |
267 | //mNextAlarmDateTime | 288 | //mNextAlarmDateTime |
268 | //return mNextSummary; | 289 | //return mNextSummary; |
269 | //return mNextAlarmEventDateTime; | 290 | //return mNextAlarmEventDateTime; |
270 | bool newNextAlarm = false; | 291 | bool newNextAlarm = false; |
271 | bool computeNextAlarm = false; | 292 | bool computeNextAlarm = false; |
272 | bool ok; | 293 | bool ok; |