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