summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
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
@@ -69,24 +69,25 @@ public:
void resetTempSyncStat();
void resetPilotStat(int id);
/**
Clears out the current calendar, freeing all used memory etc.
*/
virtual void close() = 0;
/**
Sync changes in memory to persistant storage.
*/
virtual void save() = 0;
virtual QPtrList<Event> getExternLastSyncEvents() = 0;
+ virtual void removeSyncInfo( QString syncProfile) = 0;
virtual bool isSaving() { return false; }
/**
Return the owner of the calendar's full name.
*/
const QString &getOwner() const;
/**
Set the owner of the calendar. Should be owner's full name.
*/
void setOwner( const QString &os );
/**
Return the email address of the calendar owner.
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 21b4aaf..3f46d53 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -212,25 +212,46 @@ QPtrList<Todo> CalendarLocal::rawTodos()
{
return mTodoList;
}
Todo *CalendarLocal::todo( QString syncProf, QString id )
{
Todo *todo;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( todo->getID( syncProf ) == id ) return todo;
}
return 0;
}
-
+void CalendarLocal::removeSyncInfo( QString syncProfile)
+{
+ QPtrList<Incidence> all = rawIncidences() ;
+ Incidence *inc;
+ for ( inc = all.first(); inc; inc = all.next() ) {
+ inc->removeID( syncProfile );
+ }
+ if ( syncProfile.isEmpty() ) {
+ QPtrList<Event> el;
+ Event *todo;
+ for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
+ if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
+ el.append( todo );
+ }
+ for ( todo = el.first(); todo; todo = el.next() ) {
+ deleteIncidence ( todo );
+ }
+ } else {
+ Event *lse = event( "last-syncEvent-"+ syncProfile);
+ deleteIncidence ( lse );
+ }
+}
QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
{
QPtrList<Event> el;
Event *todo;
for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
if ( todo->summary().left(3) == "E: " )
el.append( todo );
}
return el;
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 5b6c64c..98ec710 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -60,24 +60,25 @@ class CalendarLocal : public Calendar
bool save( const QString &fileName, CalFormat *format = 0 );
/**
Clears out the current calendar, freeing all used memory etc. etc.
*/
void close();
void save() {}
/**
Add Event to calendar.
*/
+ void removeSyncInfo( QString syncProfile);
bool addAnniversaryNoDup( Event *event );
bool addEventNoDup( Event *event );
bool addEvent( Event *event );
/**
Deletes an event from this calendar.
*/
void deleteEvent( Event *event );
/**
Retrieves an event on the basis of the unique string ID.
*/
Event *event( const QString &uid );
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index b36dc1a..9aa517c 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -344,24 +344,27 @@ int IncidenceBase::pilotId() const
int IncidenceBase::tempSyncStat() const
{
return mTempSyncStat;
}
void IncidenceBase::setTempSyncStat( int id )
{
if (mReadOnly) return;
mTempSyncStat = id;
}
void IncidenceBase::removeID(const QString &prof)
{
+ if ( prof.isEmpty() )
+ mExternalId = ":";
+ else
mExternalId = KIdManager::removeId ( mExternalId, prof);
}
void IncidenceBase::setID( const QString & prof , const QString & id )
{
mExternalId = KIdManager::setId ( mExternalId, prof, id );
}
QString IncidenceBase::getID( const QString & prof)
{
return KIdManager::getId ( mExternalId, prof );
}