summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-12-05 18:36:11 (UTC)
committer llornkcor <llornkcor>2002-12-05 18:36:11 (UTC)
commit05757f4914d19f9c392be1e60e5ec972027886bf (patch) (unidiff)
tree0096190bb2cf832d90ca93968952b9eccf3d3149
parent418fd5dab5503755aa1783d404576252684d4a96 (diff)
downloadopie-05757f4914d19f9c392be1e60e5ec972027886bf.zip
opie-05757f4914d19f9c392be1e60e5ec972027886bf.tar.gz
opie-05757f4914d19f9c392be1e60e5ec972027886bf.tar.bz2
fix beep so all sessions are the same
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp8
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
@@ -491,261 +491,259 @@ void Konsole::hitTab()
491 } 491 }
492} 492}
493 493
494void Konsole::hitPaste() 494void Konsole::hitPaste()
495{ 495{
496 TEWidget* te = getTe(); 496 TEWidget* te = getTe();
497 if (te != 0) { 497 if (te != 0) {
498 te->pasteClipboard(); 498 te->pasteClipboard();
499 } 499 }
500} 500}
501 501
502void Konsole::hitUp() 502void Konsole::hitUp()
503{ 503{
504 TEWidget* te = getTe(); 504 TEWidget* te = getTe();
505 if (te != 0) { 505 if (te != 0) {
506 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); 506 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0);
507 QApplication::sendEvent( te, &ke ); 507 QApplication::sendEvent( te, &ke );
508 } 508 }
509} 509}
510 510
511void Konsole::hitDown() 511void Konsole::hitDown()
512{ 512{
513 TEWidget* te = getTe(); 513 TEWidget* te = getTe();
514 if (te != 0) { 514 if (te != 0) {
515 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); 515 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0);
516 QApplication::sendEvent( te, &ke ); 516 QApplication::sendEvent( te, &ke );
517 } 517 }
518} 518}
519 519
520/** 520/**
521 This function calculates the size of the external widget 521 This function calculates the size of the external widget
522 needed for the internal widget to be 522 needed for the internal widget to be
523 */ 523 */
524QSize Konsole::calcSize(int columns, int lines) { 524QSize 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
540void Konsole::setColLin(int columns, int lines) 540void 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/*
559void Konsole::setFont(int fontno) 559void 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
586void Konsole::changeColumns(int columns) 586void 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
600void Konsole::doneSession(TESession*, int ) 600void 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
616void Konsole::newSession() { 616void 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
641TEWidget* Konsole::getTe() { 639TEWidget* 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
649void Konsole::switchSession(QWidget* w) { 647void 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
663void Konsole::colorMenuIsSelected(int iD) { 661void 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
669void Konsole::colorMenuSelected(int iD) 667void 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");
720 colorMenu->setItemChecked(-11,TRUE); 718 colorMenu->setItemChecked(-11,TRUE);
721 } 719 }
722 if(iD==-12) {// Green, Yellow - is ugly 720 if(iD==-12) {// Green, Yellow - is ugly
723// foreground.setRgb(0x18,0xB2,0x18); 721// foreground.setRgb(0x18,0xB2,0x18);
724 foreground.setRgb(36,139,10); 722 foreground.setRgb(36,139,10);
725// background.setRgb(0xB2,0x68,0x18); 723// background.setRgb(0xB2,0x68,0x18);
726 background.setRgb(255,255,0); 724 background.setRgb(255,255,0);
727 cfg.writeEntry("Schema","12"); 725 cfg.writeEntry("Schema","12");
728 colorMenu->setItemChecked(-12,TRUE); 726 colorMenu->setItemChecked(-12,TRUE);
729 } 727 }
730 if(iD==-13) {// Blue, Magenta 728 if(iD==-13) {// Blue, Magenta
731 foreground.setRgb(0x18,0xB2,0xB2); 729 foreground.setRgb(0x18,0xB2,0xB2);
732 background.setRgb(0x18,0x18,0xB2); 730 background.setRgb(0x18,0x18,0xB2);
733 cfg.writeEntry("Schema","13"); 731 cfg.writeEntry("Schema","13");
734 colorMenu->setItemChecked(-13,TRUE); 732 colorMenu->setItemChecked(-13,TRUE);
735 } 733 }
736 if(iD==-14) {// Magenta, Blue 734 if(iD==-14) {// Magenta, Blue
737 foreground.setRgb(0x18,0x18,0xB2); 735 foreground.setRgb(0x18,0x18,0xB2);
738 background.setRgb(0x18,0xB2,0xB2); 736 background.setRgb(0x18,0xB2,0xB2);
739 cfg.writeEntry("Schema","14"); 737 cfg.writeEntry("Schema","14");
740 colorMenu->setItemChecked(-14,TRUE); 738 colorMenu->setItemChecked(-14,TRUE);
741 } 739 }
742 if(iD==-15) {// Cyan, White 740 if(iD==-15) {// Cyan, White
743 foreground.setRgb(0x18,0xB2,0xB2); 741 foreground.setRgb(0x18,0xB2,0xB2);
744 background.setRgb(0xFF,0xFF,0xFF); 742 background.setRgb(0xFF,0xFF,0xFF);
745 cfg.writeEntry("Schema","15"); 743 cfg.writeEntry("Schema","15");
746 colorMenu->setItemChecked(-15,TRUE); 744 colorMenu->setItemChecked(-15,TRUE);
747 } 745 }
748 if(iD==-16) {// White, Cyan 746 if(iD==-16) {// White, Cyan
749 background.setRgb(0x18,0xB2,0xB2); 747 background.setRgb(0x18,0xB2,0xB2);
750 foreground.setRgb(0xFF,0xFF,0xFF); 748 foreground.setRgb(0xFF,0xFF,0xFF);
751 cfg.writeEntry("Schema","16"); 749 cfg.writeEntry("Schema","16");