From kde-commits Fri Feb 09 19:14:06 2007 From: David Faure Date: Fri, 09 Feb 2007 19:14:06 +0000 To: kde-commits Subject: Re: branches/KDE/3.5/kdepim/kresources/kolab/kabc Message-Id: <200702092014.10549.dfaure () klaralvdalens-datakonsult ! se> X-MARC-Message: https://marc.info/?l=kde-commits&m=117104888219810 On Friday 09 February 2007, Frerich Raabe wrote: > On Friday 09 February 2007 20:00, David Faure wrote: > > @@ -537,11 +539,18 @@ > > element.appendChild( e ); > > const Address& a = *it; > > writeString( e, "type", a.type ); > > - writeString( e, "street", a.street ); > > + if ( !a.street.isEmpty() ) > > + writeString( e, "street", a.street ); > > + if ( !a.pobox.isEmpty() ) > > + writeString( e, "pobox", a.pobox ); > > + if ( !a.locality.isEmpty() ) > > writeString( e, "locality", a.locality ); > > - writeString( e, "region", a.region ); > > - writeString( e, "postal-code", a.postalCode ); > > - writeString( e, "country", a.country ); > > + if ( !a.region.isEmpty() ) > > + writeString( e, "region", a.region ); > > + if ( !a.postalCode.isEmpty() ) > > + writeString( e, "postal-code", a.postalCode ); > > + if ( !a.country.isEmpty() ) > > + writeString( e, "country", a.country ); > > } > > Maybe the check for emptyness should be in writeString itself? Hmm. Maybe. But not all fields are optional, so the risk would be to generate invalid xml when the user leaves a field empty, if for some reason the spec makes a field mandatory. -- David Faure, faure@kde.org, dfaure@klaralvdalens-datakonsult.se KDE/KOffice developer, Qt consultancy projects Klarälvdalens Datakonsult AB, Platform-independent software solutions