-rw-r--r-- | kaddressbook/kabcore.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 6e482b5..e6bdde9 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2241,9 +2241,9 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString | |||
2241 | preferredEmailList.append((*it).preferredEmail()); | 2241 | preferredEmailList.append((*it).preferredEmail()); |
2242 | assembledNameList.append((*it).assembledName()); | 2242 | assembledNameList.append((*it).assembledName()); |
2243 | uidList.append((*it).uid()); | 2243 | uidList.append((*it).uid()); |
2244 | 2244 | ||
2245 | qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2245 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2246 | } | 2246 | } |
2247 | } | 2247 | } |
2248 | 2248 | ||
2249 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2249 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
@@ -2253,9 +2253,9 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString | |||
2253 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2253 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2254 | */ | 2254 | */ |
2255 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2255 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2256 | { | 2256 | { |
2257 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2257 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2258 | 2258 | ||
2259 | QString foundUid = QString::null; | 2259 | QString foundUid = QString::null; |
2260 | if ( ! uid.isEmpty() ) { | 2260 | if ( ! uid.isEmpty() ) { |
2261 | Addressee adrr = mAddressBook->findByUid( uid ); | 2261 | Addressee adrr = mAddressBook->findByUid( uid ); |
@@ -2288,9 +2288,9 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses | |||
2288 | namelist = mAddressBook->findByName( name ); | 2288 | namelist = mAddressBook->findByName( name ); |
2289 | 2289 | ||
2290 | if (!email.isEmpty()) | 2290 | if (!email.isEmpty()) |
2291 | emaillist = mAddressBook->findByEmail( email ); | 2291 | emaillist = mAddressBook->findByEmail( email ); |
2292 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2292 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2293 | //check if we have a match in Namelist and Emaillist | 2293 | //check if we have a match in Namelist and Emaillist |
2294 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2294 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2295 | foundUid = emaillist[0].uid(); | 2295 | foundUid = emaillist[0].uid(); |
2296 | } | 2296 | } |
@@ -2405,26 +2405,26 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i | |||
2405 | 2405 | ||
2406 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2406 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2407 | bool remCh, locCh; | 2407 | bool remCh, locCh; |
2408 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 2408 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
2409 | qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 2409 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
2410 | locCh = ( localMod > mLastAddressbookSync ); | 2410 | locCh = ( localMod > mLastAddressbookSync ); |
2411 | if ( !remCh && ! locCh ) { | 2411 | if ( !remCh && ! locCh ) { |
2412 | qDebug("both not changed "); | 2412 | //qDebug("both not changed "); |
2413 | lastSync = localMod.addDays(1); | 2413 | lastSync = localMod.addDays(1); |
2414 | if ( mode <= SYNC_PREF_ASK ) | 2414 | if ( mode <= SYNC_PREF_ASK ) |
2415 | return 0; | 2415 | return 0; |
2416 | } else { | 2416 | } else { |
2417 | if ( locCh ) { | 2417 | if ( locCh ) { |
2418 | qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2418 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2419 | lastSync = localMod.addDays( -1 ); | 2419 | lastSync = localMod.addDays( -1 ); |
2420 | if ( !remCh ) | 2420 | if ( !remCh ) |
2421 | remoteMod =( lastSync.addDays( -1 ) ); | 2421 | remoteMod =( lastSync.addDays( -1 ) ); |
2422 | } else { | 2422 | } else { |
2423 | qDebug(" not loc changed "); | 2423 | //qDebug(" not loc changed "); |
2424 | lastSync = localMod.addDays( 1 ); | 2424 | lastSync = localMod.addDays( 1 ); |
2425 | if ( remCh ) { | 2425 | if ( remCh ) { |
2426 | qDebug("rem changed "); | 2426 | //qDebug("rem changed "); |
2427 | remoteMod =( lastSync.addDays( 1 ) ); | 2427 | remoteMod =( lastSync.addDays( 1 ) ); |
2428 | } | 2428 | } |
2429 | 2429 | ||
2430 | } | 2430 | } |
@@ -2436,15 +2436,15 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i | |||
2436 | if ( localMod == remoteMod ) | 2436 | if ( localMod == remoteMod ) |
2437 | return 0; | 2437 | return 0; |
2438 | 2438 | ||
2439 | } | 2439 | } |
2440 | qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); | 2440 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); |
2441 | qDebug("lastsync %s ", lastSync.toString().latin1() ); | 2441 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); |
2442 | //full = true; //debug only | 2442 | //full = true; //debug only |
2443 | if ( full ) { | 2443 | if ( full ) { |
2444 | bool equ = ( (*local) == (*remote) ); | 2444 | bool equ = ( (*local) == (*remote) ); |
2445 | if ( equ ) { | 2445 | if ( equ ) { |
2446 | qDebug("equal "); | 2446 | //qDebug("equal "); |
2447 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2447 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2448 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 2448 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
2449 | } | 2449 | } |
2450 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 2450 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
@@ -2555,9 +2555,9 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2555 | } else { | 2555 | } else { |
2556 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2556 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2557 | addresseeRSync = addresseeLSync ; | 2557 | addresseeRSync = addresseeLSync ; |
2558 | } else { | 2558 | } else { |
2559 | qDebug("FULLDATE 1"); | 2559 | //qDebug("FULLDATE 1"); |
2560 | fullDateRange = true; | 2560 | fullDateRange = true; |
2561 | Addressee newAdd; | 2561 | Addressee newAdd; |
2562 | addresseeRSync = newAdd; | 2562 | addresseeRSync = newAdd; |
2563 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); | 2563 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); |
@@ -2566,18 +2566,18 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2566 | addresseeRSync.setCategories( i18n("SyncAddressee") ); | 2566 | addresseeRSync.setCategories( i18n("SyncAddressee") ); |
2567 | } | 2567 | } |
2568 | } | 2568 | } |
2569 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { | 2569 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { |
2570 | qDebug("FULLDATE 2"); | 2570 | // qDebug("FULLDATE 2"); |
2571 | fullDateRange = true; | 2571 | fullDateRange = true; |
2572 | } | 2572 | } |
2573 | if ( ! fullDateRange ) { | 2573 | if ( ! fullDateRange ) { |
2574 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { | 2574 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { |
2575 | 2575 | ||
2576 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); | 2576 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); |
2577 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); | 2577 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); |
2578 | fullDateRange = true; | 2578 | fullDateRange = true; |
2579 | qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); | 2579 | //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); |
2580 | } | 2580 | } |
2581 | } | 2581 | } |
2582 | // fullDateRange = true; // debug only! | 2582 | // fullDateRange = true; // debug only! |
2583 | if ( fullDateRange ) | 2583 | if ( fullDateRange ) |
@@ -2855,8 +2855,9 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
2855 | } | 2855 | } |
2856 | setModified(); | 2856 | setModified(); |
2857 | 2857 | ||
2858 | } | 2858 | } |
2859 | abLocal.removeResources(); | ||
2859 | if ( syncOK ) | 2860 | if ( syncOK ) |
2860 | mViewManager->refreshView(); | 2861 | mViewManager->refreshView(); |
2861 | return syncOK; | 2862 | return syncOK; |
2862 | 2863 | ||
@@ -2893,8 +2894,9 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource) | |||
2893 | } else | 2894 | } else |
2894 | message( i18n("Sync cancelled or failed.") ); | 2895 | message( i18n("Sync cancelled or failed.") ); |
2895 | setModified(); | 2896 | setModified(); |
2896 | } | 2897 | } |
2898 | abLocal.removeResources(); | ||
2897 | if ( syncOK ) | 2899 | if ( syncOK ) |
2898 | mViewManager->refreshView(); | 2900 | mViewManager->refreshView(); |
2899 | disableBR( false ); | 2901 | disableBR( false ); |
2900 | return syncOK; | 2902 | return syncOK; |
@@ -2932,8 +2934,9 @@ bool KABCore::syncPhone() | |||
2932 | } | 2934 | } |
2933 | } | 2935 | } |
2934 | setModified(); | 2936 | setModified(); |
2935 | } | 2937 | } |
2938 | abLocal.removeResources(); | ||
2936 | if ( syncOK ) | 2939 | if ( syncOK ) |
2937 | mViewManager->refreshView(); | 2940 | mViewManager->refreshView(); |
2938 | return syncOK; | 2941 | return syncOK; |
2939 | } | 2942 | } |