summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
Side-by-side diff
Diffstat (limited to 'kabc/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index f3744bc..e04f4b1 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -374,13 +374,13 @@ bool AddressBook::save( Ticket *ticket )
return ticket->resource()->save( ticket );
}
return false;
}
// exports all Addressees, which are syncable
-void AddressBook::export2File( QString fileName )
+void AddressBook::export2File( QString fileName, QString resourceName )
{
QFile outFile( fileName );
if ( !outFile.open( IO_WriteOnly ) ) {
QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" );
KMessageBox::error( 0, text.arg( fileName ) );
@@ -389,21 +389,27 @@ void AddressBook::export2File( QString fileName )
QTextStream t( &outFile );
t.setEncoding( QTextStream::UnicodeUTF8 );
Iterator it;
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";
outFile.close();
}
// if QStringList uids is empty, all are exported