# kabc Library API Documentation

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

# testutils.cpp

    00001 #include <vcardparser.h>
    00002 #include <kabc/addressee.h>
    00003 #include <qfile.h>
    00004
    00005 using namespace KABC;
    00006
    00007 Addressee
    00008 vcard1()
    00009 {
    00010     Addressee addr;
    00011
    00012     addr.setName( "Frank Dawson" );
    00013     addr.setOrganization( "Lotus Development Corporation" );
    00014     addr.setUrl( KURL( "http://home.earthlink.net/~fdawson") );
    00015     addr.insertEmail( "fdawson@earthlink.net" );
    00016     addr.insertEmail( "Frank_Dawson@Lotus.com", true );
    00017     addr.insertPhoneNumber( PhoneNumber("+1-919-676-9515",PhoneNumber::Voice|PhoneNumber::Msg
    00018                                         |PhoneNumber::Work ) );
    00019     addr.insertPhoneNumber( PhoneNumber("+1-919-676-9564",PhoneNumber::Fax |PhoneNumber::Work ));
    00020     Address a( Address::Work | Address::Postal | Address::Parcel );
    00021     a.setStreet( "6544 Battleford Drive" );
    00022     a.setLocality( "Raleigh" );
    00023     a.setRegion( "NC" );
    00024     a.setPostalCode( "27613-3502" );
    00025     a.setCountry( "U.S.A." );
    00026     addr.insertAddress( a );
    00027     return addr;
    00028 }
    00029
    00030 Addressee
    00031 vcard2()
    00032 {
    00033     Addressee addr;
    00034
    00035     addr.setName( "Tim Howes" );
    00036     addr.setOrganization( "Netscape Communications Corp." );
    00037     addr.insertEmail( "howes@netscape.com" );
    00038     addr.insertPhoneNumber( PhoneNumber("+1-415-937-3419",PhoneNumber::Voice|PhoneNumber::Msg
    00039                                         |PhoneNumber::Work) );
    00040     addr.insertPhoneNumber( PhoneNumber("+1-415-528-4164",PhoneNumber::Fax |PhoneNumber::Work) );
    00041     Address a( Address::Work );
    00042     a.setStreet( "501 E. Middlefield Rd." );
    00043     a.setLocality( "Mountain View" );
    00044     a.setRegion( "CA" );
    00045     a.setPostalCode( "94043" );
    00046     a.setCountry( "U.S.A." );
    00047     addr.insertAddress( a );
    00048     return addr;
    00049 }
    00050
    00051 Addressee
    00052 vcard3()
    00053 {
    00054     Addressee addr;
    00055
    00056     addr.setName( "ian geiser" );
    00057     addr.setOrganization( "Source eXtreme" );
    00058     addr.insertEmail( "geiseri@yahoo.com" );
    00059     addr.setTitle( "VP of Engineering" );
    00060     return addr;
    00061 }
    00062
    00063
    00064 QString
    00065 vcardAsText( const QString& location )
    00066 {
    00067     QString line;
    00068     QFile file( location );
    00069     if ( file.open( IO_ReadOnly ) ) {
    00070         QTextStream stream( &file );
    00071         if ( !stream.eof() ) {
    00072             line = stream.read();
    00073         }
    00074         file.close();
    00075     }
    00076     return line;
    00077 }
    00078
    00079 Addressee::List
    00080 vCardsAsAddresseeList()
    00081 {
    00082     Addressee::List l;
    00083
    00084     l.append( vcard1() );
    00085     l.append( vcard2() );
    00086     l.append( vcard3() );
    00087
    00088     return l;
    00089 }
    00090
    00091 QString
    00092 vCardsAsText()
    00093 {
    00094     QString vcards = vcardAsText( "tests/vcard1.vcf" );
    00095     vcards += vcardAsText( "tests/vcard2.vcf" );
    00096     vcards += vcardAsText( "tests/vcard3.vcf" );
    00097
    00098     return vcards;
    00099 }

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