summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp8
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp3
2 files changed, 8 insertions, 3 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index dab0ea3..350ab3a 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -929,169 +929,173 @@ void TEWidget::pasteClipboard( )
929 929
930void TEWidget::setSelection(const QString& t) 930void TEWidget::setSelection(const QString& t)
931{ 931{
932#ifndef QT_NO_CLIPBOARD 932#ifndef QT_NO_CLIPBOARD
933 // Disconnect signal while WE set the clipboard 933 // Disconnect signal while WE set the clipboard
934 QObject *cb = QApplication::clipboard(); 934 QObject *cb = QApplication::clipboard();
935 QObject::disconnect( cb, SIGNAL(dataChanged()), 935 QObject::disconnect( cb, SIGNAL(dataChanged()),
936 this, SLOT(onClearSelection()) ); 936 this, SLOT(onClearSelection()) );
937 937
938 QApplication::clipboard()->setText(t); 938 QApplication::clipboard()->setText(t);
939 939
940 QObject::connect( cb, SIGNAL(dataChanged()), 940 QObject::connect( cb, SIGNAL(dataChanged()),
941 this, SLOT(onClearSelection()) ); 941 this, SLOT(onClearSelection()) );
942#endif 942#endif
943} 943}
944 944
945void TEWidget::onClearSelection() 945void TEWidget::onClearSelection()
946{ 946{
947 emit clearSelectionSignal(); 947 emit clearSelectionSignal();
948} 948}
949 949
950/* ------------------------------------------------------------------------- */ 950/* ------------------------------------------------------------------------- */
951/* */ 951/* */
952/* Keyboard */ 952/* Keyboard */
953/* */ 953/* */
954/* ------------------------------------------------------------------------- */ 954/* ------------------------------------------------------------------------- */
955 955
956//FIXME: an `eventFilter' has been installed instead of a `keyPressEvent' 956//FIXME: an `eventFilter' has been installed instead of a `keyPressEvent'
957// due to a bug in `QT' or the ignorance of the author to prevent 957// due to a bug in `QT' or the ignorance of the author to prevent
958// repaint events being emitted to the screen whenever one leaves 958// repaint events being emitted to the screen whenever one leaves
959// or reenters the screen to/from another application. 959// or reenters the screen to/from another application.
960// 960//
961// Troll says one needs to change focusInEvent() and focusOutEvent(), 961// Troll says one needs to change focusInEvent() and focusOutEvent(),
962// which would also let you have an in-focus cursor and an out-focus 962// which would also let you have an in-focus cursor and an out-focus
963// cursor like xterm does. 963// cursor like xterm does.
964 964
965// for the auto-hide cursor feature, I added empty focusInEvent() and 965// for the auto-hide cursor feature, I added empty focusInEvent() and
966// focusOutEvent() so that update() isn't called. 966// focusOutEvent() so that update() isn't called.
967// For auto-hide, we need to get keypress-events, but we only get them when 967// For auto-hide, we need to get keypress-events, but we only get them when
968// we have focus. 968// we have focus.
969 969
970void TEWidget::doScroll(int lines) 970void TEWidget::doScroll(int lines)
971{ 971{
972 scrollbar->setValue(scrollbar->value()+lines); 972 scrollbar->setValue(scrollbar->value()+lines);
973} 973}
974 974
975bool TEWidget::eventFilter( QObject *obj, QEvent *e ) 975bool TEWidget::eventFilter( QObject *obj, QEvent *e )
976{ 976{
977 if ( (e->type() == QEvent::Accel || 977 if ( (e->type() == QEvent::Accel ||
978 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) 978 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this )
979 { 979 {
980 static_cast<QKeyEvent *>( e )->ignore(); 980 static_cast<QKeyEvent *>( e )->ignore();
981 return true; 981 return true;
982 } 982 }
983 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) 983 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
984 return FALSE; // not us 984 return FALSE; // not us
985 if ( e->type() == QEvent::Wheel) 985 if ( e->type() == QEvent::Wheel)
986 { 986 {
987 QApplication::sendEvent(scrollbar, e); 987 QApplication::sendEvent(scrollbar, e);
988 } 988 }
989 989
990#ifdef FAKE_CTRL_AND_ALT 990#ifdef FAKE_CTRL_AND_ALT
991 static bool control = FALSE; 991 static bool control = FALSE;
992 static bool alt = FALSE; 992 static bool alt = FALSE;
993 // Has a keyboard with no CTRL and ALT keys, but we fake it: 993 qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:");
994 bool dele=FALSE; 994 bool dele=FALSE;
995 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 995 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
996 QKeyEvent* ke = (QKeyEvent*)e; 996 QKeyEvent* ke = (QKeyEvent*)e;
997 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 997 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
998 switch (ke->key()) { 998 switch (ke->key()) {
999 case Key_F9: // let this be "Control" 999 case Key_F9: // let this be "Control"
1000 control = keydown; 1000 control = keydown;
1001 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 1001 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
1002 dele=TRUE; 1002 dele=TRUE;
1003 break; 1003 break;
1004 case Key_F13: // let this be "Alt" 1004 case Key_F13: // let this be "Alt"
1005 alt = keydown; 1005 alt = keydown;
1006 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); 1006 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
1007 dele=TRUE; 1007 dele=TRUE;
1008 break; 1008 break;
1009 default: 1009 default:
1010 if ( control ) { 1010 if ( control ) {
1011 int a = toupper(ke->ascii())-64; 1011 int a = toupper(ke->ascii())-64;
1012 if ( a >= 0 && a < ' ' ) { 1012 if ( a >= 0 && a < ' ' ) {
1013 e = new QKeyEvent(e->type(), ke->key(), 1013 e = new QKeyEvent(e->type(), ke->key(),
1014 a, ke->state()|ControlButton, QChar(a,0)); 1014 a, ke->state()|ControlButton, QChar(a,0));
1015 dele=TRUE; 1015 dele=TRUE;
1016 } 1016 }
1017 } 1017 }
1018 if ( alt ) { 1018 if ( alt ) {
1019 e = new QKeyEvent(e->type(), ke->key(), 1019 e = new QKeyEvent(e->type(), ke->key(),
1020 ke->ascii(), ke->state()|AltButton, ke->text()); 1020 ke->ascii(), ke->state()|AltButton, ke->text());
1021 dele=TRUE; 1021 dele=TRUE;
1022 } 1022 }
1023 } 1023 }
1024 } 1024 }
1025#endif 1025#endif
1026 1026
1027 if ( e->type() == QEvent::KeyPress ) 1027 if ( e->type() == QEvent::KeyPress )
1028 { 1028 {
1029 QKeyEvent* ke = (QKeyEvent*)e; 1029 QKeyEvent* ke = (QKeyEvent*)e;
1030
1031 actSel=0; // Key stroke implies a screen update, so TEWidget won't 1030 actSel=0; // Key stroke implies a screen update, so TEWidget won't
1032 // know where the current selection is. 1031 // know where the current selection is.
1033 1032
1033// qDebug("key pressed is 0x%x",ke->key());
1034 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
1035// qDebug("key pressed 2 is 0x%x",ke->key());
1036 emitText("\\"); // expose
1037 } else
1034 emit keyPressedSignal(ke); // expose 1038 emit keyPressedSignal(ke); // expose
1035 ke->accept(); 1039 ke->accept();
1036#ifdef FAKE_CTRL_AND_ALT 1040#ifdef FAKE_CTRL_AND_ALT
1037 if ( dele ) delete e; 1041 if ( dele ) delete e;
1038#endif 1042#endif
1039 return true; // stop the event 1043 return true; // stop the event
1040 } 1044 }
1041 if ( e->type() == QEvent::Enter ) 1045 if ( e->type() == QEvent::Enter )
1042 { 1046 {
1043 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), 1047 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
1044 this, SLOT(onClearSelection()) ); 1048 this, SLOT(onClearSelection()) );
1045 } 1049 }
1046 if ( e->type() == QEvent::Leave ) 1050 if ( e->type() == QEvent::Leave )
1047 { 1051 {
1048 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 1052 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
1049 this, SLOT(onClearSelection()) ); 1053 this, SLOT(onClearSelection()) );
1050 } 1054 }
1051 return QFrame::eventFilter( obj, e ); 1055 return QFrame::eventFilter( obj, e );
1052} 1056}
1053 1057
1054/* ------------------------------------------------------------------------- */ 1058/* ------------------------------------------------------------------------- */
1055/* */ 1059/* */
1056/* Frame */ 1060/* Frame */
1057/* */ 1061/* */
1058/* ------------------------------------------------------------------------- */ 1062/* ------------------------------------------------------------------------- */
1059 1063
1060void TEWidget::frameChanged() 1064void TEWidget::frameChanged()
1061{ 1065{
1062 propagateSize(); 1066 propagateSize();
1063 update(); 1067 update();
1064} 1068}
1065 1069
1066/* ------------------------------------------------------------------------- */ 1070/* ------------------------------------------------------------------------- */
1067/* */ 1071/* */
1068/* Sound */ 1072/* Sound */
1069/* */ 1073/* */
1070/* ------------------------------------------------------------------------- */ 1074/* ------------------------------------------------------------------------- */
1071 1075
1072void TEWidget::Bell() 1076void TEWidget::Bell()
1073{ 1077{
1074 QApplication::beep(); 1078 QApplication::beep();
1075} 1079}
1076 1080
1077/* ------------------------------------------------------------------------- */ 1081/* ------------------------------------------------------------------------- */
1078/* */ 1082/* */
1079/* Auxiluary */ 1083/* Auxiluary */
1080/* */ 1084/* */
1081/* ------------------------------------------------------------------------- */ 1085/* ------------------------------------------------------------------------- */
1082 1086
1083void TEWidget::clearImage() 1087void TEWidget::clearImage()
1084// initialize the image 1088// initialize the image
1085// for internal use only 1089// for internal use only
1086{ 1090{
1087 for (int y = 0; y < lines; y++) 1091 for (int y = 0; y < lines; y++)
1088 for (int x = 0; x < columns; x++) 1092 for (int x = 0; x < columns; x++)
1089 { 1093 {
1090 image[loc(x,y)].c = 0xff; //' '; 1094 image[loc(x,y)].c = 0xff; //' ';
1091 image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; 1095 image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR;
1092 image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; 1096 image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR;
1093 image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; 1097 image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION;
1094 } 1098 }
1095} 1099}
1096 1100
1097// Create Image /////////////////////////////////////////////////////// 1101// Create Image ///////////////////////////////////////////////////////
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index f13d0c9..adcfb7f 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -107,129 +107,130 @@ static const char *commonCmds[] =
107 "cardctl eject", 107 "cardctl eject",
108 "cat ", 108 "cat ",
109 "cd ", 109 "cd ",
110 "chmod ", 110 "chmod ",
111 "clear", 111 "clear",
112 "cp ", 112 "cp ",
113 "dc ", 113 "dc ",
114 "df ", 114 "df ",
115 "dmesg", 115 "dmesg",
116 "echo ", 116 "echo ",
117 "env", 117 "env",
118 "find ", 118 "find ",
119 "free", 119 "free",
120 "grep ", 120 "grep ",
121 "ifconfig ", 121 "ifconfig ",
122 "ipkg ", 122 "ipkg ",
123 "mkdir ", 123 "mkdir ",
124 "mv ", 124 "mv ",
125 "nc localhost 7776", 125 "nc localhost 7776",
126 "nc localhost 7777", 126 "nc localhost 7777",
127 "netstat ", 127 "netstat ",
128 "nslookup ", 128 "nslookup ",
129 "ping ", 129 "ping ",
130 "ps aux", 130 "ps aux",
131 "pwd ", 131 "pwd ",
132 "rm ", 132 "rm ",
133 "rmdir ", 133 "rmdir ",
134 "route ", 134 "route ",
135 "set ", 135 "set ",
136 "traceroute", 136 "traceroute",
137 137
138/* 138/*
139 "gzip", 139 "gzip",
140 "gunzip", 140 "gunzip",
141 "chgrp", 141 "chgrp",
142 "chown", 142 "chown",
143 "date", 143 "date",
144 "dd", 144 "dd",
145 "df", 145 "df",
146 "dmesg", 146 "dmesg",
147 "fuser", 147 "fuser",
148 "hostname", 148 "hostname",
149 "kill", 149 "kill",
150 "killall", 150 "killall",
151 "ln", 151 "ln",
152 "ping", 152 "ping",
153 "mount", 153 "mount",
154 "more", 154 "more",
155 "sort", 155 "sort",
156 "touch", 156 "touch",
157 "umount", 157 "umount",
158 "mknod", 158 "mknod",
159 "netstat", 159 "netstat",
160*/ 160*/
161 161
162 "exit", 162 "exit",
163 NULL 163 NULL
164}; 164};
165 165
166 166
167Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : 167Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
168 QMainWindow(parent, name, fl) 168 QMainWindow(parent, name, fl)
169{ 169{
170 QStrList args; 170 QStrList args;
171 init("/bin/sh",args); 171 init("/bin/ash",args);
172// init("/bin/sh",args);
172} 173}
173 174
174Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) 175Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int)
175 : QMainWindow(0, name) 176 : QMainWindow(0, name)
176{ 177{
177 init(_pgm,_args); 178 init(_pgm,_args);
178} 179}
179 180
180void Konsole::initCommandList() 181void Konsole::initCommandList()
181{ 182{
182// qDebug("Konsole::initCommandList"); 183// qDebug("Konsole::initCommandList");
183 Config cfg("Konsole"); 184 Config cfg("Konsole");
184 cfg.setGroup("Commands"); 185 cfg.setGroup("Commands");
185 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 186 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
186 commonCombo->clear(); 187 commonCombo->clear();
187 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { 188 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") {
188 for (int i = 0; commonCmds[i] != NULL; i++) { 189 for (int i = 0; commonCmds[i] != NULL; i++) {
189 commonCombo->insertItem(commonCmds[i],i); 190 commonCombo->insertItem(commonCmds[i],i);
190 } 191 }
191 } else { 192 } else {
192 for (int i = 0; i < 100; i++) { 193 for (int i = 0; i < 100; i++) {
193 if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) 194 if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
194 commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); 195 commonCombo->insertItem((cfg.readEntry( QString::number(i),"")));
195 } 196 }
196 } 197 }
197 198
198} 199}
199 200
200void Konsole::init(const char* _pgm, QStrList & _args) 201void Konsole::init(const char* _pgm, QStrList & _args)
201{ 202{
202 b_scroll = TRUE; // histon; 203 b_scroll = TRUE; // histon;
203 n_keytab = 0; 204 n_keytab = 0;
204 n_render = 0; 205 n_render = 0;
205 startUp=0; 206 startUp=0;
206 setCaption( tr("Terminal") ); 207 setCaption( tr("Terminal") );
207 setIcon( Resource::loadPixmap( "konsole" ) ); 208 setIcon( Resource::loadPixmap( "konsole" ) );
208 209
209 Config cfg("Konsole"); 210 Config cfg("Konsole");
210 cfg.setGroup("Konsole"); 211 cfg.setGroup("Konsole");
211 QString tmp; 212 QString tmp;
212 // initialize the list of allowed fonts /////////////////////////////////// 213 // initialize the list of allowed fonts ///////////////////////////////////
213 cfont = cfg.readNumEntry("FontID", 1); 214 cfont = cfg.readNumEntry("FontID", 1);
214 QFont f = QFont("Micro", 4, QFont::Normal); 215 QFont f = QFont("Micro", 4, QFont::Normal);
215 f.setFixedPitch(TRUE); 216 f.setFixedPitch(TRUE);
216 fonts.append(new VTFont(tr("Micro"), f)); 217 fonts.append(new VTFont(tr("Micro"), f));
217 218
218 f = QFont("Fixed", 7, QFont::Normal); 219 f = QFont("Fixed", 7, QFont::Normal);
219 f.setFixedPitch(TRUE); 220 f.setFixedPitch(TRUE);
220 fonts.append(new VTFont(tr("Small Fixed"), f)); 221 fonts.append(new VTFont(tr("Small Fixed"), f));
221 222
222 f = QFont("Fixed", 12, QFont::Normal); 223 f = QFont("Fixed", 12, QFont::Normal);
223 f.setFixedPitch(TRUE); 224 f.setFixedPitch(TRUE);
224 fonts.append(new VTFont(tr("Medium Fixed"), f)); 225 fonts.append(new VTFont(tr("Medium Fixed"), f));
225 226
226 // create terminal emulation framework //////////////////////////////////// 227 // create terminal emulation framework ////////////////////////////////////
227 nsessions = 0; 228 nsessions = 0;
228 229
229 tab = new EKNumTabWidget(this); 230 tab = new EKNumTabWidget(this);
230 231
231 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); 232 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
232 233
233 // create terminal toolbar //////////////////////////////////////////////// 234 // create terminal toolbar ////////////////////////////////////////////////
234 setToolBarsMovable( FALSE ); 235 setToolBarsMovable( FALSE );
235 QPEToolBar *menuToolBar = new QPEToolBar( this ); 236 QPEToolBar *menuToolBar = new QPEToolBar( this );