21 #include <QtCore/QFile>
23 #include <kaboutdata.h>
24 #include <kapplication.h>
25 #include <kcmdlineargs.h>
27 #include "kabc/addressee.h"
28 #include "kabc/phonenumber.h"
29 #include "kabc/address.h"
31 #include "kabc/picture.h"
32 #include "kabc/sound.h"
33 #include "kabc/secrecy.h"
34 #include "kabc/vcardconverter.h"
36 int main(
int argc,
char **argv )
38 KAboutData aboutData(
"testwrite", 0, ki18n(
"vCard test writer" ),
"0.1" );
40 KCmdLineArgs::init( argc, argv, &aboutData );
42 KApplication app(
false );
44 KABC::Addressee addressee;
46 addressee.setNameFromString( QLatin1String(
"Mr. Tobias Koenig Jr." ) );
47 addressee.setNickName( QLatin1String(
"tokoe" ) );
48 addressee.setBirthday( QDateTime( QDate( 1982, 7, 19 ) ) );
49 addressee.setMailer( QLatin1String(
"mutt1.2" ) );
55 addressee.setGeo( geo );
57 addressee.setTitle( QLatin1String(
"nerd" ) );
58 addressee.setRole( QLatin1String(
"Maintainer" ) );
59 addressee.setOrganization( QLatin1String(
"KDE" ) );
60 addressee.setNote( QLatin1String(
"nerver\ntouch a running system" ) );
61 addressee.setProductId( QLatin1String(
"testId" ) );
62 addressee.setRevision( QDateTime::currentDateTime() );
63 addressee.setSortString( QLatin1String(
"koenig" ) );
64 addressee.setUrl( KUrl( QLatin1String(
"http://wgess16.dyndns.org" ) ) );
65 addressee.setSecrecy( KABC::Secrecy( KABC::Secrecy::Confidential ) );
67 addressee.insertEmail( QLatin1String(
"tokoe@kde.org" ),
true );
68 addressee.insertEmail( QLatin1String(
"tokoe82@yahoo.de" ),
true );
74 addressee.insertPhoneNumber( phone1 );
75 addressee.insertPhoneNumber( phone2 );
78 addressee.insertKey( key );
80 QStringList categories;
81 categories << QLatin1String(
"Friends" ) << QLatin1String(
"School" ) << QLatin1String(
"KDE" );
82 addressee.setCategories( categories );
85 a.setStreet( QLatin1String(
"6544 Battleford Drive" ) );
86 a.setLocality( QLatin1String(
"Raleigh" ) );
87 a.setRegion( QLatin1String(
"NC" ) );
88 a.setPostalCode( QLatin1String(
"27613-3502" ) );
89 a.setCountry( QLatin1String(
"U.S.A." ) );
90 addressee.insertAddress( a );
92 addressee.insertCustom( QLatin1String(
"1hsdf" ), QLatin1String(
"ertuer" ),
93 QLatin1String(
"iurt" ) );
94 addressee.insertCustom( QLatin1String(
"2hsdf" ), QLatin1String(
"ertuer" ),
95 QLatin1String(
"iurt" ) );
96 addressee.insertCustom( QLatin1String(
"3hsdf" ), QLatin1String(
"ertuer" ),
97 QLatin1String(
"iurt" ) );
99 KABC::Addressee::List list;
100 for (
int i = 0; i < 1000; ++i ) {
101 KABC::Addressee addr = addressee;
102 addr.setUid( QString::number( i ) );
109 QFile file( QLatin1String(
"out.vcf" ) );
110 if ( !file.open( QIODevice::WriteOnly ) ) {
111 qDebug(
"Can't open file '%s' fro writing", qPrintable( file.fileName() ) );