author | zautrix <zautrix> | 2004-10-09 21:35:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-09 21:35:22 (UTC) |
commit | 213a9d993e5a4751b64e18320cfbebb000681d13 (patch) (unidiff) | |
tree | 995b465797464e689b73d3271ff4a3f8f0d3749b /kabc | |
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 | ||||
-rw-r--r-- | kabc/addressbook.h | 3 |
2 files changed, 47 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 | |||
@@ -47,6 +47,7 @@ $Id$ | |||
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
48 | #include <kdebug.h> | 48 | #include <kdebug.h> |
49 | #include <libkcal/syncdefines.h> | 49 | #include <libkcal/syncdefines.h> |
50 | #include <libkdepim/phoneaccess.h> | ||
50 | #include "addressbook.h" | 51 | #include "addressbook.h" |
51 | #include "resource.h" | 52 | #include "resource.h" |
52 | #include "vcardconverter.h" | 53 | #include "vcardconverter.h" |
@@ -459,6 +460,49 @@ void AddressBook::removeUntagged() | |||
459 | removeAddressee( todel ); | 460 | removeAddressee( todel ); |
460 | deleteRemovedAddressees(); | 461 | deleteRemovedAddressees(); |
461 | } | 462 | } |
463 | void AddressBook::smplifyAddressees() | ||
464 | { | ||
465 | Iterator ait; | ||
466 | for ( ait = begin(); ait != end(); ++ait ) { | ||
467 | (*ait).simplifyEmails(); | ||
468 | (*ait).simplifyPhoneNumbers(); | ||
469 | (*ait).simplifyPhoneNumberTypes(); | ||
470 | (*ait).simplifyAddresses(); | ||
471 | } | ||
472 | } | ||
473 | void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) | ||
474 | { | ||
475 | Iterator ait; | ||
476 | for ( ait = begin(); ait != end(); ++ait ) { | ||
477 | QString id = (*ait).IDStr(); | ||
478 | (*ait).setIDStr( ":"); | ||
479 | (*ait).setExternalUID( id ); | ||
480 | (*ait).setOriginalExternalUID( id ); | ||
481 | if ( isPreSync ) | ||
482 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); | ||
483 | else | ||
484 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | ||
485 | } | ||
486 | } | ||
487 | bool AddressBook::saveABphone( QString fileName ) | ||
488 | { | ||
489 | smplifyAddressees(); | ||
490 | qDebug("saveABphone:: saving AB... "); | ||
491 | if ( ! saveAB() ) | ||
492 | return false; | ||
493 | qDebug("saveABphone:: writing to phone... "); | ||
494 | if ( !PhoneAccess::writeToPhone( fileName) ) { | ||
495 | return false; | ||
496 | } | ||
497 | qDebug("saveABphone:: re-reading from phone... "); | ||
498 | if ( !PhoneAccess::readFromPhone( fileName) ) { | ||
499 | return false; | ||
500 | } | ||
501 | qDebug("reloading phone book... "); | ||
502 | if ( !load() ) | ||
503 | return false; | ||
504 | return true; | ||
505 | } | ||
462 | bool AddressBook::saveAB() | 506 | bool AddressBook::saveAB() |
463 | { | 507 | { |
464 | bool ok = true; | 508 | bool ok = true; |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 532e05d..cc755d1 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -142,6 +142,9 @@ class AddressBook : public QObject | |||
142 | */ | 142 | */ |
143 | bool save( Ticket *ticket ); | 143 | bool save( Ticket *ticket ); |
144 | bool saveAB( ); | 144 | bool saveAB( ); |
145 | bool saveABphone( QString fileName ); | ||
146 | void smplifyAddressees(); | ||
147 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); | ||
145 | void export2File( QString fileName ); | 148 | void export2File( QString fileName ); |
146 | void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); | 149 | void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); |
147 | void setUntagged(); | 150 | void setUntagged(); |