author | zautrix <zautrix> | 2004-10-13 05:15:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-13 05:15:03 (UTC) |
commit | f08cf9044213a60c87e2bf299665d13a335feff5 (patch) (side-by-side diff) | |
tree | c9c0e8b0f7f7a48dcee8fbdd5b9a467985c78fdd /kabc/vcardformatimpl.cpp | |
parent | 308bc78a3ab0d27718070a5ebdf3f019ac570c6b (diff) | |
download | kdepimpi-f08cf9044213a60c87e2bf299665d13a335feff5.zip kdepimpi-f08cf9044213a60c87e2bf299665d13a335feff5.tar.gz kdepimpi-f08cf9044213a60c87e2bf299665d13a335feff5.tar.bz2 |
fixed some newline probs
-rw-r--r-- | kabc/vcardformatimpl.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index ede5773..c31af46 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -803,100 +803,100 @@ void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent ) writeToString( (*addr), vstr ); qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); /*US vstr.replace( ":", "\\:" ); vstr.replace( ",", "\\," ); vstr.replace( ";", "\\;" ); vstr.replace( "\r\n", "\\n" ); */ vstr.replace( QRegExp(":"), "\\:" ); vstr.replace( QRegExp(","), "\\," ); vstr.replace( QRegExp(";"), "\\;" ); vstr.replace( QRegExp("\r\n"), "\\n" ); cl.setValue( new TextValue( vstr.utf8() ) ); } else return; } else { cl.setValue( new TextValue( agent.url().utf8() ) ); params.append( new Param( "VALUE", "uri" ) ); } cl.setParamList( params ); vcard->add( cl ); } Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl ) { Agent agent; bool isIntern = true; TextValue *v = (TextValue *)cl->value(); ParamList params = cl->paramList(); ParamListIterator it( params ); for( ; it.current(); ++it ) { if ( (*it)->name() == "VALUE" && (*it)->value() == "uri" ) isIntern = false; } if ( isIntern ) { QString vstr = QString::fromUtf8( v->asString() ); qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); /*US vstr.replace( "\\n", "\r\n" ); vstr.replace( "\\:", ":" ); vstr.replace( "\\,", "," ); vstr.replace( "\\;", ";" ); */ - vstr.replace( QRegExp("\\n"), "\r\n" ); - vstr.replace( QRegExp("\\:"), ":" ); - vstr.replace( QRegExp("\\,"), "," ); - vstr.replace( QRegExp("\\;"), ";" ); + vstr.replace( QRegExp("\\\\n"), "\r\n" ); + vstr.replace( QRegExp("\\\\:"), ":" ); + vstr.replace( QRegExp("\\\\,"), "," ); + vstr.replace( QRegExp("\\\\;"), ";" ); Addressee *addr = new Addressee; readFromString( vstr, *addr ); agent.setAddressee( addr ); } else { agent.setUrl( QString::fromUtf8( v->asString() ) ); } return agent; } void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType type, const Picture &pic, const Addressee &addr, bool intern ) { ContentLine cl; cl.setName( EntityTypeToParamName( type ) ); if ( pic.isIntern() && pic.data().isNull() ) return; if ( !pic.isIntern() && pic.url().isEmpty() ) return; ParamList params; if ( pic.isIntern() ) { QImage img = pic.data(); if ( intern ) { // only for vCard export we really write the data inline QByteArray data; QDataStream s( data, IO_WriteOnly ); s.setVersion( 4 ); // to produce valid png files s << img; cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); } else { // save picture in cache QString dir; if ( type == EntityPhoto ) dir = "photos"; if ( type == EntityLogo ) dir = "logos"; img.save( locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ), pic.type().utf8() ); cl.setValue( new TextValue( "<dummy>" ) ); } params.append( new Param( "ENCODING", "b" ) ); if ( !pic.type().isEmpty() ) params.append( new Param( "TYPE", pic.type().utf8() ) ); } else { cl.setValue( new TextValue( pic.url().utf8() ) ); |