From 64be8d64fc26d1025a24150d065197ba5d608f3d Mon Sep 17 00:00:00 2001 From: zautrix Date: Fri, 02 Dec 2005 09:10:14 +0000 Subject: more sync --- (limited to 'kabc/addressbook.cpp') diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index f3744bc..e04f4b1 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -377,7 +377,7 @@ bool AddressBook::save( Ticket *ticket ) return false; } // exports all Addressees, which are syncable -void AddressBook::export2File( QString fileName ) +void AddressBook::export2File( QString fileName, QString resourceName ) { QFile outFile( fileName ); @@ -392,15 +392,21 @@ void AddressBook::export2File( QString fileName ) KABC::VCardConverter::Version version; version = KABC::VCardConverter::v3_0; for ( it = begin(); it != end(); ++it ) { - if ( (*it).resource() && (*it).resource()->includeInSync() ) { - if ( !(*it).IDStr().isEmpty() ) { - (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); + if ( (*it).resource() ) { + bool include = (*it).resource()->includeInSync(); + if ( !resourceName.isEmpty() ) + include = (resourceName == (*it).resource()->name() ); + if ( include ) { + qDebug(QString ("Exporting resource %1 to file %2").arg( (*it).resource()->name() ).arg( fileName ) ); + 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"; -- cgit v0.9.0.2