summaryrefslogtreecommitdiffabout
path: root/kabc/plugins
authorzautrix <zautrix>2004-09-21 10:08:57 (UTC)
committer zautrix <zautrix>2004-09-21 10:08:57 (UTC)
commit19f445f0b6e7d4591db46b89e877ed9f4332ecd4 (patch) (unidiff)
treefd21a5dc32332060197d792552ef1eb469e92175 /kabc/plugins
parent1cf4cc6e7bf25ee309852c7c97155de86917289f (diff)
downloadkdepimpi-19f445f0b6e7d4591db46b89e877ed9f4332ecd4.zip
kdepimpi-19f445f0b6e7d4591db46b89e877ed9f4332ecd4.tar.gz
kdepimpi-19f445f0b6e7d4591db46b89e877ed9f4332ecd4.tar.bz2
more sync fixes
Diffstat (limited to 'kabc/plugins') (more/less context) (ignore 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
3 files changed, 61 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()
165 QFile file( mFileName ); 165 QFile file( mFileName );
166 qDebug("ResourceFile::openfile %s ", mFileName.latin1());
166 167
@@ -196,3 +197,3 @@ bool ResourceFile::load()
196 197
197 198 qDebug("ResourceFile::loadfile %s ", mFileName.latin1());
198 QFile file( mFileName ); 199 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 )
206 KABC::Addressee::List changedAddressees; 206 KABC::Addressee::List changedAddressees;
207 typedef QMap<int,QString> AddresseeMap;
208 AddresseeMap map;
209 CardId id ;
207 210
@@ -211,3 +214,2 @@ bool ResourceSharpDTM::save( Ticket *ticket )
211 QString uid = (*it).originalExternalUID(); 214 QString uid = (*it).originalExternalUID();
212 CardId id ;
213 bool res; 215 bool res;
@@ -225,2 +227,9 @@ bool ResourceSharpDTM::save( Ticket *ticket )
225 { 227 {
228 res = mAccess->finishEditCard(&id);
229 //(*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
230 //(*it).setExternalUID( QString::number( id ) );
231 //(*it).setOriginalExternalUID( QString::number( id ) );
232 map.insert(id,(*it).uid());
233
234#if 0
226 KABC::Addressee addressee; 235 KABC::Addressee addressee;
@@ -228,3 +237,3 @@ bool ResourceSharpDTM::save( Ticket *ticket )
228 addressee.setUid((*it).uid() ); 237 addressee.setUid((*it).uid() );
229 addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 238 (it*).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
230 res = mAccess->finishEditCard(&id); 239 res = mAccess->finishEditCard(&id);
@@ -234,2 +243,3 @@ bool ResourceSharpDTM::save( Ticket *ticket )
234 changedAddressees.append( addressee ); 243 changedAddressees.append( addressee );
244#endif
235 245
@@ -263,2 +273,7 @@ bool ResourceSharpDTM::save( Ticket *ticket )
263 { 273 {
274 res = mAccess->finishEditCard(&id);
275 //(*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM );
276 map.insert(id,(*it).uid());
277
278#if 0
264 KABC::Addressee addressee; 279 KABC::Addressee addressee;
@@ -269,2 +284,3 @@ bool ResourceSharpDTM::save( Ticket *ticket )
269 res = mAccess->finishEditCard(&id); 284 res = mAccess->finishEditCard(&id);
285#endif
270 if (res == false) 286 if (res == false)
@@ -283,5 +299,31 @@ bool ResourceSharpDTM::save( Ticket *ticket )
283 } 299 }
300 AddresseeMap::Iterator itam;
301 res;
302 for ( res=mAccess->first(); res == true; res=mAccess->next())
303 {
304 id = mAccess->cardId();
305 int idint = id;
306 itam = map.find( idint );
307 if ( itam != map.end() ) {
308 KABC::Addressee addressee;
309 qDebug("found change %d %s ", idint, itam.data().latin1());
310 res = mConverter->sharpToAddressee( id, mAccess, addressee );
311
312 if ( !addressee.isEmpty() && res )
313 {
314 addressee.setResource( this );
315 addressee.setUid( itam.data() );
316 addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
317 addressBook()->insertAddressee( addressee , false );
318 }
319 }
320 }
321#if 0
284 KABC::Addressee::List::Iterator it2; 322 KABC::Addressee::List::Iterator it2;
285 for ( it2 = changedAddressees.begin(); it2 != changedAddressees.end(); ++it2 ) 323 for ( it2 = changedAddressees.begin(); it2 != changedAddressees.end(); ++it2 ) {
324 (*it2).computeCsum( "Sharp_DTM" );
325 qDebug("CSUM: %s ",(*it2).getCsum( "Sharp_DTM" ).latin1() );
286 addressBook()->insertAddressee((*it2)); 326 addressBook()->insertAddressee((*it2));
327 }
328#endif
287 //US mAccess->save(); 329 //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
288 //qDebug("SharpDTMConverter::addresseeToSharp check if the fileAs transformation works!!\n%s",addr.formattedName().latin1() ); 288 //qDebug("SharpDTMConverter::addresseeToSharp check if the fileAs transformation works!!\n%s",addr.formattedName().latin1() );
289 database->writeField(ZdbAdrs::FileAs, addr.formattedName()); 289 QString formattedName = addr.formattedName();
290 database->writeField(ZdbAdrs::FullName, addr.formattedName()); 290 if ( formattedName.isEmpty() ) {
291 if ( !addr.familyName().isEmpty() ) {
292 formattedName = addr.familyName();
293 if ( !addr.givenName().isEmpty() ) {
294 formattedName += ", ";
295 formattedName += addr.givenName();
296 }
297 } else
298 formattedName = addr.givenName();
299 }
300 database->writeField(ZdbAdrs::FileAs, formattedName);
301 database->writeField(ZdbAdrs::FullName, formattedName);
291 302
@@ -351,3 +362,3 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da
351 PhoneNumber mobile = addr.phoneNumber( PhoneNumber::Cell ); 362 PhoneNumber mobile = addr.phoneNumber( PhoneNumber::Cell );
352 if (!businessmobile.number().isEmpty()) { 363 if (! mobile.number().isEmpty()) {
353 if ( ! cellHome ) 364 if ( ! cellHome )