author | llornkcor <llornkcor> | 2005-08-10 08:14:56 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-08-10 08:14:56 (UTC) |
commit | ae7eb0bd76bd93cee70f258f3c4aef1accee766c (patch) (unidiff) | |
tree | 08fa3a0118b258b51b8107608e9632bb51de763c | |
parent | cfc9ff35215081a33adde29872553513d08f58bb (diff) | |
download | opie-ae7eb0bd76bd93cee70f258f3c4aef1accee766c.zip opie-ae7eb0bd76bd93cee70f258f3c4aef1accee766c.tar.gz opie-ae7eb0bd76bd93cee70f258f3c4aef1accee766c.tar.bz2 |
add close session button
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 10 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 7f3ea65..f4ca0bf 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -529,195 +529,198 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
529 | 529 | ||
530 | tmp=cfg.readEntry("Position","Top"); | 530 | tmp=cfg.readEntry("Position","Top"); |
531 | if(tmp=="Top") | 531 | if(tmp=="Top") |
532 | { | 532 | { |
533 | tab->setTabPosition(QTabWidget::Top); | 533 | tab->setTabPosition(QTabWidget::Top); |
534 | tab->getTabBar()->show(); | 534 | tab->getTabBar()->show(); |
535 | tabPos = tm_top; | 535 | tabPos = tm_top; |
536 | } | 536 | } |
537 | else if (tmp=="Bottom") | 537 | else if (tmp=="Bottom") |
538 | { | 538 | { |
539 | tab->setTabPosition(QTabWidget::Bottom); | 539 | tab->setTabPosition(QTabWidget::Bottom); |
540 | tab->getTabBar()->show(); | 540 | tab->getTabBar()->show(); |
541 | tabPos = tm_bottom; | 541 | tabPos = tm_bottom; |
542 | } | 542 | } |
543 | else | 543 | else |
544 | { | 544 | { |
545 | tab->getTabBar()->hide(); | 545 | tab->getTabBar()->hide(); |
546 | tab->setMargin(tab->margin()); | 546 | tab->setMargin(tab->margin()); |
547 | tabPos = tm_hidden; | 547 | tabPos = tm_hidden; |
548 | } | 548 | } |
549 | 549 | ||
550 | cm_bw = colorMenu->insertItem(tr( "Black on White")); | 550 | cm_bw = colorMenu->insertItem(tr( "Black on White")); |
551 | cm_wb = colorMenu->insertItem(tr( "White on Black")); | 551 | cm_wb = colorMenu->insertItem(tr( "White on Black")); |
552 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); | 552 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); |
553 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); | 553 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); |
554 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); | 554 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); |
555 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); | 555 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); |
556 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); | 556 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); |
557 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); | 557 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); |
558 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); | 558 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); |
559 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); | 559 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); |
560 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); | 560 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); |
561 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); | 561 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); |
562 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); | 562 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); |
563 | cm_default = colorMenu->insertItem(tr("default")); | 563 | cm_default = colorMenu->insertItem(tr("default")); |
564 | 564 | ||
565 | #ifdef QT_QWS_OPIE | 565 | #ifdef QT_QWS_OPIE |
566 | 566 | ||
567 | colorMenu->insertItem(tr( "Custom")); | 567 | colorMenu->insertItem(tr( "Custom")); |
568 | #endif | 568 | #endif |
569 | 569 | ||
570 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 570 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
571 | 571 | ||
572 | sessionList = new QPopupMenu(this); | 572 | sessionList = new QPopupMenu(this); |
573 | sessionList-> insertItem ( Opie::Core::OResource::loadPixmap( "konsole/Terminal", Opie::Core::OResource::SmallIcon ), | 573 | sessionList-> insertItem ( Opie::Core::OResource::loadPixmap( "konsole/Terminal", Opie::Core::OResource::SmallIcon ), |
574 | tr( "new session" ), this, SLOT(newSession()) ); | 574 | tr( "new session" ), this, SLOT(newSession()) ); |
575 | 575 | ||
576 | // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 576 | // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
577 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 577 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
578 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); | 578 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); |
579 | connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); | 579 | connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); |
580 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 580 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
581 | connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 581 | connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
582 | connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); | 582 | connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); |
583 | 583 | ||
584 | menuBar->insertItem( tr("View"), configMenu ); | 584 | menuBar->insertItem( tr("View"), configMenu ); |
585 | menuBar->insertItem( tr("Fonts"), fontList ); | 585 | menuBar->insertItem( tr("Fonts"), fontList ); |
586 | menuBar->insertItem( tr("Sessions"), sessionList ); | 586 | menuBar->insertItem( tr("Sessions"), sessionList ); |
587 | 587 | ||
588 | toolBar = new QToolBar( this ); | 588 | toolBar = new QToolBar( this ); |
589 | 589 | ||
590 | QAction *a; | 590 | QAction *a; |
591 | 591 | ||
592 | // Button Commands | 592 | // Button Commands |
593 | a = new QAction( tr("New"), Opie::Core::OResource::loadPixmap( "konsole/konsole", Opie::Core::OResource::SmallIcon ), | 593 | a = new QAction( tr("New"), Opie::Core::OResource::loadPixmap( "konsole/konsole", Opie::Core::OResource::SmallIcon ), |
594 | QString::null, 0, this, 0 ); | 594 | QString::null, 0, this, 0 ); |
595 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); | 595 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); |
596 | a->addTo( toolBar ); | 596 | a->addTo( toolBar ); |
597 | 597 | ||
598 | a = new QAction( tr("Full Screen"), Opie::Core::OResource::loadPixmap( "fullscreen", Opie::Core::OResource::SmallIcon ), | 598 | a = new QAction( tr("Full Screen"), Opie::Core::OResource::loadPixmap( "fullscreen", Opie::Core::OResource::SmallIcon ), |
599 | QString::null, 0, this, 0 ); | 599 | QString::null, 0, this, 0 ); |
600 | connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); | 600 | connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); |
601 | a->addTo( toolBar ); | 601 | a->addTo( toolBar ); |
602 | 602 | ||
603 | a = new QAction( tr("Zoom"), Opie::Core::OResource::loadPixmap( "zoom", Opie::Core::OResource::SmallIcon ), | 603 | a = new QAction( tr("Zoom"), Opie::Core::OResource::loadPixmap( "zoom", Opie::Core::OResource::SmallIcon ), |
604 | QString::null, 0, this, 0 ); | 604 | QString::null, 0, this, 0 ); |
605 | connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); | 605 | connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); |
606 | a->addTo( toolBar ); | 606 | a->addTo( toolBar ); |
607 | 607 | ||
608 | 608 | ||
609 | a = new QAction( tr("Enter"), Opie::Core::OResource::loadPixmap( "konsole/enter", Opie::Core::OResource::SmallIcon ), | 609 | a = new QAction( tr("Enter"), Opie::Core::OResource::loadPixmap( "konsole/enter", Opie::Core::OResource::SmallIcon ), |
610 | QString::null, 0, this, 0 ); | 610 | QString::null, 0, this, 0 ); |
611 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); | 611 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); |
612 | a = new QAction( tr("Space"), Opie::Core::OResource::loadPixmap( "konsole/space", Opie::Core::OResource::SmallIcon ), | 612 | a = new QAction( tr("Space"), Opie::Core::OResource::loadPixmap( "konsole/space", Opie::Core::OResource::SmallIcon ), |
613 | QString::null, 0, this, 0 ); | 613 | QString::null, 0, this, 0 ); |
614 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); | 614 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); |
615 | a = new QAction( tr("Tab"), Opie::Core::OResource::loadPixmap( "konsole/tab", Opie::Core::OResource::SmallIcon ), | 615 | a = new QAction( tr("Tab"), Opie::Core::OResource::loadPixmap( "konsole/tab", Opie::Core::OResource::SmallIcon ), |
616 | QString::null, 0, this, 0 ); | 616 | QString::null, 0, this, 0 ); |
617 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); | 617 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); |
618 | a = new QAction( tr("Up"), Opie::Core::OResource::loadPixmap( "konsole/up", Opie::Core::OResource::SmallIcon ), | 618 | a = new QAction( tr("Up"), Opie::Core::OResource::loadPixmap( "konsole/up", Opie::Core::OResource::SmallIcon ), |
619 | QString::null, 0, this, 0 ); | 619 | QString::null, 0, this, 0 ); |
620 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); | 620 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); |
621 | a = new QAction( tr("Down"), Opie::Core::OResource::loadPixmap( "konsole/down", Opie::Core::OResource::SmallIcon ), | 621 | a = new QAction( tr("Down"), Opie::Core::OResource::loadPixmap( "konsole/down", Opie::Core::OResource::SmallIcon ), |
622 | QString::null, 0, this, 0 ); | 622 | QString::null, 0, this, 0 ); |
623 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); | 623 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); |
624 | 624 | ||
625 | a = new QAction( tr("Paste"), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ), | 625 | a = new QAction( tr("Paste"), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); |
626 | QString::null, 0, this, 0 ); | ||
627 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); | 626 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); |
627 | |||
628 | a = new QAction( tr("Close"), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),QString::null, 0, this, 0 ); | ||
629 | connect( a, SIGNAL( activated() ), this, SLOT( closeSession() ) ); | ||
630 | |||
628 | a->addTo( toolBar ); | 631 | a->addTo( toolBar ); |
629 | 632 | ||
630 | secondToolBar = new QToolBar( this ); | 633 | secondToolBar = new QToolBar( this ); |
631 | secondToolBar->setHorizontalStretchable( TRUE ); | 634 | secondToolBar->setHorizontalStretchable( TRUE ); |
632 | 635 | ||
633 | commonCombo = new QComboBox( secondToolBar ); | 636 | commonCombo = new QComboBox( secondToolBar ); |
634 | // commonCombo->setMaximumWidth(236); | 637 | // commonCombo->setMaximumWidth(236); |
635 | 638 | ||
636 | ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); | 639 | ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); |
637 | if( listHidden) | 640 | if( listHidden) |
638 | { | 641 | { |
639 | secondToolBar->hide(); | 642 | secondToolBar->hide(); |
640 | editCommandListMenu->setItemEnabled(ec_quick ,FALSE); | 643 | editCommandListMenu->setItemEnabled(ec_quick ,FALSE); |
641 | } | 644 | } |
642 | ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); | 645 | ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); |
643 | 646 | ||
644 | cfg.setGroup("Commands"); | 647 | cfg.setGroup("Commands"); |
645 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 648 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
646 | 649 | ||
647 | initCommandList(); | 650 | initCommandList(); |
648 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 651 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
649 | // commonCombo->insertItem( commonCmds[i], i ); | 652 | // commonCombo->insertItem( commonCmds[i], i ); |
650 | // tmp = cfg.readEntry( QString::number(i),""); | 653 | // tmp = cfg.readEntry( QString::number(i),""); |
651 | // if(tmp != "") | 654 | // if(tmp != "") |
652 | // commonCombo->changeItem( tmp,i ); | 655 | // commonCombo->changeItem( tmp,i ); |
653 | // } | 656 | // } |
654 | 657 | ||
655 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 658 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
656 | 659 | ||
657 | sm_none = scrollMenu->insertItem(tr( "None" )); | 660 | sm_none = scrollMenu->insertItem(tr( "None" )); |
658 | sm_left = scrollMenu->insertItem(tr( "Left" )); | 661 | sm_left = scrollMenu->insertItem(tr( "Left" )); |
659 | sm_right = scrollMenu->insertItem(tr( "Right" )); | 662 | sm_right = scrollMenu->insertItem(tr( "Right" )); |
660 | // scrollMenu->insertSeparator(4); | 663 | // scrollMenu->insertSeparator(4); |
661 | // scrollMenu->insertItem(tr( "Horizontal" )); | 664 | // scrollMenu->insertItem(tr( "Horizontal" )); |
662 | 665 | ||
663 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 666 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
664 | 667 | ||
665 | configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); | 668 | configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); |
666 | 669 | ||
667 | cm_wrap = configMenu->insertItem(tr( "Wrap" )); | 670 | cm_wrap = configMenu->insertItem(tr( "Wrap" )); |
668 | cfg.setGroup("ScrollBar"); | 671 | cfg.setGroup("ScrollBar"); |
669 | configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); | 672 | configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); |
670 | 673 | ||
671 | cm_beep = configMenu->insertItem(tr( "Use Beep" )); | 674 | cm_beep = configMenu->insertItem(tr( "Use Beep" )); |
672 | cfg.setGroup("Menubar"); | 675 | cfg.setGroup("Menubar"); |
673 | configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); | 676 | configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); |
674 | 677 | ||
675 | fullscreen_msg = new QLabel(this); | 678 | fullscreen_msg = new QLabel(this); |
676 | fullscreen_msg-> setAlignment ( AlignCenter | SingleLine ); | 679 | fullscreen_msg-> setAlignment ( AlignCenter | SingleLine ); |
677 | fullscreen_msg-> hide(); | 680 | fullscreen_msg-> hide(); |
678 | fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); | 681 | fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); |
679 | fullscreen_msg-> setAutoResize(true); | 682 | fullscreen_msg-> setAutoResize(true); |
680 | fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 683 | fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
681 | fullscreen_msg-> setText(tr("To exit fullscreen, tap here.")); | 684 | fullscreen_msg-> setText(tr("To exit fullscreen, tap here.")); |
682 | 685 | ||
683 | fullscreen_timer = new QTimer(this); | 686 | fullscreen_timer = new QTimer(this); |
684 | connect(fullscreen_timer, SIGNAL(timeout()), | 687 | connect(fullscreen_timer, SIGNAL(timeout()), |
685 | this, SLOT(fullscreenTimeout())); | 688 | this, SLOT(fullscreenTimeout())); |
686 | show_fullscreen_msg = true; | 689 | show_fullscreen_msg = true; |
687 | 690 | ||
688 | //scrollMenuSelected(-29); | 691 | //scrollMenuSelected(-29); |
689 | // cfg.setGroup("ScrollBar"); | 692 | // cfg.setGroup("ScrollBar"); |
690 | // if(cfg.readBoolEntry("HorzScroll",0)) { | 693 | // if(cfg.readBoolEntry("HorzScroll",0)) { |
691 | // if(cfg.readNumEntry("Position",2) == 0) | 694 | // if(cfg.readNumEntry("Position",2) == 0) |
692 | // te->setScrollbarLocation(1); | 695 | // te->setScrollbarLocation(1); |
693 | // else | 696 | // else |
694 | // te->setScrollbarLocation(0); | 697 | // te->setScrollbarLocation(0); |
695 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 698 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
696 | // te->setWrapAt(120); | 699 | // te->setWrapAt(120); |
697 | // } | 700 | // } |
698 | // create applications ///////////////////////////////////////////////////// | 701 | // create applications ///////////////////////////////////////////////////// |
699 | setCentralWidget(tab); | 702 | setCentralWidget(tab); |
700 | 703 | ||
701 | // load keymaps //////////////////////////////////////////////////////////// | 704 | // load keymaps //////////////////////////////////////////////////////////// |
702 | KeyTrans::loadAll(); | 705 | KeyTrans::loadAll(); |
703 | for (int i = 0; i < KeyTrans::count(); i++) | 706 | for (int i = 0; i < KeyTrans::count(); i++) |
704 | { | 707 | { |
705 | KeyTrans* s = KeyTrans::find(i); | 708 | KeyTrans* s = KeyTrans::find(i); |
706 | assert( s ); | 709 | assert( s ); |
707 | } | 710 | } |
708 | 711 | ||
709 | se_pgm = _pgm; | 712 | se_pgm = _pgm; |
710 | se_args = _args; | 713 | se_args = _args; |
711 | 714 | ||
712 | cfg.setGroup("CommandLine"); | 715 | cfg.setGroup("CommandLine"); |
713 | 716 | ||
714 | if (cfg.hasKey("shell_args")) | 717 | if (cfg.hasKey("shell_args")) |
715 | { | 718 | { |
716 | QStringList se_args_list = cfg.readListEntry("shell_args",'|'); | 719 | QStringList se_args_list = cfg.readListEntry("shell_args",'|'); |
717 | for(uint i = 0; i < se_args_list.count(); i++) | 720 | for(uint i = 0; i < se_args_list.count(); i++) |
718 | { | 721 | { |
719 | se_args.prepend(se_args_list[se_args_list.count() - i - 1].latin1()); | 722 | se_args.prepend(se_args_list[se_args_list.count() - i - 1].latin1()); |
720 | } | 723 | } |
721 | } | 724 | } |
722 | else | 725 | else |
723 | { | 726 | { |
@@ -1823,96 +1826,99 @@ void Konsole::setDocument( const QString &cmd) | |||
1823 | system(cmd2.latin1()); | 1826 | system(cmd2.latin1()); |
1824 | if(startUp <= 1 && nsessions < 2) | 1827 | if(startUp <= 1 && nsessions < 2) |
1825 | { | 1828 | { |
1826 | doneSession(getTe(), 0); | 1829 | doneSession(getTe(), 0); |
1827 | exit(0); | 1830 | exit(0); |
1828 | } | 1831 | } |
1829 | else | 1832 | else |
1830 | doneSession(getTe(), 0); | 1833 | doneSession(getTe(), 0); |
1831 | } | 1834 | } |
1832 | else | 1835 | else |
1833 | { | 1836 | { |
1834 | if (te != 0) | 1837 | if (te != 0) |
1835 | { | 1838 | { |
1836 | te->emitText(cmd+"\r"); | 1839 | te->emitText(cmd+"\r"); |
1837 | } | 1840 | } |
1838 | } | 1841 | } |
1839 | startUp++; | 1842 | startUp++; |
1840 | } | 1843 | } |
1841 | 1844 | ||
1842 | 1845 | ||
1843 | // what is the point of this when you can just | 1846 | // what is the point of this when you can just |
1844 | // run commands by using the shell directly?? | 1847 | // run commands by using the shell directly?? |
1845 | void Konsole::parseCommandLine() | 1848 | void Konsole::parseCommandLine() |
1846 | { | 1849 | { |
1847 | QString cmd; | 1850 | QString cmd; |
1848 | // newSession(); | 1851 | // newSession(); |
1849 | for (int i=1;i< qApp->argc();i++) | 1852 | for (int i=1;i< qApp->argc();i++) |
1850 | { | 1853 | { |
1851 | if( QString(qApp->argv()[i]) == "-e") | 1854 | if( QString(qApp->argv()[i]) == "-e") |
1852 | { | 1855 | { |
1853 | i++; | 1856 | i++; |
1854 | for ( int j=i;j< qApp->argc();j++) | 1857 | for ( int j=i;j< qApp->argc();j++) |
1855 | { | 1858 | { |
1856 | cmd+=QString(qApp->argv()[j])+" "; | 1859 | cmd+=QString(qApp->argv()[j])+" "; |
1857 | } | 1860 | } |
1858 | cmd.stripWhiteSpace(); | 1861 | cmd.stripWhiteSpace(); |
1859 | system(cmd.latin1()); | 1862 | system(cmd.latin1()); |
1860 | exit(0);//close(); | 1863 | exit(0);//close(); |
1861 | } // end -e switch | 1864 | } // end -e switch |
1862 | } | 1865 | } |
1863 | startUp++; | 1866 | startUp++; |
1864 | } | 1867 | } |
1865 | 1868 | ||
1866 | void Konsole::changeForegroundColor(const QColor &color) | 1869 | void Konsole::changeForegroundColor(const QColor &color) |
1867 | { | 1870 | { |
1868 | Config cfg( "Konsole" ); | 1871 | Config cfg( "Konsole" ); |
1869 | cfg.setGroup("Colors"); | 1872 | cfg.setGroup("Colors"); |
1870 | int r, g, b; | 1873 | int r, g, b; |
1871 | color.rgb(&r,&g,&b); | 1874 | color.rgb(&r,&g,&b); |
1872 | foreground.setRgb(r,g,b); | 1875 | foreground.setRgb(r,g,b); |
1873 | 1876 | ||
1874 | cfg.writeEntry("foreground",color.name()); | 1877 | cfg.writeEntry("foreground",color.name()); |
1875 | odebug << "foreground "+color.name() << oendl; | 1878 | odebug << "foreground "+color.name() << oendl; |
1876 | cfg.write(); | 1879 | cfg.write(); |
1877 | 1880 | ||
1878 | odebug << "do other dialog" << oendl; | 1881 | odebug << "do other dialog" << oendl; |
1879 | #ifdef QT_QWS_OPIE | 1882 | #ifdef QT_QWS_OPIE |
1880 | 1883 | ||
1881 | Opie::OColorPopupMenu* penColorPopupMenu2 = new Opie::OColorPopupMenu(Qt::black, this,"background color"); | 1884 | Opie::OColorPopupMenu* penColorPopupMenu2 = new Opie::OColorPopupMenu(Qt::black, this,"background color"); |
1882 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, | 1885 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, |
1883 | SLOT(changeBackgroundColor(const QColor&))); | 1886 | SLOT(changeBackgroundColor(const QColor&))); |
1884 | penColorPopupMenu2->exec(); | 1887 | penColorPopupMenu2->exec(); |
1885 | #endif | 1888 | #endif |
1886 | } | 1889 | } |
1887 | 1890 | ||
1888 | void Konsole::changeBackgroundColor(const QColor &color) | 1891 | void Konsole::changeBackgroundColor(const QColor &color) |
1889 | { | 1892 | { |
1890 | 1893 | ||
1891 | odebug << "Change background" << oendl; | 1894 | odebug << "Change background" << oendl; |
1892 | Config cfg( "Konsole" ); | 1895 | Config cfg( "Konsole" ); |
1893 | cfg.setGroup("Colors"); | 1896 | cfg.setGroup("Colors"); |
1894 | int r, g, b; | 1897 | int r, g, b; |
1895 | color.rgb(&r,&g,&b); | 1898 | color.rgb(&r,&g,&b); |
1896 | background.setRgb(r,g,b); | 1899 | background.setRgb(r,g,b); |
1897 | cfg.writeEntry("background",color.name()); | 1900 | cfg.writeEntry("background",color.name()); |
1898 | odebug << "background "+color.name() << oendl; | 1901 | odebug << "background "+color.name() << oendl; |
1899 | cfg.write(); | 1902 | cfg.write(); |
1900 | } | 1903 | } |
1901 | 1904 | ||
1902 | void Konsole::doWrap() | 1905 | void Konsole::doWrap() |
1903 | { | 1906 | { |
1904 | Config cfg( "Konsole" ); | 1907 | Config cfg( "Konsole" ); |
1905 | cfg.setGroup("ScrollBar"); | 1908 | cfg.setGroup("ScrollBar"); |
1906 | TEWidget* te = getTe(); | 1909 | TEWidget* te = getTe(); |
1907 | if( !cfg.readBoolEntry("HorzScroll",0)) | 1910 | if( !cfg.readBoolEntry("HorzScroll",0)) |
1908 | { | 1911 | { |
1909 | te->setWrapAt(0); | 1912 | te->setWrapAt(0); |
1910 | configMenu->setItemChecked( cm_wrap,TRUE); | 1913 | configMenu->setItemChecked( cm_wrap,TRUE); |
1911 | } | 1914 | } |
1912 | else | 1915 | else |
1913 | { | 1916 | { |
1914 | // te->setWrapAt(90); | 1917 | // te->setWrapAt(90); |
1915 | te->setWrapAt(120); | 1918 | te->setWrapAt(120); |
1916 | configMenu->setItemChecked( cm_wrap,FALSE); | 1919 | configMenu->setItemChecked( cm_wrap,FALSE); |
1917 | } | 1920 | } |
1918 | } | 1921 | } |
1922 | void Konsole::closeSession() { | ||
1923 | doneSession(getTe(), 0); | ||
1924 | } | ||
diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index e163cb8..40f5284 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h | |||
@@ -8,192 +8,193 @@ | |||
8 | /* */ | 8 | /* */ |
9 | /* This file is part of Konsole, an X terminal. */ | 9 | /* This file is part of Konsole, an X terminal. */ |
10 | /* */ | 10 | /* */ |
11 | /* The material contained in here more or less directly orginates from */ | 11 | /* The material contained in here more or less directly orginates from */ |
12 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ | 12 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ |
13 | /* */ | 13 | /* */ |
14 | /* -------------------------------------------------------------------------- */ | 14 | /* -------------------------------------------------------------------------- */ |
15 | /* */ | 15 | /* */ |
16 | /* Ported Konsole to Qt/Embedded */ | 16 | /* Ported Konsole to Qt/Embedded */ |
17 | /* */ | 17 | /* */ |
18 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 18 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
19 | /* */ | 19 | /* */ |
20 | /* -------------------------------------------------------------------------- */ | 20 | /* -------------------------------------------------------------------------- */ |
21 | 21 | ||
22 | #ifndef KONSOLE_H | 22 | #ifndef KONSOLE_H |
23 | #define KONSOLE_H | 23 | #define KONSOLE_H |
24 | 24 | ||
25 | 25 | ||
26 | #include <qmainwindow.h> | 26 | #include <qmainwindow.h> |
27 | #include <qaction.h> | 27 | #include <qaction.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qstrlist.h> | 29 | #include <qstrlist.h> |
30 | #include <qintdict.h> | 30 | #include <qintdict.h> |
31 | #include <qptrdict.h> | 31 | #include <qptrdict.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qcolor.h> | 35 | #include <qcolor.h> |
36 | 36 | ||
37 | #include "MyPty.h" | 37 | #include "MyPty.h" |
38 | #include "TEWidget.h" | 38 | #include "TEWidget.h" |
39 | #include "TEmuVt102.h" | 39 | #include "TEmuVt102.h" |
40 | #include "session.h" | 40 | #include "session.h" |
41 | 41 | ||
42 | class EKNumTabWidget; | 42 | class EKNumTabWidget; |
43 | 43 | ||
44 | class Konsole : public QMainWindow | 44 | class Konsole : public QMainWindow |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
48 | public: | 48 | public: |
49 | 49 | ||
50 | static QString appName() | 50 | static QString appName() |
51 | { | 51 | { |
52 | return QString::fromLatin1("embeddedkonsole"); | 52 | return QString::fromLatin1("embeddedkonsole"); |
53 | } | 53 | } |
54 | 54 | ||
55 | Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 55 | Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); |
56 | Konsole(const char * name, const char* pgm, QStrList & _args, int histon); | 56 | Konsole(const char * name, const char* pgm, QStrList & _args, int histon); |
57 | ~Konsole(); | 57 | ~Konsole(); |
58 | void setColLin(int columns, int lines); | 58 | void setColLin(int columns, int lines); |
59 | QToolBar *secondToolBar; | 59 | QToolBar *secondToolBar; |
60 | void show(); | 60 | void show(); |
61 | void setColor(int); | 61 | void setColor(int); |
62 | int lastSelectedMenu; | 62 | int lastSelectedMenu; |
63 | int startUp; | 63 | int startUp; |
64 | 64 | ||
65 | public slots: | 65 | public slots: |
66 | void changeFontSize(int); | 66 | void changeFontSize(int); |
67 | void toggleFullScreen(); | 67 | void toggleFullScreen(); |
68 | void setFullScreen(bool); | 68 | void setFullScreen(bool); |
69 | void changeSession(int); | 69 | void changeSession(int); |
70 | void cycleZoom(); | 70 | void cycleZoom(); |
71 | void newSession(); | 71 | void newSession(); |
72 | 72 | ||
73 | private slots: | 73 | private slots: |
74 | void setDocument(const QString &); | 74 | void setDocument(const QString &); |
75 | void doneSession(TEWidget*,int); | 75 | void doneSession(TEWidget*,int); |
76 | void changeTitle(TEWidget*, const QString&); | 76 | void changeTitle(TEWidget*, const QString&); |
77 | void changeColumns(int); | 77 | void changeColumns(int); |
78 | void setFont(int); | 78 | void setFont(int); |
79 | // void fontChanged(int); | 79 | // void fontChanged(int); |
80 | void configMenuSelected(int ); | 80 | void configMenuSelected(int ); |
81 | void colorMenuSelected(int); | 81 | void colorMenuSelected(int); |
82 | void colorMenuIsSelected(int); | 82 | void colorMenuIsSelected(int); |
83 | void tabMenuSelected(int); | 83 | void tabMenuSelected(int); |
84 | void sessionListSelected(int); | 84 | void sessionListSelected(int); |
85 | 85 | ||
86 | void enterCommand(int); | 86 | void enterCommand(int); |
87 | void hitEnter(); | 87 | void hitEnter(); |
88 | void hitSpace(); | 88 | void hitSpace(); |
89 | void hitTab(); | 89 | void hitTab(); |
90 | void hitPaste(); | 90 | void hitPaste(); |
91 | void hitUp(); | 91 | void hitUp(); |
92 | void hitDown(); | 92 | void hitDown(); |
93 | void switchSession(QWidget *); | 93 | void switchSession(QWidget *); |
94 | void changeCommand(const QString &, int); | 94 | void changeCommand(const QString &, int); |
95 | void initCommandList(); | 95 | void initCommandList(); |
96 | void scrollMenuSelected(int); | 96 | void scrollMenuSelected(int); |
97 | void editCommandListMenuSelected(int); | 97 | void editCommandListMenuSelected(int); |
98 | void parseCommandLine(); | 98 | void parseCommandLine(); |
99 | void changeForegroundColor(const QColor &); | 99 | void changeForegroundColor(const QColor &); |
100 | void changeBackgroundColor(const QColor &); | 100 | void changeBackgroundColor(const QColor &); |
101 | 101 | ||
102 | void historyDialog(); | 102 | void historyDialog(); |
103 | void fullscreenTimeout(); | 103 | void fullscreenTimeout(); |
104 | void closeSession(); | ||
104 | 105 | ||
105 | private: | 106 | private: |
106 | void doWrap(); | 107 | void doWrap(); |
107 | void init(const char* _pgm, QStrList & _args); | 108 | void init(const char* _pgm, QStrList & _args); |
108 | void initSession(const char* _pgm, QStrList & _args); | 109 | void initSession(const char* _pgm, QStrList & _args); |
109 | void runSession(TESession* s); | 110 | void runSession(TESession* s); |
110 | void setColorPixmaps(); | 111 | void setColorPixmaps(); |
111 | void setHistory(bool); | 112 | void setHistory(bool); |
112 | void setColors(QColor foreground, QColor background); | 113 | void setColors(QColor foreground, QColor background); |
113 | int findFont(const QString& name, int size, bool exact = false); | 114 | int findFont(const QString& name, int size, bool exact = false); |
114 | QSize calcSize(int columns, int lines); | 115 | QSize calcSize(int columns, int lines); |
115 | TEWidget* getTe(); | 116 | TEWidget* getTe(); |
116 | QStringList commands; | 117 | QStringList commands; |
117 | QLabel * msgLabel; | 118 | QLabel * msgLabel; |
118 | QColor foreground, background; | 119 | QColor foreground, background; |
119 | bool fromMenu; | 120 | bool fromMenu; |
120 | 121 | ||
121 | bool fullscreen; | 122 | bool fullscreen; |
122 | 123 | ||
123 | private: | 124 | private: |
124 | class VTFont | 125 | class VTFont |
125 | { | 126 | { |
126 | public: | 127 | public: |
127 | VTFont(const QString& name, QFont& font, const QString& family, int familyNum, int size) | 128 | VTFont(const QString& name, QFont& font, const QString& family, int familyNum, int size) |
128 | { | 129 | { |
129 | this->name = name; | 130 | this->name = name; |
130 | this->font = font; | 131 | this->font = font; |
131 | this->family = family; | 132 | this->family = family; |
132 | this->size = size; | 133 | this->size = size; |
133 | this->familyNum = familyNum; | 134 | this->familyNum = familyNum; |
134 | } | 135 | } |
135 | 136 | ||
136 | QFont& getFont() | 137 | QFont& getFont() |
137 | { | 138 | { |
138 | return font; | 139 | return font; |
139 | } | 140 | } |
140 | QString getName() | 141 | QString getName() |
141 | { | 142 | { |
142 | return name; | 143 | return name; |
143 | } | 144 | } |
144 | int getSize() | 145 | int getSize() |
145 | { | 146 | { |
146 | return(size); | 147 | return(size); |
147 | } | 148 | } |
148 | QString getFamily() | 149 | QString getFamily() |
149 | { | 150 | { |
150 | return(family); | 151 | return(family); |
151 | } | 152 | } |
152 | int getFamilyNum() | 153 | int getFamilyNum() |
153 | { | 154 | { |
154 | return(familyNum); | 155 | return(familyNum); |
155 | } | 156 | } |
156 | 157 | ||
157 | private: | 158 | private: |
158 | QFont font; | 159 | QFont font; |
159 | QString name; | 160 | QString name; |
160 | QString family; | 161 | QString family; |
161 | int familyNum; | 162 | int familyNum; |
162 | int size; | 163 | int size; |
163 | }; | 164 | }; |
164 | 165 | ||
165 | EKNumTabWidget* tab; | 166 | EKNumTabWidget* tab; |
166 | int tabPos; | 167 | int tabPos; |
167 | int nsessions; | 168 | int nsessions; |
168 | QList<VTFont> fonts; | 169 | QList<VTFont> fonts; |
169 | int cfont; | 170 | int cfont; |
170 | QCString se_pgm; | 171 | QCString se_pgm; |
171 | QStrList se_args; | 172 | QStrList se_args; |
172 | 173 | ||
173 | QToolBar *menuToolBar; | 174 | QToolBar *menuToolBar; |
174 | QToolBar *toolBar; | 175 | QToolBar *toolBar; |
175 | QComboBox *commonCombo; | 176 | QComboBox *commonCombo; |
176 | 177 | ||
177 | QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu; | 178 | QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu; |
178 | QPopupMenu *sessionList, *tabMenu; | 179 | QPopupMenu *sessionList, *tabMenu; |
179 | 180 | ||
180 | int sm_none, sm_left, sm_right; | 181 | int sm_none, sm_left, sm_right; |
181 | int cm_beep, cm_wrap; | 182 | int cm_beep, cm_wrap; |
182 | int cm_default; | 183 | int cm_default; |
183 | int cm_bw, cm_wb, cm_gb, cm_bt, cm_br, cm_rb, cm_gy, cm_bm, cm_mb, cm_cw, cm_wc, cm_bb, cm_ab; | 184 | int cm_bw, cm_wb, cm_gb, cm_bt, cm_br, cm_rb, cm_gy, cm_bm, cm_mb, cm_cw, cm_wc, cm_bb, cm_ab; |
184 | int tm_top, tm_bottom, tm_hidden; | 185 | int tm_top, tm_bottom, tm_hidden; |
185 | int ec_edit, ec_cmdlist, ec_quick; | 186 | int ec_edit, ec_cmdlist, ec_quick; |
186 | 187 | ||
187 | bool show_fullscreen_msg; | 188 | bool show_fullscreen_msg; |
188 | QTimer *fullscreen_timer; | 189 | QTimer *fullscreen_timer; |
189 | QLabel *fullscreen_msg; | 190 | QLabel *fullscreen_msg; |
190 | 191 | ||
191 | 192 | ||
192 | // history scrolling I think | 193 | // history scrolling I think |
193 | bool b_scroll; | 194 | bool b_scroll; |
194 | 195 | ||
195 | int n_keytab; | 196 | int n_keytab; |
196 | int n_scroll; | 197 | int n_scroll; |
197 | int n_render; | 198 | int n_render; |
198 | QString pmPath; // pixmap path | 199 | QString pmPath; // pixmap path |
199 | QString dropText; | 200 | QString dropText; |