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