summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp45
-rw-r--r--core/apps/embeddedkonsole/konsole.h3
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,68 +1,69 @@
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
56class EKNumTabBar : public QTabBar { 57class EKNumTabBar : public QTabBar {
57public: 58public:
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();
@@ -156,97 +157,97 @@ static const char *commonCmds[] =
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
166Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : 167Konsole::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
173Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) 174Konsole::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
179void Konsole::initCommandList() 180void 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
199void Konsole::init(const char* _pgm, QStrList & _args) 200void 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
@@ -319,122 +320,122 @@ void Konsole::init(const char* _pgm, QStrList & _args)
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
368parseCommandLine();
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
375void Konsole::show() 376void 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
383void Konsole::initSession(const char*, QStrList &) 384void Konsole::initSession(const char*, QStrList &)
384{ 385{
385 QMainWindow::show(); 386 QMainWindow::show();
386} 387}
387 388
388Konsole::~Konsole() 389Konsole::~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
399void Konsole::fontChanged(int f) 400void 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
417void Konsole::enterCommand(int c) 418void 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
430void Konsole::hitEnter() 431void 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
438void Konsole::hitSpace() 439void Konsole::hitSpace()
439{ 440{
440 TEWidget* te = getTe(); 441 TEWidget* te = getTe();
@@ -798,48 +799,86 @@ void Konsole::editCommandListMenuSelected(int 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'
849void 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
869void 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
@@ -9,115 +9,118 @@
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
41class EKNumTabWidget; 41class EKNumTabWidget;
42 42
43class Konsole : public QMainWindow 43class Konsole : public QMainWindow
44{ 44{
45Q_OBJECT 45Q_OBJECT
46 46
47public: 47public:
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;
57private slots: 58private 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();
76private: 79private:
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
86private: 89private:
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;