• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeabc
 

tdeabc

  • tdeabc
  • vcardparser
vcardparser/testwrite.cpp
1/*
2 This file is part of libtdeabc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include <tdeabc/addressee.h>
21#include <tdeabc/phonenumber.h>
22#include <tdeabc/address.h>
23#include <tdeabc/key.h>
24#include <tdeabc/picture.h>
25#include <tdeabc/sound.h>
26#include <tdeabc/secrecy.h>
27#include <tdeaboutdata.h>
28#include <tdeapplication.h>
29#include <tdecmdlineargs.h>
30
31#include <tqfile.h>
32#include <tqtextstream.h>
33
34#include "vcardconverter.h"
35
36int main( int argc, char **argv )
37{
38 TDEAboutData aboutData( "testwrite", "vCard test writer", "0.1" );
39
40 TDECmdLineArgs::init( argc, argv, &aboutData );
41
42 TDEApplication app( false, false );
43
44
45 TDEABC::Addressee addressee;
46
47 addressee.setNameFromString( "Mr. Tobias Koenig Jr." );
48 addressee.setNickName( "tokoe" );
49 addressee.setBirthday( TQDate( 1982, 7, 19 ) );
50 addressee.setMailer( "mutt1.2" );
51 addressee.setTimeZone( TDEABC::TimeZone( +2 ) );
52
53 TDEABC::Geo geo;
54 geo.setLatitude( 30 );
55 geo.setLongitude( 51 );
56 addressee.setGeo( geo );
57
58 addressee.setTitle( "nerd" );
59 addressee.setRole( "Maintainer" );
60 addressee.setOrganization( "KDE" );
61 addressee.setNote( "nerver\ntouch a running system" );
62 addressee.setProductId( "testId" );
63 addressee.setRevision( TQDateTime::currentDateTime() );
64 addressee.setSortString( "koenig" );
65 addressee.setUrl( KURL( "http://wgess16.dyndns.org") );
66 addressee.setSecrecy( TDEABC::Secrecy( TDEABC::Secrecy::Confidential ) );
67/*
68 TQImage img;
69 img.load( "testimg.png", "PNG" );
70 TDEABC::Picture photo;
71 photo.setData( img );
72 addressee.setPhoto( photo );
73
74 TQImage img2;
75 img2.load( "testimg.png", "PNG" );
76 TDEABC::Picture logo;
77 logo.setData( img2 );
78 addressee.setLogo( logo );
79
80 TQFile soundFile( "testsound.wav" );
81 soundFile.open( IO_ReadOnly );
82 TQByteArray data = soundFile.readAll();
83 soundFile.close();
84 TDEABC::Sound sound;
85 sound.setData( data );
86 addressee.setSound( sound );
87*/
88 addressee.insertEmail( "tokoe@kde.org", true );
89 addressee.insertEmail( "tokoe82@yahoo.de", true );
90
91 TDEABC::PhoneNumber phone1( "3541523475", TDEABC::PhoneNumber::Pref | TDEABC::PhoneNumber::Home );
92 TDEABC::PhoneNumber phone2( "+46745673475", TDEABC::PhoneNumber::Work );
93 addressee.insertPhoneNumber( phone1 );
94 addressee.insertPhoneNumber( phone2 );
95
96 TDEABC::Key key( "secret key", TDEABC::Key::X509 );
97 addressee.insertKey( key );
98
99 TQStringList categories;
100 categories << "Friends" << "School" << "KDE";
101 addressee.setCategories( categories );
102
103 TDEABC::Address a( TDEABC::Address::Work | TDEABC::Address::Postal | TDEABC::Address::Parcel );
104 a.setStreet( "6544 Battleford Drive" );
105 a.setLocality( "Raleigh" );
106 a.setRegion( "NC" );
107 a.setPostalCode( "27613-3502" );
108 a.setCountry( "U.S.A." );
109 addressee.insertAddress( a );
110
111 addressee.insertCustom( "1hsdf", "ertuer", "iurt" );
112 addressee.insertCustom( "2hsdf", "ertuer", "iurt" );
113 addressee.insertCustom( "3hsdf", "ertuer", "iurt" );
114
115 TDEABC::Addressee::List list;
116 for ( int i = 0; i < 1000; ++i ) {
117 TDEABC::Addressee addr = addressee;
118 addr.setUid( TQString::number( i ) );
119 list.append( addr );
120 }
121
122 TDEABC::VCardConverter converter;
123 TQString txt = converter.createVCards( list );
124
125 TQFile file( "out.vcf" );
126 file.open( IO_WriteOnly );
127
128 TQTextStream s( &file );
129 s.setEncoding( TQTextStream::UnicodeUTF8 );
130 s << txt;
131 file.close();
132
133 return 0;
134}
KURL
TDEABC::Address
Postal address information.
Definition: address.h:56
TDEABC::Addressee
address book entry
Definition: addressee.src.h:75
TDEABC::Addressee::setUid
void setUid(const TQString &uid)
Set unique identifier.
Definition: addressee.src.cpp:166
TDEABC::Addressee::setCategories
void setCategories(const TQStringList &)
Set categories to given value.
Definition: addressee.src.cpp:778
TDEABC::Addressee::insertPhoneNumber
void insertPhoneNumber(const PhoneNumber &phoneNumber)
Insert a phone number.
Definition: addressee.src.cpp:460
TDEABC::Addressee::insertCustom
void insertCustom(const TQString &app, const TQString &name, const TQString &value)
Insert custom entry.
Definition: addressee.src.cpp:791
TDEABC::Addressee::insertEmail
void insertEmail(const TQString &email, bool preferred=false)
Insert an email address.
Definition: addressee.src.cpp:412
TDEABC::Addressee::insertAddress
void insertAddress(const Address &address)
Insert an address.
Definition: addressee.src.cpp:675
TDEABC::Addressee::setNameFromString
DECLARATIONS void setNameFromString(const TQString &)
Set name fields by parsing the given string and trying to associate the parts of the string with acco...
Definition: addressee.src.cpp:204
TDEABC::Addressee::insertKey
void insertKey(const Key &key)
Insert a key.
Definition: addressee.src.cpp:534
TDEABC::Geo
Geographic position.
Definition: geo.h:36
TDEABC::Geo::setLongitude
void setLongitude(float)
Sets the longitude.
Definition: geo.cpp:54
TDEABC::Geo::setLatitude
void setLatitude(float)
Sets the latitude.
Definition: geo.cpp:38
TDEABC::Key
A class to store an encryption key.
Definition: key.h:34
TDEABC::PhoneNumber
Phonenumber information.
Definition: phonenumber.h:39
TDEABC::TimeZone
Time zone information.
Definition: timezone.h:36
TDEABC::VCardConverter
Class to converting contact objects into vCard format and vice versa.
Definition: vcardconverter.h:54
TDEABC::VCardConverter::createVCards
TQString createVCards(Addressee::List list, Version version=v3_0)
Creates a string in vCard format which contains the given list of contact.
Definition: vcardconverter.cpp:54
TDEAboutData
TDEApplication
TDECmdLineArgs::init
static void init(int _argc, char **_argv, const char *_appname, const char *programName, const char *_description, const char *_version, bool noTDEApp=false)
TDEStdAccel::key
int key(StdAccel id)

tdeabc

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

tdeabc

Skip menu "tdeabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeabc by doxygen 1.9.4
This website is maintained by Timothy Pearson.