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 | |
parent | 308bc78a3ab0d27718070a5ebdf3f019ac570c6b (diff) | |
download | kdepimpi-f08cf9044213a60c87e2bf299665d13a335feff5.zip kdepimpi-f08cf9044213a60c87e2bf299665d13a335feff5.tar.gz kdepimpi-f08cf9044213a60c87e2bf299665d13a335feff5.tar.bz2 |
fixed some newline probs
-rw-r--r-- | kabc/vcard/ContentLine.cpp | 1 | ||||
-rw-r--r-- | kabc/vcardformatimpl.cpp | 8 | ||||
-rw-r--r-- | kabc/vcardparser/vcardparser.cpp | 2 | ||||
-rw-r--r-- | kabc/vcardparser/vcardtool.cpp | 10 |
4 files changed, 11 insertions, 10 deletions
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp index f7e04a9..c368172 100644 --- a/kabc/vcard/ContentLine.cpp +++ b/kabc/vcard/ContentLine.cpp @@ -286,35 +286,36 @@ ContentLine::_assemble() vDebug("Adding parameters"); ParamListIterator it(paramList_); for (; it.current(); ++it) line += ";" + it.current()->asString(); vDebug("Adding value"); if (value_ != 0) line += ":" + value_->asString(); else vDebug("No value"); // Quote newlines line = line.replace( QRegExp( "\n" ), "\\n" ); // Fold lines longer than 72 chars const int maxLen = 72; uint cursor = 0; while( line.length() > ( cursor + 1 ) * maxLen ) { strRep_ += line.mid( cursor * maxLen, maxLen ); strRep_ += "\r\n "; ++cursor; } strRep_ += line.mid( cursor * maxLen ); + //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); } void ContentLine::clear() { group_.truncate(0); name_.truncate(0); paramList_.clear(); delete value_; value_ = 0; } diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index ede5773..c31af46 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -827,52 +827,52 @@ void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent ) } 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() ) { 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 @@ -92,49 +92,49 @@ VCard::List VCardParser::parseVCards( const QString& text ) 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; } diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp index 3fb212e..d1f823b 100644 --- a/kabc/vcardparser/vcardtool.cpp +++ b/kabc/vcardparser/vcardtool.cpp @@ -791,53 +791,53 @@ VCardLine VCardTool::createSecrecy( const Secrecy &secrecy ) return line; } Agent VCardTool::parseAgent( const VCardLine &line ) { Agent agent; QStringList params = line.parameterList(); if ( params.contains( "value" ) ) { if ( line.parameter( "value" ).lower() == "uri" ) agent.setUrl( line.value().asString() ); } else { QString str = line.value().asString(); //US using the old implementation instead qDebug("VCardTool::parseAgent has to be verified"); /*US str.replace( "\\n", "\r\n" ); str.replace( "\\N", "\r\n" ); str.replace( "\\;", ";" ); str.replace( "\\:", ":" ); str.replace( "\\,", "," ); */ - str.replace( QRegExp("\\n") , "\r\n" ); - str.replace( QRegExp("\\N") , "\r\n" ); - str.replace( QRegExp("\\;") , ";" ); - str.replace( QRegExp("\\:") , ":" ); - str.replace( QRegExp("\\,") , "," ); + str.replace( QRegExp("\\\\n") , "\r\n" ); + str.replace( QRegExp("\\\\N") , "\r\n" ); + str.replace( QRegExp("\\\\;") , ";" ); + str.replace( QRegExp("\\\\:") , ":" ); + str.replace( QRegExp("\\\\,") , "," ); Addressee::List list = parseVCards( str ); if ( list.count() > 0 ) { Addressee *addr = new Addressee; *addr = list[ 0 ]; agent.setAddressee( addr ); } } return agent; } VCardLine VCardTool::createAgent( VCard::Version version, const Agent &agent ) { VCardLine line( "AGENT" ); if ( agent.isIntern() ) { if ( agent.addressee() != 0 ) { Addressee::List list; list.append( *agent.addressee() ); QString str = createVCards( list, version ); //US using the old implementation instead |