kabc
24 #include <QtCore/QFile>
27 #include <kcomponentdata.h>
28 #include <kcmdlineargs.h>
30 #include <kaboutdata.h>
32 #include "kabc/vcardconverter.h"
35 int main(
int argc,
char **argv )
37 KAboutData aboutData(
"testread", 0, ki18n(
"vCard test reader" ),
"0.1" );
38 aboutData.addAuthor( ki18n(
"Cornelius Schumacher" ), KLocalizedString(),
"schumacher@kde.org" );
40 KCmdLineArgs::init( argc, argv, &aboutData );
42 KCmdLineOptions options;
43 options.add(
"vcard21", ki18n(
"vCard 2.1" ) );
44 options.add(
"+inputfile", ki18n(
"Input file" ) );
45 KCmdLineArgs::addCmdLineOptions( options );
47 KComponentData componentData( &aboutData );
50 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
52 if ( args->count() != 1 ) {
53 std::cerr <<
"Missing argument" << std::endl;
57 QString inputFile( args->arg( 0 ) );
59 QFile file( inputFile );
60 if ( !file.open( QIODevice::ReadOnly ) ) {
61 qDebug(
"Unable to open file '%s' for reading!", qPrintable( file.fileName() ) );
65 QByteArray text = file.readAll();
69 KABC::Addressee::List list = converter.
parseVCards( text );
71 if ( args->isSet(
"vcard21" ) ) {
72 text = converter.
createVCards( list, KABC::VCardConverter::v2_1 );
77 std::cout << text.data();
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:29:42 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.