-rw-r--r-- | kde2file/caldump/main.cpp | 38 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 29 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | libkcal/calendar.cpp | 8 | ||||
-rw-r--r-- | libkcal/calendar.h | 2 |
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 | |||
@@ -57,2 +57,3 @@ | |||
57 | #include <qdir.h> | 57 | #include <qdir.h> |
58 | #include <qapplication.h> | ||
58 | 59 | ||
@@ -154,3 +155,3 @@ int main( int argc, char *argv[] ) | |||
154 | } else { | 155 | } else { |
155 | qDebug("*************************load"); | 156 | qDebug("************load"); |
156 | localCalendar = new CalendarLocal(); | 157 | localCalendar = new CalendarLocal(); |
@@ -163,3 +164,3 @@ int main( int argc, char *argv[] ) | |||
163 | if ( storage->load() ) { | 164 | if ( storage->load() ) { |
164 | qDebug("*************************loaded!"); | 165 | qDebug("***********loaded!"); |
165 | KCal::Incidence::List newInc = localCalendar->rawIncidences(); | 166 | KCal::Incidence::List newInc = localCalendar->rawIncidences(); |
@@ -167,5 +168,5 @@ int main( int argc, char *argv[] ) | |||
167 | for( it = newInc.begin(); it != newInc.end(); ++it ) { | 168 | for( it = newInc.begin(); it != newInc.end(); ++it ) { |
168 | if ( (*it)->pilotId() > 0 ) { //changed | 169 | if ( (*it)->pilotId() > 1 ) { //changed |
169 | Incidence* cl = (*it)->clone(); | 170 | qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1()); |
170 | Incidence *incOld = calendarResource->incidence( cl->uid() ); | 171 | Incidence *incOld = calendarResource->incidence( (*it)->uid() ); |
171 | ResourceCalendar * res = 0; | 172 | ResourceCalendar * res = 0; |
@@ -174,2 +175,3 @@ int main( int argc, char *argv[] ) | |||
174 | if ( res ) { | 175 | if ( res ) { |
176 | Incidence* cl = (*it)->clone(); | ||
175 | cl->setPilotId( incOld->pilotId() ); | 177 | cl->setPilotId( incOld->pilotId() ); |
@@ -182,3 +184,3 @@ int main( int argc, char *argv[] ) | |||
182 | calendarResource->deleteEvent( (Event *) incOld ); | 184 | calendarResource->deleteEvent( (Event *) incOld ); |
183 | 185 | qDebug("*********change incidence %s ",cl->summary().latin1()); | |
184 | if ( cl->type() == "Journal" ) | 186 | if ( cl->type() == "Journal" ) |
@@ -191,12 +193,12 @@ int main( int argc, char *argv[] ) | |||
191 | } else { | 193 | } else { |
192 | if ( incOld ) { | 194 | Incidence* cl = (*it)->clone(); |
193 | qDebug("ERROR: no resource found for old incidence "); | 195 | qDebug("*********add incidence %s ",cl->summary().latin1()); |
194 | if ( incOld->type() == "Journal" ) | 196 | calendarResource->addIncidence( cl ); |
195 | calendarResource->deleteJournal( (Journal *) incOld ); | 197 | ++add; |
196 | else if ( incOld->type() == "Todo" ) | 198 | } |
197 | calendarResource->deleteTodo( (Todo *) incOld ); | 199 | } else { // maybe added |
198 | else if ( incOld->type() == "Event" ) | 200 | Incidence *incOld = calendarResource->incidence( (*it)->uid() ); |
199 | calendarResource->deleteEvent( (Event *) incOld ); | 201 | if ( !incOld ) { //added |
200 | 202 | Incidence* cl = (*it)->clone(); | |
201 | } | 203 | qDebug("*********add incidence %s ",cl->summary().latin1()); |
202 | calendarResource->addIncidence( cl ); | 204 | calendarResource->addIncidence( cl ); |
@@ -204,6 +206,2 @@ int main( int argc, char *argv[] ) | |||
204 | } | 206 | } |
205 | } else { // added | ||
206 | Incidence* cl = (*it)->clone(); | ||
207 | calendarResource->addIncidence( cl ); | ||
208 | ++add; | ||
209 | } | 207 | } |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index f727cd4..ff1db2c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -759,3 +759,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
759 | if ( localMod == remoteMod ) | 759 | if ( localMod == remoteMod ) |
760 | if ( local->revision() == remote->revision() ) | 760 | // if ( local->revision() == remote->revision() ) |
761 | return 0; | 761 | return 0; |
@@ -934,7 +934,4 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
934 | local->resetTempSyncStat(); | 934 | local->resetTempSyncStat(); |
935 | #ifdef DESKTOP_VERSION | 935 | if ( mSyncKDE ) |
936 | //Needed for KDE - OL sync | 936 | remote->resetPilotStat(1); |
937 | local->resetPilotStat(); | ||
938 | remote->resetPilotStat(); | ||
939 | #endif | ||
940 | mLastCalendarSync = QDateTime::currentDateTime(); | 937 | mLastCalendarSync = QDateTime::currentDateTime(); |
@@ -971,3 +968,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
971 | } | 968 | } |
972 | if ( fullDateRange ) | 969 | if ( fullDateRange && !mSyncKDE ) |
973 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 970 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
@@ -1033,5 +1030,4 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1033 | remote->addIncidence( inR ); | 1030 | remote->addIncidence( inR ); |
1034 | #ifdef DESKTOP_VERSION | 1031 | if ( mSyncKDE ) |
1035 | inR->setPilotId( 1 ); | 1032 | inR->setPilotId( 2 ); |
1036 | #endif | ||
1037 | ++changedRemote; | 1033 | ++changedRemote; |
@@ -1041,4 +1037,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1041 | idS = inL->IDStr(); | 1037 | idS = inL->IDStr(); |
1038 | int pid = inL->pilotId(); | ||
1042 | local->deleteIncidence( inL ); | 1039 | local->deleteIncidence( inL ); |
1043 | inL = inR->clone(); | 1040 | inL = inR->clone(); |
1041 | if ( mSyncKDE ) | ||
1042 | inL->setPilotId( pid ); | ||
1044 | inL->setIDStr( idS ); | 1043 | inL->setIDStr( idS ); |
@@ -1183,4 +1182,6 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1183 | eventLSync->setReadOnly( true ); | 1182 | eventLSync->setReadOnly( true ); |
1184 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 1183 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal... |
1185 | remote->addEvent( eventRSync ); | 1184 | remote->addEvent( eventRSync ); |
1185 | else | ||
1186 | delete eventRSync; | ||
1186 | QString mes; | 1187 | QString mes; |
@@ -3736,2 +3737,7 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | |||
3736 | // mSyncManager = manager; | 3737 | // mSyncManager = manager; |
3738 | mSyncKDE = false; | ||
3739 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | ||
3740 | qDebug("SyncKDE request detected!"); | ||
3741 | mSyncKDE = true; | ||
3742 | } | ||
3737 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3743 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
@@ -3742,2 +3748,3 @@ bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | |||
3742 | { | 3748 | { |
3749 | mSyncKDE = false; | ||
3743 | //mSyncManager = manager; | 3750 | //mSyncManager = manager; |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 9f56cc8..1cd896d 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -489,2 +489,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
489 | private: | 489 | private: |
490 | bool mSyncKDE; | ||
490 | KSyncManager* mSyncManager; | 491 | KSyncManager* mSyncManager; |
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index eeb5f48..52daaaa 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -251,3 +251,3 @@ QPtrList<Incidence> Calendar::incidences() | |||
251 | 251 | ||
252 | void Calendar::resetPilotStat() | 252 | void Calendar::resetPilotStat(int id ) |
253 | { | 253 | { |
@@ -258,9 +258,9 @@ void Calendar::resetPilotStat() | |||
258 | QPtrList<Event> e = rawEvents(); | 258 | QPtrList<Event> e = rawEvents(); |
259 | for( i = e.first(); i; i = e.next() ) i->setPilotId( 0 ); | 259 | for( i = e.first(); i; i = e.next() ) i->setPilotId( id ); |
260 | 260 | ||
261 | QPtrList<Todo> t = rawTodos(); | 261 | QPtrList<Todo> t = rawTodos(); |
262 | for( i = t.first(); i; i = t.next() ) i->setPilotId( 0 ); | 262 | for( i = t.first(); i; i = t.next() ) i->setPilotId( id ); |
263 | 263 | ||
264 | QPtrList<Journal> j = journals(); | 264 | QPtrList<Journal> j = journals(); |
265 | for( i = j.first(); i; i = j.next() ) i->setPilotId( 0 ); | 265 | for( i = j.first(); i; i = j.next() ) i->setPilotId( id ); |
266 | } | 266 | } |
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index d5294eb..b801186 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -69,3 +69,3 @@ public: | |||
69 | void resetTempSyncStat(); | 69 | void resetTempSyncStat(); |
70 | void resetPilotStat(); | 70 | void resetPilotStat(int id); |
71 | /** | 71 | /** |