From 61c95ce0295f1397db6499c5b468a9fb3d32a0f4 Mon Sep 17 00:00:00 2001 From: zautrix Date: Fri, 14 Jan 2005 11:37:40 +0000 Subject: made kapi saving faster --- (limited to 'kabc/vcard/ContentLine.cpp') diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp index c368172..2f88cde 100644 --- a/kabc/vcard/ContentLine.cpp +++ b/kabc/vcard/ContentLine.cpp @@ -273,6 +273,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( "\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_ + "\""); strRep_.truncate(0); @@ -307,7 +334,8 @@ ContentLine::_assemble() ++cursor; } strRep_ += line.mid( cursor * maxLen ); - //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); + qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); +#endif } void -- cgit v0.9.0.2