-rw-r--r-- | korganizer/calendarview.cpp | 16 | ||||
-rw-r--r-- | libkcal/alarm.cpp | 36 | ||||
-rw-r--r-- | libkcal/recurrence.cpp | 56 | ||||
-rw-r--r-- | libkcal/sharpformat.cpp | 7 |
4 files changed, 94 insertions, 21 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 258bd43..94cc97d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -738,7 +738,7 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b lastSync = local->lastModified().addDays(1); } else { if ( locCh ) { - qDebug("loc changed %d", local->revision() ); + qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1()); lastSync = local->lastModified().addDays( -1 ); if ( !remCh ) remote->setLastModified( lastSync.addDays( -1 ) ); @@ -786,7 +786,7 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b } int result; bool localIsNew; - qDebug("mLastCalendarSync %s lastsync %s --- local %s remote %s ",mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); + //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); if ( full && mode < SYNC_PREF_NEWEST ) mode = SYNC_PREF_ASK; @@ -1030,7 +1030,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int remote->deleteIncidence( inR ); if ( inL->revision() < maxrev ) inL->setRevision( maxrev ); - remote->addIncidence( inL->clone() ); + inR = inL->clone(); + inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); + remote->addIncidence( inR ); ++changedRemote; } else { if ( inR->revision() < maxrev ) @@ -1052,7 +1054,8 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int ++deletedEventR; } else { inR->setLastModified( modifiedCalendar ); - local->addIncidence( inR->clone() ); + inL = inR->clone(); + local->addIncidence( inL ); ++addedEvent; } } else { @@ -1103,8 +1106,11 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { inL->removeID(mCurrentSyncDevice ); ++addedEventR; + qDebug("remote added Incidence %s ", inL->summary().latin1()); inL->setLastModified( modifiedCalendar ); - remote->addIncidence( inL->clone() ); + inR = inL->clone(); + inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); + remote->addIncidence( inR ); } } } else { diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp index 29e6205..1fc7169 100644 --- a/libkcal/alarm.cpp +++ b/libkcal/alarm.cpp @@ -49,6 +49,7 @@ Alarm::~Alarm() bool Alarm::operator==( const Alarm& rhs ) const { + if ( mType != rhs.mType || mAlarmSnoozeTime != rhs.mAlarmSnoozeTime || mAlarmRepeatCount != rhs.mAlarmRepeatCount || @@ -56,6 +57,40 @@ bool Alarm::operator==( const Alarm& rhs ) const mHasTime != rhs.mHasTime) return false; +#if 0 + if ( mType != rhs.mType ) { + + qDebug("aaa1 "); + return false; + } + + if ( mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ) { + + qDebug("aaa2 "); + return false; + } + + + if ( mAlarmRepeatCount != rhs.mAlarmRepeatCount ) { + + qDebug("aaa3 "); + return false; + } + + if ( mAlarmEnabled != rhs.mAlarmEnabled ) { + + qDebug("aaa4 "); + return false; + } + + if ( mHasTime != rhs.mHasTime ) { + + qDebug("aaa5 "); + return false; + } +#endif + + if (mHasTime) { if (mAlarmTime != rhs.mAlarmTime) return false; @@ -64,7 +99,6 @@ bool Alarm::operator==( const Alarm& rhs ) const mEndOffset != rhs.mEndOffset) return false; } - switch (mType) { case Display: return mDescription == rhs.mDescription; diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp index dd74e10..e84f672 100644 --- a/libkcal/recurrence.cpp +++ b/libkcal/recurrence.cpp @@ -106,6 +106,7 @@ bool Recurrence::operator==( const Recurrence& r2 ) const // we need the above line, because two non recurring events may // differ in the other settings, because one (or both) // may be not initialized properly + if ( recurs != r2.recurs || rFreq != r2.rFreq || rDuration != r2.rDuration @@ -122,18 +123,49 @@ bool Recurrence::operator==( const Recurrence& r2 ) const case rWeekly: return rDays == r2.rDays && rWeekStart == r2.rWeekStart; - case rMonthlyPos: - return rMonthPositions.count() == r2.rMonthPositions.count(); - case rMonthlyDay: - return rMonthDays.count() == r2.rMonthDays.count(); - case rYearlyPos: - return rYearNums.count() == r2.rYearNums.count() - && rMonthPositions.count() == r2.rMonthPositions.count(); - case rYearlyMonth: - return rYearNums.count() == r2.rYearNums.count() - && mFeb29YearlyType == r2.mFeb29YearlyType; - case rYearlyDay: - return rYearNums == r2.rYearNums; + case rMonthlyPos: { + QPtrList<rMonthPos> MonthPositions = rMonthPositions; + QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions; + if ( !MonthPositions.count() ) + return false; + if ( !MonthPositions2.count() ) + return false; + return MonthPositions.first()->rPos == MonthPositions2.first()->rPos; + } + case rMonthlyDay: { + QPtrList<int> MonthDays = rMonthDays ; + QPtrList<int> MonthDays2 = r2.rMonthDays ; + if ( !MonthDays.count() ) + return false; + if ( !MonthDays2.count() ) + return false; + return *MonthDays.first() == *MonthDays2.first() ; + } + case rYearlyPos: { + + QPtrList<int> YearNums = rYearNums; + QPtrList<int> YearNums2 = r2.rYearNums; + if ( *YearNums.first() != *YearNums2.first() ) + return false; + QPtrList<rMonthPos> MonthPositions = rMonthPositions; + QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions; + if ( !MonthPositions.count() ) + return false; + if ( !MonthPositions2.count() ) + return false; + return MonthPositions.first()->rPos == MonthPositions2.first()->rPos; + + } + case rYearlyMonth: { + QPtrList<int> YearNums = rYearNums; + QPtrList<int> YearNums2 = r2.rYearNums; + return ( *YearNums.first() == *YearNums2.first() && mFeb29YearlyType == r2.mFeb29YearlyType); + } + case rYearlyDay: { + QPtrList<int> YearNums = rYearNums; + QPtrList<int> YearNums2 = r2.rYearNums; + return ( *YearNums.first() == *YearNums2.first() ); + } case rNone: case rMinutely: case rHourly: diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index defdb09..89eb72f 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp @@ -180,8 +180,9 @@ class SharpParser : public QObject else { alarm = new Alarm( event ); event->addAlarm( alarm ); - } alarm->setType( Alarm::Audio ); + } + //alarm->setType( Alarm::Audio ); alarm->setEnabled( true ); int alarmOffset = attList[9].toInt(); alarm->setStartOffset( alarmOffset * -60 ); @@ -368,13 +369,13 @@ ulong SharpFormat::getCsum( const QStringList & attList) } #include <stdlib.h> -#define DEBUGMODE false +//#define DEBUGMODE false +#define DEBUGMODE true bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) { bool debug = DEBUGMODE; - //debug = true; QString text; QString codec = "utf8"; QLabel status ( i18n("Reading events ..."), 0 ); |