-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index f3792e4..a8ddc99 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -227,65 +227,65 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
227 | fonts.append(new VTFont(tr("Small Fixed"), f)); | 227 | fonts.append(new VTFont(tr("Small Fixed"), f)); |
228 | 228 | ||
229 | f = QFont("Fixed", 12, QFont::Normal); | 229 | f = QFont("Fixed", 12, QFont::Normal); |
230 | f.setFixedPitch(TRUE); | 230 | f.setFixedPitch(TRUE); |
231 | fonts.append(new VTFont(tr("Medium Fixed"), f)); | 231 | fonts.append(new VTFont(tr("Medium Fixed"), f)); |
232 | 232 | ||
233 | // create terminal emulation framework //////////////////////////////////// | 233 | // create terminal emulation framework //////////////////////////////////// |
234 | nsessions = 0; | 234 | nsessions = 0; |
235 | 235 | ||
236 | tab = new EKNumTabWidget(this); | 236 | tab = new EKNumTabWidget(this); |
237 | 237 | ||
238 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 238 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
239 | 239 | ||
240 | // create terminal toolbar //////////////////////////////////////////////// | 240 | // create terminal toolbar //////////////////////////////////////////////// |
241 | setToolBarsMovable( FALSE ); | 241 | setToolBarsMovable( FALSE ); |
242 | QPEToolBar *menuToolBar = new QPEToolBar( this ); | 242 | QPEToolBar *menuToolBar = new QPEToolBar( this ); |
243 | menuToolBar->setHorizontalStretchable( TRUE ); | 243 | menuToolBar->setHorizontalStretchable( TRUE ); |
244 | 244 | ||
245 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); | 245 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); |
246 | 246 | ||
247 | fontList = new QPopupMenu( this ); | 247 | fontList = new QPopupMenu( this ); |
248 | for(uint i = 0; i < fonts.count(); i++) { | 248 | for(uint i = 0; i < fonts.count(); i++) { |
249 | VTFont *fnt = fonts.at(i); | 249 | VTFont *fnt = fonts.at(i); |
250 | fontList->insertItem(fnt->getName(), i); | 250 | fontList->insertItem(fnt->getName(), i); |
251 | } | 251 | } |
252 | fontChanged(cfont); | 252 | fontChanged(cfont); |
253 | 253 | ||
254 | configMenu = new QPopupMenu( this); | 254 | configMenu = new QPopupMenu( this); |
255 | colorMenu = new QPopupMenu( this); | 255 | colorMenu = new QPopupMenu( this); |
256 | scrollMenu = new QPopupMenu( this); | 256 | scrollMenu = new QPopupMenu( this); |
257 | editCommandListMenu = new QPopupMenu( this); | 257 | editCommandListMenu = new QPopupMenu( this); |
258 | 258 | ||
259 | configMenu->insertItem("Command List",editCommandListMenu); | 259 | configMenu->insertItem(tr("Command List"), editCommandListMenu); |
260 | 260 | ||
261 | bool listHidden; | 261 | bool listHidden; |
262 | cfg.setGroup("Menubar"); | 262 | cfg.setGroup("Menubar"); |
263 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { | 263 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { |
264 | editCommandListMenu->insertItem( tr( "Show command list" )); | 264 | editCommandListMenu->insertItem( tr( "Show command list" )); |
265 | listHidden=TRUE; | 265 | listHidden=TRUE; |
266 | } else { | 266 | } else { |
267 | editCommandListMenu->insertItem( tr( "Hide command list" )); | 267 | editCommandListMenu->insertItem( tr( "Hide command list" )); |
268 | listHidden=FALSE; | 268 | listHidden=FALSE; |
269 | } | 269 | } |
270 | 270 | ||
271 | cfg.setGroup("Tabs"); | 271 | cfg.setGroup("Tabs"); |
272 | tmp=cfg.readEntry("Position","Bottom"); | 272 | tmp=cfg.readEntry("Position","Bottom"); |
273 | if(tmp=="Top") { | 273 | if(tmp=="Top") { |
274 | tab->setTabPosition(QTabWidget::Top); | 274 | tab->setTabPosition(QTabWidget::Top); |
275 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); | 275 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); |
276 | } else { | 276 | } else { |
277 | tab->setTabPosition(QTabWidget::Bottom); | 277 | tab->setTabPosition(QTabWidget::Bottom); |
278 | configMenu->insertItem("Tabs on Top"); | 278 | configMenu->insertItem("Tabs on Top"); |
279 | } | 279 | } |
280 | configMenu->insertSeparator(2); | 280 | configMenu->insertSeparator(2); |
281 | 281 | ||
282 | colorMenu->insertItem(tr( "Green on Black")); | 282 | colorMenu->insertItem(tr( "Green on Black")); |
283 | colorMenu->insertItem(tr( "Black on White")); | 283 | colorMenu->insertItem(tr( "Black on White")); |
284 | colorMenu->insertItem(tr( "White on Black")); | 284 | colorMenu->insertItem(tr( "White on Black")); |
285 | colorMenu->insertItem(tr( "Black on Transparent")); | 285 | colorMenu->insertItem(tr( "Black on Transparent")); |
286 | colorMenu->insertItem(tr( "Black on Red")); | 286 | colorMenu->insertItem(tr( "Black on Red")); |
287 | colorMenu->insertItem(tr( "Red on Black")); | 287 | colorMenu->insertItem(tr( "Red on Black")); |
288 | colorMenu->insertItem(tr( "Green on Yellow")); | 288 | colorMenu->insertItem(tr( "Green on Yellow")); |
289 | colorMenu->insertItem(tr( "Blue on Magenta")); | 289 | colorMenu->insertItem(tr( "Blue on Magenta")); |
290 | colorMenu->insertItem(tr( "Magenta on Blue")); | 290 | colorMenu->insertItem(tr( "Magenta on Blue")); |
291 | colorMenu->insertItem(tr( "Cyan on White")); | 291 | colorMenu->insertItem(tr( "Cyan on White")); |
@@ -592,65 +592,65 @@ void Konsole::newSession() { | |||
592 | se->setConnect(TRUE); | 592 | se->setConnect(TRUE); |
593 | se->setHistory(b_scroll); | 593 | se->setHistory(b_scroll); |
594 | tab->setCurrentPage(nsessions); | 594 | tab->setCurrentPage(nsessions); |
595 | nsessions++; | 595 | nsessions++; |
596 | setColor(); | 596 | setColor(); |
597 | } | 597 | } |
598 | } | 598 | } |
599 | 599 | ||
600 | TEWidget* Konsole::getTe() { | 600 | TEWidget* Konsole::getTe() { |
601 | if (nsessions) { | 601 | if (nsessions) { |
602 | return (TEWidget *) tab->currentPage(); | 602 | return (TEWidget *) tab->currentPage(); |
603 | } else { | 603 | } else { |
604 | return 0; | 604 | return 0; |
605 | } | 605 | } |
606 | } | 606 | } |
607 | 607 | ||
608 | void Konsole::switchSession(QWidget* w) { | 608 | void Konsole::switchSession(QWidget* w) { |
609 | TEWidget* te = (TEWidget *) w; | 609 | TEWidget* te = (TEWidget *) w; |
610 | 610 | ||
611 | QFont teFnt = te->getVTFont(); | 611 | QFont teFnt = te->getVTFont(); |
612 | for(uint i = 0; i < fonts.count(); i++) { | 612 | for(uint i = 0; i < fonts.count(); i++) { |
613 | VTFont *fnt = fonts.at(i); | 613 | VTFont *fnt = fonts.at(i); |
614 | bool cf = fnt->getFont() == teFnt; | 614 | bool cf = fnt->getFont() == teFnt; |
615 | fontList->setItemChecked(i, cf); | 615 | fontList->setItemChecked(i, cf); |
616 | if (cf) { | 616 | if (cf) { |
617 | cfont = i; | 617 | cfont = i; |
618 | } | 618 | } |
619 | } | 619 | } |
620 | } | 620 | } |
621 | 621 | ||
622 | void Konsole::colorMenuIsSelected(int iD) { | 622 | void Konsole::colorMenuIsSelected(int iD) { |
623 | fromMenu = TRUE; | 623 | fromMenu = TRUE; |
624 | colorMenuSelected(iD); | 624 | colorMenuSelected(iD); |
625 | } | 625 | } |
626 | 626 | ||
627 | /// ------------------------------- some new stuff by L.J. Potter | 627 | /// ------------------------------- some new stuff by L.J. Potter |
628 | void Konsole::colorMenuSelected(int iD) | 628 | void Konsole::colorMenuSelected(int iD) |
629 | { // this is NOT pretty, elegant or anything else besides functional | 629 | { // this is NOT pretty, elegant or anything else besides functional |
630 | // QString temp; | 630 | // QString temp; |
631 | // qDebug( temp.sprintf("colormenu %d", iD)); | 631 | // qDebug( temp.sprintf("colormenu %d", iD)); |
632 | TEWidget* te = getTe(); | 632 | TEWidget* te = getTe(); |
633 | Config cfg("Konsole"); | 633 | Config cfg("Konsole"); |
634 | cfg.setGroup("Colors"); | 634 | cfg.setGroup("Colors"); |
635 | // QColor foreground; | 635 | // QColor foreground; |
636 | // QColor background; | 636 | // QColor background; |
637 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); | 637 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); |
638 | ColorEntry m_table[TABLE_COLORS]; | 638 | ColorEntry m_table[TABLE_COLORS]; |
639 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 639 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
640 | /////////// fore back | 640 | /////////// fore back |
641 | int i; | 641 | int i; |
642 | if(iD==-9) { // default default | 642 | if(iD==-9) { // default default |
643 | for (i = 0; i < TABLE_COLORS; i++) { | 643 | for (i = 0; i < TABLE_COLORS; i++) { |
644 | m_table[i].color = defaultCt[i].color; | 644 | m_table[i].color = defaultCt[i].color; |
645 | if(i==1 || i == 11) | 645 | if(i==1 || i == 11) |
646 | m_table[i].transparent=1; | 646 | m_table[i].transparent=1; |
647 | cfg.writeEntry("Schema","9"); | 647 | cfg.writeEntry("Schema","9"); |
648 | colorMenu->setItemChecked(-9,TRUE); | 648 | colorMenu->setItemChecked(-9,TRUE); |
649 | } | 649 | } |
650 | } else { | 650 | } else { |
651 | if(iD==-6) { // green black | 651 | if(iD==-6) { // green black |
652 | foreground.setRgb(0x18,255,0x18); | 652 | foreground.setRgb(0x18,255,0x18); |
653 | background.setRgb(0x00,0x00,0x00); | 653 | background.setRgb(0x00,0x00,0x00); |
654 | cfg.writeEntry("Schema","6"); | 654 | cfg.writeEntry("Schema","6"); |
655 | colorMenu->setItemChecked(-6,TRUE); | 655 | colorMenu->setItemChecked(-6,TRUE); |
656 | } | 656 | } |
@@ -724,65 +724,65 @@ void Konsole::colorMenuSelected(int iD) | |||
724 | } | 724 | } |
725 | if(iD==-19) {// Custom | 725 | if(iD==-19) {// Custom |
726 | qDebug("do custom"); | 726 | qDebug("do custom"); |
727 | if(fromMenu) { | 727 | if(fromMenu) { |
728 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); | 728 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); |
729 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, | 729 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, |
730 | SLOT(changeForegroundColor(const QColor&))); | 730 | SLOT(changeForegroundColor(const QColor&))); |
731 | penColorPopupMenu->exec(); | 731 | penColorPopupMenu->exec(); |
732 | } | 732 | } |
733 | cfg.writeEntry("Schema","19"); | 733 | cfg.writeEntry("Schema","19"); |
734 | if(!fromMenu) { | 734 | if(!fromMenu) { |
735 | foreground.setNamedColor(cfg.readEntry("foreground","")); | 735 | foreground.setNamedColor(cfg.readEntry("foreground","")); |
736 | background.setNamedColor(cfg.readEntry("background","")); | 736 | background.setNamedColor(cfg.readEntry("background","")); |
737 | } | 737 | } |
738 | fromMenu=FALSE; | 738 | fromMenu=FALSE; |
739 | colorMenu->setItemChecked(-19,TRUE); | 739 | colorMenu->setItemChecked(-19,TRUE); |
740 | } | 740 | } |
741 | 741 | ||
742 | for (i = 0; i < TABLE_COLORS; i++) { | 742 | for (i = 0; i < TABLE_COLORS; i++) { |
743 | if(i==0 || i == 10) { | 743 | if(i==0 || i == 10) { |
744 | m_table[i].color = foreground; | 744 | m_table[i].color = foreground; |
745 | } | 745 | } |
746 | else if(i==1 || i == 11) { | 746 | else if(i==1 || i == 11) { |
747 | m_table[i].color = background; m_table[i].transparent=0; | 747 | m_table[i].color = background; m_table[i].transparent=0; |
748 | } | 748 | } |
749 | else | 749 | else |
750 | m_table[i].color = defaultCt[i].color; | 750 | m_table[i].color = defaultCt[i].color; |
751 | } | 751 | } |
752 | } | 752 | } |
753 | lastSelectedMenu = iD; | 753 | lastSelectedMenu = iD; |
754 | te->setColorTable(m_table); | 754 | te->setColorTable(m_table); |
755 | update(); | 755 | update(); |
756 | 756 | ||
757 | } | 757 | } |
758 | 758 | ||
759 | void Konsole::configMenuSelected(int iD) | 759 | void Konsole::configMenuSelected(int iD) |
760 | { | 760 | { |
761 | // QString temp; | 761 | // QString temp; |
762 | // qDebug( temp.sprintf("configmenu %d",iD)); | 762 | // qDebug( temp.sprintf("configmenu %d",iD)); |
763 | TEWidget* te = getTe(); | 763 | TEWidget* te = getTe(); |
764 | Config cfg("Konsole"); | 764 | Config cfg("Konsole"); |
765 | cfg.setGroup("Menubar"); | 765 | cfg.setGroup("Menubar"); |
766 | if( iD == -4) { | 766 | if( iD == -4) { |
767 | cfg.setGroup("Tabs"); | 767 | cfg.setGroup("Tabs"); |
768 | QString tmp=cfg.readEntry("Position","Bottom"); | 768 | QString tmp=cfg.readEntry("Position","Bottom"); |
769 | 769 | ||
770 | if(tmp=="Top") { | 770 | if(tmp=="Top") { |
771 | tab->setTabPosition(QTabWidget::Bottom); | 771 | tab->setTabPosition(QTabWidget::Bottom); |
772 | configMenu->changeItem( iD,"Tabs on Top"); | 772 | configMenu->changeItem( iD,"Tabs on Top"); |
773 | cfg.writeEntry("Position","Bottom"); | 773 | cfg.writeEntry("Position","Bottom"); |
774 | } else { | 774 | } else { |
775 | tab->setTabPosition(QTabWidget::Top); | 775 | tab->setTabPosition(QTabWidget::Top); |
776 | configMenu->changeItem( iD,"Tabs on Bottom"); | 776 | configMenu->changeItem( iD,"Tabs on Bottom"); |
777 | cfg.writeEntry("Position","Top"); | 777 | cfg.writeEntry("Position","Top"); |
778 | } | 778 | } |
779 | } | 779 | } |
780 | } | 780 | } |
781 | 781 | ||
782 | void Konsole::changeCommand(const QString &text, int c) | 782 | void Konsole::changeCommand(const QString &text, int c) |
783 | { | 783 | { |
784 | Config cfg("Konsole"); | 784 | Config cfg("Konsole"); |
785 | cfg.setGroup("Commands"); | 785 | cfg.setGroup("Commands"); |
786 | if(commonCmds[c] != text) { | 786 | if(commonCmds[c] != text) { |
787 | cfg.writeEntry(QString::number(c),text); | 787 | cfg.writeEntry(QString::number(c),text); |
788 | commonCombo->clearEdit(); | 788 | commonCombo->clearEdit(); |
@@ -900,48 +900,48 @@ void Konsole::parseCommandLine() { | |||
900 | QString cmd; | 900 | QString cmd; |
901 | // newSession(); | 901 | // newSession(); |
902 | for (int i=1;i< qApp->argc();i++) { | 902 | for (int i=1;i< qApp->argc();i++) { |
903 | if( QString(qApp->argv()[i]) == "-e") { | 903 | if( QString(qApp->argv()[i]) == "-e") { |
904 | i++; | 904 | i++; |
905 | for ( int j=i;j< qApp->argc();j++) { | 905 | for ( int j=i;j< qApp->argc();j++) { |
906 | cmd+=QString(qApp->argv()[j])+" "; | 906 | cmd+=QString(qApp->argv()[j])+" "; |
907 | } | 907 | } |
908 | cmd.stripWhiteSpace(); | 908 | cmd.stripWhiteSpace(); |
909 | system(cmd.latin1()); | 909 | system(cmd.latin1()); |
910 | exit(0);//close(); | 910 | exit(0);//close(); |
911 | } // end -e switch | 911 | } // end -e switch |
912 | } | 912 | } |
913 | startUp++; | 913 | startUp++; |
914 | } | 914 | } |
915 | 915 | ||
916 | void Konsole::changeForegroundColor(const QColor &color) { | 916 | void Konsole::changeForegroundColor(const QColor &color) { |
917 | Config cfg("Konsole"); | 917 | Config cfg("Konsole"); |
918 | cfg.setGroup("Colors"); | 918 | cfg.setGroup("Colors"); |
919 | int r, g, b; | 919 | int r, g, b; |
920 | color.rgb(&r,&g,&b); | 920 | color.rgb(&r,&g,&b); |
921 | foreground.setRgb(r,g,b); | 921 | foreground.setRgb(r,g,b); |
922 | // QString colors; | 922 | // QString colors; |
923 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); | 923 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); |
924 | cfg.writeEntry("foreground",color.name()); | 924 | cfg.writeEntry("foreground",color.name()); |
925 | cfg.write(); | 925 | cfg.write(); |
926 | 926 | ||
927 | qDebug("do other dialog"); | 927 | qDebug("do other dialog"); |
928 | ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); | 928 | ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); |
929 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, | 929 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, |
930 | SLOT(changeBackgroundColor(const QColor&))); | 930 | SLOT(changeBackgroundColor(const QColor&))); |
931 | penColorPopupMenu2->exec(); | 931 | penColorPopupMenu2->exec(); |
932 | 932 | ||
933 | } | 933 | } |
934 | 934 | ||
935 | void Konsole::changeBackgroundColor(const QColor &color) { | 935 | void Konsole::changeBackgroundColor(const QColor &color) { |
936 | 936 | ||
937 | qDebug("Change background"); | 937 | qDebug("Change background"); |
938 | Config cfg("Konsole"); | 938 | Config cfg("Konsole"); |
939 | cfg.setGroup("Colors"); | 939 | cfg.setGroup("Colors"); |
940 | int r, g, b; | 940 | int r, g, b; |
941 | color.rgb(&r,&g,&b); | 941 | color.rgb(&r,&g,&b); |
942 | background.setRgb(r,g,b); | 942 | background.setRgb(r,g,b); |
943 | // QString colors; | 943 | // QString colors; |
944 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); | 944 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); |
945 | cfg.writeEntry("background",color.name()); | 945 | cfg.writeEntry("background",color.name()); |
946 | cfg.write(); | 946 | cfg.write(); |
947 | } | 947 | } |