author | zautrix <zautrix> | 2004-10-09 21:35:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-09 21:35:22 (UTC) |
commit | 213a9d993e5a4751b64e18320cfbebb000681d13 (patch) (side-by-side diff) | |
tree | 995b465797464e689b73d3271ff4a3f8f0d3749b /kabc/addressbook.cpp | |
parent | d68435216e1ebc5a7fed391157197994e13992b3 (diff) | |
download | kdepimpi-213a9d993e5a4751b64e18320cfbebb000681d13.zip kdepimpi-213a9d993e5a4751b64e18320cfbebb000681d13.tar.gz kdepimpi-213a9d993e5a4751b64e18320cfbebb000681d13.tar.bz2 |
ab phone sync implemented
-rw-r--r-- | kabc/addressbook.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 16927e2..d037d2f 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -49,2 +49,3 @@ $Id$ #include <libkcal/syncdefines.h> +#include <libkdepim/phoneaccess.h> #include "addressbook.h" @@ -461,2 +462,45 @@ void AddressBook::removeUntagged() } +void AddressBook::smplifyAddressees() +{ + Iterator ait; + for ( ait = begin(); ait != end(); ++ait ) { + (*ait).simplifyEmails(); + (*ait).simplifyPhoneNumbers(); + (*ait).simplifyPhoneNumberTypes(); + (*ait).simplifyAddresses(); + } +} +void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) +{ + Iterator ait; + for ( ait = begin(); ait != end(); ++ait ) { + QString id = (*ait).IDStr(); + (*ait).setIDStr( ":"); + (*ait).setExternalUID( id ); + (*ait).setOriginalExternalUID( id ); + if ( isPreSync ) + (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); + else + (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); + } +} +bool AddressBook::saveABphone( QString fileName ) +{ + smplifyAddressees(); + qDebug("saveABphone:: saving AB... "); + if ( ! saveAB() ) + return false; + qDebug("saveABphone:: writing to phone... "); + if ( !PhoneAccess::writeToPhone( fileName) ) { + return false; + } + qDebug("saveABphone:: re-reading from phone... "); + if ( !PhoneAccess::readFromPhone( fileName) ) { + return false; + } + qDebug("reloading phone book... "); + if ( !load() ) + return false; + return true; +} bool AddressBook::saveAB() |