author | zautrix <zautrix> | 2005-07-09 10:40:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-09 10:40:57 (UTC) |
commit | b51db424f4b1e558ab8c7c723859bb564c99d83b (patch) (side-by-side diff) | |
tree | 2de26e6455c6b07b17cb169ef23e4170387a5fcc | |
parent | f731dd9fc5b3f14c44d4de26eb5370a79c63887c (diff) | |
download | kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.zip kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.tar.gz kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/calendarview.cpp | 7 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 35 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 2 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 8 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 1 |
6 files changed, 41 insertions, 13 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index ccacc52..a350c3b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1225,5 +1225,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b break; case SYNC_PREF_ASK: - //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); + qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); if ( lastSync > remoteMod && lastSync > localMod) return 0; @@ -1232,5 +1232,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b if ( lastSync > localMod ) return 2; - //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); + qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); localIsNew = localMod >= remoteMod; if ( localIsNew ) @@ -1360,4 +1360,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); if ( eventR ) { + qDebug("last-syncEvent on remote found "); eventRSync = (Event*) eventR->clone(); remote->deleteEvent(eventR ); @@ -1382,5 +1383,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( eventLSync->dtStart() != eventRSync->dtStart() ) { - // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); + qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); fullDateRange = true; diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 14a1a45..95477cd 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -78,4 +78,5 @@ public: virtual bool addCalendarFile( QString name, int id ) = 0; virtual bool mergeCalendarFile( QString name ) = 0; + virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ) = 0; virtual void setSyncEventsReadOnly() = 0; virtual void stopAllTodos() = 0; diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 3e42ec0..e37a7ad 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -80,5 +80,5 @@ bool CalendarLocal::mergeCalendarFile( QString name ) } -Incidence* CalendarLocal::incidenceForUid( const QString& uid ) +Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates) { Todo *todo;; @@ -86,4 +86,5 @@ Incidence* CalendarLocal::incidenceForUid( const QString& uid ) for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { if ( todo->uid() == uid ) { + if ( doNotCheckDuplicates ) return todo; if ( retVal ) { if ( retVal->calID() > todo->calID() ) { @@ -99,4 +100,5 @@ Incidence* CalendarLocal::incidenceForUid( const QString& uid ) for ( event = mEventList.first(); event; event = mEventList.next() ) { if ( event->uid() == uid ) { + if ( doNotCheckDuplicates ) return event; if ( retVal ) { if ( retVal->calID() > event->calID() ) { @@ -111,4 +113,5 @@ Incidence* CalendarLocal::incidenceForUid( const QString& uid ) for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) if ( it->uid() == uid ) { + if ( doNotCheckDuplicates ) return it; if ( retVal ) { if ( retVal->calID() > it->calID() ) { @@ -124,15 +127,29 @@ Incidence* CalendarLocal::incidenceForUid( const QString& uid ) bool CalendarLocal::mergeCalendar( Calendar* remote ) { + // 1 look for raw inc in local + // if inc not in remote, delete in local + // 2 look for raw inc in remote + // if inc in local, replace it + // if not in local, add it to default calendar + QPtrList<Incidence> localInc = rawIncidences(); + Incidence* inL = localInc.first(); + while ( inL ) { + if ( ! inL->isReadOnly () ) + if ( !remote->incidenceForUid( inL->uid(), true )) + deleteIncidence( inL ); + inL = localInc.next(); + } QPtrList<Incidence> er = remote->rawIncidences(); Incidence* inR = er.first(); - Incidence* inL; while ( inR ) { - inL = incidenceForUid( inR->uid() ); + inL = incidenceForUid( inR->uid(),false ); if ( inL ) { - int calID = inL->calID(); - deleteIncidence( inL ); - inL = inR->clone(); - inL->setCalID( calID ); - addIncidence( inL ); + if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) { + int calID = inL->calID(); + deleteIncidence( inL ); + inL = inR->clone(); + inL->setCalID( calID ); + addIncidence( inL ); + } } else { inL = inR->clone(); @@ -144,4 +161,6 @@ bool CalendarLocal::mergeCalendar( Calendar* remote ) return true; } + + bool CalendarLocal::addCalendarFile( QString name, int id ) { diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 23b0542..a7a85c8 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h @@ -48,5 +48,5 @@ class CalendarLocal : public Calendar bool mergeCalendarFile( QString name ); bool mergeCalendar( Calendar* cal ); - Incidence* incidenceForUid( const QString& uid ); + Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ); void setSyncEventsReadOnly(); void stopAllTodos(); diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index dcead02..1a19f3e 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -35,4 +35,5 @@ IncidenceBase::IncidenceBase() : mPilotId(0), mSyncStatus(SYNCMOD) { + blockLastModified = false; setUid(CalFormat::createUniqueId()); mOrganizer = ""; @@ -54,4 +55,5 @@ IncidenceBase::IncidenceBase(const IncidenceBase &i) : { + blockLastModified = false; mReadOnly = i.mReadOnly; mDtStart = i.mDtStart; @@ -150,6 +152,9 @@ void IncidenceBase::setTagged( bool b) void IncidenceBase::setCalID( int id ) { - if ( mCalID > 0 ) + if ( mCalID > 0 ) { + blockLastModified = true; updated(); + blockLastModified = false; + } mCalID = id; } @@ -190,4 +195,5 @@ QString IncidenceBase::uid() const void IncidenceBase::setLastModified(const QDateTime &lm) { + if ( blockLastModified ) return; // DON'T! updated() because we call this from // Calendar::updateEvent(). diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index bccf287..bed73db 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h @@ -151,4 +151,5 @@ class IncidenceBase : public CustomProperties void setTagged( bool ); protected: + bool blockLastModified; bool mIsTagged; QDateTime mDtStart; |