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

List:       kde-pim
Subject:    Re: [Kde-pim] KABC Addresses
From:       Jost Schenck <jost.schenck () gmx ! de>
Date:       2002-10-01 8:48:26
[Download RAW message or body]

On Lørdag den 28. september 2002 16:36, Tobias Koenig wrote:
> On Thu, Sep 26, 2002 at 04:54:00PM +0200, Anders Lund wrote:
> > "Postbox %Postbox" PURGE_NO_VALUE
> > %Street PURGE_NO_VALUE
> > %Locality", %ZipCode"
> > %Area PURGE_NO_VALUE
> > %CountryCode %Country PURGE_CURRENT_LOCATION
>
> We should use short parameters like %r = region, %s = street.
> Furthermore the template has to be in _one_ line (it is saved in a
> kconfig file)

With the purge stuff this is a bit more complicated: for example the literal 
word Postbox should not be included if the value of %p or %postbox is purged. 
This must be marked up which is difficult. In Anders' example the the 
quotation marks seem to do this, but I doubt it is always clear what the 
PURGE keyword refers to (e.g. "Postbox %Postbox" never really evaluates to 
no-value, but rather to "Postbox "). What about the case "Region, Country", 
where the comma should be left out if *either* region or country is purged?

So as an RFC: for a start I use the following, any comments welcome.

------------------
%n = real name
%N = REAL NAME
%s = street
%S = STREET
%z = zip code
%l = location
%L = LOCATION
%r = region
%R = REGION
%c = country
%C = COUNTRY
%p = post office box
\n = new line
%, = conditional comma+whitespace, will be left out if the value directly 
     left or right of it is purged or no-value
%0(...) = the string inside the brackets will be purged if every
     tag inside it evaluates to no-value

So for example for Germany we'd maybe have something like:

AddressFormat=%n\n%0(Postfach %p\n)%0(%s\n)%0(%z %l\n)%r%,%c
------------------

I've included uppercase variants as in quite some countries some fields are 
uppercased (IIRC russia for example). 

Unfortunately the purge things need a little lookahead parsing so it's not as 
trivial as doing a couple of QString::replace. Still, I'd rather do this 
cleanly than come up with a solution that leaves orphaned commas everywhere 
etc.

In the long run we'd need more tags eg. for company addresses etc. but for now 
this is okay for a start I think.

What do you think?
-Jost.

_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

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