-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 653652a..1016885 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -45,128 +45,129 @@ | |||
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 | class EKNumTabBar : public QTabBar { | 55 | class EKNumTabBar : public QTabBar { |
56 | public: | 56 | public: |
57 | void numberTabs() | 57 | void numberTabs() |
58 | { | 58 | { |
59 | // Yes, it really is this messy. QTabWidget needs functions | 59 | // Yes, it really is this messy. QTabWidget needs functions |
60 | // that provide acces to tabs in a sequential way. | 60 | // that provide acces to tabs in a sequential way. |
61 | int m=INT_MIN; | 61 | int m=INT_MIN; |
62 | for (int i=0; i<count(); i++) { | 62 | for (int i=0; i<count(); i++) { |
63 | QTab* left=0; | 63 | QTab* left=0; |
64 | QListIterator<QTab> it(*tabList()); | 64 | QListIterator<QTab> it(*tabList()); |
65 | int x=INT_MAX; | 65 | int x=INT_MAX; |
66 | for( QTab* t; (t=it.current()); ++it ) { | 66 | for( QTab* t; (t=it.current()); ++it ) { |
67 | int tx = t->rect().x(); | 67 | int tx = t->rect().x(); |
68 | if ( tx<x && tx>m ) { | 68 | if ( tx<x && tx>m ) { |
69 | x = tx; | 69 | x = tx; |
70 | left = t; | 70 | left = t; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | if ( left ) { | 73 | if ( left ) { |
74 | left->setText(QString::number(i+1)); | 74 | left->setText(QString::number(i+1)); |
75 | m = left->rect().x(); | 75 | m = left->rect().x(); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | } | 78 | } |
79 | }; | 79 | }; |
80 | 80 | ||
81 | class EKNumTabWidget : public QTabWidget { | 81 | class EKNumTabWidget : public QTabWidget { |
82 | public: | 82 | public: |
83 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) | 83 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) |
84 | { | 84 | { |
85 | } | 85 | } |
86 | 86 | ||
87 | void addTab(QWidget* w) | 87 | void addTab(QWidget* w) |
88 | { | 88 | { |
89 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); | 89 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); |
90 | QTabWidget::addTab(w,t); | 90 | QTabWidget::addTab(w,t); |
91 | } | 91 | } |
92 | 92 | ||
93 | void removeTab(QWidget* w) | 93 | void removeTab(QWidget* w) |
94 | { | 94 | { |
95 | removePage(w); | 95 | removePage(w); |
96 | ((EKNumTabBar*)tabBar())->numberTabs(); | 96 | ((EKNumTabBar*)tabBar())->numberTabs(); |
97 | } | 97 | } |
98 | }; | 98 | }; |
99 | 99 | ||
100 | // This could be configurable or dynamicly generated from the bash history | 100 | // This could be configurable or dynamicly generated from the bash history |
101 | // file of the user | 101 | // file of the user |
102 | static const char *commonCmds[] = | 102 | static const char *commonCmds[] = |
103 | { | 103 | { |
104 | "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 |
105 | "cardctl eject", | 105 | "cardctl eject", |
106 | "cat ", | 106 | "cat ", |
107 | "cd ", | 107 | "cd ", |
108 | "chmod ", | 108 | "chmod ", |
109 | "clear", | ||
109 | "cp ", | 110 | "cp ", |
110 | "dc ", | 111 | "dc ", |
111 | "df ", | 112 | "df ", |
112 | "dmesg", | 113 | "dmesg", |
113 | "echo ", | 114 | "echo ", |
114 | "env", | 115 | "env", |
115 | "find ", | 116 | "find ", |
116 | "free", | 117 | "free", |
117 | "grep ", | 118 | "grep ", |
118 | "ifconfig ", | 119 | "ifconfig ", |
119 | "ipkg ", | 120 | "ipkg ", |
120 | "mkdir ", | 121 | "mkdir ", |
121 | "mv ", | 122 | "mv ", |
122 | "nc localhost 7776", | 123 | "nc localhost 7776", |
123 | "nc localhost 7777", | 124 | "nc localhost 7777", |
124 | "nslookup ", | 125 | "nslookup ", |
125 | "ping ", | 126 | "ping ", |
126 | "ps aux", | 127 | "ps aux", |
127 | "pwd ", | 128 | "pwd ", |
128 | "rm ", | 129 | "rm ", |
129 | "rmdir ", | 130 | "rmdir ", |
130 | "route ", | 131 | "route ", |
131 | "set ", | 132 | "set ", |
132 | "traceroute", | 133 | "traceroute", |
133 | 134 | ||
134 | /* | 135 | /* |
135 | "gzip", | 136 | "gzip", |
136 | "gunzip", | 137 | "gunzip", |
137 | "chgrp", | 138 | "chgrp", |
138 | "chown", | 139 | "chown", |
139 | "date", | 140 | "date", |
140 | "dd", | 141 | "dd", |
141 | "df", | 142 | "df", |
142 | "dmesg", | 143 | "dmesg", |
143 | "fuser", | 144 | "fuser", |
144 | "hostname", | 145 | "hostname", |
145 | "kill", | 146 | "kill", |
146 | "killall", | 147 | "killall", |
147 | "ln", | 148 | "ln", |
148 | "ping", | 149 | "ping", |
149 | "mount", | 150 | "mount", |
150 | "more", | 151 | "more", |
151 | "sort", | 152 | "sort", |
152 | "touch", | 153 | "touch", |
153 | "umount", | 154 | "umount", |
154 | "mknod", | 155 | "mknod", |
155 | "netstat", | 156 | "netstat", |
156 | */ | 157 | */ |
157 | 158 | ||
158 | "exit", | 159 | "exit", |
159 | NULL | 160 | NULL |
160 | }; | 161 | }; |
161 | 162 | ||
162 | 163 | ||
163 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 164 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
164 | QMainWindow(parent, name, fl) | 165 | QMainWindow(parent, name, fl) |
165 | { | 166 | { |
166 | QStrList args; | 167 | QStrList args; |
167 | init("/bin/sh",args); | 168 | init("/bin/sh",args); |
168 | } | 169 | } |
169 | 170 | ||
170 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) | 171 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) |
171 | : QMainWindow(0, name) | 172 | : QMainWindow(0, name) |
172 | { | 173 | { |