summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp44
-rw-r--r--kabc/addressbook.h3
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
@@ -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()
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 532e05d..cc755d1 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -144,2 +144,5 @@ class AddressBook : public QObject
bool saveAB( );
+ bool saveABphone( QString fileName );
+ void smplifyAddressees();
+ void preparePhoneSync( QString currentSyncDevice, bool isPreSync );
void export2File( QString fileName );