[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: branches/KDE/3.5/kdepim/kresources/kolab/kabc
From:       David Faure <dfaure () klaralvdalens-datakonsult ! se>
Date:       2007-02-09 19:14:06
Message-ID: 200702092014.10549.dfaure () klaralvdalens-datakonsult ! se
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic