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

tdeabc

  • tdeabc
  • vcardparser
testwrite2.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( TQString::fromUtf8("Иван Иванов") );
48 addressee.setNickName( TQString::fromUtf8("иванчо") );
49 addressee.setBirthday( TQDate( 1981, 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( TQString::fromUtf8("Др") );
59 addressee.setRole( TQString::fromUtf8("Самарянин") );
60 addressee.setOrganization( TQString::fromUtf8("България ООД") );
61 addressee.setNote( TQString::fromUtf8("не\nпипай работеща система") );
62 addressee.setProductId( "testId" );
63 addressee.setRevision( TQDateTime::currentDateTime() );
64 addressee.setSortString( TQString::fromUtf8("сортиране") );
65 addressee.setUrl( KURL( "http://wgess17.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( TQString::fromUtf8("иван.иванов@българия.оод"), true );
89 addressee.insertEmail( TQString::fromUtf8("иванчо@yahoo.de"), true );
90
91 TDEABC::PhoneNumber phone1( "029876543", TDEABC::PhoneNumber::Pref | TDEABC::PhoneNumber::Home );
92 TDEABC::PhoneNumber phone2( "+359888111222", 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( TQString::fromUtf8("Цар Борис III") );
105 a.setLocality( TQString::fromUtf8("София" ));
106 a.setRegion( TQString::fromUtf8("София град" ));
107 a.setPostalCode( TQString::fromUtf8("1000" ));
108 a.setCountry( TQString::fromUtf8("България" ));
109 addressee.insertAddress( a );
110
111 addressee.insertCustom( "1hsdf", "test1",TQString::fromUtf8( "ежзик" ));
112 addressee.insertCustom( "2hsdf", "test2",TQString::fromUtf8( "ежзик" ));
113 addressee.insertCustom( "3hsdf", "test3",TQString::fromUtf8( "ежзик" ));
114
115 addressee.dump();
116
117 TDEABC::Addressee::List list;
118 for ( int i = 0; i < 20; ++i ) {
119 TDEABC::Addressee addr = addressee;
120 addr.setUid( TQString::number( i ) );
121 list.append( addr );
122 }
123
124 TDEABC::VCardConverter converter;
125 TQString txt = converter.createVCards( list );
126
127 TQFile file( "out2.vcf" );
128 file.open( IO_WriteOnly );
129
130 TQTextStream s( &file );
131 s.setEncoding( TQTextStream::UnicodeUTF8 );
132 s << txt;
133 file.close();
134
135 return 0;
136}
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::dump
void dump() const
Debug output.
Definition: addressee.src.cpp:631
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.