summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp31
-rw-r--r--kabc/addressee.cpp19
-rw-r--r--kabc/addressee.h1
-rw-r--r--kabc/stdaddressbook.cpp7
-rw-r--r--kaddressbook/kabcore.cpp25
-rw-r--r--korganizer/calendarview.cpp2
6 files changed, 58 insertions, 27 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index ec9f893..46a9cf4 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -345,5 +345,10 @@ bool AddressBook::load()
345 Addressee::List::Iterator addrIt; 345 Addressee::List::Iterator addrIt;
346 for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) 346 for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) {
347 (*addrIt).setChanged( false ); 347 (*addrIt).setChanged( false );
348 348 QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" );
349 if ( !id.isEmpty() ) {
350 //qDebug("setId aa %s ", id.latin1());
351 (*addrIt).setIDStr(id );
352 }
353 }
349 blockLSEchange = true; 354 blockLSEchange = true;
@@ -368,3 +373,8 @@ bool AddressBook::saveAB()
368 deleteRemovedAddressees(); 373 deleteRemovedAddressees();
369 374 Iterator ait;
375 for ( ait = begin(); ait != end(); ++ait ) {
376 if ( !(*ait).IDStr().isEmpty() ) {
377 (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() );
378 }
379 }
370 KRES::Manager<Resource>::ActiveIterator it; 380 KRES::Manager<Resource>::ActiveIterator it;
@@ -452,4 +462,6 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev )
452 if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { 462 if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) {
463 //qDebug("block insert ");
453 return; 464 return;
454 } 465 }
466 //qDebug("inserting.... %s ",a.uid().latin1() );
455 bool found = false; 467 bool found = false;
@@ -482,3 +494,3 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev )
482 } else { 494 } else {
483 if ( (*it).uid() == QString("last-syncAddressee-") ) { 495 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
484 QString name = (*it).uid().mid( 19 ); 496 QString name = (*it).uid().mid( 19 );
@@ -518,3 +530,3 @@ void AddressBook::removeAddressee( const Addressee &a )
518 } else { 530 } else {
519 if ( (*it).uid() == QString("last-syncAddressee-") ) { 531 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
520 QString name = (*it).uid().mid( 19 ); 532 QString name = (*it).uid().mid( 19 );
@@ -547,9 +559,14 @@ void AddressBook::removeDeletedAddressees()
547 (*it).setRevision( dt ); 559 (*it).setRevision( dt );
548 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 560 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
561 (*it).setIDStr("");
562 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE || (*it).uid().left( 19 ) == QString("last-syncAddressee-")) {
549 it2 = it; 563 it2 = it;
564 //qDebug("removing %s ",(*it).uid().latin1() );
550 ++it; 565 ++it;
551 removeAddressee( it2 ); 566 removeAddressee( it2 );
552 } else 567 } else {
568 //qDebug("skipping %s ",(*it).uid().latin1() );
553 ++it; 569 ++it;
554 } 570 }
571 }
555 deleteRemovedAddressees(); 572 deleteRemovedAddressees();
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 0f5d605..d6b70c4 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -81,3 +81,3 @@ struct Addressee::AddresseeData : public KShared
81 QStringList custom; 81 QStringList custom;
82 82 int mTempSyncStat;
83 Resource *resource; 83 Resource *resource;
@@ -96,3 +96,3 @@ Addressee::Addressee()
96 mData->revision = QDateTime ( QDate( 2004,1,1)); 96 mData->revision = QDateTime ( QDate( 2004,1,1));
97 mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 97 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
98} 98}
@@ -106,3 +106,2 @@ Addressee::Addressee( const Addressee &a )
106 mData = a.mData; 106 mData = a.mData;
107 mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
108} 107}
@@ -270,3 +269,5 @@ void Addressee::computeCsum(const QString &dev)
270 } 269 }
271 setCsum( dev, QString::number (getCsum4List(l)) ); 270 uint cs = getCsum4List(l);
271 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
272 setCsum( dev, QString::number (cs ));
272} 273}
@@ -281,3 +282,5 @@ void Addressee::setID( const QString & prof , const QString & id )
281 detach(); 282 detach();
283 qDebug("setID1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
282 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 284 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
285 qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
283} 286}
@@ -285,3 +288,5 @@ void Addressee::setTempSyncStat( int id )
285{ 288{
286 mTempSyncStat = id; 289 if ( mData->mTempSyncStat == id ) return;
290 detach();
291 mData->mTempSyncStat = id;
287} 292}
@@ -289,3 +294,3 @@ int Addressee::tempSyncStat() const
289{ 294{
290 return mTempSyncStat; 295 return mData->mTempSyncStat;
291} 296}
@@ -300,3 +305,5 @@ void Addressee::setCsum( const QString & prof , const QString & id )
300 detach(); 305 detach();
306 qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
301 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 307 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
308 qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
302} 309}
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 0805458..bfb0840 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -828,3 +828,2 @@ class Addressee
828 void detach(); 828 void detach();
829 int mTempSyncStat;
830 829
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index ec47a4e..181a09e 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -167,3 +167,8 @@ bool StdAddressBook::save()
167 ab->deleteRemovedAddressees(); 167 ab->deleteRemovedAddressees();
168 168 Iterator ait;
169 for ( ait = ab->begin(); ait != ab->end(); ++ait ) {
170 if ( !(*ait).IDStr().isEmpty() ) {
171 (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() );
172 }
173 }
169 KRES::Manager<Resource>::ActiveIterator it; 174 KRES::Manager<Resource>::ActiveIterator it;
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 8776b53..56f6af2 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2528,3 +2528,3 @@ KABC::Addressee KABCore::getLastSyncAddressee()
2528 QString sum = ""; 2528 QString sum = "";
2529 if ( KABPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 2529 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2530 sum = "E: "; 2530 sum = "E: ";
@@ -2554,11 +2554,13 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2554 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2554 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2555 //if ( remCh ) 2555 if ( remCh )
2556 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2556 qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2557 locCh = ( local->revision() > mLastAddressbookSync ); 2557 locCh = ( local->revision() > mLastAddressbookSync );
2558 if ( !remCh && ! locCh ) { 2558 if ( !remCh && ! locCh ) {
2559 //qDebug("both not changed "); 2559 qDebug("both not changed ");
2560 lastSync = local->revision().addDays(1); 2560 lastSync = local->revision().addDays(1);
2561 if ( mode <= SYNC_PREF_ASK )
2562 return 0;
2561 } else { 2563 } else {
2562 if ( locCh ) { 2564 if ( locCh ) {
2563 //qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1()); 2565 qDebug("loc changed %s %s", local->revision().toString().latin1(), mLastAddressbookSync.toString().latin1());
2564 lastSync = local->revision().addDays( -1 ); 2566 lastSync = local->revision().addDays( -1 );
@@ -2792,5 +2794,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2792 QString des = addresseeLSync.note(); 2794 QString des = addresseeLSync.note();
2793 QString pref = "a"; 2795 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
2794 if ( des.find(pref+ inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
2795 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 2796 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
2797 remote->insertAddressee( inR, false );
2796 ++deletedAddresseeR; 2798 ++deletedAddresseeR;
@@ -2822,3 +2824,3 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2822 er.clear(); 2824 er.clear();
2823 QStringList el = remote->uidList(); 2825 QStringList el = local->uidList();
2824 modulo = (el.count()/10)+1; 2826 modulo = (el.count()/10)+1;
@@ -2829,3 +2831,2 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2829 while ( incCounter < el.count()) { 2831 while ( incCounter < el.count()) {
2830
2831 qApp->processEvents(); 2832 qApp->processEvents();
@@ -2839,4 +2840,2 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2839 skipIncidence = true; 2840 skipIncidence = true;
2840 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2841 skipIncidence = true;
2842 if ( !skipIncidence ) { 2841 if ( !skipIncidence ) {
@@ -2854,3 +2853,2 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2854 ++addedAddresseeR; 2853 ++addedAddresseeR;
2855 //qDebug("remote added Incidence %s ", inL.summary().latin1());
2856 inL.setRevision( modifiedCalendar ); 2854 inL.setRevision( modifiedCalendar );
@@ -2897,2 +2895,4 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2897 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2895 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2896 addresseeRSync.setNote( "" ) ;
2897 addresseeLSync.setNote( "" );
2898 2898
@@ -2939,2 +2939,3 @@ bool KABCore::syncAB(QString filename, int mode)
2939 if ( external ) { 2939 if ( external ) {
2940 qDebug("**********Setting vcf mode to external ");
2940 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2941 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 56b3fb0..0c75632 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -737,2 +737,4 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
737 lastSync = local->lastModified().addDays(1); 737 lastSync = local->lastModified().addDays(1);
738 if ( mode <= SYNC_PREF_ASK )
739 return 0;
738 } else { 740 } else {