summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp42
1 files changed, 27 insertions, 15 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 6538295..d1d385c 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -644,11 +644,6 @@ void KABCore::beamVCard(const QStringList& uids)
- QFile outFile(fileName);
+
KABC::VCardConverter converter;
QString description;
-
- if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
-
- QTextStream t( &outFile ); // use a text stream
- t.setEncoding( QTextStream::UnicodeUTF8 );
-
+ QString datastream;
for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
@@ -664,13 +659,26 @@ void KABCore::beamVCard(const QStringList& uids)
converter.addresseeToVCard( a, vcard );
- t << vcard;
-
+ int start = 0;
+ int next;
+ while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
+ int semi = vcard.find(";", next);
+ int dopp = vcard.find(":", next);
+ int sep;
+ 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();
+ start = sep;
}
- } else {
- qDebug("Error open temp beam file ");
- return;
+ datastream += vcard.mid( start,vcard.length() );
}
-
- outFile.close();
-
#ifndef DESKTOP_VERSION
+ QFile outFile(fileName);
+ if ( outFile.open(IO_WriteOnly) ) {
+ datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
+ QTextStream t( &outFile ); // use a text stream
+ t.setEncoding( QTextStream::UnicodeUTF8 );
+ t <<datastream;
+ outFile.close();
Ir *ir = new Ir( this );
@@ -678,2 +686,6 @@ void KABCore::beamVCard(const QStringList& uids)
ir->send( fileName, description, "text/x-vCard" );
+ } else {
+ qDebug("Error open temp beam file ");
+ return;
+ }
#endif