author | llornkcor <llornkcor> | 2002-11-10 02:09:45 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-10 02:09:45 (UTC) |
commit | 7601c75b529d9ff205403a32206b9431845cfc91 (patch) (unidiff) | |
tree | 83aa6347ad7e0cf0175f88f86666c5df705526b1 | |
parent | ea13a08c3f27b007b24743d8de066fbe52961534 (diff) | |
download | opie-7601c75b529d9ff205403a32206b9431845cfc91.zip opie-7601c75b529d9ff205403a32206b9431845cfc91.tar.gz opie-7601c75b529d9ff205403a32206b9431845cfc91.tar.bz2 |
fixes for sharp rom version
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 4480fe2..8885b58 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -777,220 +777,226 @@ void Konsole::colorMenuSelected(int iD) | |||
777 | #endif | 777 | #endif |
778 | for (i = 0; i < TABLE_COLORS; i++) { | 778 | for (i = 0; i < TABLE_COLORS; i++) { |
779 | if(i==0 || i == 10) { | 779 | if(i==0 || i == 10) { |
780 | m_table[i].color = foreground; | 780 | m_table[i].color = foreground; |
781 | } | 781 | } |
782 | else if(i==1 || i == 11) { | 782 | else if(i==1 || i == 11) { |
783 | m_table[i].color = background; m_table[i].transparent=0; | 783 | m_table[i].color = background; m_table[i].transparent=0; |
784 | } | 784 | } |
785 | else | 785 | else |
786 | m_table[i].color = defaultCt[i].color; | 786 | m_table[i].color = defaultCt[i].color; |
787 | } | 787 | } |
788 | } | 788 | } |
789 | lastSelectedMenu = iD; | 789 | lastSelectedMenu = iD; |
790 | te->setColorTable(m_table); | 790 | te->setColorTable(m_table); |
791 | update(); | 791 | update(); |
792 | 792 | ||
793 | } | 793 | } |
794 | 794 | ||
795 | void Konsole::configMenuSelected(int iD) | 795 | void Konsole::configMenuSelected(int iD) |
796 | { | 796 | { |
797 | // QString temp; | 797 | // QString temp; |
798 | // qDebug( temp.sprintf("configmenu %d",iD)); | 798 | // qDebug( temp.sprintf("configmenu %d",iD)); |
799 | TEWidget* te = getTe(); | 799 | TEWidget* te = getTe(); |
800 | Config cfg("Konsole"); | 800 | Config cfg("Konsole"); |
801 | cfg.setGroup("Menubar"); | 801 | cfg.setGroup("Menubar"); |
802 | int i,j; | 802 | int i,j; |
803 | #ifdef QT_QWS_OPIE | 803 | #ifdef QT_QWS_OPIE |
804 | i=-29;j=-30; | 804 | i=-29;j=-30; |
805 | #else | 805 | #else |
806 | i=-28;j=-29; | 806 | i=-28;j=-29; |
807 | #endif | 807 | #endif |
808 | 808 | ||
809 | if(iD == -4) { | 809 | if(iD == -4) { |
810 | cfg.setGroup("Tabs"); | 810 | cfg.setGroup("Tabs"); |
811 | QString tmp=cfg.readEntry("Position","Bottom"); | 811 | QString tmp=cfg.readEntry("Position","Bottom"); |
812 | 812 | ||
813 | if(tmp=="Top") { | 813 | if(tmp=="Top") { |
814 | tab->setTabPosition(QTabWidget::Bottom); | 814 | tab->setTabPosition(QTabWidget::Bottom); |
815 | configMenu->changeItem( iD,"Tabs on Top"); | 815 | configMenu->changeItem( iD,"Tabs on Top"); |
816 | cfg.writeEntry("Position","Bottom"); | 816 | cfg.writeEntry("Position","Bottom"); |
817 | } else { | 817 | } else { |
818 | tab->setTabPosition(QTabWidget::Top); | 818 | tab->setTabPosition(QTabWidget::Top); |
819 | configMenu->changeItem( iD,"Tabs on Bottom"); | 819 | configMenu->changeItem( iD,"Tabs on Bottom"); |
820 | cfg.writeEntry("Position","Top"); | 820 | cfg.writeEntry("Position","Top"); |
821 | } | 821 | } |
822 | } | 822 | } |
823 | if(iD == i) { | 823 | if(iD == i) { |
824 | cfg.setGroup("ScrollBar"); | 824 | cfg.setGroup("ScrollBar"); |
825 | bool b=cfg.readBoolEntry("HorzScroll",0); | 825 | bool b=cfg.readBoolEntry("HorzScroll",0); |
826 | b=!b; | 826 | b=!b; |
827 | cfg.writeEntry("HorzScroll", b ); | 827 | cfg.writeEntry("HorzScroll", b ); |
828 | cfg.write(); | 828 | cfg.write(); |
829 | doWrap(); | 829 | doWrap(); |
830 | if(cfg.readNumEntry("Position",2) == 0) { | 830 | if(cfg.readNumEntry("Position",2) == 0) { |
831 | te->setScrollbarLocation(1); | 831 | te->setScrollbarLocation(1); |
832 | } else { | 832 | } else { |
833 | te->setScrollbarLocation(0); | 833 | te->setScrollbarLocation(0); |
834 | } | 834 | } |
835 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 835 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
836 | } | 836 | } |
837 | if(iD == j) { | 837 | if(iD == j) { |
838 | cfg.setGroup("Menubar"); | 838 | cfg.setGroup("Menubar"); |
839 | bool b=cfg.readBoolEntry("useBeep",0); | 839 | bool b=cfg.readBoolEntry("useBeep",0); |
840 | b=!b; | 840 | b=!b; |
841 | cfg.writeEntry("useBeep", b ); | 841 | cfg.writeEntry("useBeep", b ); |
842 | cfg.write(); | 842 | cfg.write(); |
843 | configMenu->setItemChecked(j,b); | 843 | configMenu->setItemChecked(j,b); |
844 | te->useBeep=b; | 844 | te->useBeep=b; |
845 | } | 845 | } |
846 | } | 846 | } |
847 | 847 | ||
848 | void Konsole::changeCommand(const QString &text, int c) | 848 | void Konsole::changeCommand(const QString &text, int c) |
849 | { | 849 | { |
850 | Config cfg("Konsole"); | 850 | Config cfg("Konsole"); |
851 | cfg.setGroup("Commands"); | 851 | cfg.setGroup("Commands"); |
852 | if(commonCmds[c] != text) { | 852 | if(commonCmds[c] != text) { |
853 | cfg.writeEntry(QString::number(c),text); | 853 | cfg.writeEntry(QString::number(c),text); |
854 | commonCombo->clearEdit(); | 854 | commonCombo->clearEdit(); |
855 | commonCombo->setCurrentItem(c); | 855 | commonCombo->setCurrentItem(c); |
856 | } | 856 | } |
857 | } | 857 | } |
858 | 858 | ||
859 | void Konsole::setColor() | 859 | void Konsole::setColor() |
860 | { | 860 | { |
861 | Config cfg("Konsole"); | 861 | Config cfg("Konsole"); |
862 | cfg.setGroup("Colors"); | 862 | cfg.setGroup("Colors"); |
863 | int scheme = cfg.readNumEntry("Schema",1); | 863 | int scheme = cfg.readNumEntry("Schema",1); |
864 | if(scheme != 1) colorMenuSelected( -scheme); | 864 | if(scheme != 1) colorMenuSelected( -scheme); |
865 | } | 865 | } |
866 | 866 | ||
867 | void Konsole::scrollMenuSelected(int index) | 867 | void Konsole::scrollMenuSelected(int index) |
868 | { | 868 | { |
869 | qDebug( "scrollbar menu %d",index); | 869 | qDebug( "scrollbar menu %d",index); |
870 | TEWidget* te = getTe(); | 870 | TEWidget* te = getTe(); |
871 | Config cfg("Konsole"); | 871 | Config cfg("Konsole"); |
872 | cfg.setGroup("ScrollBar"); | 872 | cfg.setGroup("ScrollBar"); |
873 | switch( index){ | 873 | int i,j,k; |
874 | case -25: | 874 | #ifdef QT_QWS_OPIE |
875 | te->setScrollbarLocation(0); | 875 | i=-25;j=-26;k=-27; |
876 | cfg.writeEntry("Position",0); | 876 | #else |
877 | break; | 877 | i=-24;j=-25;k=-26; |
878 | case -26: | 878 | #endif |
879 | te->setScrollbarLocation(1); | 879 | if(index == i) { |
880 | cfg.writeEntry("Position",1); | 880 | |
881 | break; | 881 | te->setScrollbarLocation(0); |
882 | case -27: | 882 | cfg.writeEntry("Position",0); |
883 | te->setScrollbarLocation(2); | 883 | } else if(index == j) { |
884 | cfg.writeEntry("Position",2); | 884 | |
885 | break; | 885 | te->setScrollbarLocation(1); |
886 | cfg.writeEntry("Position",1); | ||
887 | } else if(index == k) { | ||
888 | |||
889 | te->setScrollbarLocation(2); | ||
890 | cfg.writeEntry("Position",2); | ||
891 | } | ||
892 | |||
886 | // case -29: { | 893 | // case -29: { |
887 | // bool b=cfg.readBoolEntry("HorzScroll",0); | 894 | // bool b=cfg.readBoolEntry("HorzScroll",0); |
888 | // cfg.writeEntry("HorzScroll", !b ); | 895 | // cfg.writeEntry("HorzScroll", !b ); |
889 | // cfg.write(); | 896 | // cfg.write(); |
890 | // if(cfg.readNumEntry("Position",2) == 0) { | 897 | // if(cfg.readNumEntry("Position",2) == 0) { |
891 | // te->setScrollbarLocation(1); | 898 | // te->setScrollbarLocation(1); |
892 | // te->setWrapAt(0); | 899 | // te->setWrapAt(0); |
893 | // } else { | 900 | // } else { |
894 | // te->setScrollbarLocation(0); | 901 | // te->setScrollbarLocation(0); |
895 | // te->setWrapAt(120); | 902 | // te->setWrapAt(120); |
896 | // } | 903 | // } |
897 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 904 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
898 | // } | 905 | // } |
899 | // break; | 906 | // break; |
900 | }; | ||
901 | } | 907 | } |
902 | 908 | ||
903 | void Konsole::editCommandListMenuSelected(int iD) | 909 | void Konsole::editCommandListMenuSelected(int iD) |
904 | { | 910 | { |
905 | // QString temp; | 911 | // QString temp; |
906 | // qDebug( temp.sprintf("edit command list %d",iD)); | 912 | // qDebug( temp.sprintf("edit command list %d",iD)); |
907 | TEWidget* te = getTe(); | 913 | TEWidget* te = getTe(); |
908 | Config cfg("Konsole"); | 914 | Config cfg("Konsole"); |
909 | cfg.setGroup("Menubar"); | 915 | cfg.setGroup("Menubar"); |
910 | if( iD == -3) { | 916 | if( iD == -3) { |
911 | if(!secondToolBar->isHidden()) { | 917 | if(!secondToolBar->isHidden()) { |
912 | secondToolBar->hide(); | 918 | secondToolBar->hide(); |
913 | configMenu->changeItem( iD,tr( "Show Command List" )); | 919 | configMenu->changeItem( iD,tr( "Show Command List" )); |
914 | cfg.writeEntry("Hidden","TRUE"); | 920 | cfg.writeEntry("Hidden","TRUE"); |
915 | configMenu->setItemEnabled(-23 ,FALSE); | 921 | configMenu->setItemEnabled(-23 ,FALSE); |
916 | } else { | 922 | } else { |
917 | secondToolBar->show(); | 923 | secondToolBar->show(); |
918 | configMenu->changeItem( iD,tr( "Hide Command List" )); | 924 | configMenu->changeItem( iD,tr( "Hide Command List" )); |
919 | cfg.writeEntry("Hidden","FALSE"); | 925 | cfg.writeEntry("Hidden","FALSE"); |
920 | configMenu->setItemEnabled(-23 ,TRUE); | 926 | configMenu->setItemEnabled(-23 ,TRUE); |
921 | 927 | ||
922 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { | 928 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { |
923 | configMenu->setItemChecked(-23,TRUE); | 929 | configMenu->setItemChecked(-23,TRUE); |
924 | commonCombo->setEditable( TRUE ); | 930 | commonCombo->setEditable( TRUE ); |
925 | } else { | 931 | } else { |
926 | configMenu->setItemChecked(-23,FALSE); | 932 | configMenu->setItemChecked(-23,FALSE); |
927 | commonCombo->setEditable( FALSE ); | 933 | commonCombo->setEditable( FALSE ); |
928 | } | 934 | } |
929 | } | 935 | } |
930 | } | 936 | } |
931 | if( iD == -23) { | 937 | if( iD == -23) { |
932 | cfg.setGroup("Commands"); | 938 | cfg.setGroup("Commands"); |
933 | // qDebug("enableCommandEdit"); | 939 | // qDebug("enableCommandEdit"); |
934 | if( !configMenu->isItemChecked(iD) ) { | 940 | if( !configMenu->isItemChecked(iD) ) { |
935 | commonCombo->setEditable( TRUE ); | 941 | commonCombo->setEditable( TRUE ); |
936 | configMenu->setItemChecked(iD,TRUE); | 942 | configMenu->setItemChecked(iD,TRUE); |
937 | commonCombo->setCurrentItem(0); | 943 | commonCombo->setCurrentItem(0); |
938 | cfg.writeEntry("EditEnabled","TRUE"); | 944 | cfg.writeEntry("EditEnabled","TRUE"); |
939 | } else { | 945 | } else { |
940 | commonCombo->setEditable( FALSE ); | 946 | commonCombo->setEditable( FALSE ); |
941 | configMenu->setItemChecked(iD,FALSE); | 947 | configMenu->setItemChecked(iD,FALSE); |
942 | cfg.writeEntry("EditEnabled","FALSE"); | 948 | cfg.writeEntry("EditEnabled","FALSE"); |
943 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 949 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
944 | te->setFocus(); | 950 | te->setFocus(); |
945 | } | 951 | } |
946 | } | 952 | } |
947 | if(iD == -24) { | 953 | if(iD == -24) { |
948 | // "edit commands" | 954 | // "edit commands" |
949 | CommandEditDialog *m = new CommandEditDialog(this); | 955 | CommandEditDialog *m = new CommandEditDialog(this); |
950 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); | 956 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); |
951 | m->showMaximized(); | 957 | m->showMaximized(); |
952 | } | 958 | } |
953 | 959 | ||
954 | } | 960 | } |
955 | 961 | ||
956 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' | 962 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' |
957 | void Konsole::setDocument( const QString &cmd) { | 963 | void Konsole::setDocument( const QString &cmd) { |
958 | newSession(); | 964 | newSession(); |
959 | TEWidget* te = getTe(); | 965 | TEWidget* te = getTe(); |
960 | if(cmd.find("-e", 0, TRUE) != -1) { | 966 | if(cmd.find("-e", 0, TRUE) != -1) { |
961 | QString cmd2; | 967 | QString cmd2; |
962 | cmd2=cmd.right(cmd.length()-3)+" &"; | 968 | cmd2=cmd.right(cmd.length()-3)+" &"; |
963 | system(cmd2.latin1()); | 969 | system(cmd2.latin1()); |
964 | if(startUp <= 1 && nsessions < 2) { | 970 | if(startUp <= 1 && nsessions < 2) { |
965 | doneSession(getTe()->currentSession, 0); | 971 | doneSession(getTe()->currentSession, 0); |
966 | exit(0); | 972 | exit(0); |
967 | } else | 973 | } else |
968 | doneSession(getTe()->currentSession, 0); | 974 | doneSession(getTe()->currentSession, 0); |
969 | } else { | 975 | } else { |
970 | if (te != 0) { | 976 | if (te != 0) { |
971 | te->emitText(cmd+"\r"); | 977 | te->emitText(cmd+"\r"); |
972 | } | 978 | } |
973 | } | 979 | } |
974 | startUp++; | 980 | startUp++; |
975 | } | 981 | } |
976 | 982 | ||
977 | void Konsole::parseCommandLine() { | 983 | void Konsole::parseCommandLine() { |
978 | QString cmd; | 984 | QString cmd; |
979 | // newSession(); | 985 | // newSession(); |
980 | for (int i=1;i< qApp->argc();i++) { | 986 | for (int i=1;i< qApp->argc();i++) { |
981 | if( QString(qApp->argv()[i]) == "-e") { | 987 | if( QString(qApp->argv()[i]) == "-e") { |
982 | i++; | 988 | i++; |
983 | for ( int j=i;j< qApp->argc();j++) { | 989 | for ( int j=i;j< qApp->argc();j++) { |
984 | cmd+=QString(qApp->argv()[j])+" "; | 990 | cmd+=QString(qApp->argv()[j])+" "; |
985 | } | 991 | } |
986 | cmd.stripWhiteSpace(); | 992 | cmd.stripWhiteSpace(); |
987 | system(cmd.latin1()); | 993 | system(cmd.latin1()); |
988 | exit(0);//close(); | 994 | exit(0);//close(); |
989 | } // end -e switch | 995 | } // end -e switch |
990 | } | 996 | } |
991 | startUp++; | 997 | startUp++; |
992 | } | 998 | } |
993 | 999 | ||
994 | void Konsole::changeForegroundColor(const QColor &color) { | 1000 | void Konsole::changeForegroundColor(const QColor &color) { |
995 | Config cfg("Konsole"); | 1001 | Config cfg("Konsole"); |
996 | cfg.setGroup("Colors"); | 1002 | cfg.setGroup("Colors"); |