summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-20 01:16:22 (UTC)
committer ulf69 <ulf69>2004-08-20 01:16:22 (UTC)
commitf7a401f03c18ef96eb40dc5540b31cd10880e845 (patch) (unidiff)
treef028d7dd67e34d00d44bd9af27b6e2c3dcd93cef
parentd39b363278224b969d4c2945d32968c980b5d842 (diff)
downloadkdepimpi-f7a401f03c18ef96eb40dc5540b31cd10880e845.zip
kdepimpi-f7a401f03c18ef96eb40dc5540b31cd10880e845.tar.gz
kdepimpi-f7a401f03c18ef96eb40dc5540b31cd10880e845.tar.bz2
bugfix: fixed a memoryleak in vCards while saving contacts
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/VCardEntity.cpp9
-rw-r--r--kabc/vcardformatimpl.cpp4
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
@@ -104,19 +104,26 @@ VCardEntity::_assemble()
104 104
105 for (; it.current(); ++it) 105 for (; it.current(); ++it)
106 strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck. 106 strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck.
107} 107}
108 108
109 VCardList & 109 VCardList &
110VCardEntity::cardList() 110VCardEntity::cardList()
111{ 111{
112 parse(); 112 parse();
113 return cardList_; 113 return cardList_;
114} 114}
115 115
116 void 116 void
117VCardEntity::setCardList(const VCardList & l) 117VCardEntity::setCardList(const VCardList & l)
118{ 118{
119 parse(); 119 parse();
120 cardList_ = l; 120 //UScardList_ = l;
121 VCardListIterator it(l);
122
123 for (; it.current(); ++it) {
124 VCard* v = new VCard(*it.current());
125 cardList_.append(v);
126 }
127
121} 128}
122 129
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp
index bd9a57b..bffaa64 100644
--- a/kabc/vcardformatimpl.cpp
+++ b/kabc/vcardformatimpl.cpp
@@ -270,34 +270,34 @@ bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v )
270 if ( type == EntityLabel ) { 270 if ( type == EntityLabel ) {
271 int type = readAddressParam( cl ); 271 int type = readAddressParam( cl );
272 Address address = addressee.address( type ); 272 Address address = addressee.address( type );
273 if ( address.isEmpty() ) 273 if ( address.isEmpty() )
274 address.setType( type ); 274 address.setType( type );
275 275
276 address.setLabel( QString::fromUtf8( cl->value()->asString() ) ); 276 address.setLabel( QString::fromUtf8( cl->value()->asString() ) );
277 addressee.insertAddress( address ); 277 addressee.insertAddress( address );
278 } 278 }
279 } 279 }
280 280
281 return true; 281 return true;
282} 282}
283 283
284void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern ) 284void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern )
285{ 285{
286 ContentLine cl; 286//US ContentLine cl;
287 QString value; 287//US QString value;
288 288
289 addTextValue( v, EntityName, addressee.name() ); 289 addTextValue( v, EntityName, addressee.name() );
290 addTextValue( v, EntityUID, addressee.uid() ); 290 addTextValue( v, EntityUID, addressee.uid() );
291 addTextValue( v, EntityFullName, addressee.formattedName() ); 291 addTextValue( v, EntityFullName, addressee.formattedName() );
292 292
293 QStringList emails = addressee.emails(); 293 QStringList emails = addressee.emails();
294 QStringList::ConstIterator it4; 294 QStringList::ConstIterator it4;
295 for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) { 295 for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) {
296 addTextValue( v, EntityEmail, *it4 ); 296 addTextValue( v, EntityEmail, *it4 );
297 } 297 }
298 298
299 QStringList customs = addressee.customs(); 299 QStringList customs = addressee.customs();
300 QStringList::ConstIterator it5; 300 QStringList::ConstIterator it5;
301 for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) { 301 for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) {
302 addCustomValue( v, *it5 ); 302 addCustomValue( v, *it5 );
303 } 303 }