summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore 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.cpp27
-rw-r--r--korganizer/calendarview.cpp2
6 files changed, 59 insertions, 28 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index ec9f893..46a9cf4 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -345,5 +345,10 @@ bool AddressBook::load()
Addressee::List::Iterator addrIt;
- for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt )
+ for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) {
(*addrIt).setChanged( false );
-
+ QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" );
+ if ( !id.isEmpty() ) {
+ //qDebug("setId aa %s ", id.latin1());
+ (*addrIt).setIDStr(id );
+ }
+ }
blockLSEchange = true;
@@ -368,3 +373,8 @@ bool AddressBook::saveAB()
deleteRemovedAddressees();
-
+ Iterator ait;
+ for ( ait = begin(); ait != end(); ++ait ) {
+ if ( !(*ait).IDStr().isEmpty() ) {
+ (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() );
+ }
+ }
KRES::Manager<Resource>::ActiveIterator it;
@@ -452,4 +462,6 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev )
if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) {
+ //qDebug("block insert ");
return;
}
+ //qDebug("inserting.... %s ",a.uid().latin1() );
bool found = false;
@@ -482,3 +494,3 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev )
} else {
- if ( (*it).uid() == QString("last-syncAddressee-") ) {
+ if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
QString name = (*it).uid().mid( 19 );
@@ -518,3 +530,3 @@ void AddressBook::removeAddressee( const Addressee &a )
} else {
- if ( (*it).uid() == QString("last-syncAddressee-") ) {
+ if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
QString name = (*it).uid().mid( 19 );
@@ -547,8 +559,13 @@ void AddressBook::removeDeletedAddressees()
(*it).setRevision( dt );
- if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
+ (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
+ (*it).setIDStr("");
+ if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE || (*it).uid().left( 19 ) == QString("last-syncAddressee-")) {
it2 = it;
+ //qDebug("removing %s ",(*it).uid().latin1() );
++it;
removeAddressee( it2 );
- } else
+ } else {
+ //qDebug("skipping %s ",(*it).uid().latin1() );
++it;
+ }
}
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 0f5d605..d6b70c4 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -81,3 +81,3 @@ struct Addressee::AddresseeData : public KShared
QStringList custom;
-
+ int mTempSyncStat;
Resource *resource;
@@ -96,3 +96,3 @@ Addressee::Addressee()
mData->revision = QDateTime ( QDate( 2004,1,1));
- mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
+ mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
}
@@ -106,3 +106,2 @@ Addressee::Addressee( const Addressee &a )
mData = a.mData;
- mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
}
@@ -270,3 +269,5 @@ void Addressee::computeCsum(const QString &dev)
}
- setCsum( dev, QString::number (getCsum4List(l)) );
+ uint cs = getCsum4List(l);
+ qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
+ setCsum( dev, QString::number (cs ));
}
@@ -281,3 +282,5 @@ void Addressee::setID( const QString & prof , const QString & id )
detach();
+ qDebug("setID1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
+ qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
}
@@ -285,3 +288,5 @@ void Addressee::setTempSyncStat( int id )
{
- mTempSyncStat = id;
+ if ( mData->mTempSyncStat == id ) return;
+ detach();
+ mData->mTempSyncStat = id;
}
@@ -289,3 +294,3 @@ int Addressee::tempSyncStat() const
{
- return mTempSyncStat;
+ return mData->mTempSyncStat;
}
@@ -300,3 +305,5 @@ void Addressee::setCsum( const QString & prof , const QString & id )
detach();
+ qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
+ qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
}
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 0805458..bfb0840 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -828,3 +828,2 @@ class Addressee
void detach();
- int mTempSyncStat;
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index ec47a4e..181a09e 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -167,3 +167,8 @@ bool StdAddressBook::save()
ab->deleteRemovedAddressees();
-
+ Iterator ait;
+ for ( ait = ab->begin(); ait != ab->end(); ++ait ) {
+ if ( !(*ait).IDStr().isEmpty() ) {
+ (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() );
+ }
+ }
KRES::Manager<Resource>::ActiveIterator it;
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 8776b53..56f6af2 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2528,3 +2528,3 @@ KABC::Addressee KABCore::getLastSyncAddressee()
QString sum = "";
- if ( KABPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
sum = "E: ";
@@ -2554,11 +2554,13 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
- //if ( remCh )
- //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
+ if ( remCh )
+ qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
locCh = ( local->revision() > mLastAddressbookSync );
if ( !remCh && ! locCh ) {
- //qDebug("both not changed ");
+ qDebug("both not changed ");
lastSync = local->revision().addDays(1);
+ if ( mode <= SYNC_PREF_ASK )
+ return 0;
} else {
if ( locCh ) {
- //qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1());
+ qDebug("loc changed %s %s", local->revision().toString().latin1(), mLastAddressbookSync.toString().latin1());
lastSync = local->revision().addDays( -1 );
@@ -2792,5 +2794,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
QString des = addresseeLSync.note();
- QString pref = "a";
- if ( des.find(pref+ inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
+ if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
+ remote->insertAddressee( inR, false );
++deletedAddresseeR;
@@ -2822,3 +2824,3 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
er.clear();
- QStringList el = remote->uidList();
+ QStringList el = local->uidList();
modulo = (el.count()/10)+1;
@@ -2829,3 +2831,2 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
while ( incCounter < el.count()) {
-
qApp->processEvents();
@@ -2839,4 +2840,2 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
skipIncidence = true;
- if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
- skipIncidence = true;
if ( !skipIncidence ) {
@@ -2853,4 +2852,3 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
inL.removeID(mCurrentSyncDevice );
- ++addedAddresseeR;
- //qDebug("remote added Incidence %s ", inL.summary().latin1());
+ ++addedAddresseeR;
inL.setRevision( modifiedCalendar );
@@ -2897,2 +2895,4 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
+ addresseeRSync.setNote( "" ) ;
+ addresseeLSync.setNote( "" );
@@ -2939,2 +2939,3 @@ bool KABCore::syncAB(QString filename, int mode)
if ( external ) {
+ qDebug("**********Setting vcf mode to external ");
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 56b3fb0..0c75632 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -737,2 +737,4 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
lastSync = local->lastModified().addDays(1);
+ if ( mode <= SYNC_PREF_ASK )
+ return 0;
} else {