summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
authorzautrix <zautrix>2004-09-19 11:32:40 (UTC)
committer zautrix <zautrix>2004-09-19 11:32:40 (UTC)
commiteea0ff04703dffdbe8b67a0dc9f592597d7450c1 (patch) (side-by-side diff)
tree874549d9c1c6239304fe1540d1b56269652954c0 /kabc/addressbook.cpp
parent953277a85e6ec5630ab0d64b4d68815e4e4f9906 (diff)
downloadkdepimpi-eea0ff04703dffdbe8b67a0dc9f592597d7450c1.zip
kdepimpi-eea0ff04703dffdbe8b67a0dc9f592597d7450c1.tar.gz
kdepimpi-eea0ff04703dffdbe8b67a0dc9f592597d7450c1.tar.bz2
more AB sync
Diffstat (limited to 'kabc/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 46a9cf4..64832f1 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -248,11 +248,14 @@ void AddressBook::init(const QString &config, const QString &family )
con->writeEntry( "ResourceKeys", QString("sync") );
con->writeEntry( "Standard", QString("sync") );
con->setGroup( "Resource_sync" );
- con->writeEntry( "FileFormat", QString("vcard") );
con->writeEntry( "FileName", config );
+ con->writeEntry( "FileFormat", QString("vcard") );
con->writeEntry( "ResourceIdentifier", QString("sync") );
con->writeEntry( "ResourceName", QString("sync_res") );
- con->writeEntry( "ResourceType", QString("file") );
+ if ( config.right(4) == ".xml" )
+ con->writeEntry( "ResourceType", QString("qtopia") );
+ else
+ con->writeEntry( "ResourceType", QString("file") );
//con->sync();
d->mConfig = con;
}
@@ -599,6 +602,27 @@ Addressee AddressBook::findByUid( const QString &uid )
}
return Addressee();
}
+Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile )
+{
+ Iterator it;
+ for ( it = begin(); it != end(); ++it ) {
+ if ( uid == (*it).getID( profile ) )
+ return (*it);
+ }
+ return Addressee();
+}
+void AddressBook::mergeAB( AddressBook *aBook, const QString& profile )
+{
+ Iterator it;
+ Addressee ad;
+ for ( it = begin(); it != end(); ++it ) {
+ ad = aBook->findByExternUid( (*it).externalUID(), profile );
+ if ( !ad.isEmpty() ) {
+ (*it).mergeContact( ad );
+ }
+ }
+}
+
#if 0
Addressee::List AddressBook::getExternLastSyncAddressees()
{