summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp10
-rw-r--r--kabc/addressbook.h2
2 files changed, 9 insertions, 3 deletions
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,7 +392,12 @@ 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).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() );
}
@@ -403,6 +408,7 @@ void AddressBook::export2File( QString fileName )
t << vcard << "\r\n";
}
}
+ }
t << "\r\n\r\n";
outFile.close();
}
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 18c03b5..4a0d0a3 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -146,7 +146,7 @@ class AddressBook : public QObject
void smplifyAddressees();
void removeSyncInfo( QString syncProfile);
void preparePhoneSync( QString currentSyncDevice, bool isPreSync );
- void export2File( QString fileName );
+ void export2File( QString fileName, QString resourceName = "" );
bool export2PhoneFormat( QStringList uids ,QString fileName );
int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false );
void setUntagged( bool setNonSyncTagged = false );