-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 @@ -700,9 +700,12 @@ void KABCore::export2phone() 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; @@ -716,9 +719,21 @@ void KABCore::export2phone() 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); |