summaryrefslogtreecommitdiffabout
path: root/kabc/vcard/ContentLine.cpp
Side-by-side diff
Diffstat (limited to 'kabc/vcard/ContentLine.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/ContentLine.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp
index 2f88cde..0a2f97d 100644
--- a/kabc/vcard/ContentLine.cpp
+++ b/kabc/vcard/ContentLine.cpp
@@ -148,34 +148,39 @@ ContentLine::operator == (ContentLine & x)
return false;
return true;
}
ContentLine::~ContentLine()
{
delete value_;
value_ = 0;
}
void
ContentLine::_parse()
{
vDebug("parse");
- // Unqote newlines
+ // Unfold folded lines
+ // NLR
+ strRep_ = strRep_.replace( QRegExp( "\\r" ), "" );
+ // Unqote newlines
strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" );
+ //NLR
+ strRep_ = strRep_.replace( QRegExp( "\\\\r" ), "\r" );
int split = strRep_.find(':');
if (split == -1) { // invalid content line
vDebug("No ':'");
return;
}
QCString firstPart(strRep_.left(split));
QCString valuePart(strRep_.mid(split + 1));
split = firstPart.find('.');
if (split != -1) {
group_ = firstPart.left(split);
firstPart = firstPart.mid(split + 1);
@@ -272,32 +277,33 @@ ContentLine::_parse()
void
ContentLine::_assemble()
{
//strRep_.truncate(0);
QString line;
if (!group_.isEmpty())
line = group_ + '.';
line += name_;
ParamListIterator it(paramList_);
for (; it.current(); ++it)
line += ";" + it.current()->asString();
if (value_ != 0)
line += ":" + value_->asString();
+ line = line.replace( QRegExp( "\r" ), "\\r" );
line = line.replace( QRegExp( "\n" ), "\\n" );
// Fold lines longer than 72 chars
const int maxLen = 72;
uint cursor = 0;
QString cut;
while( line.length() > ( cursor + 1 ) * maxLen ) {
cut += line.mid( cursor * maxLen, maxLen );
cut += "\r\n ";
++cursor;
}
cut += line.mid( cursor * maxLen );
strRep_ = cut.latin1();
//qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
#if 0
vDebug("Assemble (argl) - my name is \"" + name_ + "\"");