summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp23
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/incidencebase.cpp3
4 files changed, 27 insertions, 1 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index b801186..b7d6a1f 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -57,48 +57,49 @@ namespace KCal {
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*/
60class Calendar : public QObject, public CustomProperties, 60class Calendar : public QObject, public CustomProperties,
61 public IncidenceBase::Observer 61 public IncidenceBase::Observer
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
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 void resetTempSyncStat(); 69 void resetTempSyncStat();
70 void resetPilotStat(int id); 70 void resetPilotStat(int id);
71 /** 71 /**
72 Clears out the current calendar, freeing all used memory etc. 72 Clears out the current calendar, freeing all used memory etc.
73 */ 73 */
74 virtual void close() = 0; 74 virtual void close() = 0;
75 75
76 /** 76 /**
77 Sync changes in memory to persistant storage. 77 Sync changes in memory to persistant storage.
78 */ 78 */
79 virtual void save() = 0; 79 virtual void save() = 0;
80 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 80 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
81 virtual void removeSyncInfo( QString syncProfile) = 0;
81 virtual bool isSaving() { return false; } 82 virtual bool isSaving() { return false; }
82 83
83 /** 84 /**
84 Return the owner of the calendar's full name. 85 Return the owner of the calendar's full name.
85 */ 86 */
86 const QString &getOwner() const; 87 const QString &getOwner() const;
87 /** 88 /**
88 Set the owner of the calendar. Should be owner's full name. 89 Set the owner of the calendar. Should be owner's full name.
89 */ 90 */
90 void setOwner( const QString &os ); 91 void setOwner( const QString &os );
91 /** 92 /**
92 Return the email address of the calendar owner. 93 Return the email address of the calendar owner.
93 */ 94 */
94 const QString &getEmail(); 95 const QString &getEmail();
95 /** 96 /**
96 Set the email address of the calendar owner. 97 Set the email address of the calendar owner.
97 */ 98 */
98 void setEmail( const QString & ); 99 void setEmail( const QString & );
99 100
100 /** 101 /**
101 Set time zone from a timezone string (e.g. -2:00) 102 Set time zone from a timezone string (e.g. -2:00)
102 */ 103 */
103 void setTimeZone( const QString &tz ); 104 void setTimeZone( const QString &tz );
104 /** 105 /**
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 21b4aaf..3f46d53 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -200,49 +200,70 @@ bool CalendarLocal::addTodo( Todo *todo )
200 200
201void CalendarLocal::deleteTodo( Todo *todo ) 201void 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
211QPtrList<Todo> CalendarLocal::rawTodos() 211QPtrList<Todo> CalendarLocal::rawTodos()
212{ 212{
213 return mTodoList; 213 return mTodoList;
214} 214}
215Todo *CalendarLocal::todo( QString syncProf, QString id ) 215Todo *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 224void 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}
225QPtrList<Event> CalendarLocal::getExternLastSyncEvents() 246QPtrList<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}
238Event *CalendarLocal::event( QString syncProf, QString id ) 259Event *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}
247Todo *CalendarLocal::todo( const QString &uid ) 268Todo *CalendarLocal::todo( const QString &uid )
248{ 269{
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 5b6c64c..98ec710 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -48,48 +48,49 @@ class CalendarLocal : public Calendar
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 void removeSyncInfo( QString syncProfile);
72 bool addAnniversaryNoDup( Event *event ); 73 bool addAnniversaryNoDup( Event *event );
73 bool addEventNoDup( Event *event ); 74 bool addEventNoDup( Event *event );
74 bool addEvent( Event *event ); 75 bool addEvent( Event *event );
75 /** 76 /**
76 Deletes an event from this calendar. 77 Deletes an event from this calendar.
77 */ 78 */
78 void deleteEvent( Event *event ); 79 void deleteEvent( Event *event );
79 80
80 /** 81 /**
81 Retrieves an event on the basis of the unique string ID. 82 Retrieves an event on the basis of the unique string ID.
82 */ 83 */
83 Event *event( const QString &uid ); 84 Event *event( const QString &uid );
84 /** 85 /**
85 Return unfiltered list of all events in calendar. 86 Return unfiltered list of all events in calendar.
86 */ 87 */
87 QPtrList<Event> rawEvents(); 88 QPtrList<Event> rawEvents();
88 QPtrList<Event> getExternLastSyncEvents(); 89 QPtrList<Event> getExternLastSyncEvents();
89 /** 90 /**
90 Add a todo to the todolist. 91 Add a todo to the todolist.
91 */ 92 */
92 bool addTodo( Todo *todo ); 93 bool addTodo( Todo *todo );
93 bool addTodoNoDup( Todo *todo ); 94 bool addTodoNoDup( Todo *todo );
94 /** 95 /**
95 Remove a todo from the todolist. 96 Remove a todo from the todolist.
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index b36dc1a..9aa517c 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -332,48 +332,51 @@ int IncidenceBase::syncStatus() const
332 332
333void IncidenceBase::setPilotId( int id ) 333void IncidenceBase::setPilotId( int id )
334{ 334{
335 if (mReadOnly) return; 335 if (mReadOnly) return;
336 mPilotId = id; 336 mPilotId = id;
337} 337}
338 338
339int IncidenceBase::pilotId() const 339int IncidenceBase::pilotId() const
340{ 340{
341 return mPilotId; 341 return mPilotId;
342} 342}
343 343
344int IncidenceBase::tempSyncStat() const 344int IncidenceBase::tempSyncStat() const
345{ 345{
346 return mTempSyncStat; 346 return mTempSyncStat;
347} 347}
348void IncidenceBase::setTempSyncStat( int id ) 348void IncidenceBase::setTempSyncStat( int id )
349{ 349{
350 if (mReadOnly) return; 350 if (mReadOnly) return;
351 mTempSyncStat = id; 351 mTempSyncStat = id;
352} 352}
353 353
354void IncidenceBase::removeID(const QString &prof) 354void IncidenceBase::removeID(const QString &prof)
355{ 355{
356 if ( prof.isEmpty() )
357 mExternalId = ":";
358 else
356 mExternalId = KIdManager::removeId ( mExternalId, prof); 359 mExternalId = KIdManager::removeId ( mExternalId, prof);
357 360
358} 361}
359void IncidenceBase::setID( const QString & prof , const QString & id ) 362void IncidenceBase::setID( const QString & prof , const QString & id )
360{ 363{
361 mExternalId = KIdManager::setId ( mExternalId, prof, id ); 364 mExternalId = KIdManager::setId ( mExternalId, prof, id );
362} 365}
363QString IncidenceBase::getID( const QString & prof) 366QString IncidenceBase::getID( const QString & prof)
364{ 367{
365 return KIdManager::getId ( mExternalId, prof ); 368 return KIdManager::getId ( mExternalId, prof );
366} 369}
367 370
368// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: 371// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0:
369// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 372// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0
370void IncidenceBase::setCsum( const QString & prof , const QString & id ) 373void IncidenceBase::setCsum( const QString & prof , const QString & id )
371{ 374{
372 mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); 375 mExternalId = KIdManager::setCsum ( mExternalId, prof, id );
373} 376}
374QString IncidenceBase::getCsum( const QString & prof) 377QString IncidenceBase::getCsum( const QString & prof)
375{ 378{
376 return KIdManager::getCsum ( mExternalId, prof ); 379 return KIdManager::getCsum ( mExternalId, prof );
377} 380}
378 381
379void IncidenceBase::setIDStr( const QString & s ) 382void IncidenceBase::setIDStr( const QString & s )