summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-20 00:12:42 (UTC)
committer zautrix <zautrix>2004-09-20 00:12:42 (UTC)
commitb01b669d88fa195261d29ecf73b1c69e608a5ebc (patch) (unidiff)
treec0e79d45242a764b49470d07a9c95be156c121cc
parent3da2cfeab2edbe64a17251662e56668fe143f7a3 (diff)
downloadkdepimpi-b01b669d88fa195261d29ecf73b1c69e608a5ebc.zip
kdepimpi-b01b669d88fa195261d29ecf73b1c69e608a5ebc.tar.gz
kdepimpi-b01b669d88fa195261d29ecf73b1c69e608a5ebc.tar.bz2
more AB sync
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp27
-rw-r--r--kabc/addressbook.h3
-rw-r--r--kabc/addressee.cpp6
-rw-r--r--kabc/plugins/qtopia/qtopiaconverter.cpp2
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp79
-rw-r--r--kaddressbook/kabcore.cpp58
-rw-r--r--korganizer/calendarview.cpp44
7 files changed, 153 insertions, 66 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 86dc7c2..17b9ba2 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -554,5 +554,4 @@ void AddressBook::removeAddressee( const Addressee &a )
554 554
555void AddressBook::removeDeletedAddressees() 555void AddressBook::removeSyncAddressees( bool removeDeleted )
556{ 556{
557 deleteRemovedAddressees();
558 Iterator it = begin(); 557 Iterator it = begin();
@@ -564,3 +563,3 @@ void AddressBook::removeDeletedAddressees()
564 (*it).setIDStr(""); 563 (*it).setIDStr("");
565 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE || (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { 564 if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) {
566 it2 = it; 565 it2 = it;
@@ -569,3 +568,3 @@ void AddressBook::removeDeletedAddressees()
569 removeAddressee( it2 ); 568 removeAddressee( it2 );
570 } else { 569 } else {
571 //qDebug("skipping %s ",(*it).uid().latin1() ); 570 //qDebug("skipping %s ",(*it).uid().latin1() );
@@ -619,2 +618,3 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd)
619 for ( it = begin(); it != end(); ++it ) { 618 for ( it = begin(); it != end(); ++it ) {
619 qDebug("check uid %s ", (*it).uid().latin1() );
620 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || 620 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ||
@@ -623,3 +623,3 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd)
623 if ( ad.isEmpty() ) { 623 if ( ad.isEmpty() ) {
624 qDebug("ERROR ad empty "); 624 qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1());
625 } else { 625 } else {
@@ -635,3 +635,11 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd)
635 635
636 636bool AddressBook::containsExternalUid( const QString& uid )
637{
638 Iterator it;
639 for ( it = begin(); it != end(); ++it ) {
640 if ( uid == (*it).externalUID( ) )
641 return true;
642 }
643 return false;
644}
637Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) 645Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile )
@@ -655,2 +663,9 @@ void AddressBook::mergeAB( AddressBook *aBook, const QString& profile )
655 } 663 }
664#if 0
665 // test only
666 for ( it = begin(); it != end(); ++it ) {
667
668 qDebug("uid %s ", (*it).uid().latin1());
669 }
670#endif
656} 671}
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 157dc56..8f62f0d 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -294,5 +294,6 @@ class AddressBook : public QObject
294 QStringList uidList(); 294 QStringList uidList();
295 void removeDeletedAddressees(); 295 void removeSyncAddressees( bool removeDeleted = false );
296 void mergeAB( AddressBook *aBook, const QString& profile ); 296 void mergeAB( AddressBook *aBook, const QString& profile );
297 Addressee findByExternUid( const QString& uid , const QString& profile ); 297 Addressee findByExternUid( const QString& uid , const QString& profile );
298 bool containsExternalUid( const QString& uid );
298 299
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index fda62f1..e241281 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -97,3 +97,3 @@ Addressee::Addressee()
97 mData->mExternalId = ":"; 97 mData->mExternalId = ":";
98 mData->revision = QDateTime ( QDate( 2004,1,1)); 98 mData->revision = QDateTime ( QDate( 2003,1,1));
99 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 99 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
@@ -310,2 +310,4 @@ void Addressee::mergeContact( const Addressee& ad )
310 // merging keys 310 // merging keys
311 qDebug("merge contact %s ", ad.uid().latin1());
312 setUid( ad.uid() );
311} 313}
@@ -381,2 +383,3 @@ void Addressee::setOriginalExternalUID( const QString &id )
381 mData->empty = false; 383 mData->empty = false;
384 qDebug("*******Set orig uid %s ", id.latin1());
382 mData->originalExternalUID = id; 385 mData->originalExternalUID = id;
@@ -393,2 +396,3 @@ void Addressee::setUid( const QString &id )
393 detach(); 396 detach();
397 qDebug("****setuid %s ", id.latin1());
394 mData->empty = false; 398 mData->empty = false;
diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp
index de45e63..430c7b3 100644
--- a/kabc/plugins/qtopia/qtopiaconverter.cpp
+++ b/kabc/plugins/qtopia/qtopiaconverter.cpp
@@ -88,3 +88,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
88 addr.setExternalUID( exuid ); 88 addr.setExternalUID( exuid );
89 //qDebug("QtopiaConverter:set uid %s ",addr.externalUID().latin1() ); 89 qDebug("QtopiaConverter:set %s uid %s ",addr.originalExternalUID().latin1(),addr.externalUID().latin1() );
90 90
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp
index 935a1cf..1f90fcb 100644
--- a/kabc/plugins/qtopia/resourceqtopia.cpp
+++ b/kabc/plugins/qtopia/resourceqtopia.cpp
@@ -199,5 +199,7 @@ bool ResourceQtopia::save( Ticket *ticket )
199 bool res; 199 bool res;
200 200 KABC::Addressee::List changedAddressees;
201 QStringList addedUID;
201 for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { 202 for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) {
202 //KABC::Addressee addressee = (*it); 203 //KABC::Addressee addressee = (*it);
204 // qDebug("AAAfor uid %s ", (*it).originalExternalUID().latin1() );
203 if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { 205 if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
@@ -206,2 +208,3 @@ bool ResourceQtopia::save( Ticket *ticket )
206 PimContact c = mAccess->contactForId( uid, &ok ); 208 PimContact c = mAccess->contactForId( uid, &ok );
209 qDebug("ResourceQtopia::save:Found %d for uid %s ", ok,(*it).originalExternalUID().latin1() );
207 res = mConverter->addresseeToQtopia( *it, c ); 210 res = mConverter->addresseeToQtopia( *it, c );
@@ -209,9 +212,58 @@ bool ResourceQtopia::save( Ticket *ticket )
209 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL ) { 212 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL ) {
210 mAccess->addContact(c); 213 qDebug("skipping adding of contact ");
211 KABC::Addressee addressee; 214 continue;
212 mConverter->qtopiaToAddressee( c, addressee ); 215 PimContact e;
213 addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 216 AddressBookAccess Access2;
214 addressBook()->insertAddressee( addressee ); 217 Access2.addContact(e);
218 const PimContact* contact;
219 bool res;
220 QString uid2, Ouid;
221 AddressBookIterator itt(Access2);
222 for (contact=itt.toFirst(); itt.current(); ++itt)
223 {
224 contact = itt.current();
225 QString exuid = contact->uid().toString();
226 Ouid =exuid;
227 int ente = exuid.find( "-0000");
228 if ( exuid.left(1) == "{" )
229 exuid = exuid.mid(1);
230 if ( ente > -1 )
231 exuid = exuid.left( ente-1 );
232 uid2 = exuid;
233 qDebug("trying find uid ");
234 if ( !addressBook()->containsExternalUid( uid2 ) ) {
235 qDebug("ab not contains ");
236 if ( !addedUID.contains( uid2 )) {
237 qDebug("list not contains ");
238 break;
239 }
240 }
241
242 }
243 if ( !itt.current()) {
244 qDebug("ERROR uid ");
245 continue;
246 }
247 else
248 qDebug("ADD uid detected ");
249
250
251 QUuid uid3( Ouid);
252 PimContact d = Access2.contactForId( uid3, &ok );
253 if ( ! ok ) {
254 qDebug("ADD: Error getting new uid ");
255 } else {
256 qDebug("NEW UID found ");
257 PimContact g = mAccess->contactForId( c.uid(), &ok );
258 KABC::Addressee addressee;
259 mConverter->qtopiaToAddressee( g, addressee );
260 addressee.setUid((*it).uid() );
261 addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
262 changedAddressees.append( addressee );
263 addedUID.append( uid2 );
264 }
265
215 266
216 } else if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 267 } else if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
268 qDebug("Remove contact ");
217 if ( ok ) 269 if ( ok )
@@ -219,10 +271,13 @@ bool ResourceQtopia::save( Ticket *ticket )
219 else 271 else
220 qDebug("Error revoe contact from qtopia "); 272 qDebug("Error remove contact from qtopia ");
221 } else if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { 273 } else if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
222 if ( ok ) { 274 if ( ok ) {
275 qDebug("Update contact ");
223 mAccess->updateContact(c); 276 mAccess->updateContact(c);
277 PimContact g = mAccess->contactForId( c.uid(), &ok );
224 KABC::Addressee addressee; 278 KABC::Addressee addressee;
225 mConverter->qtopiaToAddressee( c, addressee ); 279 mConverter->qtopiaToAddressee( g, addressee );
280 addressee.setUid((*it).uid() );
226 addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); 281 addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM );
227 addressBook()->insertAddressee( addressee ); 282 changedAddressees.append( addressee );
228 } 283 }
@@ -239,3 +294,7 @@ bool ResourceQtopia::save( Ticket *ticket )
239 294
240 // mAccess->addressBookUpdated(); 295 KABC::Addressee::List::Iterator it2;
296 for ( it2 = changedAddressees.begin(); it2 != changedAddressees.end(); ++it2 )
297 addressBook()->insertAddressee((*it2));
298
299
241 300
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 8f3ca9b..f8683e7 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2551,2 +2551,4 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2551 QDateTime lastSync = mLastAddressbookSync; 2551 QDateTime lastSync = mLastAddressbookSync;
2552 QDateTime localMod = local->revision();
2553 QDateTime remoteMod = remote->revision();
2552 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2554 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
@@ -2555,7 +2557,7 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2555 2557
2556 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2558 qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2557 locCh = ( local->revision() > mLastAddressbookSync ); 2559 locCh = ( localMod > mLastAddressbookSync );
2558 if ( !remCh && ! locCh ) { 2560 if ( !remCh && ! locCh ) {
2559 //qDebug("both not changed "); 2561 qDebug("both not changed ");
2560 lastSync = local->revision().addDays(1); 2562 lastSync = localMod.addDays(1);
2561 if ( mode <= SYNC_PREF_ASK ) 2563 if ( mode <= SYNC_PREF_ASK )
@@ -2564,11 +2566,11 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2564 if ( locCh ) { 2566 if ( locCh ) {
2565 //qDebug("loc changed %s %s", local->revision().toString().latin1(), mLastAddressbookSync.toString().latin1()); 2567 qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2566 lastSync = local->revision().addDays( -1 ); 2568 lastSync = localMod.addDays( -1 );
2567 if ( !remCh ) 2569 if ( !remCh )
2568 remote->setRevision( lastSync.addDays( -1 ) ); 2570 remoteMod =( lastSync.addDays( -1 ) );
2569 } else { 2571 } else {
2570 //qDebug(" not loc changed "); 2572 //qDebug(" not loc changed ");
2571 lastSync = local->revision().addDays( 1 ); 2573 lastSync = localMod.addDays( 1 );
2572 if ( remCh ) 2574 if ( remCh )
2573 remote->setRevision( lastSync.addDays( 1 ) ); 2575 remoteMod =( lastSync.addDays( 1 ) );
2574 2576
@@ -2580,3 +2582,3 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2580 } else { 2582 } else {
2581 if ( local->revision() == remote->revision() ) 2583 if ( localMod == remoteMod )
2582 return 0; 2584 return 0;
@@ -2586,3 +2588,3 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2586 2588
2587 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); 2589 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod);
2588 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 2590 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
@@ -2611,5 +2613,5 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2611 case SYNC_PREF_LOCAL: 2613 case SYNC_PREF_LOCAL:
2612 if ( lastSync > remote->revision() ) 2614 if ( lastSync > remoteMod )
2613 return 1; 2615 return 1;
2614 if ( lastSync > local->revision() ) 2616 if ( lastSync > localMod )
2615 return 2; 2617 return 2;
@@ -2618,5 +2620,5 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2618 case SYNC_PREF_REMOTE: 2620 case SYNC_PREF_REMOTE:
2619 if ( lastSync > remote->revision() ) 2621 if ( lastSync > remoteMod )
2620 return 1; 2622 return 1;
2621 if ( lastSync > local->revision() ) 2623 if ( lastSync > localMod )
2622 return 2; 2624 return 2;
@@ -2625,3 +2627,3 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2625 case SYNC_PREF_NEWEST: 2627 case SYNC_PREF_NEWEST:
2626 if ( local->revision() > remote->revision() ) 2628 if ( localMod > remoteMod )
2627 return 1; 2629 return 1;
@@ -2631,8 +2633,8 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2631 case SYNC_PREF_ASK: 2633 case SYNC_PREF_ASK:
2632 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->revision().toString().latin1(), remote->revision().toString().latin1() ); 2634 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2633 if ( lastSync > remote->revision() ) 2635 if ( lastSync > remoteMod )
2634 return 1; 2636 return 1;
2635 if ( lastSync > local->revision() ) 2637 if ( lastSync > localMod )
2636 return 2; 2638 return 2;
2637 localIsNew = local->revision() >= remote->revision(); 2639 localIsNew = localMod >= remoteMod;
2638 //qDebug("conflict! ************************************** "); 2640 //qDebug("conflict! ************************************** ");
@@ -2788,2 +2790,6 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2788 } else { // take == 2 take remote 2790 } else { // take == 2 take remote
2791 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2792 if ( inR.revision().date().year() < 2004 )
2793 inR.setRevision( modifiedCalendar );
2794 }
2789 idS = inL.IDStr(); 2795 idS = inL.IDStr();
@@ -2927,5 +2933,6 @@ bool KABCore::syncAB(QString filename, int mode)
2927 bool external = false; 2933 bool external = false;
2928 2934 bool isXML = false;
2929 if ( filename.right(4) == ".xml") { 2935 if ( filename.right(4) == ".xml") {
2930 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2936 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2937 isXML = true;
2931 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); 2938 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
@@ -2938,6 +2945,5 @@ bool KABCore::syncAB(QString filename, int mode)
2938 bool found = false; 2945 bool found = false;
2939 QDateTime dt( QDate( 2004,1,1));
2940 AddressBook::Iterator it; 2946 AddressBook::Iterator it;
2941 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2947 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2942 if ( (*it).revision() != dt ) { 2948 if ( (*it).revision().date().year() > 2003 ) {
2943 found = true; 2949 found = true;
@@ -2968,7 +2974,7 @@ bool KABCore::syncAB(QString filename, int mode)
2968 { 2974 {
2969 if ( external && filename.right(4) != ".xml") 2975 if ( external )
2970 abLocal.removeDeletedAddressees(); 2976 abLocal.removeSyncAddressees( !isXML);
2971 qDebug("Saving remote AB "); 2977 qDebug("Saving remote AB ");
2972 abLocal.saveAB(); 2978 abLocal.saveAB();
2973 if ( external && filename.right(4) == ".xml") { 2979 if ( isXML ) {
2974 // afterwrite processing 2980 // afterwrite processing
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 0c75632..8e83723 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -728,2 +728,4 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
728 QDateTime lastSync = mLastCalendarSync; 728 QDateTime lastSync = mLastCalendarSync;
729 QDateTime localMod = local->lastModified();
730 QDateTime remoteMod = remote->lastModified();
729 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 731 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
@@ -733,6 +735,6 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
733 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 735 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
734 locCh = ( local->lastModified() > mLastCalendarSync ); 736 locCh = ( localMod > mLastCalendarSync );
735 if ( !remCh && ! locCh ) { 737 if ( !remCh && ! locCh ) {
736 //qDebug("both not changed "); 738 //qDebug("both not changed ");
737 lastSync = local->lastModified().addDays(1); 739 lastSync = localMod.addDays(1);
738 if ( mode <= SYNC_PREF_ASK ) 740 if ( mode <= SYNC_PREF_ASK )
@@ -741,11 +743,11 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
741 if ( locCh ) { 743 if ( locCh ) {
742 //qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1()); 744 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
743 lastSync = local->lastModified().addDays( -1 ); 745 lastSync = localMod.addDays( -1 );
744 if ( !remCh ) 746 if ( !remCh )
745 remote->setLastModified( lastSync.addDays( -1 ) ); 747 remoteMod = ( lastSync.addDays( -1 ) );
746 } else { 748 } else {
747 //qDebug(" not loc changed "); 749 //qDebug(" not loc changed ");
748 lastSync = local->lastModified().addDays( 1 ); 750 lastSync = localMod.addDays( 1 );
749 if ( remCh ) 751 if ( remCh )
750 remote->setLastModified( lastSync.addDays( 1 ) ); 752 remoteMod =( lastSync.addDays( 1 ) );
751 753
@@ -757,3 +759,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
757 } else { 759 } else {
758 if ( local->lastModified() == remote->lastModified() ) 760 if ( localMod == remoteMod )
759 if ( local->revision() == remote->revision() ) 761 if ( local->revision() == remote->revision() )
@@ -764,4 +766,4 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
764 766
765 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); 767 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
766 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 768 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
767 //full = true; //debug only 769 //full = true; //debug only
@@ -789,3 +791,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
789 bool localIsNew; 791 bool localIsNew;
790 //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() ); 792 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
791 793
@@ -796,5 +798,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
796 case SYNC_PREF_LOCAL: 798 case SYNC_PREF_LOCAL:
797 if ( lastSync > remote->lastModified() ) 799 if ( lastSync > remoteMod )
798 return 1; 800 return 1;
799 if ( lastSync > local->lastModified() ) 801 if ( lastSync > localMod )
800 return 2; 802 return 2;
@@ -803,5 +805,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
803 case SYNC_PREF_REMOTE: 805 case SYNC_PREF_REMOTE:
804 if ( lastSync > remote->lastModified() ) 806 if ( lastSync > remoteMod )
805 return 1; 807 return 1;
806 if ( lastSync > local->lastModified() ) 808 if ( lastSync > localMod )
807 return 2; 809 return 2;
@@ -810,3 +812,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
810 case SYNC_PREF_NEWEST: 812 case SYNC_PREF_NEWEST:
811 if ( local->lastModified() > remote->lastModified() ) 813 if ( localMod > remoteMod )
812 return 1; 814 return 1;
@@ -816,9 +818,9 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
816 case SYNC_PREF_ASK: 818 case SYNC_PREF_ASK:
817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 819 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
818 if ( lastSync > remote->lastModified() ) 820 if ( lastSync > remoteMod )
819 return 1; 821 return 1;
820 if ( lastSync > local->lastModified() ) 822 if ( lastSync > localMod )
821 return 2; 823 return 2;
822 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 824 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
823 localIsNew = local->lastModified() >= remote->lastModified(); 825 localIsNew = localMod >= remoteMod;
824 if ( localIsNew ) 826 if ( localIsNew )