-rw-r--r-- | kabc/vcardformatimpl.cpp | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index 3fcaf94..bd9a57b 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -54,6 +54,7 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) if ( it.current() ) { - VCard v(*it.current()); - loadAddressee( addressee, v ); +//US VCard v(*it.current()); +//US loadAddressee( addressee, v ); + loadAddressee( addressee, it.current() ); return true; } @@ -74,7 +75,8 @@ bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFi for (; it.current(); ++it) { - VCard v(*it.current()); +//US VCard v(*it.current()); Addressee addressee; - loadAddressee( addressee, v ); +//US loadAddressee( addressee, v ); + loadAddressee( addressee, it.current() ); addressee.setResource( resource ); addressBook->insertAddressee( addressee ); @@ -123,7 +125,7 @@ void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file } -bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard &v ) +bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) { - QPtrList<ContentLine> contentLines = v.contentLineList(); + QPtrList<ContentLine> contentLines = v->contentLineList(); ContentLine *cl; @@ -785,17 +787,17 @@ void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent ) if ( addr ) { writeToString( (*addr), vstr ); - + qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); -/*US +/*US vstr.replace( ":", "\\:" ); vstr.replace( ",", "\\," ); vstr.replace( ";", "\\;" ); vstr.replace( "\r\n", "\\n" ); -*/ - vstr.replace( QRegExp(":"), "\\:" ); - vstr.replace( QRegExp(","), "\\," ); - vstr.replace( QRegExp(";"), "\\;" ); - vstr.replace( QRegExp("\r\n"), "\\n" ); - +*/ + vstr.replace( QRegExp(":"), "\\:" ); + vstr.replace( QRegExp(","), "\\," ); + vstr.replace( QRegExp(";"), "\\;" ); + vstr.replace( QRegExp("\r\n"), "\\n" ); + cl.setValue( new TextValue( vstr.utf8() ) ); } else @@ -826,5 +828,5 @@ Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl ) QString vstr = QString::fromUtf8( v->asString() ); qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); -/*US +/*US vstr.replace( "\\n", "\r\n" ); vstr.replace( "\\:", ":" ); @@ -832,9 +834,9 @@ Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl ) vstr.replace( "\\;", ";" ); */ - vstr.replace( QRegExp("\\n"), "\r\n" ); - vstr.replace( QRegExp("\\:"), ":" ); - vstr.replace( QRegExp("\\,"), "," ); - vstr.replace( QRegExp("\\;"), ";" ); - + vstr.replace( QRegExp("\\n"), "\r\n" ); + vstr.replace( QRegExp("\\:"), ":" ); + vstr.replace( QRegExp("\\,"), "," ); + vstr.replace( QRegExp("\\;"), ";" ); + Addressee *addr = new Addressee; readFromString( vstr, *addr ); @@ -867,5 +869,5 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty s << img; cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); - + } else { // save picture in cache QString dir; @@ -882,5 +884,5 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty params.append( new Param( "TYPE", pic.type().utf8() ) ); } else { - + cl.setValue( new TextValue( pic.url().utf8() ) ); params.append( new Param( "VALUE", "uri" ) ); @@ -1002,6 +1004,7 @@ bool VCardFormatImpl::readFromString( const QString &vcard, Addressee &addressee if ( it.current() ) { - VCard v(*it.current()); - loadAddressee( addressee, v ); +//US VCard v(*it.current()); +//US loadAddressee( addressee, v ); + loadAddressee( addressee, it.current() ); return true; } |