author | zautrix <zautrix> | 2004-09-18 17:25:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-18 17:25:46 (UTC) |
commit | 3f16c7aa0ab6badf304c537a6981ece743138821 (patch) (side-by-side diff) | |
tree | 1dda326a1025477c7dd1a284609fa108da4e2e1d | |
parent | a355a58898d0d08d797f872751254cfa958387c1 (diff) | |
download | kdepimpi-3f16c7aa0ab6badf304c537a6981ece743138821.zip kdepimpi-3f16c7aa0ab6badf304c537a6981ece743138821.tar.gz kdepimpi-3f16c7aa0ab6badf304c537a6981ece743138821.tar.bz2 |
sync fixes
-rw-r--r-- | kabc/addressbook.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 20 |
2 files changed, 18 insertions, 11 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index d03dea3..16e1653 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -449,8 +449,11 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev ) { Addressee::List::Iterator it; for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { if ( a.uid() == (*it).uid() ) { + if ( setRev && (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { + return; + } bool changed = false; Addressee addr = a; if ( addr != (*it) ) changed = true; @@ -460,8 +463,9 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev ) (*it).setResource( standardResource() ); if ( changed ) { if ( setRev ) { + // get rid of micro seconds QDateTime dt = QDateTime::currentDateTime(); QTime t = dt.time(); dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); @@ -524,9 +528,9 @@ Addressee::List AddressBook::getExternLastSyncAddressees() Addressee::List results; Iterator it; for ( it = begin(); it != end(); ++it ) { - if ( (*it).uid().left( 20 ) == "last-syncAddressee-" ) { + if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { if ( (*it).familyName().left(3) == "E: " ) results.append( *it ); } } @@ -554,9 +558,10 @@ QStringList AddressBook:: uidList() Addressee::List AddressBook::allAddressees() { - return d->mAddressees; + return d->mAddressees; + } Addressee::List AddressBook::findByName( const QString &name ) { diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 215ce83..74c10d2 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2527,9 +2527,9 @@ KABC::Addressee KABCore::getLastSyncAddressee() lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); QString sum = ""; if ( KABPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) sum = "E: "; - lse.setFamilyName(sum+mCurrentSyncDevice + i18n(" - sync event")); + lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); lse.setRevision( mLastAddressbookSync ); lse.setCategories( i18n("SyncEvent") ); mAddressBook->insertAddressee( lse ); } @@ -2762,9 +2762,9 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo if ( incCounter % modulo == 0 ) bar.setProgress( incCounter ); uid = er[ incCounter ]; bool skipIncidence = false; - if ( uid.left(20) == QString("last-syncAddressee-") ) + if ( uid.left(19) == QString("last-syncAddressee-") ) skipIncidence = true; QString idS; qApp->processEvents(); if ( !skipIncidence ) { @@ -2849,9 +2849,9 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo if ( incCounter % modulo == 0 ) bar.setProgress( incCounter ); uid = el[ incCounter ]; bool skipIncidence = false; - if ( uid.left(20) == QString("last-syncAddressee-") ) + if ( uid.left(19) == QString("last-syncAddressee-") ) skipIncidence = true; if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) skipIncidence = true; if ( !skipIncidence ) { @@ -2896,27 +2896,29 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } ++incCounter; } el.clear(); - - - bar.hide(); mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); // get rid of micro seconds QTime t = mLastAddressbookSync.time(); mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); addresseeLSync.setRevision( mLastAddressbookSync ); addresseeRSync.setRevision( mLastAddressbookSync ); - addresseeRSync.setGivenName( i18n("Remote from: ")+mCurrentSyncName ) ; - addresseeLSync.setGivenName(i18n("Local from: ") + mCurrentSyncName ); + addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; + addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); + addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; + addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); + addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; + addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); + if ( mGlobalSyncMode == SYNC_MODE_NORMAL) remote->insertAddressee( addresseeRSync, false ); local->insertAddressee( addresseeLSync, false ); QString mes; 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 ); if ( KABPrefs::instance()->mShowSyncSummary ) { - KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); + KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); } qDebug( mes ); return syncOK; } |