• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

kabc

  • kabc
  • vcardparser
testutils.cpp
1/*
2 This file is part of libkabc.
3 Copyright (c) 2007 KDE-PIM team <kde-pim@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include <QtCore/QFile>
22
23#include <kabc/addressee.h>
24
25#include "vcardparser.h"
26
27using namespace KABC;
28
29Addressee vcard1()
30{
31 Addressee addr;
32
33 addr.setName( QLatin1String( "Frank Dawson" ) );
34 addr.setOrganization( QLatin1String( "Lotus Development Corporation" ) );
35 addr.setUrl( KUrl( QLatin1String( "http://home.earthlink.net/~fdawson" ) ) );
36 addr.insertEmail( QLatin1String( "fdawson@earthlink.net" ) );
37 addr.insertEmail( QLatin1String( "Frank_Dawson@Lotus.com" ), true );
38 addr.insertPhoneNumber( PhoneNumber( QLatin1String( "+1-919-676-9515" ),
39 PhoneNumber::Voice|PhoneNumber::Msg|PhoneNumber::Work ) );
40 addr.insertPhoneNumber( PhoneNumber( QLatin1String( "+1-919-676-9564" ),
41 PhoneNumber::Fax |PhoneNumber::Work ) );
42 Address a( Address::Work | Address::Postal | Address::Parcel );
43 a.setStreet( QLatin1String( "6544 Battleford Drive" ) );
44 a.setLocality( QLatin1String( "Raleigh" ) );
45 a.setRegion( QLatin1String( "NC" ) );
46 a.setPostalCode( QLatin1String( "27613-3502" ) );
47 a.setCountry( QLatin1String( "U.S.A." ) );
48 addr.insertAddress( a );
49 return addr;
50}
51
52Addressee vcard2()
53{
54 Addressee addr;
55
56 addr.setName( QLatin1String( "Tim Howes" ) );
57 addr.setOrganization( QLatin1String( "Netscape Communications Corp." ) );
58 addr.insertEmail( QLatin1String( "howes@netscape.com" ) );
59 addr.insertPhoneNumber( PhoneNumber( QLatin1String( "+1-415-937-3419" ),
60 PhoneNumber::Voice|PhoneNumber::Msg|PhoneNumber::Work ) );
61 addr.insertPhoneNumber( PhoneNumber( QLatin1String( "+1-415-528-4164" ),
62 PhoneNumber::Fax|PhoneNumber::Work ) );
63 Address a( Address::Work );
64 a.setStreet( QLatin1String( "501 E. Middlefield Rd." ) );
65 a.setLocality( QLatin1String( "Mountain View" ) );
66 a.setRegion( QLatin1String( "CA" ) );
67 a.setPostalCode( QLatin1String( "94043" ) );
68 a.setCountry( QLatin1String( "U.S.A." ) );
69 addr.insertAddress( a );
70 return addr;
71}
72
73Addressee vcard3()
74{
75 Addressee addr;
76
77 addr.setName( QLatin1String( "ian geiser" ) );
78 addr.setOrganization( QLatin1String( "Source eXtreme" ) );
79 addr.insertEmail( QLatin1String( "geiseri@yahoo.com" ) );
80 addr.setTitle( QLatin1String( "VP of Engineering" ) );
81 return addr;
82}
83
84QByteArray vcardAsText( const QString &location )
85{
86 QByteArray text;
87
88 QFile file( location );
89 if ( file.open( QIODevice::ReadOnly ) ) {
90 text = file.readAll();
91 file.close();
92 }
93
94 return text;
95}
96
97Addressee::List vCardsAsAddresseeList()
98{
99 Addressee::List l;
100
101 l.append( vcard1() );
102 l.append( vcard2() );
103 l.append( vcard3() );
104
105 return l;
106}
107
108QByteArray vCardsAsText()
109{
110 QByteArray vcards = vcardAsText( QLatin1String( "tests/vcard1.vcf" ) );
111 vcards += vcardAsText( QLatin1String( "tests/vcard2.vcf" ) );
112 vcards += vcardAsText( QLatin1String( "tests/vcard3.vcf" ) );
113
114 return vcards;
115}
KABC::Address
Postal address information.
Definition: address.h:38
KABC::Address::Parcel
@ Parcel
parcel
Definition: address.h:55
KABC::Address::Work
@ Work
address at work
Definition: address.h:57
KABC::Address::Postal
@ Postal
postal
Definition: address.h:54
KABC::AddresseeList
a QValueList of Addressee, with sorting functionality
Definition: addresseelist.h:289
KABC::Addressee
address book entry
Definition: addressee.h:79
KABC::Addressee::setOrganization
void setOrganization(const QString &organization)
Set organization.
Definition: addressee.cpp:968
KABC::Addressee::insertPhoneNumber
void insertPhoneNumber(const PhoneNumber &phoneNumber)
Insert a phone number.
Definition: addressee.cpp:1525
KABC::Addressee::insertEmail
void insertEmail(const QString &email, bool preferred=false)
Insert an email address.
Definition: addressee.cpp:1420
KABC::Addressee::setName
void setName(const QString &name)
Set name.
Definition: addressee.cpp:452
KABC::Addressee::insertAddress
void insertAddress(const Address &address)
Insert an address.
Definition: addressee.cpp:1773
KABC::Addressee::setUrl
void setUrl(const KUrl &url)
Set homepage.
Definition: addressee.cpp:1088
KABC::Addressee::setTitle
void setTitle(const QString &title)
Set title.
Definition: addressee.cpp:928
KABC::PhoneNumber
Phonenumber information.
Definition: phonenumber.h:39
KABC::PhoneNumber::Fax
@ Fax
Fax machine.
Definition: phonenumber.h:53
KABC::PhoneNumber::Work
@ Work
Office number.
Definition: phonenumber.h:49
KABC::PhoneNumber::Voice
@ Voice
Voice.
Definition: phonenumber.h:52
KABC::PhoneNumber::Msg
@ Msg
Messaging.
Definition: phonenumber.h:50
KABC
Class that holds a Calendar Url (FBURL/CALADRURI/CALURI)
Definition: address.h:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kabc

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

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal