summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 2c0001f..eafc12e 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -177,514 +177,512 @@ static const char *commonCmds[] =
177 "mv ", 177 "mv ",
178 "nc localhost 7776", 178 "nc localhost 7776",
179 "nc localhost 7777", 179 "nc localhost 7777",
180 "netstat ", 180 "netstat ",
181 "nslookup ", 181 "nslookup ",
182 "ping ", 182 "ping ",
183 "ps aux", 183 "ps aux",
184 "pwd ", 184 "pwd ",
185 "qcop QPE/System 'linkChanged(QString)' ''", 185 "qcop QPE/System 'linkChanged(QString)' ''",
186 "qcop QPE/System 'restart()'", 186 "qcop QPE/System 'restart()'",
187 "qcop QPE/System 'quit()'", 187 "qcop QPE/System 'quit()'",
188 "rm ", 188 "rm ",
189 "rmdir ", 189 "rmdir ",
190 "route ", 190 "route ",
191 "set ", 191 "set ",
192 "traceroute", 192 "traceroute",
193 193
194 /* 194 /*
195 "gzip", 195 "gzip",
196 "gunzip", 196 "gunzip",
197 "chgrp", 197 "chgrp",
198 "chown", 198 "chown",
199 "date", 199 "date",
200 "dd", 200 "dd",
201 "df", 201 "df",
202 "dmesg", 202 "dmesg",
203 "fuser", 203 "fuser",
204 "hostname", 204 "hostname",
205 "kill", 205 "kill",
206 "killall", 206 "killall",
207 "ln", 207 "ln",
208 "ping", 208 "ping",
209 "mount", 209 "mount",
210 "more", 210 "more",
211 "sort", 211 "sort",
212 "touch", 212 "touch",
213 "umount", 213 "umount",
214 "mknod", 214 "mknod",
215 "netstat", 215 "netstat",
216 */ 216 */
217 217
218 "exit", 218 "exit",
219 NULL 219 NULL
220 }; 220 };
221 221
222 222
223Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : 223Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
224 QMainWindow(parent, name, fl) 224 QMainWindow(parent, name, fl)
225{ 225{
226 QStrList args; 226 QStrList args;
227 init("/bin/bash",args); 227 init("/bin/bash",args);
228} 228}
229 229
230Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) 230Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int)
231 : QMainWindow(0, name) 231 : QMainWindow(0, name)
232{ 232{
233 init(_pgm,_args); 233 init(_pgm,_args);
234} 234}
235 235
236struct HistoryItem 236struct HistoryItem
237{ 237{
238 HistoryItem(int c, const QString &l) 238 HistoryItem(int c, const QString &l)
239 { 239 {
240 count = c; 240 count = c;
241 line = l; 241 line = l;
242 } 242 }
243 int count; 243 int count;
244 QString line; 244 QString line;
245}; 245};
246 246
247class HistoryList : public QList<HistoryItem> 247class HistoryList : public QList<HistoryItem>
248{ 248{
249 virtual int compareItems( QCollection::Item item1, QCollection::Item item2) 249 virtual int compareItems( QCollection::Item item1, QCollection::Item item2)
250 { 250 {
251 int c1 = ((HistoryItem*)item1)->count; 251 int c1 = ((HistoryItem*)item1)->count;
252 int c2 = ((HistoryItem*)item2)->count; 252 int c2 = ((HistoryItem*)item2)->count;
253 if (c1 > c2) 253 if (c1 > c2)
254 return(1); 254 return(1);
255 if (c1 < c2) 255 if (c1 < c2)
256 return(-1); 256 return(-1);
257 return(0); 257 return(0);
258 } 258 }
259}; 259};
260 260
261void Konsole::initCommandList() 261void Konsole::initCommandList()
262{ 262{
263 // qDebug("Konsole::initCommandList"); 263 // qDebug("Konsole::initCommandList");
264 Config cfg( "Konsole" ); 264 Config cfg( "Konsole" );
265 cfg.setGroup("Commands"); 265 cfg.setGroup("Commands");
266 // commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 266 // commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
267 commonCombo->clear(); 267 commonCombo->clear();
268 268
269 if (cfg.readEntry("ShellHistory","TRUE") == "TRUE") 269 if (cfg.readEntry("ShellHistory","TRUE") == "TRUE")
270 { 270 {
271 QString histfilename = QString(getenv("HOME")) + "/.bash_history"; 271 QString histfilename = QString(getenv("HOME")) + "/.bash_history";
272 histfilename = cfg.readEntry("ShellHistoryPath",histfilename); 272 histfilename = cfg.readEntry("ShellHistoryPath",histfilename);
273 QFile histfile(histfilename); 273 QFile histfile(histfilename);
274 // note: compiler barfed on: 274 // note: compiler barfed on:
275 // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); 275 // QFile histfile(QString(getenv("HOME")) + "/.bash_history");
276 if (histfile.open( IO_ReadOnly )) 276 if (histfile.open( IO_ReadOnly ))
277 { 277 {
278 QString line; 278 QString line;
279 uint i; 279 uint i;
280 HistoryList items; 280 HistoryList items;
281 281
282 int lineno = 0; 282 int lineno = 0;
283 while(!histfile.atEnd()) 283 while(!histfile.atEnd())
284 { 284 {
285 if (histfile.readLine(line, 200) < 0) 285 if (histfile.readLine(line, 200) < 0)
286 { 286 {
287 break; 287 break;
288 } 288 }
289 line = line.left(line.length()-1); 289 line = line.left(line.length()-1);
290 lineno++; 290 lineno++;
291 291
292 for(i=0; i<items.count(); i++) 292 for(i=0; i<items.count(); i++)
293 { 293 {
294 if (line == items.at(i)->line) 294 if (line == items.at(i)->line)
295 { 295 {
296 // weight recent commands & repeated commands more 296 // weight recent commands & repeated commands more
297 // by adding up the index of each command 297 // by adding up the index of each command
298 items.at(i)->count += lineno; 298 items.at(i)->count += lineno;
299 break; 299 break;
300 } 300 }
301 } 301 }
302 if (i >= items.count()) 302 if (i >= items.count())
303 { 303 {
304 items.append(new HistoryItem(lineno, line)); 304 items.append(new HistoryItem(lineno, line));
305 } 305 }
306 } 306 }
307 items.sort(); 307 items.sort();
308 int n = items.count(); 308 int n = items.count();
309 if (n > 40) 309 if (n > 40)
310 { 310 {
311 n = 40; 311 n = 40;
312 } 312 }
313 for(int i=0; i<n; i++) 313 for(int i=0; i<n; i++)
314 { 314 {
315 // should insert start of command, but keep whole thing 315 // should insert start of command, but keep whole thing
316 if (items.at(items.count()-i-1)->line.length() < 30) 316 if (items.at(items.count()-i-1)->line.length() < 30)
317 { 317 {
318 commonCombo->insertItem(items.at(items.count()-i-1)->line); 318 commonCombo->insertItem(items.at(items.count()-i-1)->line);
319 } 319 }
320 } 320 }
321 histfile.close(); 321 histfile.close();
322 } 322 }
323 } 323 }
324 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") 324 if (cfg.readEntry("Commands Set","FALSE") == "FALSE")
325 { 325 {
326 for (int i = 0; commonCmds[i] != NULL; i++) 326 for (int i = 0; commonCmds[i] != NULL; i++)
327 { 327 {
328 commonCombo->insertItem(commonCmds[i]); 328 commonCombo->insertItem(commonCmds[i]);
329 } 329 }
330 } 330 }
331 else 331 else
332 { 332 {
333 for (int i = 0; i < 100; i++) 333 for (int i = 0; i < 100; i++)
334 { 334 {
335 if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) 335 if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
336 commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); 336 commonCombo->insertItem(cfg.readEntry( QString::number(i),""));
337 } 337 }
338 } 338 }
339 339
340 340
341} 341}
342 342
343static void sig_handler(int x) 343static void sig_handler(int x)
344{ 344{
345 printf("got signal %d\n",x); 345 printf("got signal %d\n",x);
346} 346}
347 347
348void Konsole::init(const char* _pgm, QStrList & _args) 348void Konsole::init(const char* _pgm, QStrList & _args)
349{ 349{
350 350
351#if 0 351#if 0
352 for(int i=1; i<=31; i++) 352 for(int i=1; i<=31; i++)
353 { 353 {
354 if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV 354 if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV
355 && i != SIGINT && i != SIGILL && i != SIGTERM 355 && i != SIGINT && i != SIGILL && i != SIGTERM
356 && i != SIGBUS) 356 && i != SIGBUS)
357 signal(i,sig_handler); 357 signal(i,sig_handler);
358 } 358 }
359#endif 359#endif
360 signal(SIGSTOP, sig_handler); 360 signal(SIGSTOP, sig_handler);
361 signal(SIGCONT, sig_handler); 361 signal(SIGCONT, sig_handler);
362 signal(SIGTSTP, sig_handler); 362 signal(SIGTSTP, sig_handler);
363 363
364 b_scroll = TRUE; // histon; 364 b_scroll = TRUE; // histon;
365 n_keytab = 0; 365 n_keytab = 0;
366 n_render = 0; 366 n_render = 0;
367 startUp=0; 367 startUp=0;
368 fromMenu = FALSE; 368 fromMenu = FALSE;
369 fullscreen = false; 369 fullscreen = false;
370 370
371 setCaption( tr( "Konsole" ) ); 371 setCaption( tr( "Konsole" ) );
372 setIcon( Resource::loadPixmap( "konsole/Terminal" ) ); 372 setIcon( Resource::loadPixmap( "konsole/Terminal" ) );
373 373
374 Config cfg( "Konsole" ); 374 Config cfg( "Konsole" );
375 cfg.setGroup("Font"); 375 cfg.setGroup("Font");
376 QString tmp; 376 QString tmp;
377 377
378 // initialize the list of allowed fonts /////////////////////////////////// 378 // initialize the list of allowed fonts ///////////////////////////////////
379 379
380 QString cfgFontName = cfg.readEntry("FontName","Lcfont"); 380 QString cfgFontName = cfg.readEntry("FontName","Lcfont");
381 int cfgFontSize = cfg.readNumEntry("FontSize",18); 381 int cfgFontSize = cfg.readNumEntry("FontSize",18);
382 382
383 cfont = -1; 383 cfont = -1;
384 384
385 // this code causes repeated access to all the font files 385 // this code causes repeated access to all the font files
386 // which does slow down startup 386 // which does slow down startup
387 QFontDatabase fontDB; 387 QFontDatabase fontDB;
388 QStringList familyNames; 388 QStringList familyNames;
389 familyNames = fontDB.families( FALSE ); 389 familyNames = fontDB.families( FALSE );
390 QString s; 390 QString s;
391 int fontIndex = 0; 391 int fontIndex = 0;
392 int familyNum = 0; 392 int familyNum = 0;
393 fontList = new QPopupMenu( this ); 393 fontList = new QPopupMenu( this );
394 394
395 for(uint j = 0; j < (uint)familyNames.count(); j++) 395 for(uint j = 0; j < (uint)familyNames.count(); j++)
396 { 396 {
397 s = familyNames[j]; 397 s = familyNames[j];
398 if ( s.contains('-') ) 398 if ( s.contains('-') )
399 { 399 {
400 int i = s.find('-'); 400 int i = s.find('-');
401 s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; 401 s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]";
402 } 402 }
403 s[0] = s[0].upper(); 403 s[0] = s[0].upper();
404 404
405 QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); 405 QValueList<int> sizes = fontDB.pointSizes( familyNames[j] );
406 406
407 printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), 407 printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(),
408 sizes.count()); 408 sizes.count());
409 409
410 if (sizes.count() > 0) 410 if (sizes.count() > 0)
411 { 411 {
412 QPopupMenu *sizeMenu; 412 QPopupMenu *sizeMenu;
413 QFont f; 413 QFont f;
414 int last_width = -1; 414 int last_width = -1;
415 sizeMenu = NULL; 415 sizeMenu = NULL;
416 416
417 for(uint i = 0; i < (uint)sizes.count() + 4; i++) 417 for(uint i = 0; i < (uint)sizes.count() + 4; i++)
418 { 418 {
419 // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); 419 // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]);
420 // need to divide by 10 on the Z, but not otherwise 420 // need to divide by 10 on the Z, but not otherwise
421 int size; 421 int size;
422 422
423 if (i >= (uint)sizes.count()) 423 if (i >= (uint)sizes.count())
424 { 424 {
425 // try for expandable fonts 425 // try for expandable fonts
426 size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); 426 size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1);
427 } 427 }
428 else 428 else
429 { 429 {
430 printf("sizes[%d] = %d\n", i, sizes[i]); 430 printf("sizes[%d] = %d\n", i, sizes[i]);
431 size = sizes[i]; 431 size = sizes[i];
432 } 432 }
433 // a hack, sizes on Z seem to be points*10
434 size /= 10;
435 433
436 f = QFont(familyNames[j], size); 434 f = QFont(familyNames[j], size);
437 f.setFixedPitch(true); 435 f.setFixedPitch(true);
438 QFontMetrics fm(f); 436 QFontMetrics fm(f);
439 // don't trust f.fixedPitch() or f.exactMatch(), they lie!! 437 // don't trust f.fixedPitch() or f.exactMatch(), they lie!!
440 if (fm.width("l") == fm.width("m") 438 if (fm.width("l") == fm.width("m")
441 && (i < (uint)sizes.count() 439 && (i < (uint)sizes.count()
442 || fm.width("m") > last_width)) 440 || fm.width("m") > last_width))
443 { 441 {
444 if (i < (uint)sizes.count()) 442 if (i < (uint)sizes.count())
445 { 443 {
446 last_width = fm.width("m"); 444 last_width = fm.width("m");
447 } 445 }
448 if (sizeMenu == NULL) 446 if (sizeMenu == NULL)
449 { 447 {
450 sizeMenu = new QPopupMenu(); 448 sizeMenu = new QPopupMenu();
451 } 449 }
452 int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); 450 int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex);
453 sizeMenu->setItemParameter(id, fontIndex); 451 sizeMenu->setItemParameter(id, fontIndex);
454 sizeMenu->connectItem(id, this, SLOT(setFont(int))); 452 sizeMenu->connectItem(id, this, SLOT(setFont(int)));
455 QString name = s + " " + QString::number(size); 453 QString name = s + " " + QString::number(size);
456 fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); 454 fonts.append(new VTFont(name, f, familyNames[j], familyNum, size));
457 if (familyNames[j] == cfgFontName && size == cfgFontSize) 455 if (familyNames[j] == cfgFontName && size == cfgFontSize)
458 { 456 {
459 cfont = fontIndex; 457 cfont = fontIndex;
460 } 458 }
461 printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); 459 printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size);
462 fontIndex++; 460 fontIndex++;
463 } 461 }
464 } 462 }
465 if (sizeMenu) 463 if (sizeMenu)
466 { 464 {
467 fontList->insertItem(s, sizeMenu, familyNum + 1000); 465 fontList->insertItem(s, sizeMenu, familyNum + 1000);
468 466
469 familyNum++; 467 familyNum++;
470 } 468 }
471 } 469 }
472 470
473 } 471 }
474 472
475 if (cfont < 0 || cfont >= (int)fonts.count()) 473 if (cfont < 0 || cfont >= (int)fonts.count())
476 { 474 {
477 cfont = 0; 475 cfont = 0;
478 } 476 }
479 477
480 // create terminal emulation framework //////////////////////////////////// 478 // create terminal emulation framework ////////////////////////////////////
481 nsessions = 0; 479 nsessions = 0;
482 480
483 tab = new EKNumTabWidget(this); 481 tab = new EKNumTabWidget(this);
484 // tab->setMargin(tab->margin()-5); 482 // tab->setMargin(tab->margin()-5);
485 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); 483 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
486 484
487 // create terminal toolbar //////////////////////////////////////////////// 485 // create terminal toolbar ////////////////////////////////////////////////
488 setToolBarsMovable( FALSE ); 486 setToolBarsMovable( FALSE );
489 menuToolBar = new QToolBar( this ); 487 menuToolBar = new QToolBar( this );
490 menuToolBar->setHorizontalStretchable( TRUE ); 488 menuToolBar->setHorizontalStretchable( TRUE );
491 489
492 QMenuBar *menuBar = new QMenuBar( menuToolBar ); 490 QMenuBar *menuBar = new QMenuBar( menuToolBar );
493 491
494 bool c7xx = false; 492 bool c7xx = false;
495 if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) 493 if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600)
496 { 494 {
497 c7xx = true; 495 c7xx = true;
498 } 496 }
499 QFont menuFont; 497 QFont menuFont;
500 menuFont.setPointSize(c7xx? 18 : 10); 498 menuFont.setPointSize(c7xx? 18 : 10);
501 qApp->setFont(menuFont, true); 499 qApp->setFont(menuFont, true);
502 500
503 setFont(cfont); 501 setFont(cfont);
504 502
505 configMenu = new QPopupMenu( this); 503 configMenu = new QPopupMenu( this);
506 colorMenu = new QPopupMenu( this); 504 colorMenu = new QPopupMenu( this);
507 scrollMenu = new QPopupMenu( this); 505 scrollMenu = new QPopupMenu( this);
508 editCommandListMenu = new QPopupMenu( this); 506 editCommandListMenu = new QPopupMenu( this);
509 507
510 configMenu->insertItem(tr("Command List"), editCommandListMenu); 508 configMenu->insertItem(tr("Command List"), editCommandListMenu);
511 509
512 bool listHidden; 510 bool listHidden;
513 cfg.setGroup("Menubar"); 511 cfg.setGroup("Menubar");
514 if( cfg.readEntry("Hidden","FALSE") == "TRUE") 512 if( cfg.readEntry("Hidden","FALSE") == "TRUE")
515 { 513 {
516 ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); 514 ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" ));
517 listHidden=TRUE; 515 listHidden=TRUE;
518 } 516 }
519 else 517 else
520 { 518 {
521 ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); 519 ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" ));
522 listHidden=FALSE; 520 listHidden=FALSE;
523 } 521 }
524 522
525 cfg.setGroup("Tabs"); 523 cfg.setGroup("Tabs");
526 524
527 tabMenu = new QPopupMenu(this); 525 tabMenu = new QPopupMenu(this);
528 tm_bottom = tabMenu->insertItem(tr("Bottom" )); 526 tm_bottom = tabMenu->insertItem(tr("Bottom" ));
529 tm_top = tabMenu->insertItem(tr("Top")); 527 tm_top = tabMenu->insertItem(tr("Top"));
530 tm_hidden = tabMenu->insertItem(tr("Hidden")); 528 tm_hidden = tabMenu->insertItem(tr("Hidden"));
531 529
532 configMenu->insertItem(tr("Tabs"), tabMenu); 530 configMenu->insertItem(tr("Tabs"), tabMenu);
533 531
534 tmp=cfg.readEntry("Position","Top"); 532 tmp=cfg.readEntry("Position","Top");
535 if(tmp=="Top") 533 if(tmp=="Top")
536 { 534 {
537 tab->setTabPosition(QTabWidget::Top); 535 tab->setTabPosition(QTabWidget::Top);
538 tab->getTabBar()->show(); 536 tab->getTabBar()->show();
539 tabPos = tm_top; 537 tabPos = tm_top;
540 } 538 }
541 else if (tmp=="Bottom") 539 else if (tmp=="Bottom")
542 { 540 {
543 tab->setTabPosition(QTabWidget::Bottom); 541 tab->setTabPosition(QTabWidget::Bottom);
544 tab->getTabBar()->show(); 542 tab->getTabBar()->show();
545 tabPos = tm_bottom; 543 tabPos = tm_bottom;
546 } 544 }
547 else 545 else
548 { 546 {
549 tab->getTabBar()->hide(); 547 tab->getTabBar()->hide();
550 tab->setMargin(tab->margin()); 548 tab->setMargin(tab->margin());
551 tabPos = tm_hidden; 549 tabPos = tm_hidden;
552 } 550 }
553 551
554 cm_bw = colorMenu->insertItem(tr( "Black on White")); 552 cm_bw = colorMenu->insertItem(tr( "Black on White"));
555 cm_wb = colorMenu->insertItem(tr( "White on Black")); 553 cm_wb = colorMenu->insertItem(tr( "White on Black"));
556 cm_gb = colorMenu->insertItem(tr( "Green on Black")); 554 cm_gb = colorMenu->insertItem(tr( "Green on Black"));
557 // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); 555 // cm_bt = colorMenu->insertItem(tr( "Black on Transparent"));
558 cm_br = colorMenu->insertItem(tr( "Black on Pink")); 556 cm_br = colorMenu->insertItem(tr( "Black on Pink"));
559 cm_rb = colorMenu->insertItem(tr( "Pink on Black")); 557 cm_rb = colorMenu->insertItem(tr( "Pink on Black"));
560 cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); 558 cm_gy = colorMenu->insertItem(tr( "Green on Yellow"));
561 cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); 559 cm_bm = colorMenu->insertItem(tr( "Blue on Magenta"));
562 cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); 560 cm_mb = colorMenu->insertItem(tr( "Magenta on Blue"));
563 cm_cw = colorMenu->insertItem(tr( "Cyan on White")); 561 cm_cw = colorMenu->insertItem(tr( "Cyan on White"));
564 cm_wc = colorMenu->insertItem(tr( "White on Cyan")); 562 cm_wc = colorMenu->insertItem(tr( "White on Cyan"));
565 cm_bb = colorMenu->insertItem(tr( "Blue on Black")); 563 cm_bb = colorMenu->insertItem(tr( "Blue on Black"));
566 cm_ab = colorMenu->insertItem(tr( "Amber on Black")); 564 cm_ab = colorMenu->insertItem(tr( "Amber on Black"));
567 cm_default = colorMenu->insertItem(tr("default")); 565 cm_default = colorMenu->insertItem(tr("default"));
568 566
569#ifdef QT_QWS_OPIE 567#ifdef QT_QWS_OPIE
570 568
571 colorMenu->insertItem(tr( "Custom")); 569 colorMenu->insertItem(tr( "Custom"));
572#endif 570#endif
573 571
574 configMenu->insertItem(tr( "Colors") ,colorMenu); 572 configMenu->insertItem(tr( "Colors") ,colorMenu);
575 573
576 sessionList = new QPopupMenu(this); 574 sessionList = new QPopupMenu(this);
577 sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this, 575 sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this,
578 SLOT(newSession()) ); 576 SLOT(newSession()) );
579 577
580 // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 578 // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
581 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 579 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
582 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); 580 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) ));
583 connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); 581 connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) ));
584 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); 582 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
585 connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); 583 connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
586 connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); 584 connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) );
587 585
588 menuBar->insertItem( tr("View"), configMenu ); 586 menuBar->insertItem( tr("View"), configMenu );
589 menuBar->insertItem( tr("Fonts"), fontList ); 587 menuBar->insertItem( tr("Fonts"), fontList );
590 menuBar->insertItem( tr("Sessions"), sessionList ); 588 menuBar->insertItem( tr("Sessions"), sessionList );
591 589
592 toolBar = new QToolBar( this ); 590 toolBar = new QToolBar( this );
593 591
594 QAction *a; 592 QAction *a;
595 593
596 // Button Commands 594 // Button Commands
597 a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 ); 595 a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 );
598 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); 596 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) );
599 a->addTo( toolBar ); 597 a->addTo( toolBar );
600 598
601 a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); 599 a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 );
602 connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); 600 connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) );
603 a->addTo( toolBar ); 601 a->addTo( toolBar );
604 602
605 a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); 603 a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 );
606 connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); 604 connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) );
607 a->addTo( toolBar ); 605 a->addTo( toolBar );
608 606
609 607
610 /* 608 /*
611 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 609 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
612 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); 610 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar );
613 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); 611 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 );
614 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); 612 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar );
615 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); 613 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 );
616 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); 614 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar );
617 */ 615 */
618 /* 616 /*
619 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); 617 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
620 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); 618 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar );
621 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); 619 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
622 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); 620 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar );
623 */ 621 */
624 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 622 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
625 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); 623 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) );
626 a->addTo( toolBar ); 624 a->addTo( toolBar );
627 625
628 secondToolBar = new QToolBar( this ); 626 secondToolBar = new QToolBar( this );
629 secondToolBar->setHorizontalStretchable( TRUE ); 627 secondToolBar->setHorizontalStretchable( TRUE );
630 628
631 commonCombo = new QComboBox( secondToolBar ); 629 commonCombo = new QComboBox( secondToolBar );
632 // commonCombo->setMaximumWidth(236); 630 // commonCombo->setMaximumWidth(236);
633 631
634 ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); 632 ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) );
635 if( listHidden) 633 if( listHidden)
636 { 634 {
637 secondToolBar->hide(); 635 secondToolBar->hide();
638 editCommandListMenu->setItemEnabled(ec_quick ,FALSE); 636 editCommandListMenu->setItemEnabled(ec_quick ,FALSE);
639 } 637 }
640 ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); 638 ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) );
641 639
642 cfg.setGroup("Commands"); 640 cfg.setGroup("Commands");
643 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 641 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
644 642
645 initCommandList(); 643 initCommandList();
646 // for (int i = 0; commonCmds[i] != NULL; i++) { 644 // for (int i = 0; commonCmds[i] != NULL; i++) {
647 // commonCombo->insertItem( commonCmds[i], i ); 645 // commonCombo->insertItem( commonCmds[i], i );
648 // tmp = cfg.readEntry( QString::number(i),""); 646 // tmp = cfg.readEntry( QString::number(i),"");
649 // if(tmp != "") 647 // if(tmp != "")
650 // commonCombo->changeItem( tmp,i ); 648 // commonCombo->changeItem( tmp,i );
651 // } 649 // }
652 650
653 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 651 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
654 652
655 sm_none = scrollMenu->insertItem(tr( "None" )); 653 sm_none = scrollMenu->insertItem(tr( "None" ));
656 sm_left = scrollMenu->insertItem(tr( "Left" )); 654 sm_left = scrollMenu->insertItem(tr( "Left" ));
657 sm_right = scrollMenu->insertItem(tr( "Right" )); 655 sm_right = scrollMenu->insertItem(tr( "Right" ));
658 // scrollMenu->insertSeparator(4); 656 // scrollMenu->insertSeparator(4);
659 // scrollMenu->insertItem(tr( "Horizontal" )); 657 // scrollMenu->insertItem(tr( "Horizontal" ));
660 658
661 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); 659 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
662 660
663 configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); 661 configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog()));
664 662
665 cm_wrap = configMenu->insertItem(tr( "Wrap" )); 663 cm_wrap = configMenu->insertItem(tr( "Wrap" ));
666 cfg.setGroup("ScrollBar"); 664 cfg.setGroup("ScrollBar");
667 configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); 665 configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0));
668 666
669 cm_beep = configMenu->insertItem(tr( "Use Beep" )); 667 cm_beep = configMenu->insertItem(tr( "Use Beep" ));
670 cfg.setGroup("Menubar"); 668 cfg.setGroup("Menubar");
671 configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); 669 configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0));
672 670
673 fullscreen_msg = new QLabel(this); 671 fullscreen_msg = new QLabel(this);
674 fullscreen_msg-> setAlignment ( AlignCenter | SingleLine ); 672 fullscreen_msg-> setAlignment ( AlignCenter | SingleLine );
675 fullscreen_msg-> hide(); 673 fullscreen_msg-> hide();
676 fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); 674 fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding ));
677 fullscreen_msg-> setAutoResize(true); 675 fullscreen_msg-> setAutoResize(true);
678 fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 676 fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
679 fullscreen_msg-> setText(tr("To exit fullscreen, tap here.")); 677 fullscreen_msg-> setText(tr("To exit fullscreen, tap here."));
680 678
681 fullscreen_timer = new QTimer(this); 679 fullscreen_timer = new QTimer(this);
682 connect(fullscreen_timer, SIGNAL(timeout()), 680 connect(fullscreen_timer, SIGNAL(timeout()),
683 this, SLOT(fullscreenTimeout())); 681 this, SLOT(fullscreenTimeout()));
684 show_fullscreen_msg = true; 682 show_fullscreen_msg = true;
685 683
686 //scrollMenuSelected(-29); 684 //scrollMenuSelected(-29);
687 // cfg.setGroup("ScrollBar"); 685 // cfg.setGroup("ScrollBar");
688 // if(cfg.readBoolEntry("HorzScroll",0)) { 686 // if(cfg.readBoolEntry("HorzScroll",0)) {
689 // if(cfg.readNumEntry("Position",2) == 0) 687 // if(cfg.readNumEntry("Position",2) == 0)
690 // te->setScrollbarLocation(1); 688 // te->setScrollbarLocation(1);