-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 9be4674..275a9a8 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -523,197 +523,195 @@ void Konsole::hitDown() | |||
523 | */ | 523 | */ |
524 | QSize Konsole::calcSize(int columns, int lines) { | 524 | QSize Konsole::calcSize(int columns, int lines) { |
525 | TEWidget* te = getTe(); | 525 | TEWidget* te = getTe(); |
526 | if (te != 0) { | 526 | if (te != 0) { |
527 | QSize size = te->calcSize(columns, lines); | 527 | QSize size = te->calcSize(columns, lines); |
528 | return size; | 528 | return size; |
529 | } else { | 529 | } else { |
530 | QSize size; | 530 | QSize size; |
531 | return size; | 531 | return size; |
532 | } | 532 | } |
533 | } | 533 | } |
534 | 534 | ||
535 | /** | 535 | /** |
536 | sets application window to a size based on columns X lines of the te | 536 | sets application window to a size based on columns X lines of the te |
537 | guest widget. Call with (0,0) for setting default size. | 537 | guest widget. Call with (0,0) for setting default size. |
538 | */ | 538 | */ |
539 | 539 | ||
540 | void Konsole::setColLin(int columns, int lines) | 540 | void Konsole::setColLin(int columns, int lines) |
541 | { | 541 | { |
542 | qDebug("konsole::setColLin:: Columns %d", columns); | 542 | qDebug("konsole::setColLin:: Columns %d", columns); |
543 | 543 | ||
544 | if ((columns==0) || (lines==0)) | 544 | if ((columns==0) || (lines==0)) |
545 | { | 545 | { |
546 | if (defaultSize.isEmpty()) // not in config file : set default value | 546 | if (defaultSize.isEmpty()) // not in config file : set default value |
547 | { | 547 | { |
548 | defaultSize = calcSize(80,24); | 548 | defaultSize = calcSize(80,24); |
549 | // notifySize(24,80); // set menu items (strange arg order !) | 549 | // notifySize(24,80); // set menu items (strange arg order !) |
550 | } | 550 | } |
551 | resize(defaultSize); | 551 | resize(defaultSize); |
552 | } else { | 552 | } else { |
553 | resize(calcSize(columns, lines)); | 553 | resize(calcSize(columns, lines)); |
554 | // notifySize(lines,columns); // set menu items (strange arg order !) | 554 | // notifySize(lines,columns); // set menu items (strange arg order !) |
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
558 | /* | 558 | /* |
559 | void Konsole::setFont(int fontno) | 559 | void Konsole::setFont(int fontno) |
560 | { | 560 | { |
561 | QFont f; | 561 | QFont f; |
562 | if (fontno == 0) | 562 | if (fontno == 0) |
563 | f = defaultFont = QFont( "Helvetica", 12 ); | 563 | f = defaultFont = QFont( "Helvetica", 12 ); |
564 | else | 564 | else |
565 | if (fonts[fontno][0] == '-') | 565 | if (fonts[fontno][0] == '-') |
566 | f.setRawName( fonts[fontno] ); | 566 | f.setRawName( fonts[fontno] ); |
567 | else | 567 | else |
568 | { | 568 | { |
569 | f.setFamily(fonts[fontno]); | 569 | f.setFamily(fonts[fontno]); |
570 | f.setRawMode( TRUE ); | 570 | f.setRawMode( TRUE ); |
571 | } | 571 | } |
572 | if ( !f.exactMatch() && fontno != 0) | 572 | if ( !f.exactMatch() && fontno != 0) |
573 | { | 573 | { |
574 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); | 574 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); |
575 | QMessageBox(this, msg); | 575 | QMessageBox(this, msg); |
576 | return; | 576 | return; |
577 | } | 577 | } |
578 | if (se) se->setFontNo(fontno); | 578 | if (se) se->setFontNo(fontno); |
579 | te->setVTFont(f); | 579 | te->setVTFont(f); |
580 | n_font = fontno; | 580 | n_font = fontno; |
581 | } | 581 | } |
582 | */ | 582 | */ |
583 | 583 | ||
584 | // --| color selection |------------------------------------------------------- | 584 | // --| color selection |------------------------------------------------------- |
585 | 585 | ||
586 | void Konsole::changeColumns(int columns) | 586 | void Konsole::changeColumns(int columns) |
587 | { | 587 | { |
588 | qDebug("change columns"); | 588 | qDebug("change columns"); |
589 | TEWidget* te = getTe(); | 589 | TEWidget* te = getTe(); |
590 | if (te != 0) { | 590 | if (te != 0) { |
591 | setColLin(columns,te->Lines()); | 591 | setColLin(columns,te->Lines()); |
592 | te->update(); | 592 | te->update(); |
593 | } | 593 | } |
594 | } | 594 | } |
595 | 595 | ||
596 | //FIXME: If a child dies during session swap, | 596 | //FIXME: If a child dies during session swap, |
597 | // this routine might be called before | 597 | // this routine might be called before |
598 | // session swap is completed. | 598 | // session swap is completed. |
599 | 599 | ||
600 | void Konsole::doneSession(TESession*, int ) | 600 | void Konsole::doneSession(TESession*, int ) |
601 | { | 601 | { |
602 | TEWidget *te = getTe(); | 602 | TEWidget *te = getTe(); |
603 | if (te != 0) { | 603 | if (te != 0) { |
604 | te->currentSession->setConnect(FALSE); | 604 | te->currentSession->setConnect(FALSE); |
605 | tab->removeTab(te); | 605 | tab->removeTab(te); |
606 | delete te->currentSession; | 606 | delete te->currentSession; |
607 | delete te; | 607 | delete te; |
608 | nsessions--; | 608 | nsessions--; |
609 | } | 609 | } |
610 | 610 | ||
611 | if (nsessions == 0) { | 611 | if (nsessions == 0) { |
612 | close(); | 612 | close(); |
613 | } | 613 | } |
614 | } | 614 | } |
615 | 615 | ||
616 | void Konsole::newSession() { | 616 | void Konsole::newSession() { |
617 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? | 617 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? |
618 | TEWidget* te = new TEWidget(tab); | 618 | TEWidget* te = new TEWidget(tab); |
619 | if(nsessions == 0) { //set this the first time only | 619 | Config c("Konsole"); |
620 | Config c("Konsole"); | 620 | c.setGroup("Menubar"); |
621 | c.setGroup("Menubar"); | 621 | te->useBeep=c.readBoolEntry("useBeep",0); |
622 | te->useBeep=c.readBoolEntry("useBeep",0); | ||
623 | } | ||
624 | 622 | ||
625 | // te->setBackgroundMode(PaletteBase); //we want transparent!! | 623 | // te->setBackgroundMode(PaletteBase); //we want transparent!! |
626 | te->setVTFont(fonts.at(cfont)->getFont()); | 624 | te->setVTFont(fonts.at(cfont)->getFont()); |
627 | tab->addTab(te); | 625 | tab->addTab(te); |
628 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); | 626 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); |
629 | te->currentSession = se; | 627 | te->currentSession = se; |
630 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); | 628 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); |
631 | se->run(); | 629 | se->run(); |
632 | se->setConnect(TRUE); | 630 | se->setConnect(TRUE); |
633 | se->setHistory(b_scroll); | 631 | se->setHistory(b_scroll); |
634 | tab->setCurrentPage(nsessions); | 632 | tab->setCurrentPage(nsessions); |
635 | nsessions++; | 633 | nsessions++; |
636 | doWrap(); | 634 | doWrap(); |
637 | setColor(); | 635 | setColor(); |
638 | } | 636 | } |
639 | } | 637 | } |
640 | 638 | ||
641 | TEWidget* Konsole::getTe() { | 639 | TEWidget* Konsole::getTe() { |
642 | if (nsessions) { | 640 | if (nsessions) { |
643 | return (TEWidget *) tab->currentPage(); | 641 | return (TEWidget *) tab->currentPage(); |
644 | } else { | 642 | } else { |
645 | return 0; | 643 | return 0; |
646 | } | 644 | } |
647 | } | 645 | } |
648 | 646 | ||
649 | void Konsole::switchSession(QWidget* w) { | 647 | void Konsole::switchSession(QWidget* w) { |
650 | TEWidget* te = (TEWidget *) w; | 648 | TEWidget* te = (TEWidget *) w; |
651 | 649 | ||
652 | QFont teFnt = te->getVTFont(); | 650 | QFont teFnt = te->getVTFont(); |
653 | for(uint i = 0; i < fonts.count(); i++) { | 651 | for(uint i = 0; i < fonts.count(); i++) { |
654 | VTFont *fnt = fonts.at(i); | 652 | VTFont *fnt = fonts.at(i); |
655 | bool cf = fnt->getFont() == teFnt; | 653 | bool cf = fnt->getFont() == teFnt; |
656 | fontList->setItemChecked(i, cf); | 654 | fontList->setItemChecked(i, cf); |
657 | if (cf) { | 655 | if (cf) { |
658 | cfont = i; | 656 | cfont = i; |
659 | } | 657 | } |
660 | } | 658 | } |
661 | } | 659 | } |
662 | 660 | ||
663 | void Konsole::colorMenuIsSelected(int iD) { | 661 | void Konsole::colorMenuIsSelected(int iD) { |
664 | fromMenu = TRUE; | 662 | fromMenu = TRUE; |
665 | colorMenuSelected(iD); | 663 | colorMenuSelected(iD); |
666 | } | 664 | } |
667 | 665 | ||
668 | /// ------------------------------- some new stuff by L.J. Potter | 666 | /// ------------------------------- some new stuff by L.J. Potter |
669 | void Konsole::colorMenuSelected(int iD) | 667 | void Konsole::colorMenuSelected(int iD) |
670 | { // this is NOT pretty, elegant or anything else besides functional | 668 | { // this is NOT pretty, elegant or anything else besides functional |
671 | // QString temp; | 669 | // QString temp; |
672 | // qDebug( temp.sprintf("colormenu %d", iD)); | 670 | // qDebug( temp.sprintf("colormenu %d", iD)); |
673 | TEWidget* te = getTe(); | 671 | TEWidget* te = getTe(); |
674 | Config cfg("Konsole"); | 672 | Config cfg("Konsole"); |
675 | cfg.setGroup("Colors"); | 673 | cfg.setGroup("Colors"); |
676 | // QColor foreground; | 674 | // QColor foreground; |
677 | // QColor background; | 675 | // QColor background; |
678 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); | 676 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); |
679 | ColorEntry m_table[TABLE_COLORS]; | 677 | ColorEntry m_table[TABLE_COLORS]; |
680 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 678 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
681 | /////////// fore back | 679 | /////////// fore back |
682 | int i; | 680 | int i; |
683 | if(iD==-9) { // default default | 681 | if(iD==-9) { // default default |
684 | for (i = 0; i < TABLE_COLORS; i++) { | 682 | for (i = 0; i < TABLE_COLORS; i++) { |
685 | m_table[i].color = defaultCt[i].color; | 683 | m_table[i].color = defaultCt[i].color; |
686 | if(i==1 || i == 11) | 684 | if(i==1 || i == 11) |
687 | m_table[i].transparent=1; | 685 | m_table[i].transparent=1; |
688 | cfg.writeEntry("Schema","9"); | 686 | cfg.writeEntry("Schema","9"); |
689 | colorMenu->setItemChecked(-9,TRUE); | 687 | colorMenu->setItemChecked(-9,TRUE); |
690 | } | 688 | } |
691 | } else { | 689 | } else { |
692 | if(iD==-6) { // green black | 690 | if(iD==-6) { // green black |
693 | foreground.setRgb(0x18,255,0x18); | 691 | foreground.setRgb(0x18,255,0x18); |
694 | background.setRgb(0x00,0x00,0x00); | 692 | background.setRgb(0x00,0x00,0x00); |
695 | cfg.writeEntry("Schema","6"); | 693 | cfg.writeEntry("Schema","6"); |
696 | colorMenu->setItemChecked(-6,TRUE); | 694 | colorMenu->setItemChecked(-6,TRUE); |
697 | } | 695 | } |
698 | if(iD==-7) { // black white | 696 | if(iD==-7) { // black white |
699 | foreground.setRgb(0x00,0x00,0x00); | 697 | foreground.setRgb(0x00,0x00,0x00); |
700 | background.setRgb(0xFF,0xFF,0xFF); | 698 | background.setRgb(0xFF,0xFF,0xFF); |
701 | cfg.writeEntry("Schema","7"); | 699 | cfg.writeEntry("Schema","7"); |
702 | colorMenu->setItemChecked(-7,TRUE); | 700 | colorMenu->setItemChecked(-7,TRUE); |
703 | } | 701 | } |
704 | if(iD==-8) { // white black | 702 | if(iD==-8) { // white black |
705 | foreground.setRgb(0xFF,0xFF,0xFF); | 703 | foreground.setRgb(0xFF,0xFF,0xFF); |
706 | background.setRgb(0x00,0x00,0x00); | 704 | background.setRgb(0x00,0x00,0x00); |
707 | cfg.writeEntry("Schema","8"); | 705 | cfg.writeEntry("Schema","8"); |
708 | colorMenu->setItemChecked(-8,TRUE); | 706 | colorMenu->setItemChecked(-8,TRUE); |
709 | } | 707 | } |
710 | if(iD==-10) {// Black, Red | 708 | if(iD==-10) {// Black, Red |
711 | foreground.setRgb(0x00,0x00,0x00); | 709 | foreground.setRgb(0x00,0x00,0x00); |
712 | background.setRgb(0xB2,0x18,0x18); | 710 | background.setRgb(0xB2,0x18,0x18); |
713 | cfg.writeEntry("Schema","10"); | 711 | cfg.writeEntry("Schema","10"); |
714 | colorMenu->setItemChecked(-10,TRUE); | 712 | colorMenu->setItemChecked(-10,TRUE); |
715 | } | 713 | } |
716 | if(iD==-11) {// Red, Black | 714 | if(iD==-11) {// Red, Black |
717 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 | 715 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 |
718 | background.setRgb(0x00,0x00,0x00); | 716 | background.setRgb(0x00,0x00,0x00); |
719 | cfg.writeEntry("Schema","11"); | 717 | cfg.writeEntry("Schema","11"); |