summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-09 10:40:57 (UTC)
committer zautrix <zautrix>2005-07-09 10:40:57 (UTC)
commitb51db424f4b1e558ab8c7c723859bb564c99d83b (patch) (side-by-side diff)
tree2de26e6455c6b07b17cb169ef23e4170387a5fcc
parentf731dd9fc5b3f14c44d4de26eb5370a79c63887c (diff)
downloadkdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.zip
kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.tar.gz
kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp7
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp35
-rw-r--r--libkcal/calendarlocal.h2
-rw-r--r--libkcal/incidencebase.cpp8
-rw-r--r--libkcal/incidencebase.h1
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
@@ -1226,3 +1226,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
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)
@@ -1233,3 +1233,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
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;
@@ -1361,2 +1361,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
if ( eventR ) {
+ qDebug("last-syncEvent on remote found ");
eventRSync = (Event*) eventR->clone();
@@ -1383,3 +1384,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
- // 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());
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 14a1a45..95477cd 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -79,2 +79,3 @@ public:
virtual bool mergeCalendarFile( QString name ) = 0;
+ virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ) = 0;
virtual void setSyncEventsReadOnly() = 0;
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 3e42ec0..e37a7ad 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -81,3 +81,3 @@ bool CalendarLocal::mergeCalendarFile( QString name )
-Incidence* CalendarLocal::incidenceForUid( const QString& uid )
+Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates)
{
@@ -87,2 +87,3 @@ Incidence* CalendarLocal::incidenceForUid( const QString& uid )
if ( todo->uid() == uid ) {
+ if ( doNotCheckDuplicates ) return todo;
if ( retVal ) {
@@ -100,2 +101,3 @@ Incidence* CalendarLocal::incidenceForUid( const QString& uid )
if ( event->uid() == uid ) {
+ if ( doNotCheckDuplicates ) return event;
if ( retVal ) {
@@ -112,2 +114,3 @@ Incidence* CalendarLocal::incidenceForUid( const QString& uid )
if ( it->uid() == uid ) {
+ if ( doNotCheckDuplicates ) return it;
if ( retVal ) {
@@ -125,13 +128,27 @@ 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 {
@@ -145,2 +162,4 @@ bool CalendarLocal::mergeCalendar( Calendar* remote )
}
+
+
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
@@ -49,3 +49,3 @@ class CalendarLocal : public Calendar
bool mergeCalendar( Calendar* cal );
- Incidence* incidenceForUid( const QString& uid );
+ Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates );
void setSyncEventsReadOnly();
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index dcead02..1a19f3e 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -36,2 +36,3 @@ IncidenceBase::IncidenceBase() :
{
+ blockLastModified = false;
setUid(CalFormat::createUniqueId());
@@ -55,2 +56,3 @@ IncidenceBase::IncidenceBase(const IncidenceBase &i) :
+ blockLastModified = false;
mReadOnly = i.mReadOnly;
@@ -151,4 +153,7 @@ void IncidenceBase::setCalID( int id )
{
- if ( mCalID > 0 )
+ if ( mCalID > 0 ) {
+ blockLastModified = true;
updated();
+ blockLastModified = false;
+ }
mCalID = id;
@@ -191,2 +196,3 @@ void IncidenceBase::setLastModified(const QDateTime &lm)
{
+ if ( blockLastModified ) return;
// DON'T! updated() because we call this from
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index bccf287..bed73db 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -152,2 +152,3 @@ class IncidenceBase : public CustomProperties
protected:
+ bool blockLastModified;
bool mIsTagged;