32
32
* some signals you can connect to. They aren't in this class cause
33
33
* we can't have signals without having a QObject, which
34
34
* TerminalInterface is not.
35
* These are the signals you can connect to:
36
* void processExited( int status );
37
* void receivedData( const QString& s );
38
* See the example code below for how to connect to these..
36
* These are some signals you can connect to:
37
* void currentDirectoryChanged(const QString& dir);
39
* See the example code below for how to connect to these.
40
41
* Use it like this:
42
* // fetch the Library..
43
* KLibFactory* factory = KLibLoader::self()->factory( "libkonsolepart" );
44
* if ( factory == 0L )
46
* // inform the user that he should install konsole..
50
* KParts::Part* p = static_cast<KParts::Part*>(
51
* factory->create( this, "tralala", "QObject",
52
* "KParts::ReadOnlyPart" ) );
54
* setCentralWidget( p->widget() );
56
* // cast the part to the TerminalInterface..
57
* TerminalInterface* t = static_cast<TerminalInterface*>( p->qt_cast( "TerminalInterface" ) );
60
* // This probably happens because the konsole that is installed
61
* // comes from before KDE 3.2 , and the TerminalInterface is not
62
* // available.. What you can do here is either inform the user
63
* // that he needs a more recent konsole, or try to deliver the
64
* // functionality in some other way...
43
* //query the .desktop file to get service information about konsolepart
44
* KService::Ptr service = KService::serviceByDesktopName("konsolepart");
48
* QMessageBox::critical(this, tr("Konsole not installed"), tr("Please install the kde konsole and try again!"), QMessageBox::Ok);
52
* // create one instance of konsolepart
53
* KParts::ReadOnlyPart* p = service->createInstance<KParts::ReadOnlyPart>(parent, parentWidget, QVariantList());
60
* // cast the konsolepart to the TerminalInterface..
61
* TerminalInterface* t = qobject_cast<TerminalInterface*>(p);
67
68
* // now use the interface in all sorts of ways, e.g.
68
69
* // t->showShellInDir( QDir::home().path() );
71
72
* // l.append( "python" );
72
73
* // t->startProgram( QString::fromUtf8( "/usr/bin/python" ), l);
73
74
* // or connect to one of the signals. Connect to the Part object,
74
75
* // not to the TerminalInterface, since the latter is no QObject,
75
76
* // and as such cannot have signals..:
76
* // connect( p, SIGNAL( processExited( int ) ),
77
* // this, SLOT( shellExited( int ) ) );
77
* // connect(p, SIGNAL(currentDirectoryChanged(QString)),
78
* // this, SLOT(currentDirectoryChanged(QString)));