-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index efcb1f2..f154bb8 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -39,33 +39,32 @@ | |||
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qevent.h> | 40 | #include <qevent.h> |
41 | #include <qtabwidget.h> | 41 | #include <qtabwidget.h> |
42 | #include <qtabbar.h> | 42 | #include <qtabbar.h> |
43 | #include <qpe/config.h> | 43 | #include <qpe/config.h> |
44 | #include <qstringlist.h> | 44 | #include <qstringlist.h> |
45 | #include <qpalette.h> | 45 | #include <qpalette.h> |
46 | 46 | ||
47 | #include <sys/wait.h> | 47 | #include <sys/wait.h> |
48 | #include <stdio.h> | 48 | #include <stdio.h> |
49 | #include <stdlib.h> | 49 | #include <stdlib.h> |
50 | #include <assert.h> | 50 | #include <assert.h> |
51 | 51 | ||
52 | #include "konsole.h" | 52 | #include "konsole.h" |
53 | #include "keytrans.h" | 53 | #include "keytrans.h" |
54 | 54 | ||
55 | |||
56 | class EKNumTabBar : public QTabBar { | 55 | class EKNumTabBar : public QTabBar { |
57 | public: | 56 | public: |
58 | void numberTabs() | 57 | void numberTabs() |
59 | { | 58 | { |
60 | // Yes, it really is this messy. QTabWidget needs functions | 59 | // Yes, it really is this messy. QTabWidget needs functions |
61 | // that provide acces to tabs in a sequential way. | 60 | // that provide acces to tabs in a sequential way. |
62 | int m=INT_MIN; | 61 | int m=INT_MIN; |
63 | for (int i=0; i<count(); i++) { | 62 | for (int i=0; i<count(); i++) { |
64 | QTab* left=0; | 63 | QTab* left=0; |
65 | QListIterator<QTab> it(*tabList()); | 64 | QListIterator<QTab> it(*tabList()); |
66 | int x=INT_MAX; | 65 | int x=INT_MAX; |
67 | for( QTab* t; (t=it.current()); ++it ) { | 66 | for( QTab* t; (t=it.current()); ++it ) { |
68 | int tx = t->rect().x(); | 67 | int tx = t->rect().x(); |
69 | if ( tx<x && tx>m ) { | 68 | if ( tx<x && tx>m ) { |
70 | x = tx; | 69 | x = tx; |
71 | left = t; | 70 | left = t; |
@@ -99,42 +98,42 @@ public: | |||
99 | }; | 98 | }; |
100 | 99 | ||
101 | // This could be configurable or dynamicly generated from the bash history | 100 | // This could be configurable or dynamicly generated from the bash history |
102 | // file of the user | 101 | // file of the user |
103 | static const char *commonCmds[] = | 102 | static const char *commonCmds[] = |
104 | { | 103 | { |
105 | "ls ", // I left this here, cause it looks better than the first alpha | 104 | "ls ", // I left this here, cause it looks better than the first alpha |
106 | "cardctl eject", | 105 | "cardctl eject", |
107 | "cat ", | 106 | "cat ", |
108 | "cd ", | 107 | "cd ", |
109 | "chmod ", | 108 | "chmod ", |
110 | "cp ", | 109 | "cp ", |
111 | "dc ", | 110 | "dc ", |
112 | "df ", | 111 | "df ", |
113 | "dmesg", | 112 | "dmesg", |
114 | "echo ", | 113 | "echo ", |
114 | "env", | ||
115 | "find ", | 115 | "find ", |
116 | "free", | 116 | "free", |
117 | "grep ", | 117 | "grep ", |
118 | "ifconfig ", | 118 | "ifconfig ", |
119 | "ipkg ", | 119 | "ipkg ", |
120 | "mkdir ", | 120 | "mkdir ", |
121 | "mv ", | 121 | "mv ", |
122 | "nc localhost 7776", | 122 | "nc localhost 7776", |
123 | "nc localhost 7777", | 123 | "nc localhost 7777", |
124 | "netstat ", | ||
125 | "nslookup ", | 124 | "nslookup ", |
126 | "ping ", | 125 | "ping ", |
127 | "ps aux", | 126 | "ps aux", |
128 | "pwd ", | 127 | "pwd ", |
129 | "rm ", | 128 | "rm ", |
130 | "rmdir ", | 129 | "rmdir ", |
131 | "route ", | 130 | "route ", |
132 | "set ", | 131 | "set ", |
133 | "traceroute", | 132 | "traceroute", |
134 | 133 | ||
135 | /* | 134 | /* |
136 | "gzip", | 135 | "gzip", |
137 | "gunzip", | 136 | "gunzip", |
138 | "chgrp", | 137 | "chgrp", |
139 | "chown", | 138 | "chown", |
140 | "date", | 139 | "date", |
@@ -284,36 +283,38 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
284 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 283 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
285 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 284 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
286 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 285 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
287 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); | 286 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); |
288 | /* | 287 | /* |
289 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); | 288 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); |
290 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 289 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
291 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); | 290 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); |
292 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 291 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
293 | */ | 292 | */ |
294 | 293 | ||
295 | secondToolBar = new QPEToolBar( this ); | 294 | secondToolBar = new QPEToolBar( this ); |
296 | secondToolBar->setHorizontalStretchable( TRUE ); | 295 | secondToolBar->setHorizontalStretchable( TRUE ); |
297 | 296 | ||
298 | commonCombo = new QComboBox( secondToolBar ); | 297 | commonCombo = new QComboBox( secondToolBar ); |
299 | 298 | ||
300 | if( listHidden) | ||
301 | secondToolBar->hide(); | ||
302 | configMenu->insertItem( "Edit Command List"); | 299 | configMenu->insertItem( "Edit Command List"); |
303 | 300 | if( listHidden) { | |
301 | secondToolBar->hide(); | ||
302 | configMenu->setItemEnabled(-20 ,FALSE); | ||
303 | } | ||
304 | |||
304 | cfg.setGroup("Commands"); | 305 | cfg.setGroup("Commands"); |
305 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 306 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
306 | 307 | ||
307 | for (int i = 0; commonCmds[i] != NULL; i++) { | 308 | for (int i = 0; commonCmds[i] != NULL; i++) { |
308 | commonCombo->insertItem( commonCmds[i], i ); | 309 | commonCombo->insertItem( commonCmds[i], i ); |
309 | tmp = cfg.readEntry( QString::number(i),""); | 310 | tmp = cfg.readEntry( QString::number(i),""); |
310 | if(tmp != "") | 311 | if(tmp != "") |
311 | commonCombo->changeItem( tmp,i ); | 312 | commonCombo->changeItem( tmp,i ); |
312 | } | 313 | } |
313 | 314 | ||
314 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 315 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
315 | 316 | ||
316 | // create applications ///////////////////////////////////////////////////// | 317 | // create applications ///////////////////////////////////////////////////// |
317 | setCentralWidget(tab); | 318 | setCentralWidget(tab); |
318 | 319 | ||
319 | // load keymaps //////////////////////////////////////////////////////////// | 320 | // load keymaps //////////////////////////////////////////////////////////// |