summaryrefslogtreecommitdiffabout
path: root/kabc
Unidiff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp35
-rw-r--r--kabc/addressbook.h2
2 files changed, 24 insertions, 13 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 8882259..592d78d 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -377,4 +377,5 @@ bool AddressBook::save( Ticket *ticket )
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{
@@ -391,13 +392,15 @@ 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 ) {
394 if ( !(*it).IDStr().isEmpty() ) { 395 if ( (*it).resource() && (*it).resource()->includeInSync() ) {
395 (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); 396 if ( !(*it).IDStr().isEmpty() ) {
397 (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() );
398 }
399 KABC::VCardConverter converter;
400 QString vcard;
401 //Resource *resource() const;
402 converter.addresseeToVCard( *it, vcard, version );
403 t << vcard << "\r\n";
396 } 404 }
397 KABC::VCardConverter converter;
398 QString vcard;
399 //Resource *resource() const;
400 converter.addresseeToVCard( *it, vcard, version );
401 t << vcard << "\r\n";
402 } 405 }
403 t << "\r\n\r\n"; 406 t << "\r\n\r\n";
@@ -416,8 +419,10 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
416 if ( ! ( uids.contains((*it).uid() ) )) 419 if ( ! ( uids.contains((*it).uid() ) ))
417 continue; 420 continue;
418 } 421 }
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();
@@ -477,5 +482,5 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem
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 );
@@ -507,9 +512,15 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem
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 ) {
513 (*ait).setTagged( false ); 518 if ( setNonSyncTagged ) {
519 if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) {
520 (*ait).setTagged( true );
521 } else
522 (*ait).setTagged( false );
523 } else
524 (*ait).setTagged( false );
514 } 525 }
515} 526}
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index a6bf451..23bba02 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -149,5 +149,5 @@ class AddressBook : public QObject
149 bool export2PhoneFormat( QStringList uids ,QString fileName ); 149 bool export2PhoneFormat( QStringList uids ,QString fileName );
150 void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); 150 void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false );
151 void setUntagged(); 151 void setUntagged( bool setNonSyncTagged = false );
152 void removeUntagged(); 152 void removeUntagged();
153 void findNewExtIds( QString fileName, QString currentSyncDevice ); 153 void findNewExtIds( QString fileName, QString currentSyncDevice );