summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-04-07 07:56:05 (UTC)
committer llornkcor <llornkcor>2004-04-07 07:56:05 (UTC)
commit00dda4de55885bf3942fe3d4b6cd552ee6f020bf (patch) (unidiff)
tree476f0e48eb5cef00b97c0602a846918d90974320
parenta1221f718bb1e9bcb6318dbf3314b9a35891caac (diff)
downloadopie-00dda4de55885bf3942fe3d4b6cd552ee6f020bf.zip
opie-00dda4de55885bf3942fe3d4b6cd552ee6f020bf.tar.gz
opie-00dda4de55885bf3942fe3d4b6cd552ee6f020bf.tar.bz2
re-add enter,space,tab,up,down icons, as convience for non keyboarded devices
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
@@ -364,526 +364,523 @@ void Konsole::initCommandList()
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)