tdeabc
testvcardformatimpl.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <kdebug.h>
00022 #include <tdeapplication.h>
00023 #include <tdecmdlineargs.h>
00024
00025 #include <tdeaboutdata.h>
00026
00027 #include "vcardformatimpl.h"
00028
00029 using namespace TDEABC;
00030
00031 int
00032 main( int argc, char **argv )
00033 {
00034 TDEAboutData aboutData( "testvcardformatimpl", "vCard format plugin", "0.1" );
00035
00036 TDECmdLineArgs::init( argc, argv, &aboutData );
00037
00038 TDEApplication app( false, false );
00039
00040
00041 TDEABC::Addressee addressee;
00042
00043 addressee.setNameFromString( TQString::fromUtf8("Иван Иванов") );
00044 addressee.setNickName( TQString::fromUtf8("иванчо") );
00045 addressee.setBirthday( TQDate( 1981, 7, 19 ) );
00046 addressee.setMailer( "mutt1.2" );
00047 addressee.setTimeZone( TDEABC::TimeZone( +2 ) );
00048
00049 TDEABC::Geo geo;
00050 geo.setLatitude( 30 );
00051 geo.setLongitude( 51 );
00052 addressee.setGeo( geo );
00053
00054 addressee.setTitle( TQString::fromUtf8("Др") );
00055 addressee.setRole( TQString::fromUtf8("Самарянин") );
00056 addressee.setOrganization( TQString::fromUtf8("България ООД") );
00057 addressee.setNote( TQString::fromUtf8("не\nпипай работеща система") );
00058 addressee.setProductId( "testId" );
00059 addressee.setRevision( TQDateTime::currentDateTime() );
00060 addressee.setSortString( TQString::fromUtf8("сортиране") );
00061 addressee.setUrl( KURL( "http://wgess17.dyndns.org") );
00062 addressee.setSecrecy( TDEABC::Secrecy( TDEABC::Secrecy::Confidential ) );
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 addressee.insertEmail( TQString::fromUtf8("иван.иванов@българия.оод"), true );
00085 addressee.insertEmail( TQString::fromUtf8("иванчо@yahoo.de"), true );
00086
00087 TDEABC::PhoneNumber phone1( "029876543", TDEABC::PhoneNumber::Pref | TDEABC::PhoneNumber::Home );
00088 TDEABC::PhoneNumber phone2( "+359888111222", TDEABC::PhoneNumber::Work );
00089 addressee.insertPhoneNumber( phone1 );
00090 addressee.insertPhoneNumber( phone2 );
00091
00092 TDEABC::Key key( "secret key", TDEABC::Key::X509 );
00093 addressee.insertKey( key );
00094
00095 TQStringList categories;
00096 categories << "Friends" << "School" << "KDE";
00097 addressee.setCategories( categories );
00098
00099 TDEABC::Address a( TDEABC::Address::Work | TDEABC::Address::Postal | TDEABC::Address::Parcel );
00100 a.setStreet( TQString::fromUtf8("Цар Борис III") );
00101 a.setLocality( TQString::fromUtf8("София" ));
00102 a.setRegion( TQString::fromUtf8("София град" ));
00103 a.setPostalCode( TQString::fromUtf8("1000" ));
00104 a.setCountry( TQString::fromUtf8("България" ));
00105 addressee.insertAddress( a );
00106
00107 addressee.insertCustom( "1hsdf", "test1",TQString::fromUtf8( "ежзик" ));
00108 addressee.insertCustom( "2hsdf", "test2",TQString::fromUtf8( "ежзик" ));
00109 addressee.insertCustom( "3hsdf", "test3",TQString::fromUtf8( "ежзик" ));
00110
00111 addressee.dump();
00112
00113 kdDebug() << ">>>>>>>>>>>>>>>>END FIRST ADDRESSEE<<<<<<<<<<<<<<" << endl;
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133 VCardFormatImpl *vcfImpl = new VCardFormatImpl();
00134 TQFile file( "vfimpout.vcf" );
00135 if ( file.open(IO_WriteOnly) ){
00136 vcfImpl->save(addressee, &file);
00137 file.close();
00138 }
00139
00140
00141 TDEABC::Addressee addressee2;
00142
00143 if ( file.open(IO_ReadOnly ) ){
00144 vcfImpl->load(addressee2, &file);
00145 file.close();
00146 }
00147
00148 addressee2.dump();
00149
00150 return 0;
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174 }