summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2005-01-06 00:18:02 (UTC)
committer zautrix <zautrix>2005-01-06 00:18:02 (UTC)
commit5e7c3e3e51fa939e97b73e6443089edcec8dc663 (patch) (side-by-side diff)
tree213be239777ec911d364f736f9e6cef1f62a7c68 /kabc
parent0618fbee69bfde7f7f3c4a54b5cc45dac446abd3 (diff)
downloadkdepimpi-5e7c3e3e51fa939e97b73e6443089edcec8dc663.zip
kdepimpi-5e7c3e3e51fa939e97b73e6443089edcec8dc663.tar.gz
kdepimpi-5e7c3e3e51fa939e97b73e6443089edcec8dc663.tar.bz2
kapi pic fix
Diffstat (limited to 'kabc') (more/less context) (show whitespace changes)
-rw-r--r--kabc/vcardformatimpl.cpp2
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
@@ -62,129 +62,129 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file )
if ( it.current() ) {
//US VCard v(*it.current());
//US loadAddressee( addressee, v );
loadAddressee( addressee, it.current() );
return true;
}
return false;
}
bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file )
{
kdDebug(5700) << "VCardFormat::loadAll()" << endl;
QByteArray fdata = file->readAll();
QCString data(fdata.data(), fdata.size()+1);
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 ) ) );
break;
case EntityNickname:
addressee.setNickName( readTextValue( cl ) );
break;
case EntityLabel:
// not yet supported by kabc
break;
case EntityMailer:
addressee.setMailer( readTextValue( cl ) );
break;
case EntityTitle:
addressee.setTitle( readTextValue( cl ) );