kabc Library API Documentation

testkabc.cpp

00001 #include <kaboutdata.h>
00002 #include <kapplication.h>
00003 #include <kdebug.h>
00004 #include <klocale.h>
00005 #include <kcmdlineargs.h>
00006 #include <kstandarddirs.h>
00007 
00008 #include <qfile.h>
00009 #include <qimage.h>
00010 
00011 #include "geo.h"
00012 #include "secrecy.h"
00013 #include "stdaddressbook.h"
00014 #include "timezone.h"
00015 #include "key.h"
00016 #include "agent.h"
00017 #include "vcardconverter.h"
00018 
00019 using namespace KABC;
00020 
00021 int main(int argc,char **argv)
00022 {
00023     KAboutData aboutData("testkabc",I18N_NOOP("TestKabc"),"0.1");
00024     KCmdLineArgs::init(argc, argv, &aboutData);
00025 
00026     KApplication app( false, false );
00027     AddressBook *ab = StdAddressBook::self();
00028 
00029 #define READ
00030 
00031 #ifdef READ
00032     AddressBook::Iterator it;
00033     for ( it = ab->begin(); it != ab->end(); ++it ) {
00034       QString vcard;
00035       VCardConverter converter;
00036       converter.addresseeToVCard( *it, vcard );
00037       kdDebug() << "card=" << vcard << endl;
00038     }
00039 #else
00040     Addressee addr;
00041 
00042     addr.setGivenName("Tobias");
00043     addr.setFamilyName("Koenig");
00044 
00045 
00046     Picture pic;
00047     QImage img;
00048     img.load("/home/tobias/test.png");
00049 /*
00050     pic.setData(img);
00051     pic.setType(QImage::imageFormat("/home/tobias/test.png"));
00052 */
00053     pic.setUrl("http://www.mypict.de");
00054     addr.setLogo( pic );
00055 
00056     ab->insertAddressee( addr );
00057 
00058     StdAddressBook::save();
00059 #endif
00060 
00061     return 0;
00062 }
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:16:08 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001