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.

main.cc 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include <kde_terminal_interface.h>
  2. #include <tdeparts/part.h>
  3. #include <ktrader.h>
  4. #include <klibloader.h>
  5. #include <tdemainwindow.h>
  6. #include <tdeaboutdata.h>
  7. #include <tdecmdlineargs.h>
  8. #include <tdeapplication.h>
  9. #include <tqdir.h>
  10. #include <assert.h>
  11. #include <tdemessagebox.h>
  12. #include <cassert>
  13. #include "main.h"
  14. #include "main.moc"
  15. Win::Win()
  16. {
  17. KLibFactory* factory = KLibLoader::self()->factory( "libkonsolepart" );
  18. assert( factory );
  19. KParts::Part* p = static_cast<KParts::Part*>( factory->create( this, "tralala", TQOBJECT_OBJECT_NAME_STRING, "KParts::ReadOnlyPart" ) );
  20. setCentralWidget( p->widget() );
  21. TerminalInterface* t = ::tqqt_cast<TerminalInterface*>( p );
  22. t->showShellInDir( TQDir::home().path() );
  23. // TQStrList l;
  24. // l.append( "python" );
  25. // t->startProgram( TQString::fromUtf8( "/usr/bin/python" ), l );
  26. connect( p, TQT_SIGNAL( processExited( int ) ),
  27. this, TQT_SLOT( pythonExited( int ) ) );
  28. }
  29. int main( int argc, char** argv )
  30. {
  31. TDEAboutData* about = new TDEAboutData( "tetest", "TETest", "0.1" );
  32. TDECmdLineArgs::init( argc, argv, about );
  33. TDEApplication a;
  34. Win* win = new Win();
  35. win->show();
  36. return a.exec();
  37. };
  38. #include <iostream>
  39. void Win::pythonExited()
  40. {
  41. std::cerr << "hee, " << p << std::endl;
  42. std::cerr << ( ::tqqt_cast<TerminalInterface>(p) ) << std::endl;
  43. // KMessageBox::sorry( this, TQString::fromUtf8( "Exited, status was %1" ).arg( status ) );
  44. disconnect(p, TQT_SIGNAL( processExited() ),
  45. this, TQT_SLOT( pythonExited() ));
  46. TerminalInterface* t = ::tqqt_cast<TerminalInterface*>( p );
  47. TQStrList l;
  48. l.append( "echo" );
  49. l.append( "hello world" );
  50. t->startProgram( TQString::fromUtf8( "/bin/echo" ), l );
  51. }
  52. void Win::forked()
  53. {
  54. std::cerr << "hello from the child process!" << std::endl;
  55. }