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