From 4145dc4a513d5899d8a2b9e4573d8140d871b386 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 12 Nov 2005 23:42:08 +0000 Subject: fix --- (limited to 'kabc') diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index 26fd4f0..580c28b 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -853,11 +853,12 @@ Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl ) return agent; } +#include void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType type, const Picture &pic, const Addressee &addr, bool intern ) { ContentLine cl; cl.setName( EntityTypeToParamName( type ) ); - + // qDebug( "IIIMMMMM %s",QImage::outputFormatList ().join("-").latin1() ); if ( pic.isIntern() && pic.data().isNull() ) return; @@ -873,20 +874,23 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty s.setVersion( 4 ); // to produce valid png files s << img; cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); - + params.append( new Param( "ENCODING", "b" ) ); + if ( !pic.type().isEmpty() ) + params.append( new Param( "TYPE", pic.type().utf8() ) ); } else { // save picture in cache QString dir; if ( type == EntityPhoto ) dir = "photos"; if ( type == EntityLogo ) dir = "logos"; - - img.save( locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ), pic.type().utf8() ); - cl.setValue( new TextValue( "" ) ); + QString imUrl = locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ); + KABC::Picture* ppic =(KABC::Picture*) &pic; + ppic->setUrl( imUrl ); + img.save(imUrl, "PNG" ); + cl.setValue( new TextValue( pic.url().utf8() ) ); + params.append( new Param( "VALUE", "uri" ) ); } - params.append( new Param( "ENCODING", "b" ) ); - if ( !pic.type().isEmpty() ) - params.append( new Param( "TYPE", pic.type().utf8() ) ); + } else { cl.setValue( new TextValue( pic.url().utf8() ) ); -- cgit v0.9.0.2