-rw-r--r-- | kabc/vcard/VCardEntity.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kabc/vcard/VCardEntity.cpp b/kabc/vcard/VCardEntity.cpp index 0cd2086..5fca3bc 100644 --- a/kabc/vcard/VCardEntity.cpp +++ b/kabc/vcard/VCardEntity.cpp @@ -24,99 +24,106 @@ #include <qregexp.h> #include <VCardDefines.h> #include <VCardVCardEntity.h> using namespace VCARD; VCardEntity::VCardEntity() : Entity() { cardList_.setAutoDelete( TRUE ); } VCardEntity::VCardEntity(const VCardEntity & x) : Entity(x) { cardList_.setAutoDelete( TRUE ); } VCardEntity::VCardEntity(const QCString & s) : Entity(s) { cardList_.setAutoDelete( TRUE ); } VCardEntity & VCardEntity::operator = (VCardEntity & x) { if (*this == x) return *this; Entity::operator = (x); return *this; } VCardEntity & VCardEntity::operator = (const QCString & s) { Entity::operator = (s); return *this; } bool VCardEntity::operator == (VCardEntity & x) { x.parse(); return false; } VCardEntity::~VCardEntity() { } void VCardEntity::_parse() { vDebug("parse"); QCString s(strRep_); int i = s.find(QRegExp("BEGIN:VCARD", false)); while (i != -1) { i = s.find(QRegExp("BEGIN:VCARD", false), 11); QCString cardStr(s.left(i)); VCard * v = new VCard(cardStr); cardList_.append(v); v->parse(); s.remove(0, i); } } void VCardEntity::_assemble() { VCardListIterator it(cardList_); for (; it.current(); ++it) strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck. } VCardList & VCardEntity::cardList() { parse(); return cardList_; } void VCardEntity::setCardList(const VCardList & l) { parse(); - cardList_ = l; +//US cardList_ = l; + VCardListIterator it(l); + + for (; it.current(); ++it) { + VCard* v = new VCard(*it.current()); + cardList_.append(v); + } + } |