• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

kabc

testutils.cpp

00001 /*
00002     This file is part of libkabc.
00003     Copyright (c) 2007 KDE-PIM team <kde-pim@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include <QtCore/QFile>
00022 
00023 #include <kabc/addressee.h>
00024 
00025 #include "vcardparser.h"
00026 
00027 using namespace KABC;
00028 
00029 Addressee vcard1()
00030 {
00031   Addressee addr;
00032 
00033   addr.setName( "Frank Dawson" );
00034   addr.setOrganization( "Lotus Development Corporation" );
00035   addr.setUrl( KUrl( "http://home.earthlink.net/~fdawson" ) );
00036   addr.insertEmail( "fdawson@earthlink.net" );
00037   addr.insertEmail( "Frank_Dawson@Lotus.com", true );
00038   addr.insertPhoneNumber( PhoneNumber( "+1-919-676-9515",
00039                                        PhoneNumber::Voice|PhoneNumber::Msg|PhoneNumber::Work ) );
00040   addr.insertPhoneNumber( PhoneNumber( "+1-919-676-9564",
00041                                        PhoneNumber::Fax |PhoneNumber::Work ) );
00042   Address a( Address::Work | Address::Postal | Address::Parcel );
00043   a.setStreet( "6544 Battleford Drive" );
00044   a.setLocality( "Raleigh" );
00045   a.setRegion( "NC" );
00046   a.setPostalCode( "27613-3502" );
00047   a.setCountry( "U.S.A." );
00048   addr.insertAddress( a );
00049   return addr;
00050 }
00051 
00052 Addressee vcard2()
00053 {
00054   Addressee addr;
00055 
00056   addr.setName( "Tim Howes" );
00057   addr.setOrganization( "Netscape Communications Corp." );
00058   addr.insertEmail( "howes@netscape.com" );
00059   addr.insertPhoneNumber( PhoneNumber( "+1-415-937-3419",
00060                                        PhoneNumber::Voice|PhoneNumber::Msg|PhoneNumber::Work ) );
00061   addr.insertPhoneNumber( PhoneNumber( "+1-415-528-4164",
00062                                        PhoneNumber::Fax|PhoneNumber::Work ) );
00063   Address a( Address::Work );
00064   a.setStreet( "501 E. Middlefield Rd." );
00065   a.setLocality( "Mountain View" );
00066   a.setRegion( "CA" );
00067   a.setPostalCode( "94043" );
00068   a.setCountry( "U.S.A." );
00069   addr.insertAddress( a );
00070   return addr;
00071 }
00072 
00073 Addressee vcard3()
00074 {
00075   Addressee addr;
00076 
00077   addr.setName( "ian geiser" );
00078   addr.setOrganization( "Source eXtreme" );
00079   addr.insertEmail( "geiseri@yahoo.com" );
00080   addr.setTitle( "VP of Engineering" );
00081   return addr;
00082 }
00083 
00084 QByteArray vcardAsText( const QString &location )
00085 {
00086   QByteArray text;
00087 
00088   QFile file( location );
00089   if ( file.open( QIODevice::ReadOnly ) ) {
00090     text = file.readAll();
00091     file.close();
00092   }
00093 
00094   return text;
00095 }
00096 
00097 Addressee::List vCardsAsAddresseeList()
00098 {
00099   Addressee::List l;
00100 
00101   l.append( vcard1() );
00102   l.append( vcard2() );
00103   l.append( vcard3() );
00104 
00105   return l;
00106 }
00107 
00108 QByteArray vCardsAsText()
00109 {
00110   QByteArray vcards = vcardAsText( "tests/vcard1.vcf" );
00111   vcards += vcardAsText( "tests/vcard2.vcf" );
00112   vcards += vcardAsText( "tests/vcard3.vcf" );
00113 
00114   return vcards;
00115 }

kabc

Skip menu "kabc"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.7.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal