-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 8ca55fe..70acc42 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -1,150 +1,150 @@ | |||
1 | /* ---------------------------------------------------------------------- */ | 1 | /* ---------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [main.C] Konsole */ | 3 | /* [main.C] Konsole */ |
4 | /* */ | 4 | /* */ |
5 | /* ---------------------------------------------------------------------- */ | 5 | /* ---------------------------------------------------------------------- */ |
6 | /* */ | 6 | /* */ |
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
8 | /* */ | 8 | /* */ |
9 | /* This file is part of Konsole, an X terminal. */ | 9 | /* This file is part of Konsole, an X terminal. */ |
10 | /* */ | 10 | /* */ |
11 | /* The material contained in here more or less directly orginates from */ | 11 | /* The material contained in here more or less directly orginates from */ |
12 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ | 12 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ |
13 | /* */ | 13 | /* */ |
14 | /* ---------------------------------------------------------------------- */ | 14 | /* ---------------------------------------------------------------------- */ |
15 | /* */ | 15 | /* */ |
16 | /* Ported Konsole to Qt/Embedded */ | 16 | /* Ported Konsole to Qt/Embedded */ |
17 | /* */ | 17 | /* */ |
18 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 18 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
19 | /* */ | 19 | /* */ |
20 | /* -------------------------------------------------------------------------- */ | 20 | /* -------------------------------------------------------------------------- */ |
21 | // enhancements added by L.J. Potter <ljp@llornkcor.com> | 21 | // enhancements added by L.J. Potter <ljp@llornkcor.com> |
22 | //#define QT_QWS_OPIE | 22 | #define QT_QWS_OPIE |
23 | 23 | ||
24 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
25 | 25 | ||
26 | #include <qdir.h> | 26 | #include <qdir.h> |
27 | #include <qevent.h> | 27 | #include <qevent.h> |
28 | #include <qdragobject.h> | 28 | #include <qdragobject.h> |
29 | #include <qobjectlist.h> | 29 | #include <qobjectlist.h> |
30 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
31 | #include <qpe/qpetoolbar.h> | 31 | #include <qpe/qpetoolbar.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qfontdialog.h> | 33 | #include <qfontdialog.h> |
34 | #include <qglobal.h> | 34 | #include <qglobal.h> |
35 | #include <qpainter.h> | 35 | #include <qpainter.h> |
36 | #include <qpe/qpemenubar.h> | 36 | #include <qpe/qpemenubar.h> |
37 | #include <qmessagebox.h> | 37 | #include <qmessagebox.h> |
38 | #include <qaction.h> | 38 | #include <qaction.h> |
39 | #include <qapplication.h> | 39 | #include <qapplication.h> |
40 | #include <qfontmetrics.h> | 40 | #include <qfontmetrics.h> |
41 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
42 | #include <qevent.h> | 42 | #include <qevent.h> |
43 | #include <qtabwidget.h> | 43 | #include <qtabwidget.h> |
44 | #include <qtabbar.h> | 44 | #include <qtabbar.h> |
45 | #include <qpe/config.h> | 45 | #include <qpe/config.h> |
46 | #include <qstringlist.h> | 46 | #include <qstringlist.h> |
47 | #include <qpalette.h> | 47 | #include <qpalette.h> |
48 | 48 | ||
49 | #include <sys/wait.h> | 49 | #include <sys/wait.h> |
50 | #include <stdio.h> | 50 | #include <stdio.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | #include <assert.h> | 52 | #include <assert.h> |
53 | 53 | ||
54 | #include "konsole.h" | 54 | #include "konsole.h" |
55 | #include "keytrans.h" | 55 | #include "keytrans.h" |
56 | #include "commandeditdialog.h" | 56 | #include "commandeditdialog.h" |
57 | 57 | ||
58 | #ifdef QT_QWS_OPIE | 58 | #ifdef QT_QWS_OPIE |
59 | #include <opie/colorpopupmenu.h> | 59 | #include <opie/colorpopupmenu.h> |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | class EKNumTabBar : public QTabBar { | 62 | class EKNumTabBar : public QTabBar { |
63 | public: | 63 | public: |
64 | void numberTabs() | 64 | void numberTabs() |
65 | { | 65 | { |
66 | // Yes, it really is this messy. QTabWidget needs functions | 66 | // Yes, it really is this messy. QTabWidget needs functions |
67 | // that provide acces to tabs in a sequential way. | 67 | // that provide acces to tabs in a sequential way. |
68 | int m=INT_MIN; | 68 | int m=INT_MIN; |
69 | for (int i=0; i<count(); i++) { | 69 | for (int i=0; i<count(); i++) { |
70 | QTab* left=0; | 70 | QTab* left=0; |
71 | QListIterator<QTab> it(*tabList()); | 71 | QListIterator<QTab> it(*tabList()); |
72 | int x=INT_MAX; | 72 | int x=INT_MAX; |
73 | for( QTab* t; (t=it.current()); ++it ) { | 73 | for( QTab* t; (t=it.current()); ++it ) { |
74 | int tx = t->rect().x(); | 74 | int tx = t->rect().x(); |
75 | if ( tx<x && tx>m ) { | 75 | if ( tx<x && tx>m ) { |
76 | x = tx; | 76 | x = tx; |
77 | left = t; | 77 | left = t; |
78 | } | 78 | } |
79 | } | 79 | } |
80 | if ( left ) { | 80 | if ( left ) { |
81 | left->setText(QString::number(i+1)); | 81 | left->setText(QString::number(i+1)); |
82 | m = left->rect().x(); | 82 | m = left->rect().x(); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | } | 85 | } |
86 | }; | 86 | }; |
87 | 87 | ||
88 | class EKNumTabWidget : public QTabWidget { | 88 | class EKNumTabWidget : public QTabWidget { |
89 | public: | 89 | public: |
90 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) | 90 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) |
91 | { | 91 | { |
92 | } | 92 | } |
93 | 93 | ||
94 | void addTab(QWidget* w) | 94 | void addTab(QWidget* w) |
95 | { | 95 | { |
96 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); | 96 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); |
97 | QTabWidget::addTab(w,t); | 97 | QTabWidget::addTab(w,t); |
98 | } | 98 | } |
99 | 99 | ||
100 | void removeTab(QWidget* w) | 100 | void removeTab(QWidget* w) |
101 | { | 101 | { |
102 | removePage(w); | 102 | removePage(w); |
103 | ((EKNumTabBar*)tabBar())->numberTabs(); | 103 | ((EKNumTabBar*)tabBar())->numberTabs(); |
104 | } | 104 | } |
105 | }; | 105 | }; |
106 | 106 | ||
107 | // This could be configurable or dynamicly generated from the bash history | 107 | // This could be configurable or dynamicly generated from the bash history |
108 | // file of the user | 108 | // file of the user |
109 | static const char *commonCmds[] = | 109 | static const char *commonCmds[] = |
110 | { | 110 | { |
111 | "ls ", // I left this here, cause it looks better than the first alpha | 111 | "ls ", // I left this here, cause it looks better than the first alpha |
112 | "cardctl eject", | 112 | "cardctl eject", |
113 | "cat ", | 113 | "cat ", |
114 | "cd ", | 114 | "cd ", |
115 | "chmod ", | 115 | "chmod ", |
116 | "clear", | 116 | "clear", |
117 | "cp ", | 117 | "cp ", |
118 | "dc ", | 118 | "dc ", |
119 | "df ", | 119 | "df ", |
120 | "dmesg", | 120 | "dmesg", |
121 | "echo ", | 121 | "echo ", |
122 | "env", | 122 | "env", |
123 | "find ", | 123 | "find ", |
124 | "free", | 124 | "free", |
125 | "grep ", | 125 | "grep ", |
126 | "ifconfig ", | 126 | "ifconfig ", |
127 | "ipkg ", | 127 | "ipkg ", |
128 | "mkdir ", | 128 | "mkdir ", |
129 | "mv ", | 129 | "mv ", |
130 | "nc localhost 7776", | 130 | "nc localhost 7776", |
131 | "nc localhost 7777", | 131 | "nc localhost 7777", |
132 | "netstat ", | 132 | "netstat ", |
133 | "nslookup ", | 133 | "nslookup ", |
134 | "ping ", | 134 | "ping ", |
135 | "ps aux", | 135 | "ps aux", |
136 | "pwd ", | 136 | "pwd ", |
137 | "qcop QPE/System 'linkChanged(QString)' ''", | 137 | "qcop QPE/System 'linkChanged(QString)' ''", |
138 | "qcop QPE/System 'restart()'", | 138 | "qcop QPE/System 'restart()'", |
139 | "qcop QPE/System 'quit()'", | 139 | "qcop QPE/System 'quit()'", |
140 | "rm ", | 140 | "rm ", |
141 | "rmdir ", | 141 | "rmdir ", |
142 | "route ", | 142 | "route ", |
143 | "set ", | 143 | "set ", |
144 | "traceroute", | 144 | "traceroute", |
145 | 145 | ||
146 | /* | 146 | /* |
147 | "gzip", | 147 | "gzip", |
148 | "gunzip", | 148 | "gunzip", |
149 | "chgrp", | 149 | "chgrp", |
150 | "chown", | 150 | "chown", |