kiotest.cc

00001 #include <stdio.h>
00002 #include <kmedia2.h>
00003 #include <kcmdlineargs.h>
00004 #include <connect.h>
00005 #include <klocale.h>
00006 #include <kapplication.h>
00007 #include <kaboutdata.h>
00008 #include "qiomanager.h"
00009 #include "artskde.h"
00010 
00011 using namespace std;
00012 using namespace Arts;
00013 
00014 
00015 static KCmdLineOptions options[] =
00016 {
00017     { "+[URL]", I18N_NOOP("URL to open"), 0 },
00018     KCmdLineLastOption
00019 };
00020 
00021 int main(int argc, char **argv)
00022 {
00023     KAboutData aboutData( "kiotest", I18N_NOOP("KIOTest"), I18N_NOOP("0.1"), "", KAboutData::License_GPL, "");
00024                               
00025     KCmdLineArgs::init(argc,argv,&aboutData);
00026     KCmdLineArgs::addCmdLineOptions(options);   
00027     KApplication app;
00028     QIOManager qiomanager;
00029     Dispatcher dispatcher(&qiomanager);
00030     KIOInputStream stream;
00031     StdoutWriter writer;
00032 
00033     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00034 
00035     if(args->count())
00036     {
00037         if(!stream.openURL(args->arg(0)))
00038         {
00039         printf("can't open url");
00040         exit(1);
00041         }
00042     }
00043     else
00044         exit(1);
00045         
00046     args->clear();
00047     
00048     connect(stream, writer);
00049 
00050     writer.start();
00051     stream.start();
00052     
00053     app.exec();
00054 }
KDE Home | KDE Accessibility Home | Description of Access Keys