author | ulf69 <ulf69> | 2004-08-20 01:16:22 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-20 01:16:22 (UTC) |
commit | f7a401f03c18ef96eb40dc5540b31cd10880e845 (patch) (side-by-side diff) | |
tree | f028d7dd67e34d00d44bd9af27b6e2c3dcd93cef /kabc | |
parent | d39b363278224b969d4c2945d32968c980b5d842 (diff) | |
download | kdepimpi-f7a401f03c18ef96eb40dc5540b31cd10880e845.zip kdepimpi-f7a401f03c18ef96eb40dc5540b31cd10880e845.tar.gz kdepimpi-f7a401f03c18ef96eb40dc5540b31cd10880e845.tar.bz2 |
bugfix: fixed a memoryleak in vCards while saving contacts
-rw-r--r-- | kabc/vcard/VCardEntity.cpp | 9 | ||||
-rw-r--r-- | kabc/vcardformatimpl.cpp | 4 |
2 files changed, 10 insertions, 3 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 @@ -96,27 +96,34 @@ VCardEntity::_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); + } + } diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index bd9a57b..bffaa64 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -262,50 +262,50 @@ bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) kdDebug(5700) << "VCardFormat::load(): Unsupported entity: " << int( type ) << ": " << cl->asString() << endl; break; } } for( cl = contentLines.first(); cl; cl = contentLines.next() ) { EntityType type = cl->entityType(); if ( type == EntityLabel ) { int type = readAddressParam( cl ); Address address = addressee.address( type ); if ( address.isEmpty() ) address.setType( type ); address.setLabel( QString::fromUtf8( cl->value()->asString() ) ); addressee.insertAddress( address ); } } return true; } void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern ) { - ContentLine cl; - QString value; +//US ContentLine cl; +//US QString value; addTextValue( v, EntityName, addressee.name() ); addTextValue( v, EntityUID, addressee.uid() ); addTextValue( v, EntityFullName, addressee.formattedName() ); QStringList emails = addressee.emails(); QStringList::ConstIterator it4; for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) { addTextValue( v, EntityEmail, *it4 ); } QStringList customs = addressee.customs(); QStringList::ConstIterator it5; for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) { addCustomValue( v, *it5 ); } addTextValue( v, EntityURL, addressee.url().url() ); addNValue( v, addressee ); addTextValue( v, EntityNickname, addressee.nickName() ); addTextValue( v, EntityMailer, addressee.mailer() ); addTextValue( v, EntityTitle, addressee.title() ); |