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