-rw-r--r-- | kabc/vcardformatimpl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index c31af46..b9fe6ff 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -78,97 +78,97 @@ bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFi VCardEntity e( data ); VCardListIterator it( e.cardList() ); for (; it.current(); ++it) { //US VCard v(*it.current()); Addressee addressee; //US loadAddressee( addressee, v ); loadAddressee( addressee, it.current() ); addressee.setResource( resource ); addressBook->insertAddressee( addressee ); if (debug == true) { printf("address %s loaded successfully\n", addressee.formattedName().latin1()); } } return true; } void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) { VCardEntity vcards; VCardList vcardlist; vcardlist.setAutoDelete( true ); VCard *v = new VCard; saveAddressee( addressee, v, false ); vcardlist.append( v ); vcards.setCardList( vcardlist ); QCString vcardData = vcards.asString(); file->writeBlock( (const char*)vcardData, vcardData.length() ); } void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) { VCardEntity vcards; VCardList vcardlist; vcardlist.setAutoDelete( true ); AddressBook::Iterator it; for ( it = ab->begin(); it != ab->end(); ++it ) { if ( (*it).resource() == resource ) { VCard *v = new VCard; - saveAddressee( (*it), v, false ); + saveAddressee( (*it), v, true ); (*it).setChanged( false ); vcardlist.append( v ); } } vcards.setCardList( vcardlist ); QCString vcardData = vcards.asString(); file->writeBlock( (const char*)vcardData, vcardData.length() ); } bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) { QPtrList<ContentLine> contentLines = v->contentLineList(); ContentLine *cl; for( cl = contentLines.first(); cl; cl = contentLines.next() ) { QCString n = cl->name(); if ( n.left( 2 ) == "X-" ) { n = n.mid( 2 ); int posDash = n.find( "-" ); addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ), QString::fromUtf8( n.mid( posDash + 1 ) ), QString::fromUtf8( cl->value()->asString() ) ); continue; } EntityType type = cl->entityType(); switch( type ) { case EntityUID: addressee.setUid( readTextValue( cl ) ); break; case EntityEmail: addressee.insertEmail( readTextValue( cl ) ); break; case EntityName: addressee.setName( readTextValue( cl ) ); break; case EntityFullName: addressee.setFormattedName( readTextValue( cl ) ); break; case EntityURL: addressee.setUrl( KURL( readTextValue( cl ) ) ); |