summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-17 18:08:43 (UTC)
committer zautrix <zautrix>2004-10-17 18:08:43 (UTC)
commit6f6d1d58938539215bb4fcb5b97cf9fb089a11ef (patch) (side-by-side diff)
tree9937fe24c3fa3f29421b39a58b393e893a11636a
parentd92f58ffa1937af8a4240b9d235da15f5f352769 (diff)
downloadkdepimpi-6f6d1d58938539215bb4fcb5b97cf9fb089a11ef.zip
kdepimpi-6f6d1d58938539215bb4fcb5b97cf9fb089a11ef.tar.gz
kdepimpi-6f6d1d58938539215bb4fcb5b97cf9fb089a11ef.tar.bz2
more KDE sync fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kde2file/caldump/main.cpp38
-rw-r--r--korganizer/calendarview.cpp29
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--libkcal/calendar.cpp8
-rw-r--r--libkcal/calendar.h2
5 files changed, 42 insertions, 36 deletions
diff --git a/kde2file/caldump/main.cpp b/kde2file/caldump/main.cpp
index 755e792..be1735b 100644
--- a/kde2file/caldump/main.cpp
+++ b/kde2file/caldump/main.cpp
@@ -56,4 +56,5 @@
#include <qfile.h>
#include <qdir.h>
+#include <qapplication.h>
#include <stdlib.h>
@@ -153,5 +154,5 @@ int main( int argc, char *argv[] )
} else {
- qDebug("*************************load");
+ qDebug("************load");
localCalendar = new CalendarLocal();
localCalendar->setTimeZoneId( calendarResource->timeZoneId());
@@ -162,15 +163,16 @@ int main( int argc, char *argv[] )
int add = 0;
if ( storage->load() ) {
- qDebug("*************************loaded!");
+ qDebug("***********loaded!");
KCal::Incidence::List newInc = localCalendar->rawIncidences();
Incidence::List::ConstIterator it;
for( it = newInc.begin(); it != newInc.end(); ++it ) {
- if ( (*it)->pilotId() > 0 ) { //changed
- Incidence* cl = (*it)->clone();
- Incidence *incOld = calendarResource->incidence( cl->uid() );
+ if ( (*it)->pilotId() > 1 ) { //changed
+ qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1());
+ Incidence *incOld = calendarResource->incidence( (*it)->uid() );
ResourceCalendar * res = 0;
if ( incOld )
res = calendarResource->resource( incOld );
if ( res ) {
+ Incidence* cl = (*it)->clone();
cl->setPilotId( incOld->pilotId() );
++num;
@@ -181,5 +183,5 @@ int main( int argc, char *argv[] )
else if ( incOld->type() == "Event" )
calendarResource->deleteEvent( (Event *) incOld );
-
+ qDebug("*********change incidence %s ",cl->summary().latin1());
if ( cl->type() == "Journal" )
calendarResource->addJournal( (Journal *) cl, res );
@@ -190,21 +192,17 @@ int main( int argc, char *argv[] )
} else {
- if ( incOld ) {
- qDebug("ERROR: no resource found for old incidence ");
- if ( incOld->type() == "Journal" )
- calendarResource->deleteJournal( (Journal *) incOld );
- else if ( incOld->type() == "Todo" )
- calendarResource->deleteTodo( (Todo *) incOld );
- else if ( incOld->type() == "Event" )
- calendarResource->deleteEvent( (Event *) incOld );
-
- }
+ Incidence* cl = (*it)->clone();
+ qDebug("*********add incidence %s ",cl->summary().latin1());
+ calendarResource->addIncidence( cl );
+ ++add;
+ }
+ } else { // maybe added
+ Incidence *incOld = calendarResource->incidence( (*it)->uid() );
+ if ( !incOld ) { //added
+ Incidence* cl = (*it)->clone();
+ qDebug("*********add incidence %s ",cl->summary().latin1());
calendarResource->addIncidence( cl );
++add;
}
- } else { // added
- Incidence* cl = (*it)->clone();
- calendarResource->addIncidence( cl );
- ++add;
}
}
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index f727cd4..ff1db2c 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -758,5 +758,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
} else {
if ( localMod == remoteMod )
- if ( local->revision() == remote->revision() )
+ // if ( local->revision() == remote->revision() )
return 0;
@@ -933,9 +933,6 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
bool fullDateRange = false;
local->resetTempSyncStat();
-#ifdef DESKTOP_VERSION
- //Needed for KDE - OL sync
- local->resetPilotStat();
- remote->resetPilotStat();
-#endif
+ if ( mSyncKDE )
+ remote->resetPilotStat(1);
mLastCalendarSync = QDateTime::currentDateTime();
QDateTime modifiedCalendar = mLastCalendarSync;;
@@ -970,5 +967,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
}
}
- if ( fullDateRange )
+ if ( fullDateRange && !mSyncKDE )
mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
else
@@ -1032,7 +1029,6 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
inR->setIDStr( idS );
remote->addIncidence( inR );
-#ifdef DESKTOP_VERSION
- inR->setPilotId( 1 );
-#endif
+ if ( mSyncKDE )
+ inR->setPilotId( 2 );
++changedRemote;
} else {
@@ -1040,6 +1036,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
inR->setRevision( maxrev );
idS = inL->IDStr();
+ int pid = inL->pilotId();
local->deleteIncidence( inL );
inL = inR->clone();
+ if ( mSyncKDE )
+ inL->setPilotId( pid );
inL->setIDStr( idS );
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
@@ -1182,6 +1181,8 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
eventLSync->setReadOnly( true );
- if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
+ if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal...
remote->addEvent( eventRSync );
+ else
+ delete eventRSync;
QString mes;
mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
@@ -3735,4 +3736,9 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
{
// mSyncManager = manager;
+ mSyncKDE = false;
+ if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
+ qDebug("SyncKDE request detected!");
+ mSyncKDE = true;
+ }
mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
mCurrentSyncName = mSyncManager->getCurrentSyncName();
@@ -3741,4 +3747,5 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
{
+ mSyncKDE = false;
//mSyncManager = manager;
mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 9f56cc8..1cd896d 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -488,4 +488,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
private:
+ bool mSyncKDE;
KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index eeb5f48..52daaaa 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -250,5 +250,5 @@ QPtrList<Incidence> Calendar::incidences()
}
-void Calendar::resetPilotStat()
+void Calendar::resetPilotStat(int id )
{
QPtrList<Incidence> incidences;
@@ -257,11 +257,11 @@ void Calendar::resetPilotStat()
QPtrList<Event> e = rawEvents();
- for( i = e.first(); i; i = e.next() ) i->setPilotId( 0 );
+ for( i = e.first(); i; i = e.next() ) i->setPilotId( id );
QPtrList<Todo> t = rawTodos();
- for( i = t.first(); i; i = t.next() ) i->setPilotId( 0 );
+ for( i = t.first(); i; i = t.next() ) i->setPilotId( id );
QPtrList<Journal> j = journals();
- for( i = j.first(); i; i = j.next() ) i->setPilotId( 0 );
+ for( i = j.first(); i; i = j.next() ) i->setPilotId( id );
}
void Calendar::resetTempSyncStat()
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index d5294eb..b801186 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -68,5 +68,5 @@ public:
void deleteIncidence(Incidence *in);
void resetTempSyncStat();
- void resetPilotStat();
+ void resetPilotStat(int id);
/**
Clears out the current calendar, freeing all used memory etc.