testdistlist.cpp
00001 #include <qwidget.h>
00002
00003 #include <kaboutdata.h>
00004 #include <kapplication.h>
00005 #include <kdebug.h>
00006 #include <klocale.h>
00007 #include <kcmdlineargs.h>
00008
00009 #include "stdaddressbook.h"
00010
00011 #include "distributionlisteditor.h"
00012 #include "distributionlist.h"
00013
00014 using namespace KABC;
00015
00016 static const KCmdLineOptions options[] =
00017 {
00018 {"list <listname>", I18N_NOOP("Show distribution list with name <listname>"), 0},
00019 {0,0,0}
00020 };
00021
00022
00023 int main(int argc,char **argv)
00024 {
00025 KAboutData aboutData("testdistlist",I18N_NOOP("Test Distribution Lists"),"0.1");
00026 KCmdLineArgs::init(argc,argv,&aboutData);
00027 KCmdLineArgs::addCmdLineOptions( options );
00028
00029 KApplication app;
00030
00031 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00032 if (args->isSet("list")) {
00033 QString name = args->getOption("list");
00034
00035 DistributionListManager *manager =
00036 new DistributionListManager( StdAddressBook::self() );
00037 manager->load();
00038 DistributionList *list = manager->list( name );
00039 if ( !list ) {
00040 kdDebug() << "No list with name '" << name << "'" << endl;
00041 return 1;
00042 } else {
00043 kdDebug() << "RESULT: " << list->emails().join(", ") << endl;
00044 return 0;
00045 }
00046 }
00047
00048 DistributionListEditor *editor =
00049 new DistributionListEditor( StdAddressBook::self(), 0 );
00050
00051 editor->show();
00052 app.setMainWidget(editor);
00053
00054 QObject::connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
00055
00056 app.exec();
00057
00058 delete editor;
00059 }
This file is part of the documentation for kdelibs Version 3.1.0.