From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- interfaces/terminal/test/main.cc | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 interfaces/terminal/test/main.cc (limited to 'interfaces/terminal/test/main.cc') diff --git a/interfaces/terminal/test/main.cc b/interfaces/terminal/test/main.cc new file mode 100644 index 000000000..7d5859e57 --- /dev/null +++ b/interfaces/terminal/test/main.cc @@ -0,0 +1,63 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "main.h" +#include "main.moc" + +Win::Win() +{ + KLibFactory* factory = KLibLoader::self()->factory( "libkonsolepart" ); + assert( factory ); + KParts::Part* p = static_cast( factory->create( this, "tralala", "QObject", "KParts::ReadOnlyPart" ) ); + setCentralWidget( p->widget() ); + + TerminalInterface* t = static_cast( p->qt_cast( "TerminalInterface" ) ); + t->showShellInDir( QDir::home().path() ); +// QStrList l; +// l.append( "python" ); +// t->startProgram( QString::fromUtf8( "/usr/bin/python" ), l ); + + connect( p, SIGNAL( processExited( int ) ), + this, SLOT( pythonExited( int ) ) ); +} + + +int main( int argc, char** argv ) +{ + KAboutData* about = new KAboutData( "tetest", "TETest", "0.1" ); + KCmdLineArgs::init( argc, argv, about ); + KApplication a; + Win* win = new Win(); + win->show(); + return a.exec(); +}; + +#include + +void Win::pythonExited() +{ + std::cerr << "hee, " << p << std::endl; + std::cerr << ( p->qt_cast( "TerminalInterface" ) ) << std::endl; + // KMessageBox::sorry( this, QString::fromUtf8( "Exited, status was %1" ).arg( status ) ); + disconnect(p, SIGNAL( processExited() ), + this, SLOT( pythonExited() )); + TerminalInterface* t = static_cast( p->qt_cast( "TerminalInterface" ) ); + QStrList l; + l.append( "echo" ); + l.append( "hello world" ); + t->startProgram( QString::fromUtf8( "/bin/echo" ), l ); +} + +void Win::forked() +{ + std::cerr << "hello from the child process!" << std::endl; +} -- cgit v1.2.3