summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
Unidiff
Diffstat (limited to 'kabc/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp44
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
@@ -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}
463void 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}
473void 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}
487bool 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}
462bool AddressBook::saveAB() 506bool AddressBook::saveAB()
463{ 507{
464 bool ok = true; 508 bool ok = true;