-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 06bee33..5a68c81 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -642,391 +642,391 @@ void Konsole::switchSession(QWidget* w) { | |||
642 | fontList->setItemChecked(i, cf); | 642 | fontList->setItemChecked(i, cf); |
643 | if (cf) { | 643 | if (cf) { |
644 | cfont = i; | 644 | cfont = i; |
645 | } | 645 | } |
646 | } | 646 | } |
647 | } | 647 | } |
648 | 648 | ||
649 | void Konsole::colorMenuIsSelected(int iD) { | 649 | void Konsole::colorMenuIsSelected(int iD) { |
650 | fromMenu = TRUE; | 650 | fromMenu = TRUE; |
651 | colorMenuSelected(iD); | 651 | colorMenuSelected(iD); |
652 | } | 652 | } |
653 | 653 | ||
654 | /// ------------------------------- some new stuff by L.J. Potter | 654 | /// ------------------------------- some new stuff by L.J. Potter |
655 | void Konsole::colorMenuSelected(int iD) | 655 | void Konsole::colorMenuSelected(int iD) |
656 | { // this is NOT pretty, elegant or anything else besides functional | 656 | { // this is NOT pretty, elegant or anything else besides functional |
657 | // QString temp; | 657 | // QString temp; |
658 | // qDebug( temp.sprintf("colormenu %d", iD)); | 658 | // qDebug( temp.sprintf("colormenu %d", iD)); |
659 | TEWidget* te = getTe(); | 659 | TEWidget* te = getTe(); |
660 | Config cfg("Konsole"); | 660 | Config cfg("Konsole"); |
661 | cfg.setGroup("Colors"); | 661 | cfg.setGroup("Colors"); |
662 | // QColor foreground; | 662 | // QColor foreground; |
663 | // QColor background; | 663 | // QColor background; |
664 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); | 664 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); |
665 | ColorEntry m_table[TABLE_COLORS]; | 665 | ColorEntry m_table[TABLE_COLORS]; |
666 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 666 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
667 | /////////// fore back | 667 | /////////// fore back |
668 | int i; | 668 | int i; |
669 | if(iD==-9) { // default default | 669 | if(iD==-9) { // default default |
670 | for (i = 0; i < TABLE_COLORS; i++) { | 670 | for (i = 0; i < TABLE_COLORS; i++) { |
671 | m_table[i].color = defaultCt[i].color; | 671 | m_table[i].color = defaultCt[i].color; |
672 | if(i==1 || i == 11) | 672 | if(i==1 || i == 11) |
673 | m_table[i].transparent=1; | 673 | m_table[i].transparent=1; |
674 | cfg.writeEntry("Schema","9"); | 674 | cfg.writeEntry("Schema","9"); |
675 | colorMenu->setItemChecked(-9,TRUE); | 675 | colorMenu->setItemChecked(-9,TRUE); |
676 | } | 676 | } |
677 | } else { | 677 | } else { |
678 | if(iD==-6) { // green black | 678 | if(iD==-6) { // green black |
679 | foreground.setRgb(0x18,255,0x18); | 679 | foreground.setRgb(0x18,255,0x18); |
680 | background.setRgb(0x00,0x00,0x00); | 680 | background.setRgb(0x00,0x00,0x00); |
681 | cfg.writeEntry("Schema","6"); | 681 | cfg.writeEntry("Schema","6"); |
682 | colorMenu->setItemChecked(-6,TRUE); | 682 | colorMenu->setItemChecked(-6,TRUE); |
683 | } | 683 | } |
684 | if(iD==-7) { // black white | 684 | if(iD==-7) { // black white |
685 | foreground.setRgb(0x00,0x00,0x00); | 685 | foreground.setRgb(0x00,0x00,0x00); |
686 | background.setRgb(0xFF,0xFF,0xFF); | 686 | background.setRgb(0xFF,0xFF,0xFF); |
687 | cfg.writeEntry("Schema","7"); | 687 | cfg.writeEntry("Schema","7"); |
688 | colorMenu->setItemChecked(-7,TRUE); | 688 | colorMenu->setItemChecked(-7,TRUE); |
689 | } | 689 | } |
690 | if(iD==-8) { // white black | 690 | if(iD==-8) { // white black |
691 | foreground.setRgb(0xFF,0xFF,0xFF); | 691 | foreground.setRgb(0xFF,0xFF,0xFF); |
692 | background.setRgb(0x00,0x00,0x00); | 692 | background.setRgb(0x00,0x00,0x00); |
693 | cfg.writeEntry("Schema","8"); | 693 | cfg.writeEntry("Schema","8"); |
694 | colorMenu->setItemChecked(-8,TRUE); | 694 | colorMenu->setItemChecked(-8,TRUE); |
695 | } | 695 | } |
696 | if(iD==-10) {// Black, Red | 696 | if(iD==-10) {// Black, Red |
697 | foreground.setRgb(0x00,0x00,0x00); | 697 | foreground.setRgb(0x00,0x00,0x00); |
698 | background.setRgb(0xB2,0x18,0x18); | 698 | background.setRgb(0xB2,0x18,0x18); |
699 | cfg.writeEntry("Schema","10"); | 699 | cfg.writeEntry("Schema","10"); |
700 | colorMenu->setItemChecked(-10,TRUE); | 700 | colorMenu->setItemChecked(-10,TRUE); |
701 | } | 701 | } |
702 | if(iD==-11) {// Red, Black | 702 | if(iD==-11) {// Red, Black |
703 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 | 703 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 |
704 | background.setRgb(0x00,0x00,0x00); | 704 | background.setRgb(0x00,0x00,0x00); |
705 | cfg.writeEntry("Schema","11"); | 705 | cfg.writeEntry("Schema","11"); |
706 | colorMenu->setItemChecked(-11,TRUE); | 706 | colorMenu->setItemChecked(-11,TRUE); |
707 | } | 707 | } |
708 | if(iD==-12) {// Green, Yellow - is ugly | 708 | if(iD==-12) {// Green, Yellow - is ugly |
709 | // foreground.setRgb(0x18,0xB2,0x18); | 709 | // foreground.setRgb(0x18,0xB2,0x18); |
710 | foreground.setRgb(36,139,10); | 710 | foreground.setRgb(36,139,10); |
711 | // background.setRgb(0xB2,0x68,0x18); | 711 | // background.setRgb(0xB2,0x68,0x18); |
712 | background.setRgb(255,255,0); | 712 | background.setRgb(255,255,0); |
713 | cfg.writeEntry("Schema","12"); | 713 | cfg.writeEntry("Schema","12"); |
714 | colorMenu->setItemChecked(-12,TRUE); | 714 | colorMenu->setItemChecked(-12,TRUE); |
715 | } | 715 | } |
716 | if(iD==-13) {// Blue, Magenta | 716 | if(iD==-13) {// Blue, Magenta |
717 | foreground.setRgb(0x18,0xB2,0xB2); | 717 | foreground.setRgb(0x18,0xB2,0xB2); |
718 | background.setRgb(0x18,0x18,0xB2); | 718 | background.setRgb(0x18,0x18,0xB2); |
719 | cfg.writeEntry("Schema","13"); | 719 | cfg.writeEntry("Schema","13"); |
720 | colorMenu->setItemChecked(-13,TRUE); | 720 | colorMenu->setItemChecked(-13,TRUE); |
721 | } | 721 | } |
722 | if(iD==-14) {// Magenta, Blue | 722 | if(iD==-14) {// Magenta, Blue |
723 | foreground.setRgb(0x18,0x18,0xB2); | 723 | foreground.setRgb(0x18,0x18,0xB2); |
724 | background.setRgb(0x18,0xB2,0xB2); | 724 | background.setRgb(0x18,0xB2,0xB2); |
725 | cfg.writeEntry("Schema","14"); | 725 | cfg.writeEntry("Schema","14"); |
726 | colorMenu->setItemChecked(-14,TRUE); | 726 | colorMenu->setItemChecked(-14,TRUE); |
727 | } | 727 | } |
728 | if(iD==-15) {// Cyan, White | 728 | if(iD==-15) {// Cyan, White |
729 | foreground.setRgb(0x18,0xB2,0xB2); | 729 | foreground.setRgb(0x18,0xB2,0xB2); |
730 | background.setRgb(0xFF,0xFF,0xFF); | 730 | background.setRgb(0xFF,0xFF,0xFF); |
731 | cfg.writeEntry("Schema","15"); | 731 | cfg.writeEntry("Schema","15"); |
732 | colorMenu->setItemChecked(-15,TRUE); | 732 | colorMenu->setItemChecked(-15,TRUE); |
733 | } | 733 | } |
734 | if(iD==-16) {// White, Cyan | 734 | if(iD==-16) {// White, Cyan |
735 | background.setRgb(0x18,0xB2,0xB2); | 735 | background.setRgb(0x18,0xB2,0xB2); |
736 | foreground.setRgb(0xFF,0xFF,0xFF); | 736 | foreground.setRgb(0xFF,0xFF,0xFF); |
737 | cfg.writeEntry("Schema","16"); | 737 | cfg.writeEntry("Schema","16"); |
738 | colorMenu->setItemChecked(-16,TRUE); | 738 | colorMenu->setItemChecked(-16,TRUE); |
739 | } | 739 | } |
740 | if(iD==-17) {// Black, Blue | 740 | if(iD==-17) {// Black, Blue |
741 | background.setRgb(0x00,0x00,0x00); | 741 | background.setRgb(0x00,0x00,0x00); |
742 | foreground.setRgb(0x18,0xB2,0xB2); | 742 | foreground.setRgb(0x18,0xB2,0xB2); |
743 | cfg.writeEntry("Schema","17"); | 743 | cfg.writeEntry("Schema","17"); |
744 | colorMenu->setItemChecked(-17,TRUE); | 744 | colorMenu->setItemChecked(-17,TRUE); |
745 | } | 745 | } |
746 | if(iD==-18) {// Black, Gold | 746 | if(iD==-18) {// Black, Gold |
747 | background.setRgb(0x00,0x00,0x00); | 747 | background.setRgb(0x00,0x00,0x00); |
748 | foreground.setRgb(255,215,0); | 748 | foreground.setRgb(255,215,0); |
749 | cfg.writeEntry("Schema","18"); | 749 | cfg.writeEntry("Schema","18"); |
750 | colorMenu->setItemChecked(-18,TRUE); | 750 | colorMenu->setItemChecked(-18,TRUE); |
751 | } | 751 | } |
752 | #ifdef QWS_QT_OPIE | 752 | #ifdef QWS_QT_OPIE |
753 | if(iD==-19) { | 753 | if(iD==-19) { |
754 | // Custom | 754 | // Custom |
755 | qDebug("do custom"); | 755 | qDebug("do custom"); |
756 | if(fromMenu) { | 756 | if(fromMenu) { |
757 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); | 757 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); |
758 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, | 758 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, |
759 | SLOT(changeForegroundColor(const QColor&))); | 759 | SLOT(changeForegroundColor(const QColor&))); |
760 | penColorPopupMenu->exec(); | 760 | penColorPopupMenu->exec(); |
761 | } | 761 | } |
762 | cfg.writeEntry("Schema","19"); | 762 | cfg.writeEntry("Schema","19"); |
763 | if(!fromMenu) { | 763 | if(!fromMenu) { |
764 | foreground.setNamedColor(cfg.readEntry("foreground","")); | 764 | foreground.setNamedColor(cfg.readEntry("foreground","")); |
765 | background.setNamedColor(cfg.readEntry("background","")); | 765 | background.setNamedColor(cfg.readEntry("background","")); |
766 | } | 766 | } |
767 | fromMenu=FALSE; | 767 | fromMenu=FALSE; |
768 | colorMenu->setItemChecked(-19,TRUE); | 768 | colorMenu->setItemChecked(-19,TRUE); |
769 | } | 769 | } |
770 | #endif | 770 | #endif |
771 | for (i = 0; i < TABLE_COLORS; i++) { | 771 | for (i = 0; i < TABLE_COLORS; i++) { |
772 | if(i==0 || i == 10) { | 772 | if(i==0 || i == 10) { |
773 | m_table[i].color = foreground; | 773 | m_table[i].color = foreground; |
774 | } | 774 | } |
775 | else if(i==1 || i == 11) { | 775 | else if(i==1 || i == 11) { |
776 | m_table[i].color = background; m_table[i].transparent=0; | 776 | m_table[i].color = background; m_table[i].transparent=0; |
777 | } | 777 | } |
778 | else | 778 | else |
779 | m_table[i].color = defaultCt[i].color; | 779 | m_table[i].color = defaultCt[i].color; |
780 | } | 780 | } |
781 | } | 781 | } |
782 | lastSelectedMenu = iD; | 782 | lastSelectedMenu = iD; |
783 | te->setColorTable(m_table); | 783 | te->setColorTable(m_table); |
784 | update(); | 784 | update(); |
785 | 785 | ||
786 | } | 786 | } |
787 | 787 | ||
788 | void Konsole::configMenuSelected(int iD) | 788 | void Konsole::configMenuSelected(int iD) |
789 | { | 789 | { |
790 | // QString temp; | 790 | // QString temp; |
791 | // qDebug( temp.sprintf("configmenu %d",iD)); | 791 | // qDebug( temp.sprintf("configmenu %d",iD)); |
792 | TEWidget* te = getTe(); | 792 | TEWidget* te = getTe(); |
793 | Config cfg("Konsole"); | 793 | Config cfg("Konsole"); |
794 | cfg.setGroup("Menubar"); | 794 | cfg.setGroup("Menubar"); |
795 | if( iD == -4) { | 795 | if( iD == -4) { |
796 | cfg.setGroup("Tabs"); | 796 | cfg.setGroup("Tabs"); |
797 | QString tmp=cfg.readEntry("Position","Bottom"); | 797 | QString tmp=cfg.readEntry("Position","Bottom"); |
798 | 798 | ||
799 | if(tmp=="Top") { | 799 | if(tmp=="Top") { |
800 | tab->setTabPosition(QTabWidget::Bottom); | 800 | tab->setTabPosition(QTabWidget::Bottom); |
801 | configMenu->changeItem( iD,"Tabs on Top"); | 801 | configMenu->changeItem( iD,"Tabs on Top"); |
802 | cfg.writeEntry("Position","Bottom"); | 802 | cfg.writeEntry("Position","Bottom"); |
803 | } else { | 803 | } else { |
804 | tab->setTabPosition(QTabWidget::Top); | 804 | tab->setTabPosition(QTabWidget::Top); |
805 | configMenu->changeItem( iD,"Tabs on Bottom"); | 805 | configMenu->changeItem( iD,"Tabs on Bottom"); |
806 | cfg.writeEntry("Position","Top"); | 806 | cfg.writeEntry("Position","Top"); |
807 | } | 807 | } |
808 | } | 808 | } |
809 | int i; | 809 | int i; |
810 | #ifdef QWS_QT_OPIE | 810 | #ifdef QWS_QT_OPIE |
811 | i=-29; | 811 | i=-29; |
812 | #else | 812 | #else |
813 | i=-28; | 813 | i=-28; |
814 | #endif | 814 | #endif |
815 | 815 | ||
816 | if( iD == i) { | 816 | if( iD == i) { |
817 | cfg.setGroup("ScrollBar"); | 817 | cfg.setGroup("ScrollBar"); |
818 | bool b=cfg.readBoolEntry("HorzScroll",0); | 818 | bool b=cfg.readBoolEntry("HorzScroll",0); |
819 | b=!b; | 819 | b=!b; |
820 | cfg.writeEntry("HorzScroll", b ); | 820 | cfg.writeEntry("HorzScroll", b ); |
821 | cfg.write(); | 821 | cfg.write(); |
822 | doWrap(); | 822 | doWrap(); |
823 | if(cfg.readNumEntry("Position",2) == 0) { | 823 | if(cfg.readNumEntry("Position",2) == 0) { |
824 | te->setScrollbarLocation(1); | 824 | te->setScrollbarLocation(1); |
825 | } else { | 825 | } else { |
826 | te->setScrollbarLocation(0); | 826 | te->setScrollbarLocation(0); |
827 | } | 827 | } |
828 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 828 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
829 | } | 829 | } |
830 | } | 830 | } |
831 | 831 | ||
832 | void Konsole::changeCommand(const QString &text, int c) | 832 | void Konsole::changeCommand(const QString &text, int c) |
833 | { | 833 | { |
834 | Config cfg("Konsole"); | 834 | Config cfg("Konsole"); |
835 | cfg.setGroup("Commands"); | 835 | cfg.setGroup("Commands"); |
836 | if(commonCmds[c] != text) { | 836 | if(commonCmds[c] != text) { |
837 | cfg.writeEntry(QString::number(c),text); | 837 | cfg.writeEntry(QString::number(c),text); |
838 | commonCombo->clearEdit(); | 838 | commonCombo->clearEdit(); |
839 | commonCombo->setCurrentItem(c); | 839 | commonCombo->setCurrentItem(c); |
840 | } | 840 | } |
841 | } | 841 | } |
842 | 842 | ||
843 | void Konsole::setColor() | 843 | void Konsole::setColor() |
844 | { | 844 | { |
845 | Config cfg("Konsole"); | 845 | Config cfg("Konsole"); |
846 | cfg.setGroup("Colors"); | 846 | cfg.setGroup("Colors"); |
847 | int scheme = cfg.readNumEntry("Schema",1); | 847 | int scheme = cfg.readNumEntry("Schema",1); |
848 | if(scheme != 1) colorMenuSelected( -scheme); | 848 | if(scheme != 1) colorMenuSelected( -scheme); |
849 | } | 849 | } |
850 | 850 | ||
851 | void Konsole::scrollMenuSelected(int index) | 851 | void Konsole::scrollMenuSelected(int index) |
852 | { | 852 | { |
853 | qDebug( "scrollbar menu %d",index); | 853 | qDebug( "scrollbar menu %d",index); |
854 | TEWidget* te = getTe(); | 854 | TEWidget* te = getTe(); |
855 | Config cfg("Konsole"); | 855 | Config cfg("Konsole"); |
856 | cfg.setGroup("ScrollBar"); | 856 | cfg.setGroup("ScrollBar"); |
857 | switch( index){ | 857 | switch( index){ |
858 | case -25: | 858 | case -25: |
859 | te->setScrollbarLocation(0); | 859 | te->setScrollbarLocation(0); |
860 | cfg.writeEntry("Position",0); | 860 | cfg.writeEntry("Position",0); |
861 | break; | 861 | break; |
862 | case -26: | 862 | case -26: |
863 | te->setScrollbarLocation(1); | 863 | te->setScrollbarLocation(1); |
864 | cfg.writeEntry("Position",1); | 864 | cfg.writeEntry("Position",1); |
865 | break; | 865 | break; |
866 | case -27: | 866 | case -27: |
867 | te->setScrollbarLocation(2); | 867 | te->setScrollbarLocation(2); |
868 | cfg.writeEntry("Position",2); | 868 | cfg.writeEntry("Position",2); |
869 | break; | 869 | break; |
870 | // case -29: { | 870 | // case -29: { |
871 | // bool b=cfg.readBoolEntry("HorzScroll",0); | 871 | // bool b=cfg.readBoolEntry("HorzScroll",0); |
872 | // cfg.writeEntry("HorzScroll", !b ); | 872 | // cfg.writeEntry("HorzScroll", !b ); |
873 | // cfg.write(); | 873 | // cfg.write(); |
874 | // if(cfg.readNumEntry("Position",2) == 0) { | 874 | // if(cfg.readNumEntry("Position",2) == 0) { |
875 | // te->setScrollbarLocation(1); | 875 | // te->setScrollbarLocation(1); |
876 | // te->setWrapAt(0); | 876 | // te->setWrapAt(0); |
877 | // } else { | 877 | // } else { |
878 | // te->setScrollbarLocation(0); | 878 | // te->setScrollbarLocation(0); |
879 | // te->setWrapAt(120); | 879 | // te->setWrapAt(120); |
880 | // } | 880 | // } |
881 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 881 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
882 | // } | 882 | // } |
883 | // break; | 883 | // break; |
884 | }; | 884 | }; |
885 | } | 885 | } |
886 | 886 | ||
887 | void Konsole::editCommandListMenuSelected(int iD) | 887 | void Konsole::editCommandListMenuSelected(int iD) |
888 | { | 888 | { |
889 | // QString temp; | 889 | // QString temp; |
890 | // qDebug( temp.sprintf("edit command list %d",iD)); | 890 | // qDebug( temp.sprintf("edit command list %d",iD)); |
891 | TEWidget* te = getTe(); | 891 | TEWidget* te = getTe(); |
892 | Config cfg("Konsole"); | 892 | Config cfg("Konsole"); |
893 | cfg.setGroup("Menubar"); | 893 | cfg.setGroup("Menubar"); |
894 | if( iD == -3) { | 894 | if( iD == -3) { |
895 | if(!secondToolBar->isHidden()) { | 895 | if(!secondToolBar->isHidden()) { |
896 | secondToolBar->hide(); | 896 | secondToolBar->hide(); |
897 | configMenu->changeItem( iD,tr( "Show Command List" )); | 897 | configMenu->changeItem( iD,tr( "Show Command List" )); |
898 | cfg.writeEntry("Hidden","TRUE"); | 898 | cfg.writeEntry("Hidden","TRUE"); |
899 | configMenu->setItemEnabled(-23 ,FALSE); | 899 | configMenu->setItemEnabled(-23 ,FALSE); |
900 | } else { | 900 | } else { |
901 | secondToolBar->show(); | 901 | secondToolBar->show(); |
902 | configMenu->changeItem( iD,tr( "Hide Command List" )); | 902 | configMenu->changeItem( iD,tr( "Hide Command List" )); |
903 | cfg.writeEntry("Hidden","FALSE"); | 903 | cfg.writeEntry("Hidden","FALSE"); |
904 | configMenu->setItemEnabled(-23 ,TRUE); | 904 | configMenu->setItemEnabled(-23 ,TRUE); |
905 | 905 | ||
906 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { | 906 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { |
907 | configMenu->setItemChecked(-23,TRUE); | 907 | configMenu->setItemChecked(-23,TRUE); |
908 | commonCombo->setEditable( TRUE ); | 908 | commonCombo->setEditable( TRUE ); |
909 | } else { | 909 | } else { |
910 | configMenu->setItemChecked(-23,FALSE); | 910 | configMenu->setItemChecked(-23,FALSE); |
911 | commonCombo->setEditable( FALSE ); | 911 | commonCombo->setEditable( FALSE ); |
912 | } | 912 | } |
913 | } | 913 | } |
914 | } | 914 | } |
915 | if( iD == -23) { | 915 | if( iD == -23) { |
916 | cfg.setGroup("Commands"); | 916 | cfg.setGroup("Commands"); |
917 | // qDebug("enableCommandEdit"); | 917 | // qDebug("enableCommandEdit"); |
918 | if( !configMenu->isItemChecked(iD) ) { | 918 | if( !configMenu->isItemChecked(iD) ) { |
919 | commonCombo->setEditable( TRUE ); | 919 | commonCombo->setEditable( TRUE ); |
920 | configMenu->setItemChecked(iD,TRUE); | 920 | configMenu->setItemChecked(iD,TRUE); |
921 | commonCombo->setCurrentItem(0); | 921 | commonCombo->setCurrentItem(0); |
922 | cfg.writeEntry("EditEnabled","TRUE"); | 922 | cfg.writeEntry("EditEnabled","TRUE"); |
923 | } else { | 923 | } else { |
924 | commonCombo->setEditable( FALSE ); | 924 | commonCombo->setEditable( FALSE ); |
925 | configMenu->setItemChecked(iD,FALSE); | 925 | configMenu->setItemChecked(iD,FALSE); |
926 | cfg.writeEntry("EditEnabled","FALSE"); | 926 | cfg.writeEntry("EditEnabled","FALSE"); |
927 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 927 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
928 | te->setFocus(); | 928 | te->setFocus(); |
929 | } | 929 | } |
930 | } | 930 | } |
931 | if(iD == -24) { | 931 | if(iD == -24) { |
932 | // "edit commands" | 932 | // "edit commands" |
933 | CommandEditDialog *m = new CommandEditDialog(this); | 933 | CommandEditDialog *m = new CommandEditDialog(this); |
934 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); | 934 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); |
935 | m->showMaximized(); | 935 | m->showMaximized(); |
936 | } | 936 | } |
937 | 937 | ||
938 | } | 938 | } |
939 | 939 | ||
940 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' | 940 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' |
941 | void Konsole::setDocument( const QString &cmd) { | 941 | void Konsole::setDocument( const QString &cmd) { |
942 | newSession(); | 942 | newSession(); |
943 | TEWidget* te = getTe(); | 943 | TEWidget* te = getTe(); |
944 | if(cmd.find("-e", 0, TRUE) != -1) { | 944 | if(cmd.find("-e", 0, TRUE) != -1) { |
945 | QString cmd2; | 945 | QString cmd2; |
946 | cmd2=cmd.right(cmd.length()-3)+" &"; | 946 | cmd2=cmd.right(cmd.length()-3)+" &"; |
947 | system(cmd2.latin1()); | 947 | system(cmd2.latin1()); |
948 | if(startUp <= 1 && nsessions < 2) { | 948 | if(startUp <= 1 && nsessions < 2) { |
949 | doneSession(getTe()->currentSession, 0); | 949 | doneSession(getTe()->currentSession, 0); |
950 | exit(0); | 950 | exit(0); |
951 | } else | 951 | } else |
952 | doneSession(getTe()->currentSession, 0); | 952 | doneSession(getTe()->currentSession, 0); |
953 | } else { | 953 | } else { |
954 | if (te != 0) { | 954 | if (te != 0) { |
955 | te->emitText(cmd+"\r"); | 955 | te->emitText(cmd+"\r"); |
956 | } | 956 | } |
957 | } | 957 | } |
958 | startUp++; | 958 | startUp++; |
959 | } | 959 | } |
960 | 960 | ||
961 | void Konsole::parseCommandLine() { | 961 | void Konsole::parseCommandLine() { |
962 | QString cmd; | 962 | QString cmd; |
963 | // newSession(); | 963 | // newSession(); |
964 | for (int i=1;i< qApp->argc();i++) { | 964 | for (int i=1;i< qApp->argc();i++) { |
965 | if( QString(qApp->argv()[i]) == "-e") { | 965 | if( QString(qApp->argv()[i]) == "-e") { |
966 | i++; | 966 | i++; |
967 | for ( int j=i;j< qApp->argc();j++) { | 967 | for ( int j=i;j< qApp->argc();j++) { |
968 | cmd+=QString(qApp->argv()[j])+" "; | 968 | cmd+=QString(qApp->argv()[j])+" "; |
969 | } | 969 | } |
970 | cmd.stripWhiteSpace(); | 970 | cmd.stripWhiteSpace(); |
971 | system(cmd.latin1()); | 971 | system(cmd.latin1()); |
972 | exit(0);//close(); | 972 | exit(0);//close(); |
973 | } // end -e switch | 973 | } // end -e switch |
974 | } | 974 | } |
975 | startUp++; | 975 | startUp++; |
976 | } | 976 | } |
977 | 977 | ||
978 | void Konsole::changeForegroundColor(const QColor &color) { | 978 | void Konsole::changeForegroundColor(const QColor &color) { |
979 | Config cfg("Konsole"); | 979 | Config cfg("Konsole"); |
980 | cfg.setGroup("Colors"); | 980 | cfg.setGroup("Colors"); |
981 | int r, g, b; | 981 | int r, g, b; |
982 | color.rgb(&r,&g,&b); | 982 | color.rgb(&r,&g,&b); |
983 | foreground.setRgb(r,g,b); | 983 | foreground.setRgb(r,g,b); |
984 | // QString colors; | 984 | // QString colors; |
985 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); | 985 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); |
986 | cfg.writeEntry("foreground",color.name()); | 986 | cfg.writeEntry("foreground",color.name()); |
987 | cfg.write(); | 987 | cfg.write(); |
988 | 988 | ||
989 | qDebug("do other dialog"); | 989 | qDebug("do other dialog"); |
990 | #ifdef QWS_QT_OPIE | 990 | #ifdef QWS_QT_OPIE |
991 | 991 | ||
992 | ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); | 992 | ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); |
993 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, | 993 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, |
994 | SLOT(changeBackgroundColor(const QColor&))); | 994 | SLOT(changeBackgroundColor(const QColor&))); |
995 | penColorPopupMenu2->exec(); | 995 | penColorPopupMenu2->exec(); |
996 | #endif | 996 | #endif |
997 | } | 997 | } |
998 | 998 | ||
999 | void Konsole::changeBackgroundColor(const QColor &color) { | 999 | void Konsole::changeBackgroundColor(const QColor &color) { |
1000 | 1000 | ||
1001 | qDebug("Change background"); | 1001 | qDebug("Change background"); |
1002 | Config cfg("Konsole"); | 1002 | Config cfg("Konsole"); |
1003 | cfg.setGroup("Colors"); | 1003 | cfg.setGroup("Colors"); |
1004 | int r, g, b; | 1004 | int r, g, b; |
1005 | color.rgb(&r,&g,&b); | 1005 | color.rgb(&r,&g,&b); |
1006 | background.setRgb(r,g,b); | 1006 | background.setRgb(r,g,b); |
1007 | // QString colors; | 1007 | // QString colors; |
1008 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); | 1008 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); |
1009 | cfg.writeEntry("background",color.name()); | 1009 | cfg.writeEntry("background",color.name()); |
1010 | cfg.write(); | 1010 | cfg.write(); |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | void Konsole::doWrap() { | 1013 | void Konsole::doWrap() { |
1014 | int i; | 1014 | int i; |
1015 | #ifdef QWS_QT_OPIE | 1015 | #ifdef QWS_QT_OPIE |
1016 | i=-29; | 1016 | i=-29; |
1017 | #else | 1017 | #else |
1018 | i=-28; | 1018 | i=-28; |
1019 | #endif | 1019 | #endif |
1020 | 1020 | ||
1021 | Config cfg("Konsole"); | 1021 | Config cfg("Konsole"); |
1022 | cfg.setGroup("ScrollBar"); | 1022 | cfg.setGroup("ScrollBar"); |
1023 | TEWidget* te = getTe(); | 1023 | TEWidget* te = getTe(); |
1024 | if( !cfg.readBoolEntry("HorzScroll",0)) { | 1024 | if( !cfg.readBoolEntry("HorzScroll",0)) { |
1025 | te->setWrapAt(0); | 1025 | te->setWrapAt(0); |
1026 | configMenu->setItemChecked( i,FALSE); | 1026 | configMenu->setItemChecked( i,TRUE); |
1027 | } else { | 1027 | } else { |
1028 | te->setWrapAt(90); | 1028 | te->setWrapAt(90); |
1029 | // te->setWrapAt(120); | 1029 | // te->setWrapAt(120); |
1030 | configMenu->setItemChecked( i,TRUE); | 1030 | configMenu->setItemChecked( i,FALSE); |
1031 | } | 1031 | } |
1032 | } | 1032 | } |