author | zautrix <zautrix> | 2005-02-11 05:36:14 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-11 05:36:14 (UTC) |
commit | 0c1191e3253542b4858261241975c159ee7910c6 (patch) (side-by-side diff) | |
tree | be97b6665d130f0b72db82005726fbf7cc030abb /kabc | |
parent | 38c6a7b6ae1e98cba0fdf2d0fba59ad4b9060940 (diff) | |
download | kdepimpi-0c1191e3253542b4858261241975c159ee7910c6.zip kdepimpi-0c1191e3253542b4858261241975c159ee7910c6.tar.gz kdepimpi-0c1191e3253542b4858261241975c159ee7910c6.tar.bz2 |
font fixes
-rw-r--r-- | kabc/vcard/ContentLine.cpp | 8 |
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 @@ -116,98 +116,103 @@ ContentLine::operator = (ContentLine & x) ParamListIterator it(x.paramList_); for (; it.current(); ++it) { Param *p = new Param; p->setName( it.current()->name() ); p->setValue( it.current()->value() ); paramList_.append(p); } value_ = x.value_->clone(); Entity::operator = (x); return *this; } ContentLine & ContentLine::operator = (const QCString & s) { Entity::operator = (s); delete value_; value_ = 0; return *this; } bool ContentLine::operator == (ContentLine & x) { x.parse(); QPtrListIterator<Param> it(x.paramList()); if (!paramList_.find(it.current())) 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); } vDebug("Group == " + group_); vDebug("firstPart == " + firstPart); vDebug("valuePart == " + valuePart); // Now we have the group, the name and param list together and the value. QStrList l; RTokenise(firstPart, ";", l); if (l.count() == 0) {// invalid - no name ! vDebug("No name for this content line !"); return; } name_ = l.at(0); // Now we have the name, so the rest of 'l' is the params. // Remove the name part. l.remove(0u); entityType_ = EntityNameToEntityType(name_); paramType_ = EntityTypeToParamType(entityType_); unsigned int i = 0; // For each parameter, create a new parameter of the correct type. QStrListIterator it(l); @@ -240,96 +245,97 @@ ContentLine::_parse() } // Create a new value of the correct type. valueType_ = EntityTypeToValueType(entityType_); // kdDebug(5710) << "valueType: " << valueType_ << endl; switch (valueType_) { case ValueSound: value_ = new SoundValue; break; case ValueAgent: value_ = new AgentValue; break; case ValueAddress: value_ = new AdrValue; break; case ValueTel: value_ = new TelValue; break; case ValueTextBin: value_ = new TextBinValue; break; case ValueOrg: value_ = new OrgValue; break; case ValueN: value_ = new NValue; break; case ValueUTC: value_ = new UTCValue; break; case ValueURI: value_ = new URIValue; break; case ValueClass: value_ = new ClassValue; break; case ValueFloat: value_ = new FloatValue; break; case ValueImage: value_ = new ImageValue; break; case ValueDate: value_ = new DateValue; break; case ValueTextList: value_ = new TextListValue; break; case ValueGeo: value_ = new GeoValue; break; case ValueText: case ValueUnknown: default: value_ = new TextValue; break; } *value_ = valuePart; } 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_ + "\""); strRep_.truncate(0); QCString line; if (!group_.isEmpty()) line += group_ + '.'; line += name_; 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; } |