[Kde-pim] Accessing the addressbook from C++
Christoph Kies
mail at ckies.de
Fri Aug 1 08:36:13 BST 2008
Am Donnerstag, 31. Juli 2008 21:05:52 schrieb Stephen Kelly:
> >> [...] you should learn everything you need to:
>
> http://techbase.kde.org/Development/Tutorials#Introduction_To_KDE_4_Program
>ming
> [...]
Yes, that and the other postings helped:
My simple program now looks like:
#include<kapplication.h>
#include<kabc/stdaddressbook.h>
#include<iostream>
int main(int argc, char *argv[]){
KApplication a( argc, argv , "test");
KABC::AddressBook *ab = KABC::StdAddressBook::self();
KABC::Ticket *ticket = ab->requestSaveTicket();
if ( ticket ) {
KABC::AddressBook::Iterator it;
for ( it = ab->begin(); it != ab->end(); ++it ) {
std::cout << it->realName() << std::endl;
// do some other stuff
}
ab->save( ticket);
}
}
It compiles and links with:
g++ -I/usr/include/kde -I/usr/include/qt3 -L/usr/lib/kde -L/usr/lib/qt3/lib -lkdecore -lkdepim -lqt-mt -g -o
kabc_test kabc_test.cpp
and it runs
thanks
Christoph
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list