kiotest.cc
00001 #include <stdio.h> 00002 #include <kmedia2.h> 00003 #include <tdecmdlineargs.h> 00004 #include <connect.h> 00005 #include <tdelocale.h> 00006 #include <tdeapplication.h> 00007 #include <tdeaboutdata.h> 00008 #include "qiomanager.h" 00009 #include "artskde.h" 00010 00011 using namespace std; 00012 using namespace Arts; 00013 00014 00015 static TDECmdLineOptions options[] = 00016 { 00017 { "+[URL]", I18N_NOOP("URL to open"), 0 }, 00018 TDECmdLineLastOption 00019 }; 00020 00021 int main(int argc, char **argv) 00022 { 00023 TDEAboutData aboutData( "kiotest", I18N_NOOP("KIOTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, ""); 00024 00025 TDECmdLineArgs::init(argc,argv,&aboutData); 00026 TDECmdLineArgs::addCmdLineOptions(options); 00027 TDEApplication app; 00028 QIOManager qiomanager; 00029 Dispatcher dispatcher(&qiomanager); 00030 TDEIOInputStream stream; 00031 StdoutWriter writer; 00032 00033 TDECmdLineArgs *args = TDECmdLineArgs::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 }