summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
authorzautrix <zautrix>2004-10-13 14:23:28 (UTC)
committer zautrix <zautrix>2004-10-13 14:23:28 (UTC)
commit2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6 (patch) (unidiff)
treef1e664ddf31aae347b1a119c9111cbd1c931bf89 /kabc/addressbook.cpp
parentd41893fb0a49fbb080326a4c1fd98e1a032a182a (diff)
downloadkdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.zip
kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.tar.gz
kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.tar.bz2
more sync fixes
Diffstat (limited to 'kabc/addressbook.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 8882259..592d78d 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -376,6 +376,7 @@ bool AddressBook::save( Ticket *ticket )
376 376
377 return false; 377 return false;
378} 378}
379// exports all Addressees, which are syncable
379void AddressBook::export2File( QString fileName ) 380void AddressBook::export2File( QString fileName )
380{ 381{
381 382
@@ -391,6 +392,7 @@ void AddressBook::export2File( QString fileName )
391 KABC::VCardConverter::Version version; 392 KABC::VCardConverter::Version version;
392 version = KABC::VCardConverter::v3_0; 393 version = KABC::VCardConverter::v3_0;
393 for ( it = begin(); it != end(); ++it ) { 394 for ( it = begin(); it != end(); ++it ) {
395 if ( (*it).resource() && (*it).resource()->includeInSync() ) {
394 if ( !(*it).IDStr().isEmpty() ) { 396 if ( !(*it).IDStr().isEmpty() ) {
395 (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); 397 (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() );
396 } 398 }
@@ -400,6 +402,7 @@ void AddressBook::export2File( QString fileName )
400 converter.addresseeToVCard( *it, vcard, version ); 402 converter.addresseeToVCard( *it, vcard, version );
401 t << vcard << "\r\n"; 403 t << vcard << "\r\n";
402 } 404 }
405 }
403 t << "\r\n\r\n"; 406 t << "\r\n\r\n";
404 outFile.close(); 407 outFile.close();
405} 408}
@@ -419,6 +422,8 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
419 KABC::Addressee a = ( *it ); 422 KABC::Addressee a = ( *it );
420 if ( a.isEmpty() ) 423 if ( a.isEmpty() )
421 continue; 424 continue;
425 if ( all && a.resource() && !a.resource()->includeInSync() )
426 continue;
422 a.simplifyEmails(); 427 a.simplifyEmails();
423 a.simplifyPhoneNumbers(); 428 a.simplifyPhoneNumbers();
424 a.simplifyPhoneNumberTypes(); 429 a.simplifyPhoneNumberTypes();
@@ -476,7 +481,7 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem
476{ 481{
477 482
478 if ( removeOld ) 483 if ( removeOld )
479 setUntagged(); 484 setUntagged( true );
480 KABC::Addressee::List list; 485 KABC::Addressee::List list;
481 QFile file( fileName ); 486 QFile file( fileName );
482 file.open( IO_ReadOnly ); 487 file.open( IO_ReadOnly );
@@ -506,10 +511,16 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem
506 if ( removeOld ) 511 if ( removeOld )
507 removeUntagged(); 512 removeUntagged();
508} 513}
509void AddressBook::setUntagged() 514void AddressBook::setUntagged(bool setNonSyncTagged) // = false)
510{ 515{
511 Iterator ait; 516 Iterator ait;
512 for ( ait = begin(); ait != end(); ++ait ) { 517 for ( ait = begin(); ait != end(); ++ait ) {
518 if ( setNonSyncTagged ) {
519 if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) {
520 (*ait).setTagged( true );
521 } else
522 (*ait).setTagged( false );
523 } else
513 (*ait).setTagged( false ); 524 (*ait).setTagged( false );
514 } 525 }
515} 526}