TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kiotest.cc 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include <stdio.h>
  2. #include <kmedia2.h>
  3. #include <tdecmdlineargs.h>
  4. #include <connect.h>
  5. #include <tdelocale.h>
  6. #include <tdeapplication.h>
  7. #include <tdeaboutdata.h>
  8. #include "qiomanager.h"
  9. #include "artskde.h"
  10. using namespace std;
  11. using namespace Arts;
  12. static TDECmdLineOptions options[] =
  13. {
  14. { "+[URL]", I18N_NOOP("URL to open"), 0 },
  15. TDECmdLineLastOption
  16. };
  17. int main(int argc, char **argv)
  18. {
  19. TDEAboutData aboutData( "kiotest", I18N_NOOP("KIOTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, "");
  20. TDECmdLineArgs::init(argc,argv,&aboutData);
  21. TDECmdLineArgs::addCmdLineOptions(options);
  22. TDEApplication app;
  23. QIOManager qiomanager;
  24. Dispatcher dispatcher(&qiomanager);
  25. TDEIOInputStream stream;
  26. StdoutWriter writer;
  27. TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
  28. if(args->count())
  29. {
  30. if(!stream.openURL(args->arg(0)))
  31. {
  32. printf("can't open url");
  33. exit(1);
  34. }
  35. }
  36. else
  37. exit(1);
  38. args->clear();
  39. connect(stream, writer);
  40. writer.start();
  41. stream.start();
  42. app.exec();
  43. }