summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/konsole.cpp
Unidiff
Diffstat (limited to 'core/apps/embeddedkonsole/konsole.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index ec438c3..d855d90 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -1,84 +1,84 @@
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 <qmenubar.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 <unistd.h> 49#include <unistd.h>
50#include <pwd.h> 50#include <pwd.h>
51#include <sys/types.h> 51#include <sys/types.h>
52#include <sys/wait.h> 52#include <sys/wait.h>
53#include <stdio.h> 53#include <stdio.h>
54#include <stdlib.h> 54#include <stdlib.h>
55#include <assert.h> 55#include <assert.h>
56 56
57#include "konsole.h" 57#include "konsole.h"
58#include "keytrans.h" 58#include "keytrans.h"
59#include "commandeditdialog.h" 59#include "commandeditdialog.h"
60 60
61#ifdef QT_QWS_OPIE 61#ifdef QT_QWS_OPIE
62#include <opie/colorpopupmenu.h> 62#include <opie/colorpopupmenu.h>
63#endif 63#endif
64 64
65class EKNumTabBar : public QTabBar { 65class EKNumTabBar : public QTabBar {
66public: 66public:
67 void numberTabs() 67 void numberTabs()
68 { 68 {
69 // Yes, it really is this messy. QTabWidget needs functions 69 // Yes, it really is this messy. QTabWidget needs functions
70 // that provide acces to tabs in a sequential way. 70 // that provide acces to tabs in a sequential way.
71 int m=INT_MIN; 71 int m=INT_MIN;
72 for (int i=0; i<count(); i++) { 72 for (int i=0; i<count(); i++) {
73 QTab* left=0; 73 QTab* left=0;
74 QListIterator<QTab> it(*tabList()); 74 QListIterator<QTab> it(*tabList());
75 int x=INT_MAX; 75 int x=INT_MAX;
76 for( QTab* t; (t=it.current()); ++it ) { 76 for( QTab* t; (t=it.current()); ++it ) {
77 int tx = t->rect().x(); 77 int tx = t->rect().x();
78 if ( tx<x && tx>m ) { 78 if ( tx<x && tx>m ) {
79 x = tx; 79 x = tx;
80 left = t; 80 left = t;
81 } 81 }
82 } 82 }
83 if ( left ) { 83 if ( left ) {
84 left->setText(QString::number(i+1)); 84 left->setText(QString::number(i+1));
@@ -240,97 +240,97 @@ void Konsole::initCommandList()
240 for (int i = 0; i < 100; i++) { 240 for (int i = 0; i < 100; i++) {
241 if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) 241 if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
242 commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); 242 commonCombo->insertItem((cfg.readEntry( QString::number(i),"")));
243 } 243 }
244 } 244 }
245 245
246} 246}
247 247
248void Konsole::init(const char* _pgm, QStrList & _args) 248void Konsole::init(const char* _pgm, QStrList & _args)
249{ 249{
250 b_scroll = TRUE; // histon; 250 b_scroll = TRUE; // histon;
251 n_keytab = 0; 251 n_keytab = 0;
252 n_render = 0; 252 n_render = 0;
253 startUp=0; 253 startUp=0;
254 fromMenu = FALSE; 254 fromMenu = FALSE;
255 255
256 setCaption( tr("Terminal") ); 256 setCaption( tr("Terminal") );
257 setIcon( Resource::loadPixmap( "konsole" ) ); 257 setIcon( Resource::loadPixmap( "konsole" ) );
258 258
259 Config cfg("Konsole"); 259 Config cfg("Konsole");
260 cfg.setGroup("Konsole"); 260 cfg.setGroup("Konsole");
261 QString tmp; 261 QString tmp;
262 // initialize the list of allowed fonts /////////////////////////////////// 262 // initialize the list of allowed fonts ///////////////////////////////////
263 cfont = cfg.readNumEntry("FontID", 1); 263 cfont = cfg.readNumEntry("FontID", 1);
264 QFont f = QFont("Micro", 4, QFont::Normal); 264 QFont f = QFont("Micro", 4, QFont::Normal);
265 f.setFixedPitch(TRUE); 265 f.setFixedPitch(TRUE);
266 fonts.append(new VTFont(tr("Micro"), f)); 266 fonts.append(new VTFont(tr("Micro"), f));
267 267
268 f = QFont("Fixed", 7, QFont::Normal); 268 f = QFont("Fixed", 7, QFont::Normal);
269 f.setFixedPitch(TRUE); 269 f.setFixedPitch(TRUE);
270 fonts.append(new VTFont(tr("Small Fixed"), f)); 270 fonts.append(new VTFont(tr("Small Fixed"), f));
271 271
272 f = QFont("Fixed", 12, QFont::Normal); 272 f = QFont("Fixed", 12, QFont::Normal);
273 f.setFixedPitch(TRUE); 273 f.setFixedPitch(TRUE);
274 fonts.append(new VTFont(tr("Medium Fixed"), f)); 274 fonts.append(new VTFont(tr("Medium Fixed"), f));
275 275
276 // create terminal emulation framework //////////////////////////////////// 276 // create terminal emulation framework ////////////////////////////////////
277 nsessions = 0; 277 nsessions = 0;
278 278
279 tab = new EKNumTabWidget(this); 279 tab = new EKNumTabWidget(this);
280 280
281 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); 281 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
282 282
283 // create terminal toolbar //////////////////////////////////////////////// 283 // create terminal toolbar ////////////////////////////////////////////////
284 setToolBarsMovable( FALSE ); 284 setToolBarsMovable( FALSE );
285 QPEToolBar *menuToolBar = new QPEToolBar( this ); 285 QPEToolBar *menuToolBar = new QPEToolBar( this );
286 menuToolBar->setHorizontalStretchable( TRUE ); 286 menuToolBar->setHorizontalStretchable( TRUE );
287 287
288 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); 288 QMenuBar *menuBar = new QMenuBar( menuToolBar );
289 289
290 fontList = new QPopupMenu( this ); 290 fontList = new QPopupMenu( this );
291 for(uint i = 0; i < fonts.count(); i++) { 291 for(uint i = 0; i < fonts.count(); i++) {
292 VTFont *fnt = fonts.at(i); 292 VTFont *fnt = fonts.at(i);
293 fontList->insertItem(fnt->getName(), i); 293 fontList->insertItem(fnt->getName(), i);
294 } 294 }
295 fontChanged(cfont); 295 fontChanged(cfont);
296 296
297 configMenu = new QPopupMenu( this); 297 configMenu = new QPopupMenu( this);
298 colorMenu = new QPopupMenu( this); 298 colorMenu = new QPopupMenu( this);
299 scrollMenu = new QPopupMenu( this); 299 scrollMenu = new QPopupMenu( this);
300 editCommandListMenu = new QPopupMenu( this); 300 editCommandListMenu = new QPopupMenu( this);
301 301
302 configMenu->insertItem(tr("Command List"), editCommandListMenu); 302 configMenu->insertItem(tr("Command List"), editCommandListMenu);
303 303
304 bool listHidden; 304 bool listHidden;
305 cfg.setGroup("Menubar"); 305 cfg.setGroup("Menubar");
306 if( cfg.readEntry("Hidden","FALSE") == "TRUE") { 306 if( cfg.readEntry("Hidden","FALSE") == "TRUE") {
307 editCommandListMenu->insertItem( tr( "Show command list" )); 307 editCommandListMenu->insertItem( tr( "Show command list" ));
308 listHidden=TRUE; 308 listHidden=TRUE;
309 } else { 309 } else {
310 editCommandListMenu->insertItem( tr( "Hide command list" )); 310 editCommandListMenu->insertItem( tr( "Hide command list" ));
311 listHidden=FALSE; 311 listHidden=FALSE;
312 } 312 }
313 313
314 cfg.setGroup("Tabs"); 314 cfg.setGroup("Tabs");
315 tmp=cfg.readEntry("Position","Bottom"); 315 tmp=cfg.readEntry("Position","Bottom");
316 if(tmp=="Top") { 316 if(tmp=="Top") {
317 tab->setTabPosition(QTabWidget::Top); 317 tab->setTabPosition(QTabWidget::Top);
318 configMenu->insertItem( tr( "Tabs on Bottom" ) ); 318 configMenu->insertItem( tr( "Tabs on Bottom" ) );
319 } else { 319 } else {
320 tab->setTabPosition(QTabWidget::Bottom); 320 tab->setTabPosition(QTabWidget::Bottom);
321 configMenu->insertItem(tr("Tabs on Top")); 321 configMenu->insertItem(tr("Tabs on Top"));
322 } 322 }
323 configMenu->insertSeparator(2); 323 configMenu->insertSeparator(2);
324 324
325 colorMenu->insertItem(tr( "Green on Black")); 325 colorMenu->insertItem(tr( "Green on Black"));
326 colorMenu->insertItem(tr( "Black on White")); 326 colorMenu->insertItem(tr( "Black on White"));
327 colorMenu->insertItem(tr( "White on Black")); 327 colorMenu->insertItem(tr( "White on Black"));
328 colorMenu->insertItem(tr( "Black on Transparent")); 328 colorMenu->insertItem(tr( "Black on Transparent"));
329 colorMenu->insertItem(tr( "Black on Red")); 329 colorMenu->insertItem(tr( "Black on Red"));
330 colorMenu->insertItem(tr( "Red on Black")); 330 colorMenu->insertItem(tr( "Red on Black"));
331 colorMenu->insertItem(tr( "Green on Yellow")); 331 colorMenu->insertItem(tr( "Green on Yellow"));
332 colorMenu->insertItem(tr( "Blue on Magenta")); 332 colorMenu->insertItem(tr( "Blue on Magenta"));
333 colorMenu->insertItem(tr( "Magenta on Blue")); 333 colorMenu->insertItem(tr( "Magenta on Blue"));
334 colorMenu->insertItem(tr( "Cyan on White")); 334 colorMenu->insertItem(tr( "Cyan on White"));
335 colorMenu->insertItem(tr( "White on Cyan")); 335 colorMenu->insertItem(tr( "White on Cyan"));
336 colorMenu->insertItem(tr( "Blue on Black")); 336 colorMenu->insertItem(tr( "Blue on Black"));