-rw-r--r-- | kaddressbook/kabcore.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index c5406bf..939296f 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -698,13 +698,16 @@ void KABCore::export2phone() KABC::Addressee a = mAddressBook->findByUid( *it ); if ( a.isEmpty() ) continue; + a.simplifyEmails(); + a.simplifyPhoneNumbers(); + a.simplifyPhoneNumberTypes(); if (description.isEmpty()) description = a.formattedName(); - QString vcard; + QString vcardnew; converter.addresseeToVCard( a, vcard ); int start = 0; int next; while ( (next = vcard.find("TYPE=", start) )>= 0 ) { @@ -714,13 +717,25 @@ void KABCore::export2phone() if ( semi < dopp && semi >= 0 ) sep = semi ; else sep = dopp; - datastream +=vcard.mid( start, next - start); - datastream +=vcard.mid( next+5,sep -next -5 ).upper(); + vcardnew +=vcard.mid( start, next - start); + vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); start = sep; } - datastream += vcard.mid( start,vcard.length() ); + vcardnew += vcard.mid( start,vcard.length() ); + vcard = ""; + start = 0; + while ( (next = vcardnew.find("ADR", start) )>= 0 ) { + int sep = vcardnew.find(":", next); + vcard +=vcardnew.mid( start, next - start+3); + start = sep; + } + vcard += vcardnew.mid( start,vcardnew.length() ); + vcard.replace ( QRegExp(";;;") , "" ); + vcard.replace ( QRegExp(";;") , "" ); + datastream += vcard; + } QFile outFile(fileName); if ( outFile.open(IO_WriteOnly) ) { datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |