summaryrefslogtreecommitdiffabout
path: root/kabc/vcard/ContentLine.cpp
Unidiff
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
@@ -156,18 +156,23 @@ ContentLine::~ContentLine()
156 value_ = 0; 156 value_ = 0;
157} 157}
158 158
159 void 159 void
160ContentLine::_parse() 160ContentLine::_parse()
161{ 161{
162 vDebug("parse"); 162 vDebug("parse");
163 163
164 // Unqote newlines 164 // Unfold folded lines
165 // NLR
166 strRep_ = strRep_.replace( QRegExp( "\\r" ), "" );
167 // Unqote newlines
165 strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" ); 168 strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" );
169 //NLR
170 strRep_ = strRep_.replace( QRegExp( "\\\\r" ), "\r" );
166 171
167 int split = strRep_.find(':'); 172 int split = strRep_.find(':');
168 173
169 if (split == -1) { // invalid content line 174 if (split == -1) { // invalid content line
170 vDebug("No ':'"); 175 vDebug("No ':'");
171 return; 176 return;
172 } 177 }
173 178
@@ -280,16 +285,17 @@ ContentLine::_assemble()
280 line += name_; 285 line += name_;
281 ParamListIterator it(paramList_); 286 ParamListIterator it(paramList_);
282 for (; it.current(); ++it) 287 for (; it.current(); ++it)
283 line += ";" + it.current()->asString(); 288 line += ";" + it.current()->asString();
284 289
285 if (value_ != 0) 290 if (value_ != 0)
286 line += ":" + value_->asString(); 291 line += ":" + value_->asString();
287 292
293 line = line.replace( QRegExp( "\r" ), "\\r" );
288 line = line.replace( QRegExp( "\n" ), "\\n" ); 294 line = line.replace( QRegExp( "\n" ), "\\n" );
289 295
290 // Fold lines longer than 72 chars 296 // Fold lines longer than 72 chars
291 const int maxLen = 72; 297 const int maxLen = 72;
292 uint cursor = 0; 298 uint cursor = 0;
293 QString cut; 299 QString cut;
294 while( line.length() > ( cursor + 1 ) * maxLen ) { 300 while( line.length() > ( cursor + 1 ) * maxLen ) {
295 cut += line.mid( cursor * maxLen, maxLen ); 301 cut += line.mid( cursor * maxLen, maxLen );