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
@@ -340,15 +340,20 @@ bool AddressBook::load()
340 error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); 340 error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) );
341 ok = false; 341 ok = false;
342 } 342 }
343 343
344 // mark all addressees as unchanged 344 // mark all addressees as unchanged
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;
350 return ok; 355 return ok;
351} 356}
352 357
353bool AddressBook::save( Ticket *ticket ) 358bool AddressBook::save( Ticket *ticket )
354{ 359{
@@ -363,13 +368,18 @@ bool AddressBook::save( Ticket *ticket )
363} 368}
364bool AddressBook::saveAB() 369bool AddressBook::saveAB()
365{ 370{
366 bool ok = true; 371 bool ok = true;
367 372
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;
371 KRES::Manager<Resource> *manager = d->mManager; 381 KRES::Manager<Resource> *manager = d->mManager;
372 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 382 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
373 if ( !(*it)->readOnly() && (*it)->isOpen() ) { 383 if ( !(*it)->readOnly() && (*it)->isOpen() ) {
374 Ticket *ticket = requestSaveTicket( *it ); 384 Ticket *ticket = requestSaveTicket( *it );
375// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); 385// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() );
@@ -447,14 +457,16 @@ Ticket *AddressBook::requestSaveTicket( Resource *resource )
447 return 0; 457 return 0;
448} 458}
449 459
450void AddressBook::insertAddressee( const Addressee &a, bool setRev ) 460void AddressBook::insertAddressee( const Addressee &a, bool setRev )
451{ 461{
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;
456 Addressee::List::Iterator it; 468 Addressee::List::Iterator it;
457 for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { 469 for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) {
458 if ( a.uid() == (*it).uid() ) { 470 if ( a.uid() == (*it).uid() ) {
459 471
460 bool changed = false; 472 bool changed = false;
@@ -477,13 +489,13 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev )
477 } 489 }
478 (*it).setChanged( true ); 490 (*it).setChanged( true );
479 } 491 }
480 492
481 found = true; 493 found = true;
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 );
485 Addressee b = a; 497 Addressee b = a;
486 QString id = b.getID( name ); 498 QString id = b.getID( name );
487 if ( ! id.isEmpty() ) { 499 if ( ! id.isEmpty() ) {
488 QString des = (*it).note(); 500 QString des = (*it).note();
489 int startN; 501 int startN;
@@ -513,13 +525,13 @@ void AddressBook::removeAddressee( const Addressee &a )
513 bool found = false; 525 bool found = false;
514 for ( it = begin(); it != end(); ++it ) { 526 for ( it = begin(); it != end(); ++it ) {
515 if ( a.uid() == (*it).uid() ) { 527 if ( a.uid() == (*it).uid() ) {
516 found = true; 528 found = true;
517 it2 = it; 529 it2 = it;
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 );
521 Addressee b = a; 533 Addressee b = a;
522 QString id = b.getID( name ); 534 QString id = b.getID( name );
523 if ( ! id.isEmpty() ) { 535 if ( ! id.isEmpty() ) {
524 QString des = (*it).note(); 536 QString des = (*it).note();
525 if( des.find( id ) < 0 ) { 537 if( des.find( id ) < 0 ) {
@@ -542,19 +554,24 @@ void AddressBook::removeDeletedAddressees()
542 deleteRemovedAddressees(); 554 deleteRemovedAddressees();
543 Iterator it = begin(); 555 Iterator it = begin();
544 Iterator it2 ; 556 Iterator it2 ;
545 QDateTime dt ( QDate( 2004,1,1) ); 557 QDateTime dt ( QDate( 2004,1,1) );
546 while ( it != end() ) { 558 while ( it != end() ) {
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();
556} 573}
557 574
558void AddressBook::removeAddressee( const Iterator &it ) 575void AddressBook::removeAddressee( const Iterator &it )
559{ 576{
560 d->mRemovedAddressees.append( (*it) ); 577 d->mRemovedAddressees.append( (*it) );
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 0f5d605..d6b70c4 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -76,13 +76,13 @@ struct Addressee::AddresseeData : public KShared
76 PhoneNumber::List phoneNumbers; 76 PhoneNumber::List phoneNumbers;
77 Address::List addresses; 77 Address::List addresses;
78 Key::List keys; 78 Key::List keys;
79 QStringList emails; 79 QStringList emails;
80 QStringList categories; 80 QStringList categories;
81 QStringList custom; 81 QStringList custom;
82 82 int mTempSyncStat;
83 Resource *resource; 83 Resource *resource;
84 84
85 bool empty :1; 85 bool empty :1;
86 bool changed :1; 86 bool changed :1;
87}; 87};
88 88
@@ -91,23 +91,22 @@ Addressee::Addressee()
91 mData = new AddresseeData; 91 mData = new AddresseeData;
92 mData->empty = true; 92 mData->empty = true;
93 mData->changed = false; 93 mData->changed = false;
94 mData->resource = 0; 94 mData->resource = 0;
95 mData->mExternalId = ":"; 95 mData->mExternalId = ":";
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}
99 99
100Addressee::~Addressee() 100Addressee::~Addressee()
101{ 101{
102} 102}
103 103
104Addressee::Addressee( const Addressee &a ) 104Addressee::Addressee( const Addressee &a )
105{ 105{
106 mData = a.mData; 106 mData = a.mData;
107 mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
108} 107}
109 108
110Addressee &Addressee::operator=( const Addressee &a ) 109Addressee &Addressee::operator=( const Addressee &a )
111{ 110{
112 mData = a.mData; 111 mData = a.mData;
113 return (*this); 112 return (*this);
@@ -265,43 +264,51 @@ void Addressee::computeCsum(const QString &dev)
265 ++addressIter ) { 264 ++addressIter ) {
266 t = (*addressIter).asList(); 265 t = (*addressIter).asList();
267 t.sort(); 266 t.sort();
268 for ( iii = 0; iii < t.count(); ++iii) 267 for ( iii = 0; iii < t.count(); ++iii)
269 l.append( t[iii] ); 268 l.append( t[iii] );
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}
273void Addressee::removeID(const QString &prof) 274void Addressee::removeID(const QString &prof)
274{ 275{
275 detach(); 276 detach();
276 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 277 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
277 278
278} 279}
279void Addressee::setID( const QString & prof , const QString & id ) 280void Addressee::setID( const QString & prof , const QString & id )
280{ 281{
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}
284void Addressee::setTempSyncStat( int id ) 287void Addressee::setTempSyncStat( int id )
285{ 288{
286 mTempSyncStat = id; 289 if ( mData->mTempSyncStat == id ) return;
290 detach();
291 mData->mTempSyncStat = id;
287} 292}
288int Addressee::tempSyncStat() const 293int Addressee::tempSyncStat() const
289{ 294{
290 return mTempSyncStat; 295 return mData->mTempSyncStat;
291} 296}
292 297
293QString Addressee::getID( const QString & prof) 298QString Addressee::getID( const QString & prof)
294{ 299{
295 return KIdManager::getId ( mData->mExternalId, prof ); 300 return KIdManager::getId ( mData->mExternalId, prof );
296} 301}
297 302
298void Addressee::setCsum( const QString & prof , const QString & id ) 303void Addressee::setCsum( const QString & prof , const QString & id )
299{ 304{
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}
303 310
304QString Addressee::getCsum( const QString & prof) 311QString Addressee::getCsum( const QString & prof)
305{ 312{
306 return KIdManager::getCsum ( mData->mExternalId, prof ); 313 return KIdManager::getCsum ( mData->mExternalId, prof );
307} 314}
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 0805458..bfb0840 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -823,13 +823,12 @@ class Addressee
823 */ 823 */
824 bool changed() const; 824 bool changed() const;
825 825
826 private: 826 private:
827 Addressee copy(); 827 Addressee copy();
828 void detach(); 828 void detach();
829 int mTempSyncStat;
830 829
831 struct AddresseeData; 830 struct AddresseeData;
832 mutable KSharedPtr<AddresseeData> mData; 831 mutable KSharedPtr<AddresseeData> mData;
833}; 832};
834 833
835QDataStream &operator<<( QDataStream &, const Addressee & ); 834QDataStream &operator<<( QDataStream &, const Addressee & );
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index ec47a4e..181a09e 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -162,13 +162,18 @@ bool StdAddressBook::save()
162 kdDebug(5700) << "StdAddressBook::save()" << endl; 162 kdDebug(5700) << "StdAddressBook::save()" << endl;
163 163
164 bool ok = true; 164 bool ok = true;
165 AddressBook *ab = self(); 165 AddressBook *ab = self();
166 166
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;
170 KRES::Manager<Resource> *manager = ab->resourceManager(); 175 KRES::Manager<Resource> *manager = ab->resourceManager();
171 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 176 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
172 if ( !(*it)->readOnly() && (*it)->isOpen() ) { 177 if ( !(*it)->readOnly() && (*it)->isOpen() ) {
173 Ticket *ticket = ab->requestSaveTicket( *it ); 178 Ticket *ticket = ab->requestSaveTicket( *it );
174// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); 179// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 8776b53..56f6af2 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2523,13 +2523,13 @@ KABC::Addressee KABCore::getLastSyncAddressee()
2523 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2523 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2524 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2524 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2525 if (lse.isEmpty()) { 2525 if (lse.isEmpty()) {
2526 qDebug("Creating new last-syncAddressee "); 2526 qDebug("Creating new last-syncAddressee ");
2527 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2527 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
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: ";
2531 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2531 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2532 lse.setRevision( mLastAddressbookSync ); 2532 lse.setRevision( mLastAddressbookSync );
2533 lse.setCategories( i18n("SyncEvent") ); 2533 lse.setCategories( i18n("SyncEvent") );
2534 mAddressBook->insertAddressee( lse ); 2534 mAddressBook->insertAddressee( lse );
2535 } 2535 }
@@ -2549,21 +2549,23 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2549 // 2 take remote 2549 // 2 take remote
2550 // 3 cancel 2550 // 3 cancel
2551 QDateTime lastSync = mLastAddressbookSync; 2551 QDateTime lastSync = mLastAddressbookSync;
2552 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2552 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2553 bool remCh, locCh; 2553 bool remCh, locCh;
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 );
2565 if ( !remCh ) 2567 if ( !remCh )
2566 remote->setRevision( lastSync.addDays( -1 ) ); 2568 remote->setRevision( lastSync.addDays( -1 ) );
2567 } else { 2569 } else {
2568 //qDebug(" not loc changed "); 2570 //qDebug(" not loc changed ");
2569 lastSync = local->revision().addDays( 1 ); 2571 lastSync = local->revision().addDays( 1 );
@@ -2787,15 +2789,15 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2787 ++changedLocal; 2789 ++changedLocal;
2788 } 2790 }
2789 } 2791 }
2790 } else { // no conflict 2792 } else { // no conflict
2791 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2793 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
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;
2797 } else { 2799 } else {
2798 inR.setRevision( modifiedCalendar ); 2800 inR.setRevision( modifiedCalendar );
2799 remote->insertAddressee( inR, false ); 2801 remote->insertAddressee( inR, false );
2800 inL = inR; 2802 inL = inR;
2801 inL.setResource( 0 ); 2803 inL.setResource( 0 );
@@ -2817,31 +2819,28 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2817 } 2819 }
2818 } 2820 }
2819 } 2821 }
2820 ++incCounter; 2822 ++incCounter;
2821 } 2823 }
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;
2825 bar.setCaption (i18n("Add / remove addressees") ); 2827 bar.setCaption (i18n("Add / remove addressees") );
2826 bar.setTotalSteps ( el.count() ) ; 2828 bar.setTotalSteps ( el.count() ) ;
2827 bar.show(); 2829 bar.show();
2828 incCounter = 0; 2830 incCounter = 0;
2829 while ( incCounter < el.count()) { 2831 while ( incCounter < el.count()) {
2830
2831 qApp->processEvents(); 2832 qApp->processEvents();
2832 if ( ! bar.isVisible() ) 2833 if ( ! bar.isVisible() )
2833 return false; 2834 return false;
2834 if ( incCounter % modulo == 0 ) 2835 if ( incCounter % modulo == 0 )
2835 bar.setProgress( incCounter ); 2836 bar.setProgress( incCounter );
2836 uid = el[ incCounter ]; 2837 uid = el[ incCounter ];
2837 bool skipIncidence = false; 2838 bool skipIncidence = false;
2838 if ( uid.left(19) == QString("last-syncAddressee-") ) 2839 if ( uid.left(19) == QString("last-syncAddressee-") )
2839 skipIncidence = true; 2840 skipIncidence = true;
2840 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2841 skipIncidence = true;
2842 if ( !skipIncidence ) { 2841 if ( !skipIncidence ) {
2843 inL = local->findByUid( uid ); 2842 inL = local->findByUid( uid );
2844 inR = remote->findByUid( uid ); 2843 inR = remote->findByUid( uid );
2845 if ( inR.isEmpty() ) { 2844 if ( inR.isEmpty() ) {
2846 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2845 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2847 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 2846 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
@@ -2849,13 +2848,12 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2849 local->removeAddressee( inL ); 2848 local->removeAddressee( inL );
2850 ++deletedAddresseeL; 2849 ++deletedAddresseeL;
2851 } else { 2850 } else {
2852 if ( ! KABPrefs::instance()->mWriteBackExistingOnly ) { 2851 if ( ! KABPrefs::instance()->mWriteBackExistingOnly ) {
2853 inL.removeID(mCurrentSyncDevice ); 2852 inL.removeID(mCurrentSyncDevice );
2854 ++addedAddresseeR; 2853 ++addedAddresseeR;
2855 //qDebug("remote added Incidence %s ", inL.summary().latin1());
2856 inL.setRevision( modifiedCalendar ); 2854 inL.setRevision( modifiedCalendar );
2857 local->insertAddressee( inL, false ); 2855 local->insertAddressee( inL, false );
2858 inR = inL; 2856 inR = inL;
2859 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 2857 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
2860 inR.setResource( 0 ); 2858 inR.setResource( 0 );
2861 remote->insertAddressee( inR, false ); 2859 remote->insertAddressee( inR, false );
@@ -2892,12 +2890,14 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2892 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2890 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2893 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2891 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2894 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2892 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2895 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2893 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2896 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2894 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2897 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2895 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2896 addresseeRSync.setNote( "" ) ;
2897 addresseeLSync.setNote( "" );
2898 2898
2899 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2899 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2900 remote->insertAddressee( addresseeRSync, false ); 2900 remote->insertAddressee( addresseeRSync, false );
2901 local->insertAddressee( addresseeLSync, false ); 2901 local->insertAddressee( addresseeLSync, false );
2902 QString mes; 2902 QString mes;
2903 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"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2903 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"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
@@ -2934,12 +2934,13 @@ bool KABCore::syncAB(QString filename, int mode)
2934 } 2934 }
2935 } 2935 }
2936 external = ! found; 2936 external = ! found;
2937 } 2937 }
2938 2938
2939 if ( external ) { 2939 if ( external ) {
2940 qDebug("**********Setting vcf mode to external ");
2940 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2941 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2941 AddressBook::Iterator it; 2942 AddressBook::Iterator it;
2942 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2943 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2943 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2944 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2944 (*it).computeCsum( mCurrentSyncDevice ); 2945 (*it).computeCsum( mCurrentSyncDevice );
2945 } 2946 }
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 56b3fb0..0c75632 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -732,12 +732,14 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
732 //if ( remCh ) 732 //if ( remCh )
733 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 733 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
734 locCh = ( local->lastModified() > mLastCalendarSync ); 734 locCh = ( local->lastModified() > mLastCalendarSync );
735 if ( !remCh && ! locCh ) { 735 if ( !remCh && ! locCh ) {
736 //qDebug("both not changed "); 736 //qDebug("both not changed ");
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 {
739 if ( locCh ) { 741 if ( locCh ) {
740 //qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1()); 742 //qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1());
741 lastSync = local->lastModified().addDays( -1 ); 743 lastSync = local->lastModified().addDays( -1 );
742 if ( !remCh ) 744 if ( !remCh )
743 remote->setLastModified( lastSync.addDays( -1 ) ); 745 remote->setLastModified( lastSync.addDays( -1 ) );