summaryrefslogtreecommitdiffabout
path: root/kabc/vcardparser/vcardparser.cpp
Side-by-side diff
Diffstat (limited to 'kabc/vcardparser/vcardparser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcardparser/vcardparser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kabc/vcardparser/vcardparser.cpp b/kabc/vcardparser/vcardparser.cpp
index 11622a0..a319531 100644
--- a/kabc/vcardparser/vcardparser.cpp
+++ b/kabc/vcardparser/vcardparser.cpp
@@ -173,68 +173,68 @@ QString VCardParser::createVCards( const VCard::List& list )
VCardLine::List lines;
VCardLine::List::ConstIterator lineIt;
VCard::List::ConstIterator cardIt;
bool hasEncoding;
// iterate over the cards
VCard::List::ConstIterator listEnd( list.end() );
for ( cardIt = list.begin(); cardIt != listEnd; ++cardIt ) {
text.append( "BEGIN:VCARD\r\n" );
idents = (*cardIt).identifiers();
for ( identIt = idents.begin(); identIt != idents.end(); ++identIt ) {
lines = (*cardIt).lines( (*identIt) );
// iterate over the lines
for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) {
if ( !(*lineIt).valueString().isEmpty() ) {
if ( (*lineIt).hasGroup() )
textLine = (*lineIt).group() + "." + (*lineIt).identifier();
else
textLine = (*lineIt).identifier();
params = (*lineIt).parameterList();
hasEncoding = false;
if ( params.count() > 0 ) { // we have parameters
for ( paramIt = params.begin(); paramIt != params.end(); ++paramIt ) {
if ( (*paramIt) == "encoding" ) {
hasEncoding = true;
encodingType = (*lineIt).parameter( "encoding" ).lower();
}
values = (*lineIt).parameters( *paramIt );
for ( valueIt = values.begin(); valueIt != values.end(); ++valueIt ) {
textLine.append( ";" + (*paramIt).upper() );
if ( !(*valueIt).isEmpty() )
textLine.append( "=" + (*valueIt) );
}
}
}
if ( hasEncoding ) { // have to encode the data
QByteArray input, output;
input = (*lineIt).valueBytes();
if ( encodingType == "b" )
KCodecs::base64Encode( input, output );
else if ( encodingType == "quoted-printable" )
- KCodecs::quotedPrintableEncode( input, output );
+ KCodecs::quotedPrintableEncode( input, output, true );
textLine.append( ":" + QString( output ) );
} else
textLine.append( ":" + (*lineIt).valueString().replace( QRegExp("\n"), "\\n" ) );
if ( textLine.length() > FOLD_WIDTH ) { // we have to fold the line
for ( uint i = 0; i <= ( textLine.length() / FOLD_WIDTH ); ++i )
text.append( ( i == 0 ? "" : " " ) + textLine.mid( i * FOLD_WIDTH, FOLD_WIDTH ) + "\r\n" );
} else
text.append( textLine + "\r\n" );
}
}
}
text.append( "END:VCARD\r\n" );
text.append( "\r\n" );
}
return text;
}