summaryrefslogtreecommitdiffabout
path: root/kabc/vcardparser/vcardparser.cpp
authorzautrix <zautrix>2004-10-13 05:15:03 (UTC)
committer zautrix <zautrix>2004-10-13 05:15:03 (UTC)
commitf08cf9044213a60c87e2bf299665d13a335feff5 (patch) (side-by-side diff)
treec9c0e8b0f7f7a48dcee8fbdd5b9a467985c78fdd /kabc/vcardparser/vcardparser.cpp
parent308bc78a3ab0d27718070a5ebdf3f019ac570c6b (diff)
downloadkdepimpi-f08cf9044213a60c87e2bf299665d13a335feff5.zip
kdepimpi-f08cf9044213a60c87e2bf299665d13a335feff5.tar.gz
kdepimpi-f08cf9044213a60c87e2bf299665d13a335feff5.tar.bz2
fixed some newline probs
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 9ea084d..bec2a0c 100644
--- a/kabc/vcardparser/vcardparser.cpp
+++ b/kabc/vcardparser/vcardparser.cpp
@@ -68,97 +68,97 @@ VCard::List VCardParser::parseVCards( const QString& text )
QStringList params = QStringList::split( ';', key );
vCardLine.setIdentifier( params[0] );
if ( params.count() > 1 ) { // find all parameters
for ( uint i = 1; i < params.count(); ++i ) {
QStringList pair = QStringList::split( '=', params[i] );
//US if ( pair.size() == 1 ) {
if ( pair.count() == 1 ) {
pair.prepend( "type" );
}
if ( pair[1].contains( ',' ) ) { // parameter in type=x,y,z format
QStringList args = QStringList::split( ',', pair[ 1 ] );
for ( uint j = 0; j < args.count(); ++j )
vCardLine.addParameter( pair[0].lower(), args[j] );
} else
vCardLine.addParameter( pair[0].lower(), pair[1] );
}
}
params = vCardLine.parameterList();
if ( params.contains( "encoding" ) ) { // have to decode the data
#if 0
QByteArray input, output;
input = value.local8Bit();
if ( vCardLine.parameter( "encoding" ).lower() == "b" )
KCodecs::base64Decode( input, output );
else if ( vCardLine.parameter( "encoding" ).lower() == "quoted-printable" )
KCodecs::quotedPrintableDecode( input, output );
//qDebug("VCardParser::parseVCards has to be verified");
//US I am not sure if this is correct
//US vCardLine.setValue( output );
QCString cs(output);
qDebug("len1 %d len2 %d ",input.size(), output.size( ));
#endif
QCString cs = value.local8Bit();
qDebug("****************************************** ");
qDebug("************* WARNING ******************** ");
qDebug("****************************************** ");
qDebug("Make sure, the decoding is done after");
qDebug("QVariant conversion!");
qDebug("Insert Line DECODING OKAY, where this is implemented");
// use for decoding the above code!
vCardLine.setValue( cs );
} else {
//qDebug("VCardParser::parseVCards has to be verified");
//US vCardLine.setValue( value.replace( "\\n", "\n" ) );
- vCardLine.setValue( value.replace( QRegExp("\\n"), "\n" ) );
+ vCardLine.setValue( value.replace( QRegExp("\\\\n"), "\n" ) );
}
currentVCard.addLine( vCardLine );
}
// we do not save the start and end tag as vcardline
if ( (*it).lower().startsWith( "begin:vcard" ) ) {
inVCard = true;
//qDebug("VCardParser::parseVCards has to be verified");
//US currentLine.setLength( 0 );
currentLine = "";
currentVCard.clear(); // flush vcard
continue;
}
if ( (*it).lower().startsWith( "end:vcard" ) ) {
inVCard = false;
vCardList.append( currentVCard );
//qDebug("VCardParser::parseVCards has to be verified");
//US currentLine.setLength( 0 );
currentLine = "";
currentVCard.clear(); // flush vcard
continue;
}
currentLine = (*it);
}
}
return vCardList;
}
QString VCardParser::createVCards( const VCard::List& list )
{
QString text;
QString textLine;
QString encodingType;
QStringList idents;
QStringList params;
QStringList values;
QStringList::ConstIterator identIt;
QStringList::Iterator paramIt;
QStringList::Iterator valueIt;
VCardLine::List lines;
VCardLine::List::Iterator lineIt;
VCard::List::ConstIterator cardIt;
bool hasEncoding;