From 2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 13 Oct 2004 14:23:28 +0000 Subject: more sync fixes --- (limited to 'kabc/addressbook.cpp') 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 ) return false; } +// exports all Addressees, which are syncable void AddressBook::export2File( QString fileName ) { @@ -390,15 +391,17 @@ void AddressBook::export2File( QString fileName ) Iterator it; KABC::VCardConverter::Version version; version = KABC::VCardConverter::v3_0; - for ( it = begin(); it != end(); ++it ) { - if ( !(*it).IDStr().isEmpty() ) { - (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); + for ( it = begin(); it != end(); ++it ) { + if ( (*it).resource() && (*it).resource()->includeInSync() ) { + if ( !(*it).IDStr().isEmpty() ) { + (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); + } + KABC::VCardConverter converter; + QString vcard; + //Resource *resource() const; + converter.addresseeToVCard( *it, vcard, version ); + t << vcard << "\r\n"; } - KABC::VCardConverter converter; - QString vcard; - //Resource *resource() const; - converter.addresseeToVCard( *it, vcard, version ); - t << vcard << "\r\n"; } t << "\r\n\r\n"; outFile.close(); @@ -415,10 +418,12 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) if ( ! all ) { if ( ! ( uids.contains((*it).uid() ) )) continue; - } + } KABC::Addressee a = ( *it ); if ( a.isEmpty() ) continue; + if ( all && a.resource() && !a.resource()->includeInSync() ) + continue; a.simplifyEmails(); a.simplifyPhoneNumbers(); a.simplifyPhoneNumberTypes(); @@ -476,7 +481,7 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem { if ( removeOld ) - setUntagged(); + setUntagged( true ); KABC::Addressee::List list; QFile file( fileName ); file.open( IO_ReadOnly ); @@ -506,11 +511,17 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem if ( removeOld ) removeUntagged(); } -void AddressBook::setUntagged() +void AddressBook::setUntagged(bool setNonSyncTagged) // = false) { Iterator ait; for ( ait = begin(); ait != end(); ++ait ) { - (*ait).setTagged( false ); + if ( setNonSyncTagged ) { + if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { + (*ait).setTagged( true ); + } else + (*ait).setTagged( false ); + } else + (*ait).setTagged( false ); } } void AddressBook::removeUntagged() -- cgit v0.9.0.2