summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/plugins/file/resourcefile.cpp3
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.cpp48
-rw-r--r--kabc/plugins/sharpdtm/sharpdtmconverter.cpp17
-rw-r--r--kaddressbook/kabcore.cpp5
-rw-r--r--korganizer/calendarview.cpp4
5 files changed, 70 insertions, 7 deletions
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index b8c32d5..6cd63fd 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -165,2 +165,3 @@ bool ResourceFile::doOpen()
QFile file( mFileName );
+ qDebug("ResourceFile::openfile %s ", mFileName.latin1());
@@ -196,3 +197,3 @@ bool ResourceFile::load()
-
+ qDebug("ResourceFile::loadfile %s ", mFileName.latin1());
QFile file( mFileName );
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
index 48d3985..437bda8 100644
--- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
+++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
@@ -206,2 +206,5 @@ bool ResourceSharpDTM::save( Ticket *ticket )
KABC::Addressee::List changedAddressees;
+ typedef QMap<int,QString> AddresseeMap;
+ AddresseeMap map;
+ CardId id ;
@@ -211,3 +214,2 @@ bool ResourceSharpDTM::save( Ticket *ticket )
QString uid = (*it).originalExternalUID();
- CardId id ;
bool res;
@@ -225,2 +227,9 @@ bool ResourceSharpDTM::save( Ticket *ticket )
{
+ res = mAccess->finishEditCard(&id);
+ //(*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
+ //(*it).setExternalUID( QString::number( id ) );
+ //(*it).setOriginalExternalUID( QString::number( id ) );
+ map.insert(id,(*it).uid());
+
+#if 0
KABC::Addressee addressee;
@@ -228,3 +237,3 @@ bool ResourceSharpDTM::save( Ticket *ticket )
addressee.setUid((*it).uid() );
- addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
+ (it*).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
res = mAccess->finishEditCard(&id);
@@ -234,2 +243,3 @@ bool ResourceSharpDTM::save( Ticket *ticket )
changedAddressees.append( addressee );
+#endif
@@ -263,2 +273,7 @@ bool ResourceSharpDTM::save( Ticket *ticket )
{
+ res = mAccess->finishEditCard(&id);
+ //(*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM );
+ map.insert(id,(*it).uid());
+
+#if 0
KABC::Addressee addressee;
@@ -269,2 +284,3 @@ bool ResourceSharpDTM::save( Ticket *ticket )
res = mAccess->finishEditCard(&id);
+#endif
if (res == false)
@@ -283,5 +299,31 @@ bool ResourceSharpDTM::save( Ticket *ticket )
}
+ AddresseeMap::Iterator itam;
+ res;
+ for ( res=mAccess->first(); res == true; res=mAccess->next())
+ {
+ id = mAccess->cardId();
+ int idint = id;
+ itam = map.find( idint );
+ if ( itam != map.end() ) {
+ KABC::Addressee addressee;
+ qDebug("found change %d %s ", idint, itam.data().latin1());
+ res = mConverter->sharpToAddressee( id, mAccess, addressee );
+
+ if ( !addressee.isEmpty() && res )
+ {
+ addressee.setResource( this );
+ addressee.setUid( itam.data() );
+ addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
+ addressBook()->insertAddressee( addressee , false );
+ }
+ }
+ }
+#if 0
KABC::Addressee::List::Iterator it2;
- for ( it2 = changedAddressees.begin(); it2 != changedAddressees.end(); ++it2 )
+ for ( it2 = changedAddressees.begin(); it2 != changedAddressees.end(); ++it2 ) {
+ (*it2).computeCsum( "Sharp_DTM" );
+ qDebug("CSUM: %s ",(*it2).getCsum( "Sharp_DTM" ).latin1() );
addressBook()->insertAddressee((*it2));
+ }
+#endif
//US mAccess->save();
diff --git a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp
index f3bf2c5..fccf625 100644
--- a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp
+++ b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp
@@ -288,4 +288,15 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da
//qDebug("SharpDTMConverter::addresseeToSharp check if the fileAs transformation works!!\n%s",addr.formattedName().latin1() );
- database->writeField(ZdbAdrs::FileAs, addr.formattedName());
- database->writeField(ZdbAdrs::FullName, addr.formattedName());
+ QString formattedName = addr.formattedName();
+ if ( formattedName.isEmpty() ) {
+ if ( !addr.familyName().isEmpty() ) {
+ formattedName = addr.familyName();
+ if ( !addr.givenName().isEmpty() ) {
+ formattedName += ", ";
+ formattedName += addr.givenName();
+ }
+ } else
+ formattedName = addr.givenName();
+ }
+ database->writeField(ZdbAdrs::FileAs, formattedName);
+ database->writeField(ZdbAdrs::FullName, formattedName);
@@ -351,3 +362,3 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da
PhoneNumber mobile = addr.phoneNumber( PhoneNumber::Cell );
- if (!businessmobile.number().isEmpty()) {
+ if (! mobile.number().isEmpty()) {
if ( ! cellHome )
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index c1ead9d..c2f031a 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2771,2 +2771,3 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
+ inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
local->insertAddressee( inL, false );
@@ -2798,2 +2799,6 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
inL.setIDStr( idS );
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
+ inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
+ inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
+ }
inL.setResource( 0 );
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index bbed05b..7fae4a9 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1051,2 +1051,6 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
inL->setIDStr( idS );
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
+ inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
+ inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
+ }
local->addIncidence( inL );