author | zautrix <zautrix> | 2004-09-19 09:00:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-19 09:00:55 (UTC) |
commit | 787181d34f0d195ad72c9cf6aedbc317b6dd713e (patch) (side-by-side diff) | |
tree | ac49d2b1d7887f96f3834458071b89e77b59218b /kabc/stdaddressbook.cpp | |
parent | f370d0f89bcaeeb68bd60152a9812a9cd55e5d8a (diff) | |
download | kdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.zip kdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.tar.gz kdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.tar.bz2 |
more AB sync
-rw-r--r-- | kabc/stdaddressbook.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index ec47a4e..181a09e 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp @@ -120,97 +120,102 @@ StdAddressBook::StdAddressBook( bool onlyFastResources ) : AddressBook( "kabcrc" ) { init( onlyFastResources ); } StdAddressBook::~StdAddressBook() { if ( mAutomaticSave ) save(); } void StdAddressBook::init( bool ) { KRES::Manager<Resource> *manager = resourceManager(); KRES::Manager<Resource>::ActiveIterator it; for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { (*it)->setAddressBook( this ); if ( !(*it)->open() ) error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); } Resource *res = standardResource(); if ( !res ) { res = manager->createResource( "file" ); if ( res ) { addResource( res ); } else qDebug(" No resource available!!!"); } setStandardResource( res ); manager->writeConfig(); load(); } bool StdAddressBook::save() { kdDebug(5700) << "StdAddressBook::save()" << endl; bool ok = true; AddressBook *ab = self(); ab->deleteRemovedAddressees(); - + Iterator ait; + for ( ait = ab->begin(); ait != ab->end(); ++ait ) { + if ( !(*ait).IDStr().isEmpty() ) { + (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); + } + } KRES::Manager<Resource>::ActiveIterator it; KRES::Manager<Resource> *manager = ab->resourceManager(); for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { if ( !(*it)->readOnly() && (*it)->isOpen() ) { Ticket *ticket = ab->requestSaveTicket( *it ); // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); if ( !ticket ) { ab->error( i18n( "Unable to save to resource '%1'. It is locked." ) .arg( (*it)->resourceName() ) ); return false; } if ( !ab->save( ticket ) ) ok = false; } } return ok; } void StdAddressBook::close() { //US destructObject is not defined on my system???. Is setObject(0) the same ??? //US addressBookDeleter.destructObject(); addressBookDeleter.setObject(0); } void StdAddressBook::setAutomaticSave( bool enable ) { mAutomaticSave = enable; } bool StdAddressBook::automaticSave() { return mAutomaticSave; } // should get const for 4.X Addressee StdAddressBook::whoAmI() { //US KConfig config( "kabcrc" ); KConfig config( locateLocal("config", "kabcrc") ); config.setGroup( "General" ); return findByUid( config.readEntry( "WhoAmI" ) ); } |