# kabc Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# testaddressfmt.cpp

    00001 #include <kaboutdata.h>
    00002 #include <kapplication.h>
    00003 #include <kdebug.h>
    00004 #include <klocale.h>
    00005 #include <kcmdlineargs.h>
    00006 #include <kstandarddirs.h>
    00007
    00008 #include "addressbook.h"
    00009 #include "address.h"
    00010
    00011 using namespace KABC;
    00012
    00013 static const KCmdLineOptions options[] =
    00014 {
    00015   { "save", "", 0 },
    00016   { "number", "", 0 },
    00017   KCmdLineLastOption
    00018 };
    00019
    00020 int main(int argc,char **argv)
    00021 {
    00022   KAboutData aboutData("testaddressfmt","TestAddressFormat","0.1");
    00023   KCmdLineArgs::init(argc, argv, &aboutData);
    00024   KCmdLineArgs::addCmdLineOptions(options);
    00025
    00026   KApplication app;
    00027
    00028   Address a;
    00029   a.setStreet("Lummerlandstr. 1");
    00030   a.setPostalCode("12345");
    00031   a.setLocality("Lummerstadt");
    00032   a.setCountry ("Germany");
    00033
    00034   Address b;
    00035   b.setStreet("457 Foobar Ave");
    00036   b.setPostalCode("1A2B3C");
    00037   b.setLocality("Nervousbreaktown");
    00038   b.setRegion("DC");
    00039   b.setCountry("United States of America");
    00040
    00041   Address c;
    00042   c.setStreet("Lummerlandstr. 1");
    00043   c.setPostalCode("12345");
    00044   c.setLocality("Lummerstadt");
    00045   c.setCountry ("Deutschland");
    00046
    00047   Address d;
    00048   d.setStreet("Lummerlandstr. 1");
    00049   d.setPostalCode("12345");
    00050   d.setLocality("Lummerstadt");
    00051   d.setCountry ("");
    00052
    00053   qDebug( "-------------------------------------\nShould have german address formatting, local country formatting\n" );
    00054   qDebug( a.formattedAddress("Jim Knopf").latin1() );
    00055   qDebug( "-------------------------------------\nShould have US address formatting, local country formatting\n" );
    00056   qDebug( b.formattedAddress("Huck Finn").latin1() );
    00057   qDebug( "-------------------------------------\nShould have german address formatting, local country formatting\n" );
    00058   qDebug( c.formattedAddress("Jim Knopf").latin1() );
    00059   qDebug( "-------------------------------------\nShould have local address formatting, local country formatting\n" );
    00060   qDebug( d.formattedAddress("Jim Knopf").latin1() );
    00061 }
    00062
    00063

This file is part of the documentation for kabc Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:31 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003