-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 7812e4c..b8f009d 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -451,408 +451,408 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
451 | if (sizeMenu == NULL) | 451 | if (sizeMenu == NULL) |
452 | { | 452 | { |
453 | sizeMenu = new QPopupMenu(); | 453 | sizeMenu = new QPopupMenu(); |
454 | } | 454 | } |
455 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); | 455 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); |
456 | sizeMenu->setItemParameter(id, fontIndex); | 456 | sizeMenu->setItemParameter(id, fontIndex); |
457 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); | 457 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); |
458 | QString name = s + " " + QString::number(size); | 458 | QString name = s + " " + QString::number(size); |
459 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); | 459 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); |
460 | if (familyNames[j] == cfgFontName && size == cfgFontSize) | 460 | if (familyNames[j] == cfgFontName && size == cfgFontSize) |
461 | { | 461 | { |
462 | cfont = fontIndex; | 462 | cfont = fontIndex; |
463 | } | 463 | } |
464 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); | 464 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); |
465 | fontIndex++; | 465 | fontIndex++; |
466 | } | 466 | } |
467 | } | 467 | } |
468 | if (sizeMenu) | 468 | if (sizeMenu) |
469 | { | 469 | { |
470 | fontList->insertItem(s, sizeMenu, familyNum + 1000); | 470 | fontList->insertItem(s, sizeMenu, familyNum + 1000); |
471 | 471 | ||
472 | familyNum++; | 472 | familyNum++; |
473 | } | 473 | } |
474 | } | 474 | } |
475 | 475 | ||
476 | } | 476 | } |
477 | 477 | ||
478 | if (cfont < 0 || cfont >= (int)fonts.count()) | 478 | if (cfont < 0 || cfont >= (int)fonts.count()) |
479 | { | 479 | { |
480 | cfont = 0; | 480 | cfont = 0; |
481 | } | 481 | } |
482 | 482 | ||
483 | // create terminal emulation framework //////////////////////////////////// | 483 | // create terminal emulation framework //////////////////////////////////// |
484 | nsessions = 0; | 484 | nsessions = 0; |
485 | 485 | ||
486 | tab = new EKNumTabWidget(this); | 486 | tab = new EKNumTabWidget(this); |
487 | // tab->setMargin(tab->margin()-5); | 487 | // tab->setMargin(tab->margin()-5); |
488 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 488 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
489 | 489 | ||
490 | // create terminal toolbar //////////////////////////////////////////////// | 490 | // create terminal toolbar //////////////////////////////////////////////// |
491 | setToolBarsMovable( FALSE ); | 491 | setToolBarsMovable( FALSE ); |
492 | menuToolBar = new QToolBar( this ); | 492 | menuToolBar = new QToolBar( this ); |
493 | menuToolBar->setHorizontalStretchable( TRUE ); | 493 | menuToolBar->setHorizontalStretchable( TRUE ); |
494 | 494 | ||
495 | QMenuBar *menuBar = new QMenuBar( menuToolBar ); | 495 | QMenuBar *menuBar = new QMenuBar( menuToolBar ); |
496 | 496 | ||
497 | bool c7xx = false; | 497 | bool c7xx = false; |
498 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) | 498 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) |
499 | { | 499 | { |
500 | c7xx = true; | 500 | c7xx = true; |
501 | } | 501 | } |
502 | QFont menuFont; | 502 | QFont menuFont; |
503 | menuFont.setPointSize(c7xx? 18 : 10); | 503 | menuFont.setPointSize(c7xx? 18 : 10); |
504 | qApp->setFont(menuFont, true); | 504 | qApp->setFont(menuFont, true); |
505 | 505 | ||
506 | setFont(cfont); | 506 | setFont(cfont); |
507 | 507 | ||
508 | configMenu = new QPopupMenu( this); | 508 | configMenu = new QPopupMenu( this); |
509 | colorMenu = new QPopupMenu( this); | 509 | colorMenu = new QPopupMenu( this); |
510 | scrollMenu = new QPopupMenu( this); | 510 | scrollMenu = new QPopupMenu( this); |
511 | editCommandListMenu = new QPopupMenu( this); | 511 | editCommandListMenu = new QPopupMenu( this); |
512 | 512 | ||
513 | configMenu->insertItem(tr("Command List"), editCommandListMenu); | 513 | configMenu->insertItem(tr("Command List"), editCommandListMenu); |
514 | 514 | ||
515 | bool listHidden; | 515 | bool listHidden; |
516 | cfg.setGroup("Menubar"); | 516 | cfg.setGroup("Menubar"); |
517 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") | 517 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") |
518 | { | 518 | { |
519 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); | 519 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); |
520 | listHidden=TRUE; | 520 | listHidden=TRUE; |
521 | } | 521 | } |
522 | else | 522 | else |
523 | { | 523 | { |
524 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); | 524 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); |
525 | listHidden=FALSE; | 525 | listHidden=FALSE; |
526 | } | 526 | } |
527 | 527 | ||
528 | cfg.setGroup("Tabs"); | 528 | cfg.setGroup("Tabs"); |
529 | 529 | ||
530 | tabMenu = new QPopupMenu(this); | 530 | tabMenu = new QPopupMenu(this); |
531 | tm_bottom = tabMenu->insertItem(tr("Bottom" )); | 531 | tm_bottom = tabMenu->insertItem(tr("Bottom" )); |
532 | tm_top = tabMenu->insertItem(tr("Top")); | 532 | tm_top = tabMenu->insertItem(tr("Top")); |
533 | tm_hidden = tabMenu->insertItem(tr("Hidden")); | 533 | tm_hidden = tabMenu->insertItem(tr("Hidden")); |
534 | 534 | ||
535 | configMenu->insertItem(tr("Tabs"), tabMenu); | 535 | configMenu->insertItem(tr("Tabs"), tabMenu); |
536 | 536 | ||
537 | tmp=cfg.readEntry("Position","Top"); | 537 | tmp=cfg.readEntry("Position","Top"); |
538 | if(tmp=="Top") | 538 | if(tmp=="Top") |
539 | { | 539 | { |
540 | tab->setTabPosition(QTabWidget::Top); | 540 | tab->setTabPosition(QTabWidget::Top); |
541 | tab->getTabBar()->show(); | 541 | tab->getTabBar()->show(); |
542 | tabPos = tm_top; | 542 | tabPos = tm_top; |
543 | } | 543 | } |
544 | else if (tmp=="Bottom") | 544 | else if (tmp=="Bottom") |
545 | { | 545 | { |
546 | tab->setTabPosition(QTabWidget::Bottom); | 546 | tab->setTabPosition(QTabWidget::Bottom); |
547 | tab->getTabBar()->show(); | 547 | tab->getTabBar()->show(); |
548 | tabPos = tm_bottom; | 548 | tabPos = tm_bottom; |
549 | } | 549 | } |
550 | else | 550 | else |
551 | { | 551 | { |
552 | tab->getTabBar()->hide(); | 552 | tab->getTabBar()->hide(); |
553 | tab->setMargin(tab->margin()); | 553 | tab->setMargin(tab->margin()); |
554 | tabPos = tm_hidden; | 554 | tabPos = tm_hidden; |
555 | } | 555 | } |
556 | 556 | ||
557 | cm_bw = colorMenu->insertItem(tr( "Black on White")); | 557 | cm_bw = colorMenu->insertItem(tr( "Black on White")); |
558 | cm_wb = colorMenu->insertItem(tr( "White on Black")); | 558 | cm_wb = colorMenu->insertItem(tr( "White on Black")); |
559 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); | 559 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); |
560 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); | 560 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); |
561 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); | 561 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); |
562 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); | 562 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); |
563 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); | 563 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); |
564 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); | 564 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); |
565 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); | 565 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); |
566 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); | 566 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); |
567 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); | 567 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); |
568 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); | 568 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); |
569 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); | 569 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); |
570 | cm_default = colorMenu->insertItem(tr("default")); | 570 | cm_default = colorMenu->insertItem(tr("default")); |
571 | 571 | ||
572 | #ifdef QT_QWS_OPIE | 572 | #ifdef QT_QWS_OPIE |
573 | 573 | ||
574 | colorMenu->insertItem(tr( "Custom")); | 574 | colorMenu->insertItem(tr( "Custom")); |
575 | #endif | 575 | #endif |
576 | 576 | ||
577 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 577 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
578 | 578 | ||
579 | sessionList = new QPopupMenu(this); | 579 | sessionList = new QPopupMenu(this); |
580 | sessionList-> insertItem ( Resource::loadPixmap ( "qkonsole/qkonsole" ), tr( "new session" ), this, | 580 | sessionList-> insertItem ( Resource::loadPixmap ( "qkonsole/qkonsole" ), tr( "new session" ), this, |
581 | SLOT(newSession()) ); | 581 | SLOT(newSession()) ); |
582 | 582 | ||
583 | // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 583 | // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
584 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 584 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
585 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); | 585 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); |
586 | connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); | 586 | connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); |
587 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 587 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
588 | connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 588 | connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
589 | connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); | 589 | connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); |
590 | 590 | ||
591 | menuBar->insertItem( tr("View"), configMenu ); | 591 | menuBar->insertItem( tr("View"), configMenu ); |
592 | menuBar->insertItem( tr("Fonts"), fontList ); | 592 | menuBar->insertItem( tr("Fonts"), fontList ); |
593 | menuBar->insertItem( tr("Sessions"), sessionList ); | 593 | menuBar->insertItem( tr("Sessions"), sessionList ); |
594 | 594 | ||
595 | toolBar = new QToolBar( this ); | 595 | toolBar = new QToolBar( this ); |
596 | 596 | ||
597 | QAction *a; | 597 | QAction *a; |
598 | 598 | ||
599 | // Button Commands | 599 | // Button Commands |
600 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 ); | 600 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 ); |
601 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); | 601 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); |
602 | a->addTo( toolBar ); | 602 | a->addTo( toolBar ); |
603 | 603 | ||
604 | a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); | 604 | a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); |
605 | connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); | 605 | connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); |
606 | a->addTo( toolBar ); | 606 | a->addTo( toolBar ); |
607 | 607 | ||
608 | a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); | 608 | a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); |
609 | connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); | 609 | connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); |
610 | a->addTo( toolBar ); | 610 | a->addTo( toolBar ); |
611 | 611 | ||
612 | 612 | ||
613 | /* | 613 | /* |
614 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 614 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
615 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); | 615 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); |
616 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 616 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
617 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); | 617 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); |
618 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 618 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
619 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); | 619 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); |
620 | */ | 620 | */ |
621 | /* | 621 | /* |
622 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 622 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
623 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); | 623 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); |
624 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 624 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
625 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); | 625 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); |
626 | */ | 626 | */ |
627 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 627 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
628 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); | 628 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); |
629 | a->addTo( toolBar ); | 629 | a->addTo( toolBar ); |
630 | 630 | ||
631 | secondToolBar = new QToolBar( this ); | 631 | secondToolBar = new QToolBar( this ); |
632 | secondToolBar->setHorizontalStretchable( TRUE ); | 632 | secondToolBar->setHorizontalStretchable( TRUE ); |
633 | 633 | ||
634 | commonCombo = new QComboBox( secondToolBar ); | 634 | commonCombo = new QComboBox( secondToolBar ); |
635 | // commonCombo->setMaximumWidth(236); | 635 | // commonCombo->setMaximumWidth(236); |
636 | 636 | ||
637 | ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); | 637 | ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); |
638 | if( listHidden) | 638 | if( listHidden) |
639 | { | 639 | { |
640 | secondToolBar->hide(); | 640 | secondToolBar->hide(); |
641 | editCommandListMenu->setItemEnabled(ec_quick ,FALSE); | 641 | editCommandListMenu->setItemEnabled(ec_quick ,FALSE); |
642 | } | 642 | } |
643 | ec_edit = editCommandListMenu->insertItem(tr( "Edit" ) ); | 643 | ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); |
644 | 644 | ||
645 | cfg.setGroup("Commands"); | 645 | cfg.setGroup("Commands"); |
646 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 646 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
647 | 647 | ||
648 | initCommandList(); | 648 | initCommandList(); |
649 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 649 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
650 | // commonCombo->insertItem( commonCmds[i], i ); | 650 | // commonCombo->insertItem( commonCmds[i], i ); |
651 | // tmp = cfg.readEntry( QString::number(i),""); | 651 | // tmp = cfg.readEntry( QString::number(i),""); |
652 | // if(tmp != "") | 652 | // if(tmp != "") |
653 | // commonCombo->changeItem( tmp,i ); | 653 | // commonCombo->changeItem( tmp,i ); |
654 | // } | 654 | // } |
655 | 655 | ||
656 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 656 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
657 | 657 | ||
658 | sm_none = scrollMenu->insertItem(tr( "None" )); | 658 | sm_none = scrollMenu->insertItem(tr( "None" )); |
659 | sm_left = scrollMenu->insertItem(tr( "Left" )); | 659 | sm_left = scrollMenu->insertItem(tr( "Left" )); |
660 | sm_right = scrollMenu->insertItem(tr( "Right" )); | 660 | sm_right = scrollMenu->insertItem(tr( "Right" )); |
661 | // scrollMenu->insertSeparator(4); | 661 | // scrollMenu->insertSeparator(4); |
662 | // scrollMenu->insertItem(tr( "Horizontal" )); | 662 | // scrollMenu->insertItem(tr( "Horizontal" )); |
663 | 663 | ||
664 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 664 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
665 | 665 | ||
666 | configMenu->insertItem(tr( "History" ), this, SLOT(historyDialog())); | 666 | configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); |
667 | 667 | ||
668 | cm_wrap = configMenu->insertItem(tr( "Wrap" )); | 668 | cm_wrap = configMenu->insertItem(tr( "Wrap" )); |
669 | cfg.setGroup("ScrollBar"); | 669 | cfg.setGroup("ScrollBar"); |
670 | configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); | 670 | configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); |
671 | 671 | ||
672 | cm_beep = configMenu->insertItem(tr( "Use Beep" )); | 672 | cm_beep = configMenu->insertItem(tr( "Use Beep" )); |
673 | cfg.setGroup("Menubar"); | 673 | cfg.setGroup("Menubar"); |
674 | configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); | 674 | configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); |
675 | 675 | ||
676 | fullscreen_msg = new QLabel(this); | 676 | fullscreen_msg = new QLabel(this); |
677 | fullscreen_msg-> setAlignment ( AlignCenter | SingleLine ); | 677 | fullscreen_msg-> setAlignment ( AlignCenter | SingleLine ); |
678 | fullscreen_msg-> hide(); | 678 | fullscreen_msg-> hide(); |
679 | fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); | 679 | fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); |
680 | fullscreen_msg-> setAutoResize(true); | 680 | fullscreen_msg-> setAutoResize(true); |
681 | fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 681 | fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
682 | fullscreen_msg-> setText(tr("To exit fullscreen, tap here.")); | 682 | fullscreen_msg-> setText(tr("To exit fullscreen, tap here.")); |
683 | 683 | ||
684 | fullscreen_timer = new QTimer(this); | 684 | fullscreen_timer = new QTimer(this); |
685 | connect(fullscreen_timer, SIGNAL(timeout()), | 685 | connect(fullscreen_timer, SIGNAL(timeout()), |
686 | this, SLOT(fullscreenTimeout())); | 686 | this, SLOT(fullscreenTimeout())); |
687 | show_fullscreen_msg = true; | 687 | show_fullscreen_msg = true; |
688 | 688 | ||
689 | //scrollMenuSelected(-29); | 689 | //scrollMenuSelected(-29); |
690 | // cfg.setGroup("ScrollBar"); | 690 | // cfg.setGroup("ScrollBar"); |
691 | // if(cfg.readBoolEntry("HorzScroll",0)) { | 691 | // if(cfg.readBoolEntry("HorzScroll",0)) { |
692 | // if(cfg.readNumEntry("Position",2) == 0) | 692 | // if(cfg.readNumEntry("Position",2) == 0) |
693 | // te->setScrollbarLocation(1); | 693 | // te->setScrollbarLocation(1); |
694 | // else | 694 | // else |
695 | // te->setScrollbarLocation(0); | 695 | // te->setScrollbarLocation(0); |
696 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 696 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
697 | // te->setWrapAt(120); | 697 | // te->setWrapAt(120); |
698 | // } | 698 | // } |
699 | // create applications ///////////////////////////////////////////////////// | 699 | // create applications ///////////////////////////////////////////////////// |
700 | setCentralWidget(tab); | 700 | setCentralWidget(tab); |
701 | 701 | ||
702 | // load keymaps //////////////////////////////////////////////////////////// | 702 | // load keymaps //////////////////////////////////////////////////////////// |
703 | KeyTrans::loadAll(); | 703 | KeyTrans::loadAll(); |
704 | for (int i = 0; i < KeyTrans::count(); i++) | 704 | for (int i = 0; i < KeyTrans::count(); i++) |
705 | { | 705 | { |
706 | KeyTrans* s = KeyTrans::find(i); | 706 | KeyTrans* s = KeyTrans::find(i); |
707 | assert( s ); | 707 | assert( s ); |
708 | } | 708 | } |
709 | 709 | ||
710 | se_pgm = _pgm; | 710 | se_pgm = _pgm; |
711 | se_args = _args; | 711 | se_args = _args; |
712 | 712 | ||
713 | cfg.setGroup("CommandLine"); | 713 | cfg.setGroup("CommandLine"); |
714 | 714 | ||
715 | if (cfg.hasKey("shell_args")) | 715 | if (cfg.hasKey("shell_args")) |
716 | { | 716 | { |
717 | QStringList se_args_list = cfg.readListEntry("shell_args",'|'); | 717 | QStringList se_args_list = cfg.readListEntry("shell_args",'|'); |
718 | for(uint i = 0; i < se_args_list.count(); i++) | 718 | for(uint i = 0; i < se_args_list.count(); i++) |
719 | { | 719 | { |
720 | se_args.prepend(se_args_list[se_args_list.count() - i - 1].latin1()); | 720 | se_args.prepend(se_args_list[se_args_list.count() - i - 1].latin1()); |
721 | } | 721 | } |
722 | } | 722 | } |
723 | else | 723 | else |
724 | { | 724 | { |
725 | se_args.prepend("--login"); | 725 | se_args.prepend("--login"); |
726 | } | 726 | } |
727 | 727 | ||
728 | se_pgm = cfg.readEntry("shell_bin", QString(se_pgm)); | 728 | se_pgm = cfg.readEntry("shell_bin", QString(se_pgm)); |
729 | 729 | ||
730 | // this is the "documentation" for those who know to look | 730 | // this is the "documentation" for those who know to look |
731 | if (! cfg.hasKey("shell_args")) | 731 | if (! cfg.hasKey("shell_args")) |
732 | { | 732 | { |
733 | cfg.writeEntry("shell_args",QStringList::fromStrList(se_args),'|'); | 733 | cfg.writeEntry("shell_args",QStringList::fromStrList(se_args),'|'); |
734 | } | 734 | } |
735 | if (! cfg.hasKey("shell_bin")) | 735 | if (! cfg.hasKey("shell_bin")) |
736 | { | 736 | { |
737 | cfg.writeEntry("shell_bin",QString(se_pgm)); | 737 | cfg.writeEntry("shell_bin",QString(se_pgm)); |
738 | } | 738 | } |
739 | 739 | ||
740 | parseCommandLine(); | 740 | parseCommandLine(); |
741 | 741 | ||
742 | // read and apply default values /////////////////////////////////////////// | 742 | // read and apply default values /////////////////////////////////////////// |
743 | resize(321, 321); // Dummy. | 743 | resize(321, 321); // Dummy. |
744 | QSize currentSize = size(); | 744 | QSize currentSize = size(); |
745 | if (currentSize != size()) | 745 | if (currentSize != size()) |
746 | defaultSize = size(); | 746 | defaultSize = size(); |
747 | 747 | ||
748 | 748 | ||
749 | /* allows us to catch cancel/escape */ | 749 | /* allows us to catch cancel/escape */ |
750 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, | 750 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, |
751 | QPoint ( 0, 0 )); | 751 | QPoint ( 0, 0 )); |
752 | } | 752 | } |
753 | 753 | ||
754 | void Konsole::show() | 754 | void Konsole::show() |
755 | { | 755 | { |
756 | if ( !nsessions ) | 756 | if ( !nsessions ) |
757 | { | 757 | { |
758 | newSession(); | 758 | newSession(); |
759 | } | 759 | } |
760 | QMainWindow::show(); | 760 | QMainWindow::show(); |
761 | 761 | ||
762 | } | 762 | } |
763 | 763 | ||
764 | void Konsole::initSession(const char*, QStrList &) | 764 | void Konsole::initSession(const char*, QStrList &) |
765 | { | 765 | { |
766 | QMainWindow::show(); | 766 | QMainWindow::show(); |
767 | } | 767 | } |
768 | 768 | ||
769 | Konsole::~Konsole() | 769 | Konsole::~Konsole() |
770 | { | 770 | { |
771 | while (nsessions > 0) | 771 | while (nsessions > 0) |
772 | { | 772 | { |
773 | doneSession(getTe(), 0); | 773 | doneSession(getTe(), 0); |
774 | } | 774 | } |
775 | } | 775 | } |
776 | 776 | ||
777 | void | 777 | void |
778 | Konsole::historyDialog() | 778 | Konsole::historyDialog() |
779 | { | 779 | { |
780 | QDialog *d = new QDialog ( this, "histdlg", true ); | 780 | QDialog *d = new QDialog ( this, "histdlg", true ); |
781 | // d-> setCaption ( tr( "History" )); | 781 | // d-> setCaption ( tr( "History" )); |
782 | 782 | ||
783 | QBoxLayout *lay = new QVBoxLayout ( d, 4, 4 ); | 783 | QBoxLayout *lay = new QVBoxLayout ( d, 4, 4 ); |
784 | 784 | ||
785 | QLabel *l = new QLabel ( tr( "History Lines:" ), d ); | 785 | QLabel *l = new QLabel ( tr( "History Lines:" ), d ); |
786 | lay-> addWidget ( l ); | 786 | lay-> addWidget ( l ); |
787 | 787 | ||
788 | Config cfg( "Konsole" ); | 788 | Config cfg( "Konsole" ); |
789 | cfg.setGroup("History"); | 789 | cfg.setGroup("History"); |
790 | int hist = cfg.readNumEntry("history_lines",300); | 790 | int hist = cfg.readNumEntry("history_lines",300); |
791 | int avg_line = cfg.readNumEntry("avg_line_length",60); | 791 | int avg_line = cfg.readNumEntry("avg_line_length",60); |
792 | 792 | ||
793 | QSpinBox *spin = new QSpinBox ( 1, 100000, 20, d ); | 793 | QSpinBox *spin = new QSpinBox ( 1, 100000, 20, d ); |
794 | spin-> setValue ( hist ); | 794 | spin-> setValue ( hist ); |
795 | spin-> setWrapping ( true ); | 795 | spin-> setWrapping ( true ); |
796 | spin-> setButtonSymbols ( QSpinBox::PlusMinus ); | 796 | spin-> setButtonSymbols ( QSpinBox::PlusMinus ); |
797 | lay-> addWidget ( spin ); | 797 | lay-> addWidget ( spin ); |
798 | 798 | ||
799 | if ( d-> exec ( ) == QDialog::Accepted ) | 799 | if ( d-> exec ( ) == QDialog::Accepted ) |
800 | { | 800 | { |
801 | cfg.writeEntry("history_lines", spin->value()); | 801 | cfg.writeEntry("history_lines", spin->value()); |
802 | cfg.writeEntry("avg_line_length", avg_line); | 802 | cfg.writeEntry("avg_line_length", avg_line); |
803 | if (getTe() != NULL) | 803 | if (getTe() != NULL) |
804 | { | 804 | { |
805 | getTe()->currentSession->setHistory(true); | 805 | getTe()->currentSession->setHistory(true); |
806 | } | 806 | } |
807 | } | 807 | } |
808 | 808 | ||
809 | delete d; | 809 | delete d; |
810 | } | 810 | } |
811 | 811 | ||
812 | 812 | ||
813 | void Konsole::cycleZoom() | 813 | void Konsole::cycleZoom() |
814 | { | 814 | { |
815 | TEWidget* te = getTe(); | 815 | TEWidget* te = getTe(); |
816 | QFont font = te->getVTFont(); | 816 | QFont font = te->getVTFont(); |
817 | int size = font.pointSize(); | 817 | int size = font.pointSize(); |
818 | changeFontSize(1); | 818 | changeFontSize(1); |
819 | font = te->getVTFont(); | 819 | font = te->getVTFont(); |
820 | if (font.pointSize() <= size) | 820 | if (font.pointSize() <= size) |
821 | { | 821 | { |
822 | do | 822 | do |
823 | { | 823 | { |
824 | font = te->getVTFont(); | 824 | font = te->getVTFont(); |
825 | size = font.pointSize(); | 825 | size = font.pointSize(); |
826 | changeFontSize(-1); | 826 | changeFontSize(-1); |
827 | font = te->getVTFont(); | 827 | font = te->getVTFont(); |
828 | } | 828 | } |
829 | while (font.pointSize() < size); | 829 | while (font.pointSize() < size); |
830 | } | 830 | } |
831 | } | 831 | } |
832 | 832 | ||
833 | void Konsole::changeFontSize(int delta) | 833 | void Konsole::changeFontSize(int delta) |
834 | { | 834 | { |
835 | // printf("delta font size %d\n", delta); | 835 | // printf("delta font size %d\n", delta); |
836 | TEWidget* te = getTe(); | 836 | TEWidget* te = getTe(); |
837 | QFont font = te->getVTFont(); | 837 | QFont font = te->getVTFont(); |
838 | int size = font.pointSize(); | 838 | int size = font.pointSize(); |
839 | int closest = delta > 0? 10000 : -10000; | 839 | int closest = delta > 0? 10000 : -10000; |
840 | int closest_font = -1; | 840 | int closest_font = -1; |
841 | for(uint i = 0; i < fonts.count(); i++) | 841 | for(uint i = 0; i < fonts.count(); i++) |
842 | { | 842 | { |
843 | if (fonts.at(i)->getFont() == font) | 843 | if (fonts.at(i)->getFont() == font) |
844 | { | 844 | { |
845 | if (delta > 0) | 845 | if (delta > 0) |
846 | { | 846 | { |
847 | if (i+1 < fonts.count() | 847 | if (i+1 < fonts.count() |
848 | && fonts.at(i+1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) | 848 | && fonts.at(i+1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) |
849 | { | 849 | { |
850 | setFont(i+1); | 850 | setFont(i+1); |
851 | printf("font %d\n", i+1); | 851 | printf("font %d\n", i+1); |
852 | return; | 852 | return; |
853 | } | 853 | } |
854 | } | 854 | } |
855 | else if (delta < 0) | 855 | else if (delta < 0) |
856 | { | 856 | { |
857 | if (i > 0 | 857 | if (i > 0 |
858 | && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) | 858 | && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) |