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