author | zautrix <zautrix> | 2004-10-13 05:15:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-13 05:15:03 (UTC) |
commit | f08cf9044213a60c87e2bf299665d13a335feff5 (patch) (unidiff) | |
tree | c9c0e8b0f7f7a48dcee8fbdd5b9a467985c78fdd /kabc/vcard | |
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 |
1 files changed, 1 insertions, 0 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 | |||
@@ -246,75 +246,76 @@ ContentLine::_parse() | |||
246 | //kdDebug(5710) << "valueType: " << valueType_ << endl; | 246 | //kdDebug(5710) << "valueType: " << valueType_ << endl; |
247 | 247 | ||
248 | switch (valueType_) { | 248 | switch (valueType_) { |
249 | 249 | ||
250 | case ValueSound: value_ = new SoundValue;break; | 250 | case ValueSound: value_ = new SoundValue;break; |
251 | case ValueAgent: value_ = new AgentValue;break; | 251 | case ValueAgent: value_ = new AgentValue;break; |
252 | case ValueAddress: value_ = new AdrValue; break; | 252 | case ValueAddress: value_ = new AdrValue; break; |
253 | case ValueTel: value_ = new TelValue; break; | 253 | case ValueTel: value_ = new TelValue; break; |
254 | case ValueTextBin: value_ = new TextBinValue;break; | 254 | case ValueTextBin: value_ = new TextBinValue;break; |
255 | case ValueOrg: value_ = new OrgValue; break; | 255 | case ValueOrg: value_ = new OrgValue; break; |
256 | case ValueN: value_ = new NValue; break; | 256 | case ValueN: value_ = new NValue; break; |
257 | case ValueUTC: value_ = new UTCValue; break; | 257 | case ValueUTC: value_ = new UTCValue; break; |
258 | case ValueURI: value_ = new URIValue; break; | 258 | case ValueURI: value_ = new URIValue; break; |
259 | case ValueClass: value_ = new ClassValue;break; | 259 | case ValueClass: value_ = new ClassValue;break; |
260 | case ValueFloat: value_ = new FloatValue;break; | 260 | case ValueFloat: value_ = new FloatValue;break; |
261 | case ValueImage: value_ = new ImageValue;break; | 261 | case ValueImage: value_ = new ImageValue;break; |
262 | case ValueDate: value_ = new DateValue; break; | 262 | case ValueDate: value_ = new DateValue; break; |
263 | case ValueTextList: value_ = new TextListValue;break; | 263 | case ValueTextList: value_ = new TextListValue;break; |
264 | case ValueGeo: value_ = new GeoValue; break; | 264 | case ValueGeo: value_ = new GeoValue; break; |
265 | case ValueText: | 265 | case ValueText: |
266 | case ValueUnknown: | 266 | case ValueUnknown: |
267 | default: value_ = new TextValue; break; | 267 | default: value_ = new TextValue; break; |
268 | } | 268 | } |
269 | 269 | ||
270 | *value_ = valuePart; | 270 | *value_ = valuePart; |
271 | } | 271 | } |
272 | 272 | ||
273 | void | 273 | void |
274 | ContentLine::_assemble() | 274 | ContentLine::_assemble() |
275 | { | 275 | { |
276 | vDebug("Assemble (argl) - my name is \"" + name_ + "\""); | 276 | vDebug("Assemble (argl) - my name is \"" + name_ + "\""); |
277 | strRep_.truncate(0); | 277 | strRep_.truncate(0); |
278 | 278 | ||
279 | QCString line; | 279 | QCString line; |
280 | 280 | ||
281 | if (!group_.isEmpty()) | 281 | if (!group_.isEmpty()) |
282 | line += group_ + '.'; | 282 | line += group_ + '.'; |
283 | 283 | ||
284 | line += name_; | 284 | line += name_; |
285 | 285 | ||
286 | vDebug("Adding parameters"); | 286 | vDebug("Adding parameters"); |
287 | ParamListIterator it(paramList_); | 287 | ParamListIterator it(paramList_); |
288 | 288 | ||
289 | for (; it.current(); ++it) | 289 | for (; it.current(); ++it) |
290 | line += ";" + it.current()->asString(); | 290 | line += ";" + it.current()->asString(); |
291 | 291 | ||
292 | vDebug("Adding value"); | 292 | vDebug("Adding value"); |
293 | if (value_ != 0) | 293 | if (value_ != 0) |
294 | line += ":" + value_->asString(); | 294 | line += ":" + value_->asString(); |
295 | else | 295 | else |
296 | vDebug("No value"); | 296 | vDebug("No value"); |
297 | 297 | ||
298 | // Quote newlines | 298 | // Quote newlines |
299 | line = line.replace( QRegExp( "\n" ), "\\n" ); | 299 | line = line.replace( QRegExp( "\n" ), "\\n" ); |
300 | 300 | ||
301 | // Fold lines longer than 72 chars | 301 | // Fold lines longer than 72 chars |
302 | const int maxLen = 72; | 302 | const int maxLen = 72; |
303 | uint cursor = 0; | 303 | uint cursor = 0; |
304 | while( line.length() > ( cursor + 1 ) * maxLen ) { | 304 | while( line.length() > ( cursor + 1 ) * maxLen ) { |
305 | strRep_ += line.mid( cursor * maxLen, maxLen ); | 305 | strRep_ += line.mid( cursor * maxLen, maxLen ); |
306 | strRep_ += "\r\n "; | 306 | strRep_ += "\r\n "; |
307 | ++cursor; | 307 | ++cursor; |
308 | } | 308 | } |
309 | strRep_ += line.mid( cursor * maxLen ); | 309 | strRep_ += line.mid( cursor * maxLen ); |
310 | //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); | ||
310 | } | 311 | } |
311 | 312 | ||
312 | void | 313 | void |
313 | ContentLine::clear() | 314 | ContentLine::clear() |
314 | { | 315 | { |
315 | group_.truncate(0); | 316 | group_.truncate(0); |
316 | name_.truncate(0); | 317 | name_.truncate(0); |
317 | paramList_.clear(); | 318 | paramList_.clear(); |
318 | delete value_; | 319 | delete value_; |
319 | value_ = 0; | 320 | value_ = 0; |
320 | } | 321 | } |