summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index ff5c2f1..8207f23 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -236,782 +236,779 @@ static void konsoleInit(const char** shell) {
236 236
237 if( putenv((char*)"COLORTERM=") !=0) 237 if( putenv((char*)"COLORTERM=") !=0)
238 qDebug("putenv failed"); // to trigger mc's color detection 238 qDebug("putenv failed"); // to trigger mc's color detection
239} 239}
240 240
241 241
242Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : 242Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
243 QMainWindow(parent, name, fl) 243 QMainWindow(parent, name, fl)
244{ 244{
245 QStrList tmp; const char* shell; 245 QStrList tmp; const char* shell;
246 246
247 konsoleInit( &shell); 247 konsoleInit( &shell);
248 init(shell,tmp); 248 init(shell,tmp);
249} 249}
250 250
251Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) 251Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int)
252 : QMainWindow(0, name) 252 : QMainWindow(0, name)
253{ 253{
254 init(_pgm,_args); 254 init(_pgm,_args);
255} 255}
256 256
257struct HistoryItem 257struct HistoryItem
258{ 258{
259 HistoryItem(int c, const QString &l) 259 HistoryItem(int c, const QString &l)
260 { 260 {
261 count = c; 261 count = c;
262 line = l; 262 line = l;
263 } 263 }
264 int count; 264 int count;
265 QString line; 265 QString line;
266}; 266};
267 267
268class HistoryList : public QList<HistoryItem> 268class HistoryList : public QList<HistoryItem>
269{ 269{
270 virtual int compareItems( QCollection::Item item1, QCollection::Item item2) 270 virtual int compareItems( QCollection::Item item1, QCollection::Item item2)
271 { 271 {
272 int c1 = ((HistoryItem*)item1)->count; 272 int c1 = ((HistoryItem*)item1)->count;
273 int c2 = ((HistoryItem*)item2)->count; 273 int c2 = ((HistoryItem*)item2)->count;
274 if (c1 > c2) 274 if (c1 > c2)
275 return(1); 275 return(1);
276 if (c1 < c2) 276 if (c1 < c2)
277 return(-1); 277 return(-1);
278 return(0); 278 return(0);
279 } 279 }
280}; 280};
281 281
282void Konsole::initCommandList() 282void Konsole::initCommandList()
283{ 283{
284 // qDebug("Konsole::initCommandList"); 284 // qDebug("Konsole::initCommandList");
285 Config cfg( "Konsole" ); 285 Config cfg( "Konsole" );
286 cfg.setGroup("Commands"); 286 cfg.setGroup("Commands");
287 // commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 287 // commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
288 commonCombo->clear(); 288 commonCombo->clear();
289 289
290 if (cfg.readEntry("ShellHistory","TRUE") == "TRUE") 290 if (cfg.readEntry("ShellHistory","TRUE") == "TRUE")
291 { 291 {
292 QString histfilename = QString(getenv("HOME")) + "/.bash_history"; 292 QString histfilename = QString(getenv("HOME")) + "/.bash_history";
293 histfilename = cfg.readEntry("ShellHistoryPath",histfilename); 293 histfilename = cfg.readEntry("ShellHistoryPath",histfilename);
294 QFile histfile(histfilename); 294 QFile histfile(histfilename);
295 // note: compiler barfed on: 295 // note: compiler barfed on:
296 // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); 296 // QFile histfile(QString(getenv("HOME")) + "/.bash_history");
297 if (histfile.open( IO_ReadOnly )) 297 if (histfile.open( IO_ReadOnly ))
298 { 298 {
299 QString line; 299 QString line;
300 uint i; 300 uint i;
301 HistoryList items; 301 HistoryList items;
302 302
303 int lineno = 0; 303 int lineno = 0;
304 while(!histfile.atEnd()) 304 while(!histfile.atEnd())
305 { 305 {
306 if (histfile.readLine(line, 200) < 0) 306 if (histfile.readLine(line, 200) < 0)
307 { 307 {
308 break; 308 break;
309 } 309 }
310 line = line.left(line.length()-1); 310 line = line.left(line.length()-1);
311 lineno++; 311 lineno++;
312 312
313 for(i=0; i<items.count(); i++) 313 for(i=0; i<items.count(); i++)
314 { 314 {
315 if (line == items.at(i)->line) 315 if (line == items.at(i)->line)
316 { 316 {
317 // weight recent commands & repeated commands more 317 // weight recent commands & repeated commands more
318 // by adding up the index of each command 318 // by adding up the index of each command
319 items.at(i)->count += lineno; 319 items.at(i)->count += lineno;
320 break; 320 break;
321 } 321 }
322 } 322 }
323 if (i >= items.count()) 323 if (i >= items.count())
324 { 324 {
325 items.append(new HistoryItem(lineno, line)); 325 items.append(new HistoryItem(lineno, line));
326 } 326 }
327 } 327 }
328 items.sort(); 328 items.sort();
329 int n = items.count(); 329 int n = items.count();
330 if (n > 40) 330 if (n > 40)
331 { 331 {
332 n = 40; 332 n = 40;
333 } 333 }
334 for(int i=0; i<n; i++) 334 for(int i=0; i<n; i++)
335 { 335 {
336 // should insert start of command, but keep whole thing 336 // should insert start of command, but keep whole thing
337 if (items.at(items.count()-i-1)->line.length() < 30) 337 if (items.at(items.count()-i-1)->line.length() < 30)
338 { 338 {
339 commonCombo->insertItem(items.at(items.count()-i-1)->line); 339 commonCombo->insertItem(items.at(items.count()-i-1)->line);
340 } 340 }
341 } 341 }
342 histfile.close(); 342 histfile.close();
343 } 343 }
344 } 344 }
345 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") 345 if (cfg.readEntry("Commands Set","FALSE") == "FALSE")
346 { 346 {
347 for (int i = 0; commonCmds[i] != NULL; i++) 347 for (int i = 0; commonCmds[i] != NULL; i++)
348 { 348 {
349 commonCombo->insertItem(commonCmds[i]); 349 commonCombo->insertItem(commonCmds[i]);
350 } 350 }
351 } 351 }
352 else 352 else
353 { 353 {
354 for (int i = 0; i < 100; i++) 354 for (int i = 0; i < 100; i++)
355 { 355 {
356 if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) 356 if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
357 commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); 357 commonCombo->insertItem(cfg.readEntry( QString::number(i),""));
358 } 358 }
359 } 359 }
360 360
361 361
362} 362}
363 363
364static void sig_handler(int x) 364static void sig_handler(int x)
365{ 365{
366 printf("got signal %d\n",x); 366 printf("got signal %d\n",x);
367} 367}
368 368
369void Konsole::init(const char* _pgm, QStrList & _args) 369void Konsole::init(const char* _pgm, QStrList & _args)
370{ 370{
371 371
372#if 0 372#if 0
373 for(int i=1; i<=31; i++) 373 for(int i=1; i<=31; i++)
374 { 374 {
375 if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV 375 if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV
376 && i != SIGINT && i != SIGILL && i != SIGTERM 376 && i != SIGINT && i != SIGILL && i != SIGTERM
377 && i != SIGBUS) 377 && i != SIGBUS)
378 signal(i,sig_handler); 378 signal(i,sig_handler);
379 } 379 }
380#endif 380#endif
381 signal(SIGSTOP, sig_handler); 381 signal(SIGSTOP, sig_handler);
382 signal(SIGCONT, sig_handler); 382 signal(SIGCONT, sig_handler);
383 signal(SIGTSTP, sig_handler); 383 signal(SIGTSTP, sig_handler);
384 384
385 b_scroll = TRUE; // histon; 385 b_scroll = TRUE; // histon;
386 n_keytab = 0; 386 n_keytab = 0;
387 n_render = 0; 387 n_render = 0;
388 startUp=0; 388 startUp=0;
389 fromMenu = FALSE; 389 fromMenu = FALSE;
390 fullscreen = false; 390 fullscreen = false;
391 391
392 setCaption( tr( "Konsole" ) ); 392 setCaption( tr( "Konsole" ) );
393 setIcon( Resource::loadPixmap( "konsole/Terminal" ) ); 393 setIcon( Resource::loadPixmap( "konsole/Terminal" ) );
394 394
395 Config cfg( "Konsole" ); 395 Config cfg( "Konsole" );
396 cfg.setGroup("Font"); 396 cfg.setGroup("Font");
397 QString tmp; 397 QString tmp;
398 398
399 // initialize the list of allowed fonts /////////////////////////////////// 399 // initialize the list of allowed fonts ///////////////////////////////////
400 400
401 QString cfgFontName = cfg.readEntry("FontName","Lcfont"); 401 QString cfgFontName = cfg.readEntry("FontName","Lcfont");
402 int cfgFontSize = cfg.readNumEntry("FontSize",18); 402 int cfgFontSize = cfg.readNumEntry("FontSize",18);
403 403
404 cfont = -1; 404 cfont = -1;
405 405
406 // this code causes repeated access to all the font files 406 // this code causes repeated access to all the font files
407 // which does slow down startup 407 // which does slow down startup
408 QFontDatabase fontDB; 408 QFontDatabase fontDB;
409 QStringList familyNames; 409 QStringList familyNames;
410 familyNames = fontDB.families( FALSE ); 410 familyNames = fontDB.families( FALSE );
411 QString s; 411 QString s;
412 int fontIndex = 0; 412 int fontIndex = 0;
413 int familyNum = 0; 413 int familyNum = 0;
414 fontList = new QPopupMenu( this ); 414 fontList = new QPopupMenu( this );
415 415
416 for(uint j = 0; j < (uint)familyNames.count(); j++) 416 for(uint j = 0; j < (uint)familyNames.count(); j++)
417 { 417 {
418 s = familyNames[j]; 418 s = familyNames[j];
419 if ( s.contains('-') ) 419 if ( s.contains('-') )
420 { 420 {
421 int i = s.find('-'); 421 int i = s.find('-');
422 s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; 422 s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]";
423 } 423 }
424 s[0] = s[0].upper(); 424 s[0] = s[0].upper();
425 425
426 QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); 426 QValueList<int> sizes = fontDB.pointSizes( familyNames[j] );
427 427
428 printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), 428 printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(),
429 sizes.count()); 429 sizes.count());
430 430
431 if (sizes.count() > 0) 431 if (sizes.count() > 0)
432 { 432 {
433 QPopupMenu *sizeMenu; 433 QPopupMenu *sizeMenu;
434 QFont f; 434 QFont f;
435 int last_width = -1; 435 int last_width = -1;
436 sizeMenu = NULL; 436 sizeMenu = NULL;
437 437
438 for(uint i = 0; i < (uint)sizes.count() + 4; i++) 438 for(uint i = 0; i < (uint)sizes.count() + 4; i++)
439 { 439 {
440 // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); 440 // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]);
441 // need to divide by 10 on the Z, but not otherwise 441 // need to divide by 10 on the Z, but not otherwise
442 int size; 442 int size;
443 443
444 if (i >= (uint)sizes.count()) 444 if (i >= (uint)sizes.count())
445 { 445 {
446 // try for expandable fonts 446 // try for expandable fonts
447 size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); 447 size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1);
448 } 448 }
449 else 449 else
450 { 450 {
451 printf("sizes[%d] = %d\n", i, sizes[i]); 451 printf("sizes[%d] = %d\n", i, sizes[i]);
452 size = sizes[i]; 452 size = sizes[i];
453 } 453 }
454 454
455 f = QFont(familyNames[j], size); 455 f = QFont(familyNames[j], size);
456 f.setFixedPitch(true); 456 f.setFixedPitch(true);
457 QFontMetrics fm(f); 457 QFontMetrics fm(f);
458 // don't trust f.fixedPitch() or f.exactMatch(), they lie!! 458 // don't trust f.fixedPitch() or f.exactMatch(), they lie!!
459 if (fm.width("l") == fm.width("m") 459 if (fm.width("l") == fm.width("m")
460 && (i < (uint)sizes.count() 460 && (i < (uint)sizes.count()
461 || fm.width("m") > last_width)) 461 || fm.width("m") > last_width))
462 { 462 {
463 if (i < (uint)sizes.count()) 463 if (i < (uint)sizes.count())
464 { 464 {
465 last_width = fm.width("m"); 465 last_width = fm.width("m");
466 } 466 }
467 if (sizeMenu == NULL) 467 if (sizeMenu == NULL)
468 { 468 {
469 sizeMenu = new QPopupMenu(); 469 sizeMenu = new QPopupMenu();
470 } 470 }
471 int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); 471 int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex);
472 sizeMenu->setItemParameter(id, fontIndex); 472 sizeMenu->setItemParameter(id, fontIndex);
473 sizeMenu->connectItem(id, this, SLOT(setFont(int))); 473 sizeMenu->connectItem(id, this, SLOT(setFont(int)));
474 QString name = s + " " + QString::number(size); 474 QString name = s + " " + QString::number(size);
475 fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); 475 fonts.append(new VTFont(name, f, familyNames[j], familyNum, size));
476 if (familyNames[j] == cfgFontName && size == cfgFontSize) 476 if (familyNames[j] == cfgFontName && size == cfgFontSize)
477 { 477 {
478 cfont = fontIndex; 478 cfont = fontIndex;
479 } 479 }
480 printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); 480 printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size);
481 fontIndex++; 481 fontIndex++;
482 } 482 }
483 } 483 }
484 if (sizeMenu) 484 if (sizeMenu)
485 { 485 {
486 fontList->insertItem(s, sizeMenu, familyNum + 1000); 486 fontList->insertItem(s, sizeMenu, familyNum + 1000);
487 487
488 familyNum++; 488 familyNum++;
489 } 489 }
490 } 490 }
491 491
492 } 492 }
493 493
494 if (cfont < 0 || cfont >= (int)fonts.count()) 494 if (cfont < 0 || cfont >= (int)fonts.count())
495 { 495 {
496 cfont = 0; 496 cfont = 0;
497 } 497 }
498 498
499 // create terminal emulation framework //////////////////////////////////// 499 // create terminal emulation framework ////////////////////////////////////
500 nsessions = 0; 500 nsessions = 0;
501 501
502 tab = new EKNumTabWidget(this); 502 tab = new EKNumTabWidget(this);
503 // tab->setMargin(tab->margin()-5); 503 // tab->setMargin(tab->margin()-5);
504 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); 504 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
505 505
506 // create terminal toolbar //////////////////////////////////////////////// 506 // create terminal toolbar ////////////////////////////////////////////////
507 setToolBarsMovable( FALSE ); 507 setToolBarsMovable( FALSE );
508 menuToolBar = new QToolBar( this ); 508 menuToolBar = new QToolBar( this );
509 menuToolBar->setHorizontalStretchable( TRUE ); 509 menuToolBar->setHorizontalStretchable( TRUE );
510 510
511 QMenuBar *menuBar = new QMenuBar( menuToolBar ); 511 QMenuBar *menuBar = new QMenuBar( menuToolBar );
512 512
513 setFont(cfont); 513 setFont(cfont);
514 514
515 configMenu = new QPopupMenu( this); 515 configMenu = new QPopupMenu( this);
516 colorMenu = new QPopupMenu( this); 516 colorMenu = new QPopupMenu( this);
517 scrollMenu = new QPopupMenu( this); 517 scrollMenu = new QPopupMenu( this);
518 editCommandListMenu = new QPopupMenu( this); 518 editCommandListMenu = new QPopupMenu( this);
519 519
520 configMenu->insertItem(tr("Command List"), editCommandListMenu); 520 configMenu->insertItem(tr("Command List"), editCommandListMenu);
521 521
522 bool listHidden; 522 bool listHidden;
523 cfg.setGroup("Menubar"); 523 cfg.setGroup("Menubar");
524 if( cfg.readEntry("Hidden","FALSE") == "TRUE") 524 if( cfg.readEntry("Hidden","FALSE") == "TRUE")
525 { 525 {
526 ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); 526 ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" ));
527 listHidden=TRUE; 527 listHidden=TRUE;
528 } 528 }
529 else 529 else
530 { 530 {
531 ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); 531 ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" ));
532 listHidden=FALSE; 532 listHidden=FALSE;
533 } 533 }
534 534
535 cfg.setGroup("Tabs"); 535 cfg.setGroup("Tabs");
536 536
537 tabMenu = new QPopupMenu(this); 537 tabMenu = new QPopupMenu(this);
538 tm_bottom = tabMenu->insertItem(tr("Bottom" )); 538 tm_bottom = tabMenu->insertItem(tr("Bottom" ));
539 tm_top = tabMenu->insertItem(tr("Top")); 539 tm_top = tabMenu->insertItem(tr("Top"));
540 tm_hidden = tabMenu->insertItem(tr("Hidden")); 540 tm_hidden = tabMenu->insertItem(tr("Hidden"));
541 541
542 configMenu->insertItem(tr("Tabs"), tabMenu); 542 configMenu->insertItem(tr("Tabs"), tabMenu);
543 543
544 tmp=cfg.readEntry("Position","Top"); 544 tmp=cfg.readEntry("Position","Top");
545 if(tmp=="Top") 545 if(tmp=="Top")
546 { 546 {
547 tab->setTabPosition(QTabWidget::Top); 547 tab->setTabPosition(QTabWidget::Top);
548 tab->getTabBar()->show(); 548 tab->getTabBar()->show();
549 tabPos = tm_top; 549 tabPos = tm_top;
550 } 550 }
551 else if (tmp=="Bottom") 551 else if (tmp=="Bottom")
552 { 552 {
553 tab->setTabPosition(QTabWidget::Bottom); 553 tab->setTabPosition(QTabWidget::Bottom);
554 tab->getTabBar()->show(); 554 tab->getTabBar()->show();
555 tabPos = tm_bottom; 555 tabPos = tm_bottom;
556 } 556 }
557 else 557 else
558 { 558 {
559 tab->getTabBar()->hide(); 559 tab->getTabBar()->hide();
560 tab->setMargin(tab->margin()); 560 tab->setMargin(tab->margin());
561 tabPos = tm_hidden; 561 tabPos = tm_hidden;
562 } 562 }
563 563
564 cm_bw = colorMenu->insertItem(tr( "Black on White")); 564 cm_bw = colorMenu->insertItem(tr( "Black on White"));
565 cm_wb = colorMenu->insertItem(tr( "White on Black")); 565 cm_wb = colorMenu->insertItem(tr( "White on Black"));
566 cm_gb = colorMenu->insertItem(tr( "Green on Black")); 566 cm_gb = colorMenu->insertItem(tr( "Green on Black"));
567 // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); 567 // cm_bt = colorMenu->insertItem(tr( "Black on Transparent"));
568 cm_br = colorMenu->insertItem(tr( "Black on Pink")); 568 cm_br = colorMenu->insertItem(tr( "Black on Pink"));
569 cm_rb = colorMenu->insertItem(tr( "Pink on Black")); 569 cm_rb = colorMenu->insertItem(tr( "Pink on Black"));
570 cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); 570 cm_gy = colorMenu->insertItem(tr( "Green on Yellow"));
571 cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); 571 cm_bm = colorMenu->insertItem(tr( "Blue on Magenta"));
572 cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); 572 cm_mb = colorMenu->insertItem(tr( "Magenta on Blue"));
573 cm_cw = colorMenu->insertItem(tr( "Cyan on White")); 573 cm_cw = colorMenu->insertItem(tr( "Cyan on White"));
574 cm_wc = colorMenu->insertItem(tr( "White on Cyan")); 574 cm_wc = colorMenu->insertItem(tr( "White on Cyan"));
575 cm_bb = colorMenu->insertItem(tr( "Blue on Black")); 575 cm_bb = colorMenu->insertItem(tr( "Blue on Black"));
576 cm_ab = colorMenu->insertItem(tr( "Amber on Black")); 576 cm_ab = colorMenu->insertItem(tr( "Amber on Black"));
577 cm_default = colorMenu->insertItem(tr("default")); 577 cm_default = colorMenu->insertItem(tr("default"));
578 578
579#ifdef QT_QWS_OPIE 579#ifdef QT_QWS_OPIE
580 580
581 colorMenu->insertItem(tr( "Custom")); 581 colorMenu->insertItem(tr( "Custom"));
582#endif 582#endif
583 583
584 configMenu->insertItem(tr( "Colors") ,colorMenu); 584 configMenu->insertItem(tr( "Colors") ,colorMenu);
585 585
586 sessionList = new QPopupMenu(this); 586 sessionList = new QPopupMenu(this);
587 sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this, 587 sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this,
588 SLOT(newSession()) ); 588 SLOT(newSession()) );
589 589
590 // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 590 // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
591 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 591 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
592 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); 592 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) ));
593 connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); 593 connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) ));
594 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); 594 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
595 connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); 595 connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
596 connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); 596 connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) );
597 597
598 menuBar->insertItem( tr("View"), configMenu ); 598 menuBar->insertItem( tr("View"), configMenu );
599 menuBar->insertItem( tr("Fonts"), fontList ); 599 menuBar->insertItem( tr("Fonts"), fontList );
600 menuBar->insertItem( tr("Sessions"), sessionList ); 600 menuBar->insertItem( tr("Sessions"), sessionList );
601 601
602 toolBar = new QToolBar( this ); 602 toolBar = new QToolBar( this );
603 603
604 QAction *a; 604 QAction *a;
605 605
606 // Button Commands 606 // Button Commands
607 a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 ); 607 a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 );
608 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); 608 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) );
609 a->addTo( toolBar ); 609 a->addTo( toolBar );
610 610
611 a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); 611 a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 );
612 connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); 612 connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) );
613 a->addTo( toolBar ); 613 a->addTo( toolBar );
614 614
615 a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); 615 a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 );
616 connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); 616 connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) );
617 a->addTo( toolBar ); 617 a->addTo( toolBar );
618 618
619 619
620 /*
621 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 620 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
622 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); 621 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar );
623 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); 622 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 );
624 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); 623 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar );
625 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); 624 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 );
626 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); 625 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar );
627 */
628 /*
629 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); 626 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
630 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); 627 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar );
631 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); 628 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
632 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); 629 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar );
633 */ 630
634 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 631 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
635 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); 632 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) );
636 a->addTo( toolBar ); 633 a->addTo( toolBar );
637 634
638 secondToolBar = new QToolBar( this ); 635 secondToolBar = new QToolBar( this );
639 secondToolBar->setHorizontalStretchable( TRUE ); 636 secondToolBar->setHorizontalStretchable( TRUE );
640 637
641 commonCombo = new QComboBox( secondToolBar ); 638 commonCombo = new QComboBox( secondToolBar );
642 // commonCombo->setMaximumWidth(236); 639 // commonCombo->setMaximumWidth(236);
643 640
644 ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); 641 ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) );
645 if( listHidden) 642 if( listHidden)
646 { 643 {
647 secondToolBar->hide(); 644 secondToolBar->hide();
648 editCommandListMenu->setItemEnabled(ec_quick ,FALSE); 645 editCommandListMenu->setItemEnabled(ec_quick ,FALSE);
649 } 646 }
650 ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); 647 ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) );
651 648
652 cfg.setGroup("Commands"); 649 cfg.setGroup("Commands");
653 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 650 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
654 651
655 initCommandList(); 652 initCommandList();
656 // for (int i = 0; commonCmds[i] != NULL; i++) { 653 // for (int i = 0; commonCmds[i] != NULL; i++) {
657 // commonCombo->insertItem( commonCmds[i], i ); 654 // commonCombo->insertItem( commonCmds[i], i );
658 // tmp = cfg.readEntry( QString::number(i),""); 655 // tmp = cfg.readEntry( QString::number(i),"");
659 // if(tmp != "") 656 // if(tmp != "")
660 // commonCombo->changeItem( tmp,i ); 657 // commonCombo->changeItem( tmp,i );
661 // } 658 // }
662 659
663 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 660 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
664 661
665 sm_none = scrollMenu->insertItem(tr( "None" )); 662 sm_none = scrollMenu->insertItem(tr( "None" ));
666 sm_left = scrollMenu->insertItem(tr( "Left" )); 663 sm_left = scrollMenu->insertItem(tr( "Left" ));
667 sm_right = scrollMenu->insertItem(tr( "Right" )); 664 sm_right = scrollMenu->insertItem(tr( "Right" ));
668 // scrollMenu->insertSeparator(4); 665 // scrollMenu->insertSeparator(4);
669 // scrollMenu->insertItem(tr( "Horizontal" )); 666 // scrollMenu->insertItem(tr( "Horizontal" ));
670 667
671 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); 668 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
672 669
673 configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); 670 configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog()));
674 671
675 cm_wrap = configMenu->insertItem(tr( "Wrap" )); 672 cm_wrap = configMenu->insertItem(tr( "Wrap" ));
676 cfg.setGroup("ScrollBar"); 673 cfg.setGroup("ScrollBar");
677 configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); 674 configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0));
678 675
679 cm_beep = configMenu->insertItem(tr( "Use Beep" )); 676 cm_beep = configMenu->insertItem(tr( "Use Beep" ));
680 cfg.setGroup("Menubar"); 677 cfg.setGroup("Menubar");
681 configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); 678 configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0));
682 679
683 fullscreen_msg = new QLabel(this); 680 fullscreen_msg = new QLabel(this);
684 fullscreen_msg-> setAlignment ( AlignCenter | SingleLine ); 681 fullscreen_msg-> setAlignment ( AlignCenter | SingleLine );
685 fullscreen_msg-> hide(); 682 fullscreen_msg-> hide();
686 fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); 683 fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding ));
687 fullscreen_msg-> setAutoResize(true); 684 fullscreen_msg-> setAutoResize(true);
688 fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 685 fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
689 fullscreen_msg-> setText(tr("To exit fullscreen, tap here.")); 686 fullscreen_msg-> setText(tr("To exit fullscreen, tap here."));
690 687
691 fullscreen_timer = new QTimer(this); 688 fullscreen_timer = new QTimer(this);
692 connect(fullscreen_timer, SIGNAL(timeout()), 689 connect(fullscreen_timer, SIGNAL(timeout()),
693 this, SLOT(fullscreenTimeout())); 690 this, SLOT(fullscreenTimeout()));
694 show_fullscreen_msg = true; 691 show_fullscreen_msg = true;
695 692
696 //scrollMenuSelected(-29); 693 //scrollMenuSelected(-29);
697 // cfg.setGroup("ScrollBar"); 694 // cfg.setGroup("ScrollBar");
698 // if(cfg.readBoolEntry("HorzScroll",0)) { 695 // if(cfg.readBoolEntry("HorzScroll",0)) {
699 // if(cfg.readNumEntry("Position",2) == 0) 696 // if(cfg.readNumEntry("Position",2) == 0)
700 // te->setScrollbarLocation(1); 697 // te->setScrollbarLocation(1);
701 // else 698 // else
702 // te->setScrollbarLocation(0); 699 // te->setScrollbarLocation(0);
703 // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); 700 // te->setScrollbarLocation( cfg.readNumEntry("Position",2));
704 // te->setWrapAt(120); 701 // te->setWrapAt(120);
705 // } 702 // }
706 // create applications ///////////////////////////////////////////////////// 703 // create applications /////////////////////////////////////////////////////
707 setCentralWidget(tab); 704 setCentralWidget(tab);
708 705
709 // load keymaps //////////////////////////////////////////////////////////// 706 // load keymaps ////////////////////////////////////////////////////////////
710 KeyTrans::loadAll(); 707 KeyTrans::loadAll();
711 for (int i = 0; i < KeyTrans::count(); i++) 708 for (int i = 0; i < KeyTrans::count(); i++)
712 { 709 {
713 KeyTrans* s = KeyTrans::find(i); 710 KeyTrans* s = KeyTrans::find(i);
714 assert( s ); 711 assert( s );
715 } 712 }
716 713
717 se_pgm = _pgm; 714 se_pgm = _pgm;
718 se_args = _args; 715 se_args = _args;
719 716
720 cfg.setGroup("CommandLine"); 717 cfg.setGroup("CommandLine");
721 718
722 if (cfg.hasKey("shell_args")) 719 if (cfg.hasKey("shell_args"))
723 { 720 {
724 QStringList se_args_list = cfg.readListEntry("shell_args",'|'); 721 QStringList se_args_list = cfg.readListEntry("shell_args",'|');
725 for(uint i = 0; i < se_args_list.count(); i++) 722 for(uint i = 0; i < se_args_list.count(); i++)
726 { 723 {
727 se_args.prepend(se_args_list[se_args_list.count() - i - 1].latin1()); 724 se_args.prepend(se_args_list[se_args_list.count() - i - 1].latin1());
728 } 725 }
729 } 726 }
730 else 727 else
731 { 728 {
732 se_args.prepend("--login"); 729 se_args.prepend("--login");
733 } 730 }
734 731
735 se_pgm = cfg.readEntry("shell_bin", QString(se_pgm)); 732 se_pgm = cfg.readEntry("shell_bin", QString(se_pgm));
736 733
737 // this is the "documentation" for those who know to look 734 // this is the "documentation" for those who know to look
738 if (! cfg.hasKey("shell_args")) 735 if (! cfg.hasKey("shell_args"))
739 { 736 {
740 cfg.writeEntry("shell_args",QStringList::fromStrList(se_args),'|'); 737 cfg.writeEntry("shell_args",QStringList::fromStrList(se_args),'|');
741 } 738 }
742 if (! cfg.hasKey("shell_bin")) 739 if (! cfg.hasKey("shell_bin"))
743 { 740 {
744 cfg.writeEntry("shell_bin",QString(se_pgm)); 741 cfg.writeEntry("shell_bin",QString(se_pgm));
745 } 742 }
746 743
747 parseCommandLine(); 744 parseCommandLine();
748 745
749 // read and apply default values /////////////////////////////////////////// 746 // read and apply default values ///////////////////////////////////////////
750 resize(321, 321); // Dummy. 747 resize(321, 321); // Dummy.
751 QSize currentSize = size(); 748 QSize currentSize = size();
752 if (currentSize != size()) 749 if (currentSize != size())
753 defaultSize = size(); 750 defaultSize = size();
754 751
755 752
756 /* allows us to catch cancel/escape */ 753 /* allows us to catch cancel/escape */
757 reparent ( 0, WStyle_Customize | WStyle_NoBorder, 754 reparent ( 0, WStyle_Customize | WStyle_NoBorder,
758 QPoint ( 0, 0 )); 755 QPoint ( 0, 0 ));
759} 756}
760 757
761void Konsole::show() 758void Konsole::show()
762{ 759{
763 if ( !nsessions ) 760 if ( !nsessions )
764 { 761 {
765 newSession(); 762 newSession();
766 } 763 }
767 QMainWindow::show(); 764 QMainWindow::show();
768 765
769} 766}
770 767
771void Konsole::initSession(const char*, QStrList &) 768void Konsole::initSession(const char*, QStrList &)
772{ 769{
773 QMainWindow::show(); 770 QMainWindow::show();
774} 771}
775 772
776Konsole::~Konsole() 773Konsole::~Konsole()
777{ 774{
778 while (nsessions > 0) 775 while (nsessions > 0)
779 { 776 {
780 doneSession(getTe(), 0); 777 doneSession(getTe(), 0);
781 } 778 }
782} 779}
783 780
784void 781void
785Konsole::historyDialog() 782Konsole::historyDialog()
786{ 783{
787 QDialog *d = new QDialog ( this, "histdlg", true ); 784 QDialog *d = new QDialog ( this, "histdlg", true );
788 // d-> setCaption ( tr( "History" )); 785 // d-> setCaption ( tr( "History" ));
789 786
790 QBoxLayout *lay = new QVBoxLayout ( d, 4, 4 ); 787 QBoxLayout *lay = new QVBoxLayout ( d, 4, 4 );
791 788
792 QLabel *l = new QLabel ( tr( "History Lines:" ), d ); 789 QLabel *l = new QLabel ( tr( "History Lines:" ), d );
793 lay-> addWidget ( l ); 790 lay-> addWidget ( l );
794 791
795 Config cfg( "Konsole" ); 792 Config cfg( "Konsole" );
796 cfg.setGroup("History"); 793 cfg.setGroup("History");
797 int hist = cfg.readNumEntry("history_lines",300); 794 int hist = cfg.readNumEntry("history_lines",300);
798 int avg_line = cfg.readNumEntry("avg_line_length",60); 795 int avg_line = cfg.readNumEntry("avg_line_length",60);
799 796
800 QSpinBox *spin = new QSpinBox ( 1, 100000, 20, d ); 797 QSpinBox *spin = new QSpinBox ( 1, 100000, 20, d );
801 spin-> setValue ( hist ); 798 spin-> setValue ( hist );
802 spin-> setWrapping ( true ); 799 spin-> setWrapping ( true );
803 spin-> setButtonSymbols ( QSpinBox::PlusMinus ); 800 spin-> setButtonSymbols ( QSpinBox::PlusMinus );
804 lay-> addWidget ( spin ); 801 lay-> addWidget ( spin );
805 802
806 if ( d-> exec ( ) == QDialog::Accepted ) 803 if ( d-> exec ( ) == QDialog::Accepted )
807 { 804 {
808 cfg.writeEntry("history_lines", spin->value()); 805 cfg.writeEntry("history_lines", spin->value());
809 cfg.writeEntry("avg_line_length", avg_line); 806 cfg.writeEntry("avg_line_length", avg_line);
810 if (getTe() != NULL) 807 if (getTe() != NULL)
811 { 808 {
812 getTe()->currentSession->setHistory(true); 809 getTe()->currentSession->setHistory(true);
813 } 810 }
814 } 811 }
815 812
816 delete d; 813 delete d;
817} 814}
818 815
819 816
820void Konsole::cycleZoom() 817void Konsole::cycleZoom()
821{ 818{
822 TEWidget* te = getTe(); 819 TEWidget* te = getTe();
823 QFont font = te->getVTFont(); 820 QFont font = te->getVTFont();
824 int size = font.pointSize(); 821 int size = font.pointSize();
825 changeFontSize(1); 822 changeFontSize(1);
826 font = te->getVTFont(); 823 font = te->getVTFont();
827 if (font.pointSize() <= size) 824 if (font.pointSize() <= size)
828 { 825 {
829 do 826 do
830 { 827 {
831 font = te->getVTFont(); 828 font = te->getVTFont();
832 size = font.pointSize(); 829 size = font.pointSize();
833 changeFontSize(-1); 830 changeFontSize(-1);
834 font = te->getVTFont(); 831 font = te->getVTFont();
835 } 832 }
836 while (font.pointSize() < size); 833 while (font.pointSize() < size);
837 } 834 }
838} 835}
839 836
840void Konsole::changeFontSize(int delta) 837void Konsole::changeFontSize(int delta)
841{ 838{
842 // printf("delta font size %d\n", delta); 839 // printf("delta font size %d\n", delta);
843 TEWidget* te = getTe(); 840 TEWidget* te = getTe();
844 QFont font = te->getVTFont(); 841 QFont font = te->getVTFont();
845 int size = font.pointSize(); 842 int size = font.pointSize();
846 int closest = delta > 0? 10000 : -10000; 843 int closest = delta > 0? 10000 : -10000;
847 int closest_font = -1; 844 int closest_font = -1;
848 for(uint i = 0; i < fonts.count(); i++) 845 for(uint i = 0; i < fonts.count(); i++)
849 { 846 {
850 if (fonts.at(i)->getFont() == font) 847 if (fonts.at(i)->getFont() == font)
851 { 848 {
852 if (delta > 0) 849 if (delta > 0)
853 { 850 {
854 if (i+1 < fonts.count() 851 if (i+1 < fonts.count()
855 && fonts.at(i+1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) 852 && fonts.at(i+1)->getFamilyNum() == fonts.at(i)->getFamilyNum())
856 { 853 {
857 setFont(i+1); 854 setFont(i+1);
858 printf("font %d\n", i+1); 855 printf("font %d\n", i+1);
859 return; 856 return;
860 } 857 }
861 } 858 }
862 else if (delta < 0) 859 else if (delta < 0)
863 { 860 {
864 if (i > 0 861 if (i > 0
865 && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) 862 && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum())
866 { 863 {
867 setFont(i-1); 864 setFont(i-1);
868 printf("font %d\n", i-1); 865 printf("font %d\n", i-1);
869 return; 866 return;
870 } 867 }
871 } 868 }
872 } 869 }
873 int fsize = fonts.at(i)->getSize(); 870 int fsize = fonts.at(i)->getSize();
874 printf("%d size=%d fsize=%d closest=%d\n", i, size, fsize, closest); 871 printf("%d size=%d fsize=%d closest=%d\n", i, size, fsize, closest);
875 if ((delta > 0 && fsize > size && fsize < closest) 872 if ((delta > 0 && fsize > size && fsize < closest)
876 || (delta < 0 && fsize < size && fsize > closest)) 873 || (delta < 0 && fsize < size && fsize > closest))
877 { 874 {
878 closest = fsize; 875 closest = fsize;
879 closest_font = i; 876 closest_font = i;
880 } 877 }
881 } 878 }
882 if (closest_font >= 0) 879 if (closest_font >= 0)
883 { 880 {
884 printf("font closest %d (%d)\n", closest_font, closest); 881 printf("font closest %d (%d)\n", closest_font, closest);
885 setFont(closest_font); 882 setFont(closest_font);
886 } 883 }
887} 884}
888 885
889int Konsole::findFont(const QString& name, int size, bool exactMatch) 886int Konsole::findFont(const QString& name, int size, bool exactMatch)
890{ 887{
891 for(uint i = 0; i < fonts.count(); i++) 888 for(uint i = 0; i < fonts.count(); i++)
892 { 889 {
893 if (fonts.at(i)->getName() == name 890 if (fonts.at(i)->getName() == name
894 && fonts.at(i)->getSize() == size) 891 && fonts.at(i)->getSize() == size)
895 { 892 {
896 return(i); 893 return(i);
897 } 894 }
898 } 895 }
899 if (exactMatch) 896 if (exactMatch)
900 { 897 {
901 return(-1); 898 return(-1);
902 } 899 }
903 for(uint i = 0; i < fonts.count(); i++) 900 for(uint i = 0; i < fonts.count(); i++)
904 { 901 {
905 if (fonts.at(i)->getSize() == size) 902 if (fonts.at(i)->getSize() == size)
906 { 903 {
907 return(i); 904 return(i);
908 } 905 }
909 } 906 }
910 return(-1); 907 return(-1);
911} 908}
912 909
913void Konsole::setFont(int f) 910void Konsole::setFont(int f)
914{ 911{
915 VTFont* font = fonts.at(f); 912 VTFont* font = fonts.at(f);
916 if (font) 913 if (font)
917 { 914 {
918 TEWidget* te = getTe(); 915 TEWidget* te = getTe();
919 if (te != 0) 916 if (te != 0)
920 { 917 {
921 te->setVTFont(font->getFont()); 918 te->setVTFont(font->getFont());
922 } 919 }
923 cfont = f; 920 cfont = f;
924 921
925 int familyNum = font->getFamilyNum(); 922 int familyNum = font->getFamilyNum();
926 int size = font->getSize(); 923 int size = font->getSize();
927 printf("familyNum = %d size = %d count=%d\n", familyNum, size, 924 printf("familyNum = %d size = %d count=%d\n", familyNum, size,
928 fontList->count()); 925 fontList->count());
929 for(int i = 0; i < (int)fontList->count(); i++) 926 for(int i = 0; i < (int)fontList->count(); i++)
930 { 927 {
931 fontList->setItemChecked(i + 1000, i == familyNum); 928 fontList->setItemChecked(i + 1000, i == familyNum);
932 } 929 }
933 for(int i = 0; i < (int)fonts.count(); i++) 930 for(int i = 0; i < (int)fonts.count(); i++)
934 { 931 {
935 fontList->setItemChecked(i, fonts.at(i)->getFamilyNum() == familyNum 932 fontList->setItemChecked(i, fonts.at(i)->getFamilyNum() == familyNum
936 && fonts.at(i)->getSize() == size); 933 && fonts.at(i)->getSize() == size);
937 } 934 }
938 Config cfg( "Konsole" ); 935 Config cfg( "Konsole" );
939 cfg.setGroup("Font"); 936 cfg.setGroup("Font");
940 QString ss = "Session"+ QString::number(tab->currentPageIndex()+1); 937 QString ss = "Session"+ QString::number(tab->currentPageIndex()+1);
941 if (tab->currentPageIndex() == 0) 938 if (tab->currentPageIndex() == 0)
942 { 939 {
943 cfg.writeEntry("FontName", fonts.at(cfont)->getFamily()); 940 cfg.writeEntry("FontName", fonts.at(cfont)->getFamily());
944 cfg.writeEntry("FontSize", fonts.at(cfont)->getSize()); 941 cfg.writeEntry("FontSize", fonts.at(cfont)->getSize());
945 } 942 }
946 cfg.writeEntry("FontName"+ss, fonts.at(cfont)->getFamily()); 943 cfg.writeEntry("FontName"+ss, fonts.at(cfont)->getFamily());
947 cfg.writeEntry("FontSize"+ss, fonts.at(cfont)->getSize()); 944 cfg.writeEntry("FontSize"+ss, fonts.at(cfont)->getSize());
948 } 945 }
949} 946}
950 947
951#if 0 948#if 0
952void Konsole::fontChanged(int f) 949void Konsole::fontChanged(int f)
953{ 950{
954 VTFont* font = fonts.at(f); 951 VTFont* font = fonts.at(f);
955 if (font != 0) 952 if (font != 0)
956 { 953 {
957 for(uint i = 0; i < fonts.count(); i++) 954 for(uint i = 0; i < fonts.count(); i++)
958 { 955 {
959 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); 956 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE);
960 } 957 }
961 958
962 cfont = f; 959 cfont = f;
963 960
964 TEWidget* te = getTe(); 961 TEWidget* te = getTe();
965 if (te != 0) 962 if (te != 0)
966 { 963 {
967 te->setVTFont(font->getFont()); 964 te->setVTFont(font->getFont());
968 } 965 }
969 } 966 }
970} 967}
971#endif 968#endif
972 969
973 970
974void Konsole::enterCommand(int c) 971void Konsole::enterCommand(int c)
975{ 972{
976 TEWidget* te = getTe(); 973 TEWidget* te = getTe();
977 if (te != 0) 974 if (te != 0)
978 { 975 {
979 if(!commonCombo->editable()) 976 if(!commonCombo->editable())
980 { 977 {
981 QString text = commonCombo->text(c); //commonCmds[c]; 978 QString text = commonCombo->text(c); //commonCmds[c];
982 te->emitText(text); 979 te->emitText(text);
983 } 980 }
984 else 981 else
985 { 982 {
986 changeCommand( commonCombo->text(c), c); 983 changeCommand( commonCombo->text(c), c);
987 } 984 }
988 } 985 }
989} 986}
990 987
991void Konsole::hitEnter() 988void Konsole::hitEnter()
992{ 989{
993 TEWidget* te = getTe(); 990 TEWidget* te = getTe();
994 if (te != 0) 991 if (te != 0)
995 { 992 {
996 te->emitText(QString("\r")); 993 te->emitText(QString("\r"));
997 } 994 }
998} 995}
999 996
1000void Konsole::hitSpace() 997void Konsole::hitSpace()
1001{ 998{
1002 TEWidget* te = getTe(); 999 TEWidget* te = getTe();
1003 if (te != 0) 1000 if (te != 0)
1004 { 1001 {
1005 te->emitText(QString(" ")); 1002 te->emitText(QString(" "));
1006 } 1003 }
1007} 1004}
1008 1005
1009void Konsole::hitTab() 1006void Konsole::hitTab()
1010{ 1007{
1011 TEWidget* te = getTe(); 1008 TEWidget* te = getTe();
1012 if (te != 0) 1009 if (te != 0)
1013 { 1010 {
1014 te->emitText(QString("\t")); 1011 te->emitText(QString("\t"));
1015 } 1012 }
1016} 1013}
1017 1014