summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
authorzautrix <zautrix>2004-10-29 09:03:54 (UTC)
committer zautrix <zautrix>2004-10-29 09:03:54 (UTC)
commit6500d6ebb080f1de58fe676aa0a730d47fcf64f5 (patch) (side-by-side diff)
tree41841e05bf1e6b88e6e55f42011dce5f6bed85b4 /kabc/addressbook.cpp
parent41e3625b8c38ff45e70b59416a519d59a5f4d937 (diff)
downloadkdepimpi-6500d6ebb080f1de58fe676aa0a730d47fcf64f5.zip
kdepimpi-6500d6ebb080f1de58fe676aa0a730d47fcf64f5.tar.gz
kdepimpi-6500d6ebb080f1de58fe676aa0a730d47fcf64f5.tar.bz2
sync fixes
Diffstat (limited to 'kabc/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 6194d6d..4c4ae09 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -561,9 +561,8 @@ void AddressBook::removeSyncInfo( QString syncProfile)
}
if ( syncProfile.isEmpty() ) {
Iterator it = begin();
Iterator it2 ;
- QDateTime dt ( QDate( 2004,1,1) );
while ( it != end() ) {
if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
it2 = it;
//qDebug("removing %s ",(*it).uid().latin1() );
@@ -785,14 +784,9 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeRes
(*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 () ) );
- (*it).setRevision( dt );
+ (*it).setRevision( QDateTime::currentDateTime() );
}
(*it).setChanged( true );
}
@@ -814,14 +808,14 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeRes
}
}
}
if ( found )
- return;
+ return;
+
d->mAddressees.append( a );
Addressee& addr = d->mAddressees.last();
if ( addr.resource() == 0 )
addr.setResource( standardResource() );
-
addr.setChanged( true );
}
void AddressBook::removeAddressee( const Addressee &a )
@@ -858,15 +852,15 @@ void AddressBook::removeAddressee( const Addressee &a )
void AddressBook::removeSyncAddressees( bool removeDeleted )
{
Iterator it = begin();
Iterator it2 ;
- QDateTime dt ( QDate( 2004,1,1) );
+ QDateTime dt ( QDate( 2003,1,1) );
while ( it != end() ) {
(*it).setRevision( dt );
if (( *it).IDStr() != "changed" ) {
// "changed" is used for tagging changed addressees when syncing with KDE or OL
(*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
- (*it).setIDStr("");
+ (*it).setIDStr(":");
}
if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) {
it2 = it;
//qDebug("removing %s ",(*it).uid().latin1() );
@@ -877,10 +871,8 @@ void AddressBook::removeSyncAddressees( bool removeDeleted )
if ( removeDeleted ) {
// we have no postprocessing in the resource, we have to do it here
// we have to compute csum for all, because it could be the first sync
(*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
-
-
}
++it;
}
}
@@ -930,22 +922,24 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool
AddressBook::Iterator it;
for ( it = begin(); it != end(); ++it ) {
//qDebug("check uid %s ", (*it).uid().latin1() );
if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ||
- (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) {
+ (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ||
+ (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) {
Addressee ad = aBook->findByUid( ( (*it).uid() ));
if ( ad.isEmpty() ) {
qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1());
} else {
(*it).setIDStr(":");
- (*it).computeCsum( csd );
if ( setID ) {
if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID )
ad.setID( csd, (*it).externalUID() );
} else
ad.setID( csd, (*it).uid() );
+ (*it).computeCsum( csd );
ad.setCsum( csd, (*it).getCsum( csd ) );
- aBook->insertAddressee( ad );
+ //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() );
+ aBook->insertAddressee( ad , false);
}
}
}
}