summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-05 13:17:19 (UTC)
committer llornkcor <llornkcor>2002-04-05 13:17:19 (UTC)
commit1896c5fa43e465567595feb442013d75c476f090 (patch) (side-by-side diff)
treee8ea13fd45277f0b8d7af52f4938f411fd9ed4af
parentdd5bc1f9d61cdd8cfde4c7a7fbba3b53b77b2670 (diff)
downloadopie-1896c5fa43e465567595feb442013d75c476f090.zip
opie-1896c5fa43e465567595feb442013d75c476f090.tar.gz
opie-1896c5fa43e465567595feb442013d75c476f090.tar.bz2
Folded in changes I forgot about. Added -e argument to execute a command and leave the konsole,
and also setDocument to exec command in new session if open. so a command run like $OPIEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' will run that command in a new session (tab). So now scripts can be run from an icon, and such.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp45
-rw-r--r--core/apps/embeddedkonsole/konsole.h3
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
@@ -20,2 +20,3 @@
/* -------------------------------------------------------------------------- */
+// enhancements added by L.J. Potter <ljp@llornkcor.com>
@@ -203,3 +204,3 @@ void Konsole::init(const char* _pgm, QStrList & _args)
n_render = 0;
-
+ startUp=0;
setCaption( tr("Terminal") );
@@ -366,2 +367,3 @@ void Konsole::init(const char* _pgm, QStrList & _args)
+parseCommandLine();
// read and apply default values ///////////////////////////////////////////
@@ -371,3 +373,2 @@ void Konsole::init(const char* _pgm, QStrList & _args)
defaultSize = size();
-
}
@@ -391,3 +392,3 @@ Konsole::~Konsole()
doneSession(getTe()->currentSession, 0);
- }
+ }
@@ -845 +846,39 @@ 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
@@ -56,3 +56,5 @@ public:
int lastSelectedMenu;
+ int startUp;
private slots:
+ void setDocument(const QString &);
void doneSession(TESession*,int);
@@ -75,2 +77,3 @@ private slots:
void editCommandListMenuSelected(int);
+ void parseCommandLine();
private: