-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 45 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 3 |
2 files changed, 45 insertions, 3 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 217d8d8..16ff4df 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -19,4 +19,5 @@ /* */ /* -------------------------------------------------------------------------- */ +// enhancements added by L.J. Potter <ljp@llornkcor.com> #include <qpe/resource.h> @@ -202,5 +203,5 @@ void Konsole::init(const char* _pgm, QStrList & _args) n_keytab = 0; n_render = 0; - + startUp=0; setCaption( tr("Terminal") ); setIcon( Resource::loadPixmap( "konsole" ) ); @@ -365,4 +366,5 @@ void Konsole::init(const char* _pgm, QStrList & _args) se_args = _args; +parseCommandLine(); // read and apply default values /////////////////////////////////////////// resize(321, 321); // Dummy. @@ -370,5 +372,4 @@ void Konsole::init(const char* _pgm, QStrList & _args) if (currentSize != size()) defaultSize = size(); - } @@ -390,5 +391,5 @@ Konsole::~Konsole() while (nsessions > 0) { doneSession(getTe()->currentSession, 0); - } + } Config cfg("Konsole"); @@ -844,2 +845,40 @@ void Konsole::editCommandListMenuSelected(int iD) } + +// $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' +void Konsole::setDocument( const QString &cmd) { + newSession(); + TEWidget* te = getTe(); + if(cmd.find("-e", 0, TRUE) != -1) { + QString cmd2; + cmd2=cmd.right(cmd.length()-3)+" &"; + system(cmd2.latin1()); + if(startUp <= 1 && nsessions < 2) { + doneSession(getTe()->currentSession, 0); + exit(0); + } else + doneSession(getTe()->currentSession, 0); + } else { + if (te != 0) { + te->emitText(cmd+"\r"); + } + } + startUp++; +} + +void Konsole::parseCommandLine() { + QString cmd; + // newSession(); + for (int i=1;i< qApp->argc();i++) { + if( QString(qApp->argv()[i]) == "-e") { + i++; + for ( int j=i;j< qApp->argc();j++) { + cmd+=QString(qApp->argv()[j])+" "; + } + cmd.stripWhiteSpace(); + system(cmd.latin1()); + exit(0);//close(); + } // end -e switch + } + startUp++; +} diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index b508cf8..40edaec 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h @@ -55,5 +55,7 @@ public: void setColor(); int lastSelectedMenu; + int startUp; private slots: + void setDocument(const QString &); void doneSession(TESession*,int); void changeColumns(int); @@ -74,4 +76,5 @@ private slots: void scrollMenuSelected(int); void editCommandListMenuSelected(int); + void parseCommandLine(); private: void init(const char* _pgm, QStrList & _args); |