-rw-r--r-- | kabc/addressee.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 16 |
2 files changed, 12 insertions, 13 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index d6b70c4..c34f671 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -247,86 +247,85 @@ void Addressee::computeCsum(const QString &dev) | |||
247 | uint iii; | 247 | uint iii; |
248 | for ( iii = 0; iii < t.count(); ++iii) | 248 | for ( iii = 0; iii < t.count(); ++iii) |
249 | l.append( t[iii] ); | 249 | l.append( t[iii] ); |
250 | t = mData->emails; | 250 | t = mData->emails; |
251 | t.sort(); | 251 | t.sort(); |
252 | for ( iii = 0; iii < t.count(); ++iii) | 252 | for ( iii = 0; iii < t.count(); ++iii) |
253 | l.append( t[iii] ); | 253 | l.append( t[iii] ); |
254 | t = mData->categories; | 254 | t = mData->categories; |
255 | t.sort(); | 255 | t.sort(); |
256 | for ( iii = 0; iii < t.count(); ++iii) | 256 | for ( iii = 0; iii < t.count(); ++iii) |
257 | l.append( t[iii] ); | 257 | l.append( t[iii] ); |
258 | t = mData->custom; | 258 | t = mData->custom; |
259 | t.sort(); | 259 | t.sort(); |
260 | for ( iii = 0; iii < t.count(); ++iii) | 260 | for ( iii = 0; iii < t.count(); ++iii) |
261 | l.append( t[iii] ); | 261 | l.append( t[iii] ); |
262 | KABC::Address::List::Iterator addressIter; | 262 | KABC::Address::List::Iterator addressIter; |
263 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 263 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
264 | ++addressIter ) { | 264 | ++addressIter ) { |
265 | t = (*addressIter).asList(); | 265 | t = (*addressIter).asList(); |
266 | t.sort(); | 266 | t.sort(); |
267 | for ( iii = 0; iii < t.count(); ++iii) | 267 | for ( iii = 0; iii < t.count(); ++iii) |
268 | l.append( t[iii] ); | 268 | l.append( t[iii] ); |
269 | } | 269 | } |
270 | uint cs = getCsum4List(l); | 270 | uint cs = getCsum4List(l); |
271 | qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 271 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
272 | setCsum( dev, QString::number (cs )); | 272 | setCsum( dev, QString::number (cs )); |
273 | } | 273 | } |
274 | void Addressee::removeID(const QString &prof) | 274 | void Addressee::removeID(const QString &prof) |
275 | { | 275 | { |
276 | detach(); | 276 | detach(); |
277 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 277 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
278 | 278 | ||
279 | } | 279 | } |
280 | void Addressee::setID( const QString & prof , const QString & id ) | 280 | void Addressee::setID( const QString & prof , const QString & id ) |
281 | { | 281 | { |
282 | detach(); | 282 | detach(); |
283 | qDebug("setID1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | ||
284 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 283 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
285 | qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 284 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
286 | } | 285 | } |
287 | void Addressee::setTempSyncStat( int id ) | 286 | void Addressee::setTempSyncStat( int id ) |
288 | { | 287 | { |
289 | if ( mData->mTempSyncStat == id ) return; | 288 | if ( mData->mTempSyncStat == id ) return; |
290 | detach(); | 289 | detach(); |
291 | mData->mTempSyncStat = id; | 290 | mData->mTempSyncStat = id; |
292 | } | 291 | } |
293 | int Addressee::tempSyncStat() const | 292 | int Addressee::tempSyncStat() const |
294 | { | 293 | { |
295 | return mData->mTempSyncStat; | 294 | return mData->mTempSyncStat; |
296 | } | 295 | } |
297 | 296 | ||
298 | QString Addressee::getID( const QString & prof) | 297 | QString Addressee::getID( const QString & prof) |
299 | { | 298 | { |
300 | return KIdManager::getId ( mData->mExternalId, prof ); | 299 | return KIdManager::getId ( mData->mExternalId, prof ); |
301 | } | 300 | } |
302 | 301 | ||
303 | void Addressee::setCsum( const QString & prof , const QString & id ) | 302 | void Addressee::setCsum( const QString & prof , const QString & id ) |
304 | { | 303 | { |
305 | detach(); | 304 | detach(); |
306 | qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 305 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
307 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 306 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
308 | qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 307 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
309 | } | 308 | } |
310 | 309 | ||
311 | QString Addressee::getCsum( const QString & prof) | 310 | QString Addressee::getCsum( const QString & prof) |
312 | { | 311 | { |
313 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 312 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
314 | } | 313 | } |
315 | 314 | ||
316 | void Addressee::setIDStr( const QString & s ) | 315 | void Addressee::setIDStr( const QString & s ) |
317 | { | 316 | { |
318 | detach(); | 317 | detach(); |
319 | mData->mExternalId = s; | 318 | mData->mExternalId = s; |
320 | } | 319 | } |
321 | 320 | ||
322 | QString Addressee::IDStr() const | 321 | QString Addressee::IDStr() const |
323 | { | 322 | { |
324 | return mData->mExternalId; | 323 | return mData->mExternalId; |
325 | } | 324 | } |
326 | 325 | ||
327 | 326 | ||
328 | void Addressee::setUid( const QString &id ) | 327 | void Addressee::setUid( const QString &id ) |
329 | { | 328 | { |
330 | if ( id == mData->uid ) return; | 329 | if ( id == mData->uid ) return; |
331 | detach(); | 330 | detach(); |
332 | mData->empty = false; | 331 | mData->empty = false; |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 56f6af2..fa0c51f 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2531,59 +2531,59 @@ KABC::Addressee KABCore::getLastSyncAddressee() | |||
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 | } |
2536 | return lse; | 2536 | return lse; |
2537 | } | 2537 | } |
2538 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) | 2538 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) |
2539 | { | 2539 | { |
2540 | 2540 | ||
2541 | //void setZaurusId(int id); | 2541 | //void setZaurusId(int id); |
2542 | // int zaurusId() const; | 2542 | // int zaurusId() const; |
2543 | // void setZaurusUid(int id); | 2543 | // void setZaurusUid(int id); |
2544 | // int zaurusUid() const; | 2544 | // int zaurusUid() const; |
2545 | // void setZaurusStat(int id); | 2545 | // void setZaurusStat(int id); |
2546 | // int zaurusStat() const; | 2546 | // int zaurusStat() const; |
2547 | // 0 equal | 2547 | // 0 equal |
2548 | // 1 take local | 2548 | // 1 take local |
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 | |
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 ) | 2561 | if ( mode <= SYNC_PREF_ASK ) |
2562 | return 0; | 2562 | return 0; |
2563 | } else { | 2563 | } else { |
2564 | if ( locCh ) { | 2564 | if ( locCh ) { |
2565 | qDebug("loc changed %s %s", local->revision().toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2565 | //qDebug("loc changed %s %s", local->revision().toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2566 | lastSync = local->revision().addDays( -1 ); | 2566 | lastSync = local->revision().addDays( -1 ); |
2567 | if ( !remCh ) | 2567 | if ( !remCh ) |
2568 | remote->setRevision( lastSync.addDays( -1 ) ); | 2568 | remote->setRevision( lastSync.addDays( -1 ) ); |
2569 | } else { | 2569 | } else { |
2570 | //qDebug(" not loc changed "); | 2570 | //qDebug(" not loc changed "); |
2571 | lastSync = local->revision().addDays( 1 ); | 2571 | lastSync = local->revision().addDays( 1 ); |
2572 | if ( remCh ) | 2572 | if ( remCh ) |
2573 | remote->setRevision( lastSync.addDays( 1 ) ); | 2573 | remote->setRevision( lastSync.addDays( 1 ) ); |
2574 | 2574 | ||
2575 | } | 2575 | } |
2576 | } | 2576 | } |
2577 | full = true; | 2577 | full = true; |
2578 | if ( mode < SYNC_PREF_ASK ) | 2578 | if ( mode < SYNC_PREF_ASK ) |
2579 | mode = SYNC_PREF_ASK; | 2579 | mode = SYNC_PREF_ASK; |
2580 | } else { | 2580 | } else { |
2581 | if ( local->revision() == remote->revision() ) | 2581 | if ( local->revision() == remote->revision() ) |
2582 | return 0; | 2582 | return 0; |
2583 | 2583 | ||
2584 | } | 2584 | } |
2585 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 2585 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
2586 | 2586 | ||
2587 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); | 2587 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); |
2588 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); | 2588 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); |
2589 | //full = true; //debug only | 2589 | //full = true; //debug only |
@@ -2705,49 +2705,49 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2705 | if ( ! fullDateRange ) { | 2705 | if ( ! fullDateRange ) { |
2706 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { | 2706 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { |
2707 | 2707 | ||
2708 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); | 2708 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); |
2709 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); | 2709 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); |
2710 | fullDateRange = true; | 2710 | fullDateRange = true; |
2711 | qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); | 2711 | qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); |
2712 | } | 2712 | } |
2713 | } | 2713 | } |
2714 | // fullDateRange = true; // debug only! | 2714 | // fullDateRange = true; // debug only! |
2715 | if ( fullDateRange ) | 2715 | if ( fullDateRange ) |
2716 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); | 2716 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); |
2717 | else | 2717 | else |
2718 | mLastAddressbookSync = addresseeLSync.revision(); | 2718 | mLastAddressbookSync = addresseeLSync.revision(); |
2719 | // for resyncing if own file has changed | 2719 | // for resyncing if own file has changed |
2720 | // PENDING fixme later when implemented | 2720 | // PENDING fixme later when implemented |
2721 | #if 0 | 2721 | #if 0 |
2722 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 2722 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
2723 | mLastAddressbookSync = loadedFileVersion; | 2723 | mLastAddressbookSync = loadedFileVersion; |
2724 | qDebug("setting mLastAddressbookSync "); | 2724 | qDebug("setting mLastAddressbookSync "); |
2725 | } | 2725 | } |
2726 | #endif | 2726 | #endif |
2727 | 2727 | ||
2728 | //qDebug("*************************** "); | 2728 | //qDebug("*************************** "); |
2729 | qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); | 2729 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); |
2730 | QStringList er = remote->uidList(); | 2730 | QStringList er = remote->uidList(); |
2731 | Addressee inR ;//= er.first(); | 2731 | Addressee inR ;//= er.first(); |
2732 | Addressee inL; | 2732 | Addressee inL; |
2733 | QProgressBar bar( er.count(),0 ); | 2733 | QProgressBar bar( er.count(),0 ); |
2734 | bar.setCaption (i18n("Syncing - close to abort!") ); | 2734 | bar.setCaption (i18n("Syncing - close to abort!") ); |
2735 | 2735 | ||
2736 | int w = 300; | 2736 | int w = 300; |
2737 | if ( QApplication::desktop()->width() < 320 ) | 2737 | if ( QApplication::desktop()->width() < 320 ) |
2738 | w = 220; | 2738 | w = 220; |
2739 | int h = bar.sizeHint().height() ; | 2739 | int h = bar.sizeHint().height() ; |
2740 | int dw = QApplication::desktop()->width(); | 2740 | int dw = QApplication::desktop()->width(); |
2741 | int dh = QApplication::desktop()->height(); | 2741 | int dh = QApplication::desktop()->height(); |
2742 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2742 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2743 | bar.show(); | 2743 | bar.show(); |
2744 | int modulo = (er.count()/10)+1; | 2744 | int modulo = (er.count()/10)+1; |
2745 | int incCounter = 0; | 2745 | int incCounter = 0; |
2746 | while ( incCounter < er.count()) { | 2746 | while ( incCounter < er.count()) { |
2747 | if ( ! bar.isVisible() ) | 2747 | if ( ! bar.isVisible() ) |
2748 | return false; | 2748 | return false; |
2749 | if ( incCounter % modulo == 0 ) | 2749 | if ( incCounter % modulo == 0 ) |
2750 | bar.setProgress( incCounter ); | 2750 | bar.setProgress( incCounter ); |
2751 | uid = er[ incCounter ]; | 2751 | uid = er[ incCounter ]; |
2752 | bool skipIncidence = false; | 2752 | bool skipIncidence = false; |
2753 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 2753 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
@@ -2896,88 +2896,88 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2896 | addresseeRSync.setNote( "" ) ; | 2896 | addresseeRSync.setNote( "" ) ; |
2897 | addresseeLSync.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 ); |
2904 | if ( KABPrefs::instance()->mShowSyncSummary ) { | 2904 | if ( KABPrefs::instance()->mShowSyncSummary ) { |
2905 | KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); | 2905 | KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); |
2906 | } | 2906 | } |
2907 | qDebug( mes ); | 2907 | qDebug( mes ); |
2908 | return syncOK; | 2908 | return syncOK; |
2909 | } | 2909 | } |
2910 | 2910 | ||
2911 | bool KABCore::syncAB(QString filename, int mode) | 2911 | bool KABCore::syncAB(QString filename, int mode) |
2912 | { | 2912 | { |
2913 | 2913 | ||
2914 | //pending prepare addresseeview for output | 2914 | //pending prepare addresseeview for output |
2915 | //pending detect, if remote file has REV field. if not switch to external sync | 2915 | //pending detect, if remote file has REV field. if not switch to external sync |
2916 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 2916 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
2917 | AddressBook abLocal(filename,"syncContact"); | 2917 | AddressBook abLocal(filename,"syncContact"); |
2918 | bool syncOK = false; | 2918 | bool syncOK = false; |
2919 | if ( abLocal.load() ) { | 2919 | if ( abLocal.load() ) { |
2920 | qDebug("AB loaded %s mode %d",filename.latin1(), mode ); | 2920 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); |
2921 | bool external = false; | 2921 | bool external = false; |
2922 | Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2922 | Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2923 | if ( ! lse.isEmpty() ) { | 2923 | if ( ! lse.isEmpty() ) { |
2924 | if ( lse.familyName().left(4) == "!E: " ) | 2924 | if ( lse.familyName().left(4) == "!E: " ) |
2925 | external = true; | 2925 | external = true; |
2926 | } else { | 2926 | } else { |
2927 | bool found = false; | 2927 | bool found = false; |
2928 | QDateTime dt( QDate( 2004,1,1)); | 2928 | QDateTime dt( QDate( 2004,1,1)); |
2929 | AddressBook::Iterator it; | 2929 | AddressBook::Iterator it; |
2930 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2930 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
2931 | if ( (*it).revision() != dt ) { | 2931 | if ( (*it).revision() != dt ) { |
2932 | found = true; | 2932 | found = true; |
2933 | break; | 2933 | break; |
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 | qDebug("Setting vcf mode to external "); |
2941 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2941 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2942 | AddressBook::Iterator it; | 2942 | AddressBook::Iterator it; |
2943 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2943 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
2944 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 2944 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
2945 | (*it).computeCsum( mCurrentSyncDevice ); | 2945 | (*it).computeCsum( mCurrentSyncDevice ); |
2946 | } | 2946 | } |
2947 | } | 2947 | } |
2948 | //AddressBook::Iterator it; | 2948 | //AddressBook::Iterator it; |
2949 | //QStringList vcards; | 2949 | //QStringList vcards; |
2950 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2950 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
2951 | // qDebug("Name %s ", (*it).familyName().latin1()); | 2951 | // qDebug("Name %s ", (*it).familyName().latin1()); |
2952 | //} | 2952 | //} |
2953 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 2953 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
2954 | if ( syncOK ) { | 2954 | if ( syncOK ) { |
2955 | if ( KABPrefs::instance()->mWriteBackFile ) | 2955 | if ( KABPrefs::instance()->mWriteBackFile ) |
2956 | { | 2956 | { |
2957 | if ( external ) | 2957 | if ( external ) |
2958 | abLocal.removeDeletedAddressees(); | 2958 | abLocal.removeDeletedAddressees(); |
2959 | qDebug("saving remote AB "); | 2959 | qDebug("Saving remote AB "); |
2960 | abLocal.saveAB(); | 2960 | abLocal.saveAB(); |
2961 | } | 2961 | } |
2962 | } | 2962 | } |
2963 | setModified(); | 2963 | setModified(); |
2964 | 2964 | ||
2965 | } | 2965 | } |
2966 | if ( syncOK ) | 2966 | if ( syncOK ) |
2967 | mViewManager->refreshView(); | 2967 | mViewManager->refreshView(); |
2968 | return syncOK; | 2968 | return syncOK; |
2969 | #if 0 | 2969 | #if 0 |
2970 | 2970 | ||
2971 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { | 2971 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { |
2972 | getEventViewerDialog()->setSyncMode( true ); | 2972 | getEventViewerDialog()->setSyncMode( true ); |
2973 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 2973 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
2974 | getEventViewerDialog()->setSyncMode( false ); | 2974 | getEventViewerDialog()->setSyncMode( false ); |
2975 | if ( syncOK ) { | 2975 | if ( syncOK ) { |
2976 | if ( KOPrefs::instance()->mWriteBackFile ) | 2976 | if ( KOPrefs::instance()->mWriteBackFile ) |
2977 | { | 2977 | { |
2978 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 2978 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
2979 | storage->save(); | 2979 | storage->save(); |
2980 | } | 2980 | } |
2981 | } | 2981 | } |
2982 | setModified(); | 2982 | setModified(); |
2983 | } | 2983 | } |