summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2005-12-02 09:10:14 (UTC)
committer zautrix <zautrix>2005-12-02 09:10:14 (UTC)
commit64be8d64fc26d1025a24150d065197ba5d608f3d (patch) (side-by-side diff)
tree4f7b0c82641ac591af04f6fdd541b662d4727850 /kabc
parent2bd8aff44e90b6d58e2037771db8b38846addb3e (diff)
downloadkdepimpi-64be8d64fc26d1025a24150d065197ba5d608f3d.zip
kdepimpi-64be8d64fc26d1025a24150d065197ba5d608f3d.tar.gz
kdepimpi-64be8d64fc26d1025a24150d065197ba5d608f3d.tar.bz2
more sync
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp24
-rw-r--r--kabc/addressbook.h2
2 files changed, 16 insertions, 10 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
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 18c03b5..4a0d0a3 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -143,13 +143,13 @@ class AddressBook : public QObject
bool save( Ticket *ticket );
bool saveAB( );
bool saveABphone( QString fileName );
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 );
void removeUntagged();
void findNewExtIds( QString fileName, QString currentSyncDevice );
/**