summaryrefslogtreecommitdiffstats
path: root/interfaces/terminal/test
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /interfaces/terminal/test
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
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
Diffstat (limited to 'interfaces/terminal/test')
-rw-r--r--interfaces/terminal/test/Makefile.am6
-rw-r--r--interfaces/terminal/test/main.cc63
-rw-r--r--interfaces/terminal/test/main.h17
3 files changed, 86 insertions, 0 deletions
diff --git a/interfaces/terminal/test/Makefile.am b/interfaces/terminal/test/Makefile.am
new file mode 100644
index 000000000..799249021
--- /dev/null
+++ b/interfaces/terminal/test/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES=$(all_includes)
+check_PROGRAMS=test
+test_SOURCES=main.cc
+test_LDADD=$(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) -lkio
+test_LDFLAGS=$(all_libraries)
+METASOURCES=AUTO
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 <kde_terminal_interface.h>
+#include <kparts/part.h>
+#include <ktrader.h>
+#include <klibloader.h>
+#include <kmainwindow.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <kapplication.h>
+#include <qdir.h>
+#include <assert.h>
+#include <kmessagebox.h>
+#include <cassert>
+#include "main.h"
+#include "main.moc"
+
+Win::Win()
+{
+ KLibFactory* factory = KLibLoader::self()->factory( "libkonsolepart" );
+ assert( factory );
+ KParts::Part* p = static_cast<KParts::Part*>( factory->create( this, "tralala", "QObject", "KParts::ReadOnlyPart" ) );
+ setCentralWidget( p->widget() );
+
+ TerminalInterface* t = static_cast<TerminalInterface*>( 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 <iostream>
+
+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<TerminalInterface*>( 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;
+}
diff --git a/interfaces/terminal/test/main.h b/interfaces/terminal/test/main.h
new file mode 100644
index 000000000..098c10d54
--- /dev/null
+++ b/interfaces/terminal/test/main.h
@@ -0,0 +1,17 @@
+#ifndef MAIN_H
+#define MAIN_H
+
+
+class Win
+ : public KMainWindow
+{
+ Q_OBJECT
+ KParts::Part* p;
+public:
+ Win();
+public slots:
+ void pythonExited();
+ void forked();
+};
+
+#endif