summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp23
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
@@ -699,11 +699,14 @@ 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;
int next;
@@ -715,11 +718,23 @@ void KABCore::export2phone()
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) ) {