author | llornkcor <llornkcor> | 2002-04-05 13:17:19 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-05 13:17:19 (UTC) |
commit | 1896c5fa43e465567595feb442013d75c476f090 (patch) (unidiff) | |
tree | e8ea13fd45277f0b8d7af52f4938f411fd9ed4af | |
parent | dd5bc1f9d61cdd8cfde4c7a7fbba3b53b77b2670 (diff) | |
download | opie-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.
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 45 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 3 |
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 | |||
@@ -1,845 +1,884 @@ | |||
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 | 22 | ||
22 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
23 | 24 | ||
24 | #include <qdir.h> | 25 | #include <qdir.h> |
25 | #include <qevent.h> | 26 | #include <qevent.h> |
26 | #include <qdragobject.h> | 27 | #include <qdragobject.h> |
27 | #include <qobjectlist.h> | 28 | #include <qobjectlist.h> |
28 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
29 | #include <qpe/qpetoolbar.h> | 30 | #include <qpe/qpetoolbar.h> |
30 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
31 | #include <qfontdialog.h> | 32 | #include <qfontdialog.h> |
32 | #include <qglobal.h> | 33 | #include <qglobal.h> |
33 | #include <qpainter.h> | 34 | #include <qpainter.h> |
34 | #include <qpe/qpemenubar.h> | 35 | #include <qpe/qpemenubar.h> |
35 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
36 | #include <qaction.h> | 37 | #include <qaction.h> |
37 | #include <qapplication.h> | 38 | #include <qapplication.h> |
38 | #include <qfontmetrics.h> | 39 | #include <qfontmetrics.h> |
39 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
40 | #include <qevent.h> | 41 | #include <qevent.h> |
41 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
42 | #include <qtabbar.h> | 43 | #include <qtabbar.h> |
43 | #include <qpe/config.h> | 44 | #include <qpe/config.h> |
44 | #include <qstringlist.h> | 45 | #include <qstringlist.h> |
45 | #include <qpalette.h> | 46 | #include <qpalette.h> |
46 | 47 | ||
47 | #include <sys/wait.h> | 48 | #include <sys/wait.h> |
48 | #include <stdio.h> | 49 | #include <stdio.h> |
49 | #include <stdlib.h> | 50 | #include <stdlib.h> |
50 | #include <assert.h> | 51 | #include <assert.h> |
51 | 52 | ||
52 | #include "konsole.h" | 53 | #include "konsole.h" |
53 | #include "keytrans.h" | 54 | #include "keytrans.h" |
54 | #include "commandeditdialog.h" | 55 | #include "commandeditdialog.h" |
55 | 56 | ||
56 | class EKNumTabBar : public QTabBar { | 57 | class EKNumTabBar : public QTabBar { |
57 | public: | 58 | public: |
58 | void numberTabs() | 59 | void numberTabs() |
59 | { | 60 | { |
60 | // Yes, it really is this messy. QTabWidget needs functions | 61 | // Yes, it really is this messy. QTabWidget needs functions |
61 | // that provide acces to tabs in a sequential way. | 62 | // that provide acces to tabs in a sequential way. |
62 | int m=INT_MIN; | 63 | int m=INT_MIN; |
63 | for (int i=0; i<count(); i++) { | 64 | for (int i=0; i<count(); i++) { |
64 | QTab* left=0; | 65 | QTab* left=0; |
65 | QListIterator<QTab> it(*tabList()); | 66 | QListIterator<QTab> it(*tabList()); |
66 | int x=INT_MAX; | 67 | int x=INT_MAX; |
67 | for( QTab* t; (t=it.current()); ++it ) { | 68 | for( QTab* t; (t=it.current()); ++it ) { |
68 | int tx = t->rect().x(); | 69 | int tx = t->rect().x(); |
69 | if ( tx<x && tx>m ) { | 70 | if ( tx<x && tx>m ) { |
70 | x = tx; | 71 | x = tx; |
71 | left = t; | 72 | left = t; |
72 | } | 73 | } |
73 | } | 74 | } |
74 | if ( left ) { | 75 | if ( left ) { |
75 | left->setText(QString::number(i+1)); | 76 | left->setText(QString::number(i+1)); |
76 | m = left->rect().x(); | 77 | m = left->rect().x(); |
77 | } | 78 | } |
78 | } | 79 | } |
79 | } | 80 | } |
80 | }; | 81 | }; |
81 | 82 | ||
82 | class EKNumTabWidget : public QTabWidget { | 83 | class EKNumTabWidget : public QTabWidget { |
83 | public: | 84 | public: |
84 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) | 85 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) |
85 | { | 86 | { |
86 | } | 87 | } |
87 | 88 | ||
88 | void addTab(QWidget* w) | 89 | void addTab(QWidget* w) |
89 | { | 90 | { |
90 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); | 91 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); |
91 | QTabWidget::addTab(w,t); | 92 | QTabWidget::addTab(w,t); |
92 | } | 93 | } |
93 | 94 | ||
94 | void removeTab(QWidget* w) | 95 | void removeTab(QWidget* w) |
95 | { | 96 | { |
96 | removePage(w); | 97 | removePage(w); |
97 | ((EKNumTabBar*)tabBar())->numberTabs(); | 98 | ((EKNumTabBar*)tabBar())->numberTabs(); |
98 | } | 99 | } |
99 | }; | 100 | }; |
100 | 101 | ||
101 | // This could be configurable or dynamicly generated from the bash history | 102 | // This could be configurable or dynamicly generated from the bash history |
102 | // file of the user | 103 | // file of the user |
103 | static const char *commonCmds[] = | 104 | static const char *commonCmds[] = |
104 | { | 105 | { |
105 | "ls ", // I left this here, cause it looks better than the first alpha | 106 | "ls ", // I left this here, cause it looks better than the first alpha |
106 | "cardctl eject", | 107 | "cardctl eject", |
107 | "cat ", | 108 | "cat ", |
108 | "cd ", | 109 | "cd ", |
109 | "chmod ", | 110 | "chmod ", |
110 | "clear", | 111 | "clear", |
111 | "cp ", | 112 | "cp ", |
112 | "dc ", | 113 | "dc ", |
113 | "df ", | 114 | "df ", |
114 | "dmesg", | 115 | "dmesg", |
115 | "echo ", | 116 | "echo ", |
116 | "env", | 117 | "env", |
117 | "find ", | 118 | "find ", |
118 | "free", | 119 | "free", |
119 | "grep ", | 120 | "grep ", |
120 | "ifconfig ", | 121 | "ifconfig ", |
121 | "ipkg ", | 122 | "ipkg ", |
122 | "mkdir ", | 123 | "mkdir ", |
123 | "mv ", | 124 | "mv ", |
124 | "nc localhost 7776", | 125 | "nc localhost 7776", |
125 | "nc localhost 7777", | 126 | "nc localhost 7777", |
126 | "netstat ", | 127 | "netstat ", |
127 | "nslookup ", | 128 | "nslookup ", |
128 | "ping ", | 129 | "ping ", |
129 | "ps aux", | 130 | "ps aux", |
130 | "pwd ", | 131 | "pwd ", |
131 | "rm ", | 132 | "rm ", |
132 | "rmdir ", | 133 | "rmdir ", |
133 | "route ", | 134 | "route ", |
134 | "set ", | 135 | "set ", |
135 | "traceroute", | 136 | "traceroute", |
136 | 137 | ||
137 | /* | 138 | /* |
138 | "gzip", | 139 | "gzip", |
139 | "gunzip", | 140 | "gunzip", |
140 | "chgrp", | 141 | "chgrp", |
141 | "chown", | 142 | "chown", |
142 | "date", | 143 | "date", |
143 | "dd", | 144 | "dd", |
144 | "df", | 145 | "df", |
145 | "dmesg", | 146 | "dmesg", |
146 | "fuser", | 147 | "fuser", |
147 | "hostname", | 148 | "hostname", |
148 | "kill", | 149 | "kill", |
149 | "killall", | 150 | "killall", |
150 | "ln", | 151 | "ln", |
151 | "ping", | 152 | "ping", |
152 | "mount", | 153 | "mount", |
153 | "more", | 154 | "more", |
154 | "sort", | 155 | "sort", |
155 | "touch", | 156 | "touch", |
156 | "umount", | 157 | "umount", |
157 | "mknod", | 158 | "mknod", |
158 | "netstat", | 159 | "netstat", |
159 | */ | 160 | */ |
160 | 161 | ||
161 | "exit", | 162 | "exit", |
162 | NULL | 163 | NULL |
163 | }; | 164 | }; |
164 | 165 | ||
165 | 166 | ||
166 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 167 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
167 | QMainWindow(parent, name, fl) | 168 | QMainWindow(parent, name, fl) |
168 | { | 169 | { |
169 | QStrList args; | 170 | QStrList args; |
170 | init("/bin/sh",args); | 171 | init("/bin/sh",args); |
171 | } | 172 | } |
172 | 173 | ||
173 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) | 174 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) |
174 | : QMainWindow(0, name) | 175 | : QMainWindow(0, name) |
175 | { | 176 | { |
176 | init(_pgm,_args); | 177 | init(_pgm,_args); |
177 | } | 178 | } |
178 | 179 | ||
179 | void Konsole::initCommandList() | 180 | void Konsole::initCommandList() |
180 | { | 181 | { |
181 | // qDebug("Konsole::initCommandList"); | 182 | // qDebug("Konsole::initCommandList"); |
182 | Config cfg("Konsole"); | 183 | Config cfg("Konsole"); |
183 | cfg.setGroup("Commands"); | 184 | cfg.setGroup("Commands"); |
184 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 185 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
185 | commonCombo->clear(); | 186 | commonCombo->clear(); |
186 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { | 187 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { |
187 | for (int i = 0; commonCmds[i] != NULL; i++) { | 188 | for (int i = 0; commonCmds[i] != NULL; i++) { |
188 | commonCombo->insertItem(commonCmds[i],i); | 189 | commonCombo->insertItem(commonCmds[i],i); |
189 | } | 190 | } |
190 | } else { | 191 | } else { |
191 | for (int i = 0; i < 100; i++) { | 192 | for (int i = 0; i < 100; i++) { |
192 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 193 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
193 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); | 194 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); |
194 | } | 195 | } |
195 | } | 196 | } |
196 | 197 | ||
197 | } | 198 | } |
198 | 199 | ||
199 | void Konsole::init(const char* _pgm, QStrList & _args) | 200 | void Konsole::init(const char* _pgm, QStrList & _args) |
200 | { | 201 | { |
201 | b_scroll = TRUE; // histon; | 202 | b_scroll = TRUE; // histon; |
202 | n_keytab = 0; | 203 | n_keytab = 0; |
203 | n_render = 0; | 204 | n_render = 0; |
204 | 205 | startUp=0; | |
205 | setCaption( tr("Terminal") ); | 206 | setCaption( tr("Terminal") ); |
206 | setIcon( Resource::loadPixmap( "konsole" ) ); | 207 | setIcon( Resource::loadPixmap( "konsole" ) ); |
207 | 208 | ||
208 | Config cfg("Konsole"); | 209 | Config cfg("Konsole"); |
209 | cfg.setGroup("Konsole"); | 210 | cfg.setGroup("Konsole"); |
210 | QString tmp; | 211 | QString tmp; |
211 | // initialize the list of allowed fonts /////////////////////////////////// | 212 | // initialize the list of allowed fonts /////////////////////////////////// |
212 | cfont = cfg.readNumEntry("FontID", 1); | 213 | cfont = cfg.readNumEntry("FontID", 1); |
213 | QFont f = QFont("Micro", 4, QFont::Normal); | 214 | QFont f = QFont("Micro", 4, QFont::Normal); |
214 | f.setFixedPitch(TRUE); | 215 | f.setFixedPitch(TRUE); |
215 | fonts.append(new VTFont(tr("Micro"), f)); | 216 | fonts.append(new VTFont(tr("Micro"), f)); |
216 | 217 | ||
217 | f = QFont("Fixed", 7, QFont::Normal); | 218 | f = QFont("Fixed", 7, QFont::Normal); |
218 | f.setFixedPitch(TRUE); | 219 | f.setFixedPitch(TRUE); |
219 | fonts.append(new VTFont(tr("Small Fixed"), f)); | 220 | fonts.append(new VTFont(tr("Small Fixed"), f)); |
220 | 221 | ||
221 | f = QFont("Fixed", 12, QFont::Normal); | 222 | f = QFont("Fixed", 12, QFont::Normal); |
222 | f.setFixedPitch(TRUE); | 223 | f.setFixedPitch(TRUE); |
223 | fonts.append(new VTFont(tr("Medium Fixed"), f)); | 224 | fonts.append(new VTFont(tr("Medium Fixed"), f)); |
224 | 225 | ||
225 | // create terminal emulation framework //////////////////////////////////// | 226 | // create terminal emulation framework //////////////////////////////////// |
226 | nsessions = 0; | 227 | nsessions = 0; |
227 | 228 | ||
228 | tab = new EKNumTabWidget(this); | 229 | tab = new EKNumTabWidget(this); |
229 | 230 | ||
230 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 231 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
231 | 232 | ||
232 | // create terminal toolbar //////////////////////////////////////////////// | 233 | // create terminal toolbar //////////////////////////////////////////////// |
233 | setToolBarsMovable( FALSE ); | 234 | setToolBarsMovable( FALSE ); |
234 | QPEToolBar *menuToolBar = new QPEToolBar( this ); | 235 | QPEToolBar *menuToolBar = new QPEToolBar( this ); |
235 | menuToolBar->setHorizontalStretchable( TRUE ); | 236 | menuToolBar->setHorizontalStretchable( TRUE ); |
236 | 237 | ||
237 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); | 238 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); |
238 | 239 | ||
239 | fontList = new QPopupMenu( this ); | 240 | fontList = new QPopupMenu( this ); |
240 | for(uint i = 0; i < fonts.count(); i++) { | 241 | for(uint i = 0; i < fonts.count(); i++) { |
241 | VTFont *fnt = fonts.at(i); | 242 | VTFont *fnt = fonts.at(i); |
242 | fontList->insertItem(fnt->getName(), i); | 243 | fontList->insertItem(fnt->getName(), i); |
243 | } | 244 | } |
244 | fontChanged(cfont); | 245 | fontChanged(cfont); |
245 | 246 | ||
246 | configMenu = new QPopupMenu( this); | 247 | configMenu = new QPopupMenu( this); |
247 | colorMenu = new QPopupMenu( this); | 248 | colorMenu = new QPopupMenu( this); |
248 | scrollMenu = new QPopupMenu( this); | 249 | scrollMenu = new QPopupMenu( this); |
249 | editCommandListMenu = new QPopupMenu( this); | 250 | editCommandListMenu = new QPopupMenu( this); |
250 | 251 | ||
251 | configMenu->insertItem("Command List",editCommandListMenu); | 252 | configMenu->insertItem("Command List",editCommandListMenu); |
252 | 253 | ||
253 | bool listHidden; | 254 | bool listHidden; |
254 | cfg.setGroup("Menubar"); | 255 | cfg.setGroup("Menubar"); |
255 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { | 256 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { |
256 | editCommandListMenu->insertItem("Show command list"); | 257 | editCommandListMenu->insertItem("Show command list"); |
257 | listHidden=TRUE; | 258 | listHidden=TRUE; |
258 | } else { | 259 | } else { |
259 | editCommandListMenu->insertItem("Hide command list"); | 260 | editCommandListMenu->insertItem("Hide command list"); |
260 | listHidden=FALSE; | 261 | listHidden=FALSE; |
261 | } | 262 | } |
262 | 263 | ||
263 | cfg.setGroup("Tabs"); | 264 | cfg.setGroup("Tabs"); |
264 | tmp=cfg.readEntry("Position","Bottom"); | 265 | tmp=cfg.readEntry("Position","Bottom"); |
265 | if(tmp=="Top") { | 266 | if(tmp=="Top") { |
266 | tab->setTabPosition(QTabWidget::Top); | 267 | tab->setTabPosition(QTabWidget::Top); |
267 | configMenu->insertItem("Tabs on Bottom"); | 268 | configMenu->insertItem("Tabs on Bottom"); |
268 | } else { | 269 | } else { |
269 | tab->setTabPosition(QTabWidget::Bottom); | 270 | tab->setTabPosition(QTabWidget::Bottom); |
270 | configMenu->insertItem("Tabs on Top"); | 271 | configMenu->insertItem("Tabs on Top"); |
271 | } | 272 | } |
272 | configMenu->insertSeparator(2); | 273 | configMenu->insertSeparator(2); |
273 | 274 | ||
274 | colorMenu->insertItem("Green on Black"); | 275 | colorMenu->insertItem("Green on Black"); |
275 | colorMenu->insertItem("Black on White"); | 276 | colorMenu->insertItem("Black on White"); |
276 | colorMenu->insertItem("White on Black"); | 277 | colorMenu->insertItem("White on Black"); |
277 | colorMenu->insertItem("Black on Transparent"); | 278 | colorMenu->insertItem("Black on Transparent"); |
278 | colorMenu->insertItem("Black on Red"); | 279 | colorMenu->insertItem("Black on Red"); |
279 | colorMenu->insertItem("Red on Black"); | 280 | colorMenu->insertItem("Red on Black"); |
280 | colorMenu->insertItem("Green on Yellow"); | 281 | colorMenu->insertItem("Green on Yellow"); |
281 | colorMenu->insertItem("Blue on Magenta"); | 282 | colorMenu->insertItem("Blue on Magenta"); |
282 | colorMenu->insertItem("Magenta on Blue"); | 283 | colorMenu->insertItem("Magenta on Blue"); |
283 | colorMenu->insertItem("Cyan on White"); | 284 | colorMenu->insertItem("Cyan on White"); |
284 | colorMenu->insertItem("White on Cyan"); | 285 | colorMenu->insertItem("White on Cyan"); |
285 | colorMenu->insertItem("Blue on Black"); | 286 | colorMenu->insertItem("Blue on Black"); |
286 | colorMenu->insertItem("Amber on Black"); | 287 | colorMenu->insertItem("Amber on Black"); |
287 | configMenu->insertItem("Colors",colorMenu); | 288 | configMenu->insertItem("Colors",colorMenu); |
288 | 289 | ||
289 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 290 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
290 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 291 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
291 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); | 292 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); |
292 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 293 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
293 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 294 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
294 | menuBar->insertItem( tr("Font"), fontList ); | 295 | menuBar->insertItem( tr("Font"), fontList ); |
295 | menuBar->insertItem( tr("Options"), configMenu ); | 296 | menuBar->insertItem( tr("Options"), configMenu ); |
296 | 297 | ||
297 | QPEToolBar *toolbar = new QPEToolBar( this ); | 298 | QPEToolBar *toolbar = new QPEToolBar( this ); |
298 | 299 | ||
299 | QAction *a; | 300 | QAction *a; |
300 | 301 | ||
301 | // Button Commands | 302 | // Button Commands |
302 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); | 303 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); |
303 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); | 304 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); |
304 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 305 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
305 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); | 306 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); |
306 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 307 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
307 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); | 308 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); |
308 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 309 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
309 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); | 310 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); |
310 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 311 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
311 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 312 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
312 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 313 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
313 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 314 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
314 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 315 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
315 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); | 316 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); |
316 | /* | 317 | /* |
317 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); | 318 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); |
318 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 319 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
319 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); | 320 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); |
320 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 321 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
321 | */ | 322 | */ |
322 | 323 | ||
323 | secondToolBar = new QPEToolBar( this ); | 324 | secondToolBar = new QPEToolBar( this ); |
324 | secondToolBar->setHorizontalStretchable( TRUE ); | 325 | secondToolBar->setHorizontalStretchable( TRUE ); |
325 | 326 | ||
326 | commonCombo = new QComboBox( secondToolBar ); | 327 | commonCombo = new QComboBox( secondToolBar ); |
327 | commonCombo->setMaximumWidth(236); | 328 | commonCombo->setMaximumWidth(236); |
328 | 329 | ||
329 | editCommandListMenu->insertItem( "Quick Edit"); | 330 | editCommandListMenu->insertItem( "Quick Edit"); |
330 | if( listHidden) { | 331 | if( listHidden) { |
331 | secondToolBar->hide(); | 332 | secondToolBar->hide(); |
332 | editCommandListMenu->setItemEnabled(-22 ,FALSE); | 333 | editCommandListMenu->setItemEnabled(-22 ,FALSE); |
333 | } | 334 | } |
334 | editCommandListMenu->insertItem( "Edit"); | 335 | editCommandListMenu->insertItem( "Edit"); |
335 | 336 | ||
336 | cfg.setGroup("Commands"); | 337 | cfg.setGroup("Commands"); |
337 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 338 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
338 | 339 | ||
339 | initCommandList(); | 340 | initCommandList(); |
340 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 341 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
341 | // commonCombo->insertItem( commonCmds[i], i ); | 342 | // commonCombo->insertItem( commonCmds[i], i ); |
342 | // tmp = cfg.readEntry( QString::number(i),""); | 343 | // tmp = cfg.readEntry( QString::number(i),""); |
343 | // if(tmp != "") | 344 | // if(tmp != "") |
344 | // commonCombo->changeItem( tmp,i ); | 345 | // commonCombo->changeItem( tmp,i ); |
345 | // } | 346 | // } |
346 | 347 | ||
347 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 348 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
348 | 349 | ||
349 | scrollMenu->insertItem("None"); | 350 | scrollMenu->insertItem("None"); |
350 | scrollMenu->insertItem("Left"); | 351 | scrollMenu->insertItem("Left"); |
351 | scrollMenu->insertItem("Right"); | 352 | scrollMenu->insertItem("Right"); |
352 | configMenu->insertItem("ScrollBar",scrollMenu); | 353 | configMenu->insertItem("ScrollBar",scrollMenu); |
353 | 354 | ||
354 | // create applications ///////////////////////////////////////////////////// | 355 | // create applications ///////////////////////////////////////////////////// |
355 | setCentralWidget(tab); | 356 | setCentralWidget(tab); |
356 | 357 | ||
357 | // load keymaps //////////////////////////////////////////////////////////// | 358 | // load keymaps //////////////////////////////////////////////////////////// |
358 | KeyTrans::loadAll(); | 359 | KeyTrans::loadAll(); |
359 | for (int i = 0; i < KeyTrans::count(); i++) | 360 | for (int i = 0; i < KeyTrans::count(); i++) |
360 | { KeyTrans* s = KeyTrans::find(i); | 361 | { KeyTrans* s = KeyTrans::find(i); |
361 | assert( s ); | 362 | assert( s ); |
362 | } | 363 | } |
363 | 364 | ||
364 | se_pgm = _pgm; | 365 | se_pgm = _pgm; |
365 | se_args = _args; | 366 | se_args = _args; |
366 | 367 | ||
368 | parseCommandLine(); | ||
367 | // read and apply default values /////////////////////////////////////////// | 369 | // read and apply default values /////////////////////////////////////////// |
368 | resize(321, 321); // Dummy. | 370 | resize(321, 321); // Dummy. |
369 | QSize currentSize = size(); | 371 | QSize currentSize = size(); |
370 | if (currentSize != size()) | 372 | if (currentSize != size()) |
371 | defaultSize = size(); | 373 | defaultSize = size(); |
372 | |||
373 | } | 374 | } |
374 | 375 | ||
375 | void Konsole::show() | 376 | void Konsole::show() |
376 | { | 377 | { |
377 | if ( !nsessions ) { | 378 | if ( !nsessions ) { |
378 | newSession(); | 379 | newSession(); |
379 | } | 380 | } |
380 | QMainWindow::show(); | 381 | QMainWindow::show(); |
381 | } | 382 | } |
382 | 383 | ||
383 | void Konsole::initSession(const char*, QStrList &) | 384 | void Konsole::initSession(const char*, QStrList &) |
384 | { | 385 | { |
385 | QMainWindow::show(); | 386 | QMainWindow::show(); |
386 | } | 387 | } |
387 | 388 | ||
388 | Konsole::~Konsole() | 389 | Konsole::~Konsole() |
389 | { | 390 | { |
390 | while (nsessions > 0) { | 391 | while (nsessions > 0) { |
391 | doneSession(getTe()->currentSession, 0); | 392 | doneSession(getTe()->currentSession, 0); |
392 | } | 393 | } |
393 | 394 | ||
394 | Config cfg("Konsole"); | 395 | Config cfg("Konsole"); |
395 | cfg.setGroup("Konsole"); | 396 | cfg.setGroup("Konsole"); |
396 | cfg.writeEntry("FontID", cfont); | 397 | cfg.writeEntry("FontID", cfont); |
397 | } | 398 | } |
398 | 399 | ||
399 | void Konsole::fontChanged(int f) | 400 | void Konsole::fontChanged(int f) |
400 | { | 401 | { |
401 | VTFont* font = fonts.at(f); | 402 | VTFont* font = fonts.at(f); |
402 | if (font != 0) { | 403 | if (font != 0) { |
403 | for(uint i = 0; i < fonts.count(); i++) { | 404 | for(uint i = 0; i < fonts.count(); i++) { |
404 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); | 405 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); |
405 | } | 406 | } |
406 | 407 | ||
407 | cfont = f; | 408 | cfont = f; |
408 | 409 | ||
409 | TEWidget* te = getTe(); | 410 | TEWidget* te = getTe(); |
410 | if (te != 0) { | 411 | if (te != 0) { |
411 | te->setVTFont(font->getFont()); | 412 | te->setVTFont(font->getFont()); |
412 | } | 413 | } |
413 | } | 414 | } |
414 | } | 415 | } |
415 | 416 | ||
416 | 417 | ||
417 | void Konsole::enterCommand(int c) | 418 | void Konsole::enterCommand(int c) |
418 | { | 419 | { |
419 | TEWidget* te = getTe(); | 420 | TEWidget* te = getTe(); |
420 | if (te != 0) { | 421 | if (te != 0) { |
421 | if(!commonCombo->editable()) { | 422 | if(!commonCombo->editable()) { |
422 | QString text = commonCombo->text(c); //commonCmds[c]; | 423 | QString text = commonCombo->text(c); //commonCmds[c]; |
423 | te->emitText(text); | 424 | te->emitText(text); |
424 | } else { | 425 | } else { |
425 | changeCommand( commonCombo->text(c), c); | 426 | changeCommand( commonCombo->text(c), c); |
426 | } | 427 | } |
427 | } | 428 | } |
428 | } | 429 | } |
429 | 430 | ||
430 | void Konsole::hitEnter() | 431 | void Konsole::hitEnter() |
431 | { | 432 | { |
432 | TEWidget* te = getTe(); | 433 | TEWidget* te = getTe(); |
433 | if (te != 0) { | 434 | if (te != 0) { |
434 | te->emitText(QString("\r")); | 435 | te->emitText(QString("\r")); |
435 | } | 436 | } |
436 | } | 437 | } |
437 | 438 | ||
438 | void Konsole::hitSpace() | 439 | void Konsole::hitSpace() |
439 | { | 440 | { |
440 | TEWidget* te = getTe(); | 441 | TEWidget* te = getTe(); |
441 | if (te != 0) { | 442 | if (te != 0) { |
442 | te->emitText(QString(" ")); | 443 | te->emitText(QString(" ")); |
443 | } | 444 | } |
444 | } | 445 | } |
445 | 446 | ||
446 | void Konsole::hitTab() | 447 | void Konsole::hitTab() |
447 | { | 448 | { |
448 | TEWidget* te = getTe(); | 449 | TEWidget* te = getTe(); |
449 | if (te != 0) { | 450 | if (te != 0) { |
450 | te->emitText(QString("\t")); | 451 | te->emitText(QString("\t")); |
451 | } | 452 | } |
452 | } | 453 | } |
453 | 454 | ||
454 | void Konsole::hitPaste() | 455 | void Konsole::hitPaste() |
455 | { | 456 | { |
456 | TEWidget* te = getTe(); | 457 | TEWidget* te = getTe(); |
457 | if (te != 0) { | 458 | if (te != 0) { |
458 | te->pasteClipboard(); | 459 | te->pasteClipboard(); |
459 | } | 460 | } |
460 | } | 461 | } |
461 | 462 | ||
462 | void Konsole::hitUp() | 463 | void Konsole::hitUp() |
463 | { | 464 | { |
464 | TEWidget* te = getTe(); | 465 | TEWidget* te = getTe(); |
465 | if (te != 0) { | 466 | if (te != 0) { |
466 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); | 467 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); |
467 | QApplication::sendEvent( te, &ke ); | 468 | QApplication::sendEvent( te, &ke ); |
468 | } | 469 | } |
469 | } | 470 | } |
470 | 471 | ||
471 | void Konsole::hitDown() | 472 | void Konsole::hitDown() |
472 | { | 473 | { |
473 | TEWidget* te = getTe(); | 474 | TEWidget* te = getTe(); |
474 | if (te != 0) { | 475 | if (te != 0) { |
475 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); | 476 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); |
476 | QApplication::sendEvent( te, &ke ); | 477 | QApplication::sendEvent( te, &ke ); |
477 | } | 478 | } |
478 | } | 479 | } |
479 | 480 | ||
480 | /** | 481 | /** |
481 | This function calculates the size of the external widget | 482 | This function calculates the size of the external widget |
482 | needed for the internal widget to be | 483 | needed for the internal widget to be |
483 | */ | 484 | */ |
484 | QSize Konsole::calcSize(int columns, int lines) { | 485 | QSize Konsole::calcSize(int columns, int lines) { |
485 | TEWidget* te = getTe(); | 486 | TEWidget* te = getTe(); |
486 | if (te != 0) { | 487 | if (te != 0) { |
487 | QSize size = te->calcSize(columns, lines); | 488 | QSize size = te->calcSize(columns, lines); |
488 | return size; | 489 | return size; |
489 | } else { | 490 | } else { |
490 | QSize size; | 491 | QSize size; |
491 | return size; | 492 | return size; |
492 | } | 493 | } |
493 | } | 494 | } |
494 | 495 | ||
495 | /** | 496 | /** |
496 | sets application window to a size based on columns X lines of the te | 497 | sets application window to a size based on columns X lines of the te |
497 | guest widget. Call with (0,0) for setting default size. | 498 | guest widget. Call with (0,0) for setting default size. |
498 | */ | 499 | */ |
499 | 500 | ||
500 | void Konsole::setColLin(int columns, int lines) | 501 | void Konsole::setColLin(int columns, int lines) |
501 | { | 502 | { |
502 | if ((columns==0) || (lines==0)) | 503 | if ((columns==0) || (lines==0)) |
503 | { | 504 | { |
504 | if (defaultSize.isEmpty()) // not in config file : set default value | 505 | if (defaultSize.isEmpty()) // not in config file : set default value |
505 | { | 506 | { |
506 | defaultSize = calcSize(80,24); | 507 | defaultSize = calcSize(80,24); |
507 | // notifySize(24,80); // set menu items (strange arg order !) | 508 | // notifySize(24,80); // set menu items (strange arg order !) |
508 | } | 509 | } |
509 | resize(defaultSize); | 510 | resize(defaultSize); |
510 | } else { | 511 | } else { |
511 | resize(calcSize(columns, lines)); | 512 | resize(calcSize(columns, lines)); |
512 | // notifySize(lines,columns); // set menu items (strange arg order !) | 513 | // notifySize(lines,columns); // set menu items (strange arg order !) |
513 | } | 514 | } |
514 | } | 515 | } |
515 | 516 | ||
516 | /* | 517 | /* |
517 | void Konsole::setFont(int fontno) | 518 | void Konsole::setFont(int fontno) |
518 | { | 519 | { |
519 | QFont f; | 520 | QFont f; |
520 | if (fontno == 0) | 521 | if (fontno == 0) |
521 | f = defaultFont = QFont( "Helvetica", 12 ); | 522 | f = defaultFont = QFont( "Helvetica", 12 ); |
522 | else | 523 | else |
523 | if (fonts[fontno][0] == '-') | 524 | if (fonts[fontno][0] == '-') |
524 | f.setRawName( fonts[fontno] ); | 525 | f.setRawName( fonts[fontno] ); |
525 | else | 526 | else |
526 | { | 527 | { |
527 | f.setFamily(fonts[fontno]); | 528 | f.setFamily(fonts[fontno]); |
528 | f.setRawMode( TRUE ); | 529 | f.setRawMode( TRUE ); |
529 | } | 530 | } |
530 | if ( !f.exactMatch() && fontno != 0) | 531 | if ( !f.exactMatch() && fontno != 0) |
531 | { | 532 | { |
532 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); | 533 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); |
533 | QMessageBox(this, msg); | 534 | QMessageBox(this, msg); |
534 | return; | 535 | return; |
535 | } | 536 | } |
536 | if (se) se->setFontNo(fontno); | 537 | if (se) se->setFontNo(fontno); |
537 | te->setVTFont(f); | 538 | te->setVTFont(f); |
538 | n_font = fontno; | 539 | n_font = fontno; |
539 | } | 540 | } |
540 | */ | 541 | */ |
541 | 542 | ||
542 | // --| color selection |------------------------------------------------------- | 543 | // --| color selection |------------------------------------------------------- |
543 | 544 | ||
544 | void Konsole::changeColumns(int columns) | 545 | void Konsole::changeColumns(int columns) |
545 | { | 546 | { |
546 | TEWidget* te = getTe(); | 547 | TEWidget* te = getTe(); |
547 | if (te != 0) { | 548 | if (te != 0) { |
548 | setColLin(columns,te->Lines()); | 549 | setColLin(columns,te->Lines()); |
549 | te->update(); | 550 | te->update(); |
550 | } | 551 | } |
551 | } | 552 | } |
552 | 553 | ||
553 | //FIXME: If a child dies during session swap, | 554 | //FIXME: If a child dies during session swap, |
554 | // this routine might be called before | 555 | // this routine might be called before |
555 | // session swap is completed. | 556 | // session swap is completed. |
556 | 557 | ||
557 | void Konsole::doneSession(TESession*, int ) | 558 | void Konsole::doneSession(TESession*, int ) |
558 | { | 559 | { |
559 | TEWidget *te = getTe(); | 560 | TEWidget *te = getTe(); |
560 | if (te != 0) { | 561 | if (te != 0) { |
561 | te->currentSession->setConnect(FALSE); | 562 | te->currentSession->setConnect(FALSE); |
562 | tab->removeTab(te); | 563 | tab->removeTab(te); |
563 | delete te->currentSession; | 564 | delete te->currentSession; |
564 | delete te; | 565 | delete te; |
565 | nsessions--; | 566 | nsessions--; |
566 | } | 567 | } |
567 | 568 | ||
568 | if (nsessions == 0) { | 569 | if (nsessions == 0) { |
569 | close(); | 570 | close(); |
570 | } | 571 | } |
571 | } | 572 | } |
572 | 573 | ||
573 | void Konsole::newSession() { | 574 | void Konsole::newSession() { |
574 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? | 575 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? |
575 | TEWidget* te = new TEWidget(tab); | 576 | TEWidget* te = new TEWidget(tab); |
576 | // te->setBackgroundMode(PaletteBase); //we want transparent!! | 577 | // te->setBackgroundMode(PaletteBase); //we want transparent!! |
577 | te->setVTFont(fonts.at(cfont)->getFont()); | 578 | te->setVTFont(fonts.at(cfont)->getFont()); |
578 | tab->addTab(te); | 579 | tab->addTab(te); |
579 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); | 580 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); |
580 | te->currentSession = se; | 581 | te->currentSession = se; |
581 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); | 582 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); |
582 | se->run(); | 583 | se->run(); |
583 | se->setConnect(TRUE); | 584 | se->setConnect(TRUE); |
584 | se->setHistory(b_scroll); | 585 | se->setHistory(b_scroll); |
585 | tab->setCurrentPage(nsessions); | 586 | tab->setCurrentPage(nsessions); |
586 | nsessions++; | 587 | nsessions++; |
587 | setColor(); | 588 | setColor(); |
588 | } | 589 | } |
589 | } | 590 | } |
590 | 591 | ||
591 | TEWidget* Konsole::getTe() { | 592 | TEWidget* Konsole::getTe() { |
592 | if (nsessions) { | 593 | if (nsessions) { |
593 | return (TEWidget *) tab->currentPage(); | 594 | return (TEWidget *) tab->currentPage(); |
594 | } else { | 595 | } else { |
595 | return 0; | 596 | return 0; |
596 | } | 597 | } |
597 | } | 598 | } |
598 | 599 | ||
599 | void Konsole::switchSession(QWidget* w) { | 600 | void Konsole::switchSession(QWidget* w) { |
600 | TEWidget* te = (TEWidget *) w; | 601 | TEWidget* te = (TEWidget *) w; |
601 | 602 | ||
602 | QFont teFnt = te->getVTFont(); | 603 | QFont teFnt = te->getVTFont(); |
603 | for(uint i = 0; i < fonts.count(); i++) { | 604 | for(uint i = 0; i < fonts.count(); i++) { |
604 | VTFont *fnt = fonts.at(i); | 605 | VTFont *fnt = fonts.at(i); |
605 | bool cf = fnt->getFont() == teFnt; | 606 | bool cf = fnt->getFont() == teFnt; |
606 | fontList->setItemChecked(i, cf); | 607 | fontList->setItemChecked(i, cf); |
607 | if (cf) { | 608 | if (cf) { |
608 | cfont = i; | 609 | cfont = i; |
609 | } | 610 | } |
610 | } | 611 | } |
611 | } | 612 | } |
612 | 613 | ||
613 | /// ------------------------------- some new stuff by L.J. Potter | 614 | /// ------------------------------- some new stuff by L.J. Potter |
614 | void Konsole::colorMenuSelected(int iD) | 615 | void Konsole::colorMenuSelected(int iD) |
615 | { // this is NOT pretty, elegant or anything else besides functional | 616 | { // this is NOT pretty, elegant or anything else besides functional |
616 | // QString temp; | 617 | // QString temp; |
617 | // qDebug( temp.sprintf("colormenu %d", iD)); | 618 | // qDebug( temp.sprintf("colormenu %d", iD)); |
618 | TEWidget* te = getTe(); | 619 | TEWidget* te = getTe(); |
619 | Config cfg("Konsole"); | 620 | Config cfg("Konsole"); |
620 | cfg.setGroup("Colors"); | 621 | cfg.setGroup("Colors"); |
621 | QColor foreground; | 622 | QColor foreground; |
622 | QColor background; | 623 | QColor background; |
623 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); | 624 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); |
624 | ColorEntry m_table[TABLE_COLORS]; | 625 | ColorEntry m_table[TABLE_COLORS]; |
625 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 626 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
626 | /////////// fore back | 627 | /////////// fore back |
627 | int i; | 628 | int i; |
628 | if(iD==-9) { // default default | 629 | if(iD==-9) { // default default |
629 | for (i = 0; i < TABLE_COLORS; i++) { | 630 | for (i = 0; i < TABLE_COLORS; i++) { |
630 | m_table[i].color = defaultCt[i].color; | 631 | m_table[i].color = defaultCt[i].color; |
631 | if(i==1 || i == 11) | 632 | if(i==1 || i == 11) |
632 | m_table[i].transparent=1; | 633 | m_table[i].transparent=1; |
633 | cfg.writeEntry("Schema","98"); | 634 | cfg.writeEntry("Schema","98"); |
634 | colorMenu->setItemChecked(-9,TRUE); | 635 | colorMenu->setItemChecked(-9,TRUE); |
635 | } | 636 | } |
636 | } else { | 637 | } else { |
637 | if(iD==-6) { // green black | 638 | if(iD==-6) { // green black |
638 | foreground.setRgb(0x18,255,0x18); | 639 | foreground.setRgb(0x18,255,0x18); |
639 | background.setRgb(0x00,0x00,0x00); | 640 | background.setRgb(0x00,0x00,0x00); |
640 | cfg.writeEntry("Schema","6"); | 641 | cfg.writeEntry("Schema","6"); |
641 | colorMenu->setItemChecked(-6,TRUE); | 642 | colorMenu->setItemChecked(-6,TRUE); |
642 | } | 643 | } |
643 | if(iD==-7) { // black white | 644 | if(iD==-7) { // black white |
644 | foreground.setRgb(0x00,0x00,0x00); | 645 | foreground.setRgb(0x00,0x00,0x00); |
645 | background.setRgb(0xFF,0xFF,0xFF); | 646 | background.setRgb(0xFF,0xFF,0xFF); |
646 | cfg.writeEntry("Schema","7"); | 647 | cfg.writeEntry("Schema","7"); |
647 | colorMenu->setItemChecked(-7,TRUE); | 648 | colorMenu->setItemChecked(-7,TRUE); |
648 | } | 649 | } |
649 | if(iD==-8) { // white black | 650 | if(iD==-8) { // white black |
650 | foreground.setRgb(0xFF,0xFF,0xFF); | 651 | foreground.setRgb(0xFF,0xFF,0xFF); |
651 | background.setRgb(0x00,0x00,0x00); | 652 | background.setRgb(0x00,0x00,0x00); |
652 | cfg.writeEntry("Schema","8"); | 653 | cfg.writeEntry("Schema","8"); |
653 | colorMenu->setItemChecked(-8,TRUE); | 654 | colorMenu->setItemChecked(-8,TRUE); |
654 | } | 655 | } |
655 | if(iD==-10) {// Black, Red | 656 | if(iD==-10) {// Black, Red |
656 | foreground.setRgb(0x00,0x00,0x00); | 657 | foreground.setRgb(0x00,0x00,0x00); |
657 | background.setRgb(0xB2,0x18,0x18); | 658 | background.setRgb(0xB2,0x18,0x18); |
658 | cfg.writeEntry("Schema","10"); | 659 | cfg.writeEntry("Schema","10"); |
659 | colorMenu->setItemChecked(-10,TRUE); | 660 | colorMenu->setItemChecked(-10,TRUE); |
660 | } | 661 | } |
661 | if(iD==-11) {// Red, Black | 662 | if(iD==-11) {// Red, Black |
662 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 | 663 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 |
663 | background.setRgb(0x00,0x00,0x00); | 664 | background.setRgb(0x00,0x00,0x00); |
664 | cfg.writeEntry("Schema","11"); | 665 | cfg.writeEntry("Schema","11"); |
665 | colorMenu->setItemChecked(-11,TRUE); | 666 | colorMenu->setItemChecked(-11,TRUE); |
666 | } | 667 | } |
667 | if(iD==-12) {// Green, Yellow - is ugly | 668 | if(iD==-12) {// Green, Yellow - is ugly |
668 | // foreground.setRgb(0x18,0xB2,0x18); | 669 | // foreground.setRgb(0x18,0xB2,0x18); |
669 | foreground.setRgb(36,139,10); | 670 | foreground.setRgb(36,139,10); |
670 | // background.setRgb(0xB2,0x68,0x18); | 671 | // background.setRgb(0xB2,0x68,0x18); |
671 | background.setRgb(255,255,0); | 672 | background.setRgb(255,255,0); |
672 | cfg.writeEntry("Schema","12"); | 673 | cfg.writeEntry("Schema","12"); |
673 | colorMenu->setItemChecked(-12,TRUE); | 674 | colorMenu->setItemChecked(-12,TRUE); |
674 | } | 675 | } |
675 | if(iD==-13) {// Blue, Magenta | 676 | if(iD==-13) {// Blue, Magenta |
676 | foreground.setRgb(0x18,0xB2,0xB2); | 677 | foreground.setRgb(0x18,0xB2,0xB2); |
677 | background.setRgb(0x18,0x18,0xB2); | 678 | background.setRgb(0x18,0x18,0xB2); |
678 | cfg.writeEntry("Schema","13"); | 679 | cfg.writeEntry("Schema","13"); |
679 | colorMenu->setItemChecked(-13,TRUE); | 680 | colorMenu->setItemChecked(-13,TRUE); |
680 | } | 681 | } |
681 | if(iD==-14) {// Magenta, Blue | 682 | if(iD==-14) {// Magenta, Blue |
682 | foreground.setRgb(0x18,0x18,0xB2); | 683 | foreground.setRgb(0x18,0x18,0xB2); |
683 | background.setRgb(0x18,0xB2,0xB2); | 684 | background.setRgb(0x18,0xB2,0xB2); |
684 | cfg.writeEntry("Schema","14"); | 685 | cfg.writeEntry("Schema","14"); |
685 | colorMenu->setItemChecked(-14,TRUE); | 686 | colorMenu->setItemChecked(-14,TRUE); |
686 | } | 687 | } |
687 | if(iD==-15) {// Cyan, White | 688 | if(iD==-15) {// Cyan, White |
688 | foreground.setRgb(0x18,0xB2,0xB2); | 689 | foreground.setRgb(0x18,0xB2,0xB2); |
689 | background.setRgb(0xFF,0xFF,0xFF); | 690 | background.setRgb(0xFF,0xFF,0xFF); |
690 | cfg.writeEntry("Schema","15"); | 691 | cfg.writeEntry("Schema","15"); |
691 | colorMenu->setItemChecked(-15,TRUE); | 692 | colorMenu->setItemChecked(-15,TRUE); |
692 | } | 693 | } |
693 | if(iD==-16) {// White, Cyan | 694 | if(iD==-16) {// White, Cyan |
694 | background.setRgb(0x18,0xB2,0xB2); | 695 | background.setRgb(0x18,0xB2,0xB2); |
695 | foreground.setRgb(0xFF,0xFF,0xFF); | 696 | foreground.setRgb(0xFF,0xFF,0xFF); |
696 | cfg.writeEntry("Schema","16"); | 697 | cfg.writeEntry("Schema","16"); |
697 | colorMenu->setItemChecked(-16,TRUE); | 698 | colorMenu->setItemChecked(-16,TRUE); |
698 | } | 699 | } |
699 | if(iD==-17) {// Black, Blue | 700 | if(iD==-17) {// Black, Blue |
700 | background.setRgb(0x00,0x00,0x00); | 701 | background.setRgb(0x00,0x00,0x00); |
701 | foreground.setRgb(0x18,0xB2,0xB2); | 702 | foreground.setRgb(0x18,0xB2,0xB2); |
702 | cfg.writeEntry("Schema","17"); | 703 | cfg.writeEntry("Schema","17"); |
703 | colorMenu->setItemChecked(-17,TRUE); | 704 | colorMenu->setItemChecked(-17,TRUE); |
704 | } | 705 | } |
705 | if(iD==-18) {// Black, Gold | 706 | if(iD==-18) {// Black, Gold |
706 | background.setRgb(0x00,0x00,0x00); | 707 | background.setRgb(0x00,0x00,0x00); |
707 | foreground.setRgb(255,215,0); | 708 | foreground.setRgb(255,215,0); |
708 | cfg.writeEntry("Schema","18"); | 709 | cfg.writeEntry("Schema","18"); |
709 | colorMenu->setItemChecked(-18,TRUE); | 710 | colorMenu->setItemChecked(-18,TRUE); |
710 | } | 711 | } |
711 | 712 | ||
712 | for (i = 0; i < TABLE_COLORS; i++) { | 713 | for (i = 0; i < TABLE_COLORS; i++) { |
713 | if(i==0 || i == 10) { | 714 | if(i==0 || i == 10) { |
714 | m_table[i].color = foreground; | 715 | m_table[i].color = foreground; |
715 | } | 716 | } |
716 | else if(i==1 || i == 11) { | 717 | else if(i==1 || i == 11) { |
717 | m_table[i].color = background; m_table[i].transparent=0; | 718 | m_table[i].color = background; m_table[i].transparent=0; |
718 | } | 719 | } |
719 | else | 720 | else |
720 | m_table[i].color = defaultCt[i].color; | 721 | m_table[i].color = defaultCt[i].color; |
721 | } | 722 | } |
722 | } | 723 | } |
723 | lastSelectedMenu = iD; | 724 | lastSelectedMenu = iD; |
724 | te->setColorTable(m_table); | 725 | te->setColorTable(m_table); |
725 | update(); | 726 | update(); |
726 | } | 727 | } |
727 | 728 | ||
728 | void Konsole::configMenuSelected(int iD) | 729 | void Konsole::configMenuSelected(int iD) |
729 | { | 730 | { |
730 | // QString temp; | 731 | // QString temp; |
731 | // qDebug( temp.sprintf("configmenu %d",iD)); | 732 | // qDebug( temp.sprintf("configmenu %d",iD)); |
732 | TEWidget* te = getTe(); | 733 | TEWidget* te = getTe(); |
733 | Config cfg("Konsole"); | 734 | Config cfg("Konsole"); |
734 | cfg.setGroup("Menubar"); | 735 | cfg.setGroup("Menubar"); |
735 | if( iD == -4) { | 736 | if( iD == -4) { |
736 | cfg.setGroup("Tabs"); | 737 | cfg.setGroup("Tabs"); |
737 | QString tmp=cfg.readEntry("Position","Bottom"); | 738 | QString tmp=cfg.readEntry("Position","Bottom"); |
738 | 739 | ||
739 | if(tmp=="Top") { | 740 | if(tmp=="Top") { |
740 | tab->setTabPosition(QTabWidget::Bottom); | 741 | tab->setTabPosition(QTabWidget::Bottom); |
741 | configMenu->changeItem( iD,"Tabs on Top"); | 742 | configMenu->changeItem( iD,"Tabs on Top"); |
742 | cfg.writeEntry("Position","Bottom"); | 743 | cfg.writeEntry("Position","Bottom"); |
743 | } else { | 744 | } else { |
744 | tab->setTabPosition(QTabWidget::Top); | 745 | tab->setTabPosition(QTabWidget::Top); |
745 | configMenu->changeItem( iD,"Tabs on Bottom"); | 746 | configMenu->changeItem( iD,"Tabs on Bottom"); |
746 | cfg.writeEntry("Position","Top"); | 747 | cfg.writeEntry("Position","Top"); |
747 | } | 748 | } |
748 | } | 749 | } |
749 | } | 750 | } |
750 | 751 | ||
751 | void Konsole::changeCommand(const QString &text, int c) | 752 | void Konsole::changeCommand(const QString &text, int c) |
752 | { | 753 | { |
753 | Config cfg("Konsole"); | 754 | Config cfg("Konsole"); |
754 | cfg.setGroup("Commands"); | 755 | cfg.setGroup("Commands"); |
755 | if(commonCmds[c] != text) { | 756 | if(commonCmds[c] != text) { |
756 | cfg.writeEntry(QString::number(c),text); | 757 | cfg.writeEntry(QString::number(c),text); |
757 | commonCombo->clearEdit(); | 758 | commonCombo->clearEdit(); |
758 | commonCombo->setCurrentItem(c); | 759 | commonCombo->setCurrentItem(c); |
759 | } | 760 | } |
760 | } | 761 | } |
761 | 762 | ||
762 | void Konsole::setColor() | 763 | void Konsole::setColor() |
763 | { | 764 | { |
764 | Config cfg("Konsole"); | 765 | Config cfg("Konsole"); |
765 | cfg.setGroup("Colors"); | 766 | cfg.setGroup("Colors"); |
766 | int scheme = cfg.readNumEntry("Schema",1); | 767 | int scheme = cfg.readNumEntry("Schema",1); |
767 | if(scheme != 1) colorMenuSelected( -scheme); | 768 | if(scheme != 1) colorMenuSelected( -scheme); |
768 | } | 769 | } |
769 | 770 | ||
770 | void Konsole::scrollMenuSelected(int index) | 771 | void Konsole::scrollMenuSelected(int index) |
771 | { | 772 | { |
772 | // QString temp; | 773 | // QString temp; |
773 | // qDebug( temp.sprintf("scrollbar menu %d",index)); | 774 | // qDebug( temp.sprintf("scrollbar menu %d",index)); |
774 | TEWidget* te = getTe(); | 775 | TEWidget* te = getTe(); |
775 | Config cfg("Konsole"); | 776 | Config cfg("Konsole"); |
776 | cfg.setGroup("Scrollbar"); | 777 | cfg.setGroup("Scrollbar"); |
777 | switch( index){ | 778 | switch( index){ |
778 | case -24: | 779 | case -24: |
779 | te->setScrollbarLocation(0); | 780 | te->setScrollbarLocation(0); |
780 | cfg.writeEntry("Position",0); | 781 | cfg.writeEntry("Position",0); |
781 | break; | 782 | break; |
782 | case -25: | 783 | case -25: |
783 | te->setScrollbarLocation(1); | 784 | te->setScrollbarLocation(1); |
784 | cfg.writeEntry("Position",1); | 785 | cfg.writeEntry("Position",1); |
785 | break; | 786 | break; |
786 | case -26: | 787 | case -26: |
787 | te->setScrollbarLocation(2); | 788 | te->setScrollbarLocation(2); |
788 | cfg.writeEntry("Position",2); | 789 | cfg.writeEntry("Position",2); |
789 | break; | 790 | break; |
790 | }; | 791 | }; |
791 | 792 | ||
792 | } | 793 | } |
793 | 794 | ||
794 | void Konsole::editCommandListMenuSelected(int iD) | 795 | void Konsole::editCommandListMenuSelected(int iD) |
795 | { | 796 | { |
796 | // QString temp; | 797 | // QString temp; |
797 | // qDebug( temp.sprintf("edit command list %d",iD)); | 798 | // qDebug( temp.sprintf("edit command list %d",iD)); |
798 | TEWidget* te = getTe(); | 799 | TEWidget* te = getTe(); |
799 | Config cfg("Konsole"); | 800 | Config cfg("Konsole"); |
800 | cfg.setGroup("Menubar"); | 801 | cfg.setGroup("Menubar"); |
801 | if( iD == -3) { | 802 | if( iD == -3) { |
802 | if(!secondToolBar->isHidden()) { | 803 | if(!secondToolBar->isHidden()) { |
803 | secondToolBar->hide(); | 804 | secondToolBar->hide(); |
804 | configMenu->changeItem( iD,"Show Command List"); | 805 | configMenu->changeItem( iD,"Show Command List"); |
805 | cfg.writeEntry("Hidden","TRUE"); | 806 | cfg.writeEntry("Hidden","TRUE"); |
806 | configMenu->setItemEnabled(-22 ,FALSE); | 807 | configMenu->setItemEnabled(-22 ,FALSE); |
807 | } else { | 808 | } else { |
808 | secondToolBar->show(); | 809 | secondToolBar->show(); |
809 | configMenu->changeItem( iD,"Hide Command List"); | 810 | configMenu->changeItem( iD,"Hide Command List"); |
810 | cfg.writeEntry("Hidden","FALSE"); | 811 | cfg.writeEntry("Hidden","FALSE"); |
811 | configMenu->setItemEnabled(-22 ,TRUE); | 812 | configMenu->setItemEnabled(-22 ,TRUE); |
812 | 813 | ||
813 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { | 814 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { |
814 | configMenu->setItemChecked(-22,TRUE); | 815 | configMenu->setItemChecked(-22,TRUE); |
815 | commonCombo->setEditable( TRUE ); | 816 | commonCombo->setEditable( TRUE ); |
816 | } else { | 817 | } else { |
817 | configMenu->setItemChecked(-22,FALSE); | 818 | configMenu->setItemChecked(-22,FALSE); |
818 | commonCombo->setEditable( FALSE ); | 819 | commonCombo->setEditable( FALSE ); |
819 | } | 820 | } |
820 | } | 821 | } |
821 | } | 822 | } |
822 | if( iD == -22) { | 823 | if( iD == -22) { |
823 | cfg.setGroup("Commands"); | 824 | cfg.setGroup("Commands"); |
824 | // qDebug("enableCommandEdit"); | 825 | // qDebug("enableCommandEdit"); |
825 | if( !configMenu->isItemChecked(iD) ) { | 826 | if( !configMenu->isItemChecked(iD) ) { |
826 | commonCombo->setEditable( TRUE ); | 827 | commonCombo->setEditable( TRUE ); |
827 | configMenu->setItemChecked(iD,TRUE); | 828 | configMenu->setItemChecked(iD,TRUE); |
828 | commonCombo->setCurrentItem(0); | 829 | commonCombo->setCurrentItem(0); |
829 | cfg.writeEntry("EditEnabled","TRUE"); | 830 | cfg.writeEntry("EditEnabled","TRUE"); |
830 | } else { | 831 | } else { |
831 | commonCombo->setEditable( FALSE ); | 832 | commonCombo->setEditable( FALSE ); |
832 | configMenu->setItemChecked(iD,FALSE); | 833 | configMenu->setItemChecked(iD,FALSE); |
833 | cfg.writeEntry("EditEnabled","FALSE"); | 834 | cfg.writeEntry("EditEnabled","FALSE"); |
834 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 835 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
835 | te->setFocus(); | 836 | te->setFocus(); |
836 | } | 837 | } |
837 | } | 838 | } |
838 | if(iD == -23) { | 839 | if(iD == -23) { |
839 | // "edit commands" | 840 | // "edit commands" |
840 | CommandEditDialog *m = new CommandEditDialog(this); | 841 | CommandEditDialog *m = new CommandEditDialog(this); |
841 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); | 842 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); |
842 | m->showMaximized(); | 843 | m->showMaximized(); |
843 | } | 844 | } |
844 | 845 | ||
845 | } | 846 | } |
847 | |||
848 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' | ||
849 | void Konsole::setDocument( const QString &cmd) { | ||
850 | newSession(); | ||
851 | TEWidget* te = getTe(); | ||
852 | if(cmd.find("-e", 0, TRUE) != -1) { | ||
853 | QString cmd2; | ||
854 | cmd2=cmd.right(cmd.length()-3)+" &"; | ||
855 | system(cmd2.latin1()); | ||
856 | if(startUp <= 1 && nsessions < 2) { | ||
857 | doneSession(getTe()->currentSession, 0); | ||
858 | exit(0); | ||
859 | } else | ||
860 | doneSession(getTe()->currentSession, 0); | ||
861 | } else { | ||
862 | if (te != 0) { | ||
863 | te->emitText(cmd+"\r"); | ||
864 | } | ||
865 | } | ||
866 | startUp++; | ||
867 | } | ||
868 | |||
869 | void Konsole::parseCommandLine() { | ||
870 | QString cmd; | ||
871 | // newSession(); | ||
872 | for (int i=1;i< qApp->argc();i++) { | ||
873 | if( QString(qApp->argv()[i]) == "-e") { | ||
874 | i++; | ||
875 | for ( int j=i;j< qApp->argc();j++) { | ||
876 | cmd+=QString(qApp->argv()[j])+" "; | ||
877 | } | ||
878 | cmd.stripWhiteSpace(); | ||
879 | system(cmd.latin1()); | ||
880 | exit(0);//close(); | ||
881 | } // end -e switch | ||
882 | } | ||
883 | startUp++; | ||
884 | } | ||
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 | |||
@@ -1,134 +1,137 @@ | |||
1 | /* ----------------------------------------------------------------------- */ | 1 | /* ----------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [konsole.h] Konsole */ | 3 | /* [konsole.h] 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 | 21 | ||
22 | #ifndef KONSOLE_H | 22 | #ifndef KONSOLE_H |
23 | #define KONSOLE_H | 23 | #define KONSOLE_H |
24 | 24 | ||
25 | 25 | ||
26 | #include <qmainwindow.h> | 26 | #include <qmainwindow.h> |
27 | #include <qaction.h> | 27 | #include <qaction.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qstrlist.h> | 29 | #include <qstrlist.h> |
30 | #include <qintdict.h> | 30 | #include <qintdict.h> |
31 | #include <qptrdict.h> | 31 | #include <qptrdict.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qpe/qpetoolbar.h> | 33 | #include <qpe/qpetoolbar.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | 35 | ||
36 | #include "MyPty.h" | 36 | #include "MyPty.h" |
37 | #include "TEWidget.h" | 37 | #include "TEWidget.h" |
38 | #include "TEmuVt102.h" | 38 | #include "TEmuVt102.h" |
39 | #include "session.h" | 39 | #include "session.h" |
40 | 40 | ||
41 | class EKNumTabWidget; | 41 | class EKNumTabWidget; |
42 | 42 | ||
43 | class Konsole : public QMainWindow | 43 | class Konsole : public QMainWindow |
44 | { | 44 | { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | 46 | ||
47 | public: | 47 | public: |
48 | 48 | ||
49 | Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 49 | Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); |
50 | Konsole(const char * name, const char* pgm, QStrList & _args, int histon); | 50 | Konsole(const char * name, const char* pgm, QStrList & _args, int histon); |
51 | ~Konsole(); | 51 | ~Konsole(); |
52 | void setColLin(int columns, int lines); | 52 | void setColLin(int columns, int lines); |
53 | QPEToolBar *secondToolBar; | 53 | QPEToolBar *secondToolBar; |
54 | void show(); | 54 | void show(); |
55 | void setColor(); | 55 | void setColor(); |
56 | int lastSelectedMenu; | 56 | int lastSelectedMenu; |
57 | int startUp; | ||
57 | private slots: | 58 | private slots: |
59 | void setDocument(const QString &); | ||
58 | void doneSession(TESession*,int); | 60 | void doneSession(TESession*,int); |
59 | void changeColumns(int); | 61 | void changeColumns(int); |
60 | void fontChanged(int); | 62 | void fontChanged(int); |
61 | void configMenuSelected(int ); | 63 | void configMenuSelected(int ); |
62 | void colorMenuSelected(int); | 64 | void colorMenuSelected(int); |
63 | void enterCommand(int); | 65 | void enterCommand(int); |
64 | void hitEnter(); | 66 | void hitEnter(); |
65 | void hitSpace(); | 67 | void hitSpace(); |
66 | void hitTab(); | 68 | void hitTab(); |
67 | void hitPaste(); | 69 | void hitPaste(); |
68 | void hitUp(); | 70 | void hitUp(); |
69 | void hitDown(); | 71 | void hitDown(); |
70 | void switchSession(QWidget *); | 72 | void switchSession(QWidget *); |
71 | void newSession(); | 73 | void newSession(); |
72 | void changeCommand(const QString &, int); | 74 | void changeCommand(const QString &, int); |
73 | void initCommandList(); | 75 | void initCommandList(); |
74 | void scrollMenuSelected(int); | 76 | void scrollMenuSelected(int); |
75 | void editCommandListMenuSelected(int); | 77 | void editCommandListMenuSelected(int); |
78 | void parseCommandLine(); | ||
76 | private: | 79 | private: |
77 | void init(const char* _pgm, QStrList & _args); | 80 | void init(const char* _pgm, QStrList & _args); |
78 | void initSession(const char* _pgm, QStrList & _args); | 81 | void initSession(const char* _pgm, QStrList & _args); |
79 | void runSession(TESession* s); | 82 | void runSession(TESession* s); |
80 | void setColorPixmaps(); | 83 | void setColorPixmaps(); |
81 | void setHistory(bool); | 84 | void setHistory(bool); |
82 | QSize calcSize(int columns, int lines); | 85 | QSize calcSize(int columns, int lines); |
83 | TEWidget* getTe(); | 86 | TEWidget* getTe(); |
84 | QStringList commands; | 87 | QStringList commands; |
85 | 88 | ||
86 | private: | 89 | private: |
87 | class VTFont | 90 | class VTFont |
88 | { | 91 | { |
89 | public: | 92 | public: |
90 | VTFont(QString name, QFont& font) | 93 | VTFont(QString name, QFont& font) |
91 | { | 94 | { |
92 | this->name = name; | 95 | this->name = name; |
93 | this->font = font; | 96 | this->font = font; |
94 | } | 97 | } |
95 | 98 | ||
96 | QFont& getFont() | 99 | QFont& getFont() |
97 | { | 100 | { |
98 | return font; | 101 | return font; |
99 | } | 102 | } |
100 | 103 | ||
101 | QString getName() | 104 | QString getName() |
102 | { | 105 | { |
103 | return name; | 106 | return name; |
104 | } | 107 | } |
105 | 108 | ||
106 | private: | 109 | private: |
107 | QString name; | 110 | QString name; |
108 | QFont font; | 111 | QFont font; |
109 | }; | 112 | }; |
110 | 113 | ||
111 | EKNumTabWidget* tab; | 114 | EKNumTabWidget* tab; |
112 | int nsessions; | 115 | int nsessions; |
113 | QList<VTFont> fonts; | 116 | QList<VTFont> fonts; |
114 | int cfont; | 117 | int cfont; |
115 | QCString se_pgm; | 118 | QCString se_pgm; |
116 | QStrList se_args; | 119 | QStrList se_args; |
117 | 120 | ||
118 | QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu; | 121 | QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu; |
119 | QComboBox *commonCombo; | 122 | QComboBox *commonCombo; |
120 | // history scrolling I think | 123 | // history scrolling I think |
121 | bool b_scroll; | 124 | bool b_scroll; |
122 | 125 | ||
123 | int n_keytab; | 126 | int n_keytab; |
124 | int n_scroll; | 127 | int n_scroll; |
125 | int n_render; | 128 | int n_render; |
126 | QString pmPath; // pixmap path | 129 | QString pmPath; // pixmap path |
127 | QString dropText; | 130 | QString dropText; |
128 | QFont defaultFont; | 131 | QFont defaultFont; |
129 | QSize defaultSize; | 132 | QSize defaultSize; |
130 | 133 | ||
131 | }; | 134 | }; |
132 | 135 | ||
133 | #endif | 136 | #endif |
134 | 137 | ||