-rw-r--r-- | kabc/addressee.cpp | 22 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 45 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 |
3 files changed, 41 insertions, 28 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 295ee4f..2564894 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -449,2 +449,22 @@ void Addressee::simplifyAddresses() { + + + Address::List list; + Address::List::Iterator it; + Address::List::Iterator it2; + for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { + it2 = it; + ++it2; + for( ; it2 != mData->addresses.end(); ++it2 ) { + if ( (*it) == (*it2) ) { + list.append( *it ); + break; + } + } + } + for( it = list.begin(); it != list.end(); ++it ) { + removeAddress( (*it) ); + } + + list.clear(); int max = 2; @@ -454,4 +474,2 @@ void Addressee::simplifyAddresses() int count = 0; - Address::List list; - Address::List::Iterator it; for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index dae9cd2..087e9e3 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -695,27 +695,24 @@ void KABCore::export2phone() + QString fileName = getPhoneFile(); + if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) + return; + + QTimer::singleShot( 1, this , SLOT ( writeToPhone())); + +} +QString KABCore::getPhoneFile() +{ #ifdef _WIN32_ - QString fileName = locateLocal("tmp", "phonefile.vcf"); + return locateLocal("tmp", "phonefile.vcf"); #else - QString fileName = "/tmp/phonefile.vcf"; + return "/tmp/phonefile.vcf"; #endif - if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) - return; - - if ( PhoneAccess::writeToPhone( fileName ) ) - qDebug("Export okay "); - else - qDebug("Error export contacts "); - - -#if 0 - - setCaption( i18n("Writing to phone...")); - if ( PhoneFormat::writeToPhone( cal ) ) - setCaption( i18n("Export to phone successful!")); +} +void KABCore::writeToPhone( ) +{ + if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) + qDebug("Export okay "); else - setCaption( i18n("Error exporting to phone!")); -#endif - - + qDebug("Error export contacts "); } @@ -836,2 +833,3 @@ void KABCore::beamDone( Ir *ir ) topLevelWidget()->raise(); + message( i18n("Beaming successful!") ); } @@ -2820,8 +2818,3 @@ bool KABCore::syncPhone() QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); - QString fileName; -#ifdef _WIN32_ - fileName = locateLocal("tmp", "phonefile.vcf"); -#else - fileName = "/tmp/phonefile.vcf"; -#endif + QString fileName = getPhoneFile(); if ( !PhoneAccess::readFromPhone( fileName) ) { diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 3c33923..5871d39 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -150,2 +150,3 @@ class KABCore : public QWidget, public KSyncInterface void synchowto() ; + void writeToPhone(); @@ -373,2 +374,3 @@ class KABCore : public QWidget, public KSyncInterface void initActions(); + QString getPhoneFile(); |