-rwxr-xr-x | core/apps/embeddedkonsole/embeddedkonsole.pro | 28 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 68 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 8 |
3 files changed, 85 insertions, 19 deletions
diff --git a/core/apps/embeddedkonsole/embeddedkonsole.pro b/core/apps/embeddedkonsole/embeddedkonsole.pro index de0cfa1..6b7af27 100755 --- a/core/apps/embeddedkonsole/embeddedkonsole.pro +++ b/core/apps/embeddedkonsole/embeddedkonsole.pro | |||
@@ -18,33 +18,33 @@ SOURCES = TEScreen.cpp \ | |||
18 | TEWidget.cpp \ | 18 | TEWidget.cpp \ |
19 | TEHistory.cpp \ | 19 | TEHistory.cpp \ |
20 | TEmulation.cpp \ | 20 | TEmulation.cpp \ |
21 | TEmuVt102.cpp \ | 21 | TEmuVt102.cpp \ |
22 | session.cpp \ | 22 | session.cpp \ |
23 | keytrans.cpp \ | 23 | keytrans.cpp \ |
24 | konsole.cpp \ | 24 | konsole.cpp \ |
25 | commandeditdialog.cpp \ | 25 | commandeditdialog.cpp \ |
26 | commandeditwidget.cpp \ | 26 | commandeditwidget.cpp \ |
27 | playlistselection.cpp \ | 27 | playlistselection.cpp \ |
28 | MyPty.cpp \ | 28 | MyPty.cpp \ |
29 | main.cpp | 29 | main.cpp |
30 | INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui | 30 | INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui |
31 | TARGET = embeddedkonsole | 31 | TARGET = embeddedkonsole |
32 | INCLUDEPATH += $(OPIEDIR)/include | 32 | INCLUDEPATH += $(OPIEDIR)/include |
33 | DEPENDPATH += $(OPIEDIR)/include | 33 | DEPENDPATH += $(OPIEDIR)/include |
34 | LIBS += -lqpe | 34 | LIBS += -lqpe -lopie |
35 | REQUIRES = embeddedkonsole | 35 | REQUIRES = embeddedkonsole |
36 | 36 | ||
37 | TRANSLATIONS = ../../../i18n/de/embeddedkonsole.ts \ | 37 | TRANSLATIONS = ../../../i18n/de/embeddedkonsole.ts \ |
38 | ../../../i18n/en/embeddedkonsole.ts \ | 38 | ../../../i18n/en/embeddedkonsole.ts \ |
39 | ../../../i18n/es/embeddedkonsole.ts \ | 39 | ../../../i18n/es/embeddedkonsole.ts \ |
40 | ../../../i18n/fr/embeddedkonsole.ts \ | 40 | ../../../i18n/fr/embeddedkonsole.ts \ |
41 | ../../../i18n/hu/embeddedkonsole.ts \ | 41 | ../../../i18n/hu/embeddedkonsole.ts \ |
42 | ../../../i18n/ja/embeddedkonsole.ts \ | 42 | ../../../i18n/ja/embeddedkonsole.ts \ |
43 | ../../../i18n/ko/embeddedkonsole.ts \ | 43 | ../../../i18n/ko/embeddedkonsole.ts \ |
44 | ../../../i18n/no/embeddedkonsole.ts \ | 44 | ../../../i18n/no/embeddedkonsole.ts \ |
45 | ../../../i18n/pl/embeddedkonsole.ts \ | 45 | ../../../i18n/pl/embeddedkonsole.ts \ |
46 | ../../../i18n/pt/embeddedkonsole.ts \ | 46 | ../../../i18n/pt/embeddedkonsole.ts \ |
47 | ../../../i18n/pt_BR/embeddedkonsole.ts \ | 47 | ../../../i18n/pt_BR/embeddedkonsole.ts \ |
48 | ../../../i18n/sl/embeddedkonsole.ts \ | 48 | ../../../i18n/sl/embeddedkonsole.ts \ |
49 | ../../../i18n/zh_CN/embeddedkonsole.ts \ | 49 | ../../../i18n/zh_CN/embeddedkonsole.ts \ |
50 | ../../../i18n/zh_TW/embeddedkonsole.ts | 50 | ../../../i18n/zh_TW/embeddedkonsole.ts |
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index b0d28fc..8b1e066 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -41,32 +41,34 @@ | |||
41 | #include <qevent.h> | 41 | #include <qevent.h> |
42 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
43 | #include <qtabbar.h> | 43 | #include <qtabbar.h> |
44 | #include <qpe/config.h> | 44 | #include <qpe/config.h> |
45 | #include <qstringlist.h> | 45 | #include <qstringlist.h> |
46 | #include <qpalette.h> | 46 | #include <qpalette.h> |
47 | 47 | ||
48 | #include <sys/wait.h> | 48 | #include <sys/wait.h> |
49 | #include <stdio.h> | 49 | #include <stdio.h> |
50 | #include <stdlib.h> | 50 | #include <stdlib.h> |
51 | #include <assert.h> | 51 | #include <assert.h> |
52 | 52 | ||
53 | #include "konsole.h" | 53 | #include "konsole.h" |
54 | #include "keytrans.h" | 54 | #include "keytrans.h" |
55 | #include "commandeditdialog.h" | 55 | #include "commandeditdialog.h" |
56 | 56 | ||
57 | #include <opie/colorpopupmenu.h> | ||
58 | |||
57 | class EKNumTabBar : public QTabBar { | 59 | class EKNumTabBar : public QTabBar { |
58 | public: | 60 | public: |
59 | void numberTabs() | 61 | void numberTabs() |
60 | { | 62 | { |
61 | // Yes, it really is this messy. QTabWidget needs functions | 63 | // Yes, it really is this messy. QTabWidget needs functions |
62 | // that provide acces to tabs in a sequential way. | 64 | // that provide acces to tabs in a sequential way. |
63 | int m=INT_MIN; | 65 | int m=INT_MIN; |
64 | for (int i=0; i<count(); i++) { | 66 | for (int i=0; i<count(); i++) { |
65 | QTab* left=0; | 67 | QTab* left=0; |
66 | QListIterator<QTab> it(*tabList()); | 68 | QListIterator<QTab> it(*tabList()); |
67 | int x=INT_MAX; | 69 | int x=INT_MAX; |
68 | for( QTab* t; (t=it.current()); ++it ) { | 70 | for( QTab* t; (t=it.current()); ++it ) { |
69 | int tx = t->rect().x(); | 71 | int tx = t->rect().x(); |
70 | if ( tx<x && tx>m ) { | 72 | if ( tx<x && tx>m ) { |
71 | x = tx; | 73 | x = tx; |
72 | left = t; | 74 | left = t; |
@@ -193,32 +195,34 @@ void Konsole::initCommandList() | |||
193 | } | 195 | } |
194 | } else { | 196 | } else { |
195 | for (int i = 0; i < 100; i++) { | 197 | for (int i = 0; i < 100; i++) { |
196 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 198 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
197 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); | 199 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); |
198 | } | 200 | } |
199 | } | 201 | } |
200 | 202 | ||
201 | } | 203 | } |
202 | 204 | ||
203 | void Konsole::init(const char* _pgm, QStrList & _args) | 205 | void Konsole::init(const char* _pgm, QStrList & _args) |
204 | { | 206 | { |
205 | b_scroll = TRUE; // histon; | 207 | b_scroll = TRUE; // histon; |
206 | n_keytab = 0; | 208 | n_keytab = 0; |
207 | n_render = 0; | 209 | n_render = 0; |
208 | startUp=0; | 210 | startUp=0; |
211 | fromMenu = FALSE; | ||
212 | |||
209 | setCaption( tr("Terminal") ); | 213 | setCaption( tr("Terminal") ); |
210 | setIcon( Resource::loadPixmap( "konsole" ) ); | 214 | setIcon( Resource::loadPixmap( "konsole" ) ); |
211 | 215 | ||
212 | Config cfg("Konsole"); | 216 | Config cfg("Konsole"); |
213 | cfg.setGroup("Konsole"); | 217 | cfg.setGroup("Konsole"); |
214 | QString tmp; | 218 | QString tmp; |
215 | // initialize the list of allowed fonts /////////////////////////////////// | 219 | // initialize the list of allowed fonts /////////////////////////////////// |
216 | cfont = cfg.readNumEntry("FontID", 1); | 220 | cfont = cfg.readNumEntry("FontID", 1); |
217 | QFont f = QFont("Micro", 4, QFont::Normal); | 221 | QFont f = QFont("Micro", 4, QFont::Normal); |
218 | f.setFixedPitch(TRUE); | 222 | f.setFixedPitch(TRUE); |
219 | fonts.append(new VTFont(tr("Micro"), f)); | 223 | fonts.append(new VTFont(tr("Micro"), f)); |
220 | 224 | ||
221 | f = QFont("Fixed", 7, QFont::Normal); | 225 | f = QFont("Fixed", 7, QFont::Normal); |
222 | f.setFixedPitch(TRUE); | 226 | f.setFixedPitch(TRUE); |
223 | fonts.append(new VTFont(tr("Small Fixed"), f)); | 227 | fonts.append(new VTFont(tr("Small Fixed"), f)); |
224 | 228 | ||
@@ -275,37 +279,38 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
275 | } | 279 | } |
276 | configMenu->insertSeparator(2); | 280 | configMenu->insertSeparator(2); |
277 | 281 | ||
278 | colorMenu->insertItem(tr( "Green on Black")); | 282 | colorMenu->insertItem(tr( "Green on Black")); |
279 | colorMenu->insertItem(tr( "Black on White")); | 283 | colorMenu->insertItem(tr( "Black on White")); |
280 | colorMenu->insertItem(tr( "White on Black")); | 284 | colorMenu->insertItem(tr( "White on Black")); |
281 | colorMenu->insertItem(tr( "Black on Transparent")); | 285 | colorMenu->insertItem(tr( "Black on Transparent")); |
282 | colorMenu->insertItem(tr( "Black on Red")); | 286 | colorMenu->insertItem(tr( "Black on Red")); |
283 | colorMenu->insertItem(tr( "Red on Black")); | 287 | colorMenu->insertItem(tr( "Red on Black")); |
284 | colorMenu->insertItem(tr( "Green on Yellow")); | 288 | colorMenu->insertItem(tr( "Green on Yellow")); |
285 | colorMenu->insertItem(tr( "Blue on Magenta")); | 289 | colorMenu->insertItem(tr( "Blue on Magenta")); |
286 | colorMenu->insertItem(tr( "Magenta on Blue")); | 290 | colorMenu->insertItem(tr( "Magenta on Blue")); |
287 | colorMenu->insertItem(tr( "Cyan on White")); | 291 | colorMenu->insertItem(tr( "Cyan on White")); |
288 | colorMenu->insertItem(tr( "White on Cyan")); | 292 | colorMenu->insertItem(tr( "White on Cyan")); |
289 | colorMenu->insertItem(tr( "Blue on Black")); | 293 | colorMenu->insertItem(tr( "Blue on Black")); |
290 | colorMenu->insertItem(tr( "Amber on Black")); | 294 | colorMenu->insertItem(tr( "Amber on Black")); |
295 | colorMenu->insertItem(tr( "Custom")); | ||
291 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 296 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
292 | 297 | ||
293 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 298 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
294 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 299 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
295 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); | 300 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); |
296 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 301 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
297 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 302 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
298 | menuBar->insertItem( tr("Font"), fontList ); | 303 | menuBar->insertItem( tr("Font"), fontList ); |
299 | menuBar->insertItem( tr("Options"), configMenu ); | 304 | menuBar->insertItem( tr("Options"), configMenu ); |
300 | 305 | ||
301 | QPEToolBar *toolbar = new QPEToolBar( this ); | 306 | QPEToolBar *toolbar = new QPEToolBar( this ); |
302 | 307 | ||
303 | QAction *a; | 308 | QAction *a; |
304 | 309 | ||
305 | // Button Commands | 310 | // Button Commands |
306 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); | 311 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); |
307 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); | 312 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); |
308 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 313 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
309 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); | 314 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); |
310 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 315 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
311 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); | 316 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); |
@@ -601,53 +606,58 @@ TEWidget* Konsole::getTe() { | |||
601 | } | 606 | } |
602 | 607 | ||
603 | void Konsole::switchSession(QWidget* w) { | 608 | void Konsole::switchSession(QWidget* w) { |
604 | TEWidget* te = (TEWidget *) w; | 609 | TEWidget* te = (TEWidget *) w; |
605 | 610 | ||
606 | QFont teFnt = te->getVTFont(); | 611 | QFont teFnt = te->getVTFont(); |
607 | for(uint i = 0; i < fonts.count(); i++) { | 612 | for(uint i = 0; i < fonts.count(); i++) { |
608 | VTFont *fnt = fonts.at(i); | 613 | VTFont *fnt = fonts.at(i); |
609 | bool cf = fnt->getFont() == teFnt; | 614 | bool cf = fnt->getFont() == teFnt; |
610 | fontList->setItemChecked(i, cf); | 615 | fontList->setItemChecked(i, cf); |
611 | if (cf) { | 616 | if (cf) { |
612 | cfont = i; | 617 | cfont = i; |
613 | } | 618 | } |
614 | } | 619 | } |
615 | } | 620 | } |
616 | 621 | ||
622 | void Konsole::colorMenuIsSelected(int iD) { | ||
623 | fromMenu = TRUE; | ||
624 | colorMenuSelected(iD); | ||
625 | } | ||
626 | |||
617 | /// ------------------------------- some new stuff by L.J. Potter | 627 | /// ------------------------------- some new stuff by L.J. Potter |
618 | void Konsole::colorMenuSelected(int iD) | 628 | void Konsole::colorMenuSelected(int iD) |
619 | { // this is NOT pretty, elegant or anything else besides functional | 629 | { // this is NOT pretty, elegant or anything else besides functional |
620 | // QString temp; | 630 | // QString temp; |
621 | // qDebug( temp.sprintf("colormenu %d", iD)); | 631 | // qDebug( temp.sprintf("colormenu %d", iD)); |
622 | TEWidget* te = getTe(); | 632 | TEWidget* te = getTe(); |
623 | Config cfg("Konsole"); | 633 | Config cfg("Konsole"); |
624 | cfg.setGroup("Colors"); | 634 | cfg.setGroup("Colors"); |
625 | QColor foreground; | 635 | // QColor foreground; |
626 | QColor background; | 636 | // QColor background; |
627 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); | 637 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); |
628 | ColorEntry m_table[TABLE_COLORS]; | 638 | ColorEntry m_table[TABLE_COLORS]; |
629 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 639 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
630 | /////////// fore back | 640 | /////////// fore back |
631 | int i; | 641 | int i; |
632 | if(iD==-9) { // default default | 642 | if(iD==-9) { // default default |
633 | for (i = 0; i < TABLE_COLORS; i++) { | 643 | for (i = 0; i < TABLE_COLORS; i++) { |
634 | m_table[i].color = defaultCt[i].color; | 644 | m_table[i].color = defaultCt[i].color; |
635 | if(i==1 || i == 11) | 645 | if(i==1 || i == 11) |
636 | m_table[i].transparent=1; | 646 | m_table[i].transparent=1; |
637 | cfg.writeEntry("Schema","98"); | 647 | cfg.writeEntry("Schema","9"); |
638 | colorMenu->setItemChecked(-9,TRUE); | 648 | colorMenu->setItemChecked(-9,TRUE); |
639 | } | 649 | } |
640 | } else { | 650 | } else { |
641 | if(iD==-6) { // green black | 651 | if(iD==-6) { // green black |
642 | foreground.setRgb(0x18,255,0x18); | 652 | foreground.setRgb(0x18,255,0x18); |
643 | background.setRgb(0x00,0x00,0x00); | 653 | background.setRgb(0x00,0x00,0x00); |
644 | cfg.writeEntry("Schema","6"); | 654 | cfg.writeEntry("Schema","6"); |
645 | colorMenu->setItemChecked(-6,TRUE); | 655 | colorMenu->setItemChecked(-6,TRUE); |
646 | } | 656 | } |
647 | if(iD==-7) { // black white | 657 | if(iD==-7) { // black white |
648 | foreground.setRgb(0x00,0x00,0x00); | 658 | foreground.setRgb(0x00,0x00,0x00); |
649 | background.setRgb(0xFF,0xFF,0xFF); | 659 | background.setRgb(0xFF,0xFF,0xFF); |
650 | cfg.writeEntry("Schema","7"); | 660 | cfg.writeEntry("Schema","7"); |
651 | colorMenu->setItemChecked(-7,TRUE); | 661 | colorMenu->setItemChecked(-7,TRUE); |
652 | } | 662 | } |
653 | if(iD==-8) { // white black | 663 | if(iD==-8) { // white black |
@@ -699,47 +709,64 @@ void Konsole::colorMenuSelected(int iD) | |||
699 | foreground.setRgb(0xFF,0xFF,0xFF); | 709 | foreground.setRgb(0xFF,0xFF,0xFF); |
700 | cfg.writeEntry("Schema","16"); | 710 | cfg.writeEntry("Schema","16"); |
701 | colorMenu->setItemChecked(-16,TRUE); | 711 | colorMenu->setItemChecked(-16,TRUE); |
702 | } | 712 | } |
703 | if(iD==-17) {// Black, Blue | 713 | if(iD==-17) {// Black, Blue |
704 | background.setRgb(0x00,0x00,0x00); | 714 | background.setRgb(0x00,0x00,0x00); |
705 | foreground.setRgb(0x18,0xB2,0xB2); | 715 | foreground.setRgb(0x18,0xB2,0xB2); |
706 | cfg.writeEntry("Schema","17"); | 716 | cfg.writeEntry("Schema","17"); |
707 | colorMenu->setItemChecked(-17,TRUE); | 717 | colorMenu->setItemChecked(-17,TRUE); |
708 | } | 718 | } |
709 | if(iD==-18) {// Black, Gold | 719 | if(iD==-18) {// Black, Gold |
710 | background.setRgb(0x00,0x00,0x00); | 720 | background.setRgb(0x00,0x00,0x00); |
711 | foreground.setRgb(255,215,0); | 721 | foreground.setRgb(255,215,0); |
712 | cfg.writeEntry("Schema","18"); | 722 | cfg.writeEntry("Schema","18"); |
713 | colorMenu->setItemChecked(-18,TRUE); | 723 | colorMenu->setItemChecked(-18,TRUE); |
714 | } | 724 | } |
725 | if(iD==-19) {// Custom | ||
726 | qDebug("do custom"); | ||
727 | if(fromMenu) { | ||
728 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); | ||
729 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, | ||
730 | SLOT(changeForegroundColor(const QColor&))); | ||
731 | penColorPopupMenu->exec(); | ||
732 | } | ||
733 | cfg.writeEntry("Schema","19"); | ||
734 | if(!fromMenu) { | ||
735 | foreground.setNamedColor(cfg.readEntry("foreground","")); | ||
736 | background.setNamedColor(cfg.readEntry("background","")); | ||
737 | } | ||
738 | fromMenu=FALSE; | ||
739 | colorMenu->setItemChecked(-19,TRUE); | ||
740 | } | ||
715 | 741 | ||
716 | for (i = 0; i < TABLE_COLORS; i++) { | 742 | for (i = 0; i < TABLE_COLORS; i++) { |
717 | if(i==0 || i == 10) { | 743 | if(i==0 || i == 10) { |
718 | m_table[i].color = foreground; | 744 | m_table[i].color = foreground; |
719 | } | 745 | } |
720 | else if(i==1 || i == 11) { | 746 | else if(i==1 || i == 11) { |
721 | m_table[i].color = background; m_table[i].transparent=0; | 747 | m_table[i].color = background; m_table[i].transparent=0; |
722 | } | 748 | } |
723 | else | 749 | else |
724 | m_table[i].color = defaultCt[i].color; | 750 | m_table[i].color = defaultCt[i].color; |
725 | } | 751 | } |
726 | } | 752 | } |
727 | lastSelectedMenu = iD; | 753 | lastSelectedMenu = iD; |
728 | te->setColorTable(m_table); | 754 | te->setColorTable(m_table); |
729 | update(); | 755 | update(); |
756 | |||
730 | } | 757 | } |
731 | 758 | ||
732 | void Konsole::configMenuSelected(int iD) | 759 | void Konsole::configMenuSelected(int iD) |
733 | { | 760 | { |
734 | // QString temp; | 761 | // QString temp; |
735 | // qDebug( temp.sprintf("configmenu %d",iD)); | 762 | // qDebug( temp.sprintf("configmenu %d",iD)); |
736 | TEWidget* te = getTe(); | 763 | TEWidget* te = getTe(); |
737 | Config cfg("Konsole"); | 764 | Config cfg("Konsole"); |
738 | cfg.setGroup("Menubar"); | 765 | cfg.setGroup("Menubar"); |
739 | if( iD == -4) { | 766 | if( iD == -4) { |
740 | cfg.setGroup("Tabs"); | 767 | cfg.setGroup("Tabs"); |
741 | QString tmp=cfg.readEntry("Position","Bottom"); | 768 | QString tmp=cfg.readEntry("Position","Bottom"); |
742 | 769 | ||
743 | if(tmp=="Top") { | 770 | if(tmp=="Top") { |
744 | tab->setTabPosition(QTabWidget::Bottom); | 771 | tab->setTabPosition(QTabWidget::Bottom); |
745 | configMenu->changeItem( iD,"Tabs on Top"); | 772 | configMenu->changeItem( iD,"Tabs on Top"); |
@@ -872,16 +899,49 @@ void Konsole::setDocument( const QString &cmd) { | |||
872 | void Konsole::parseCommandLine() { | 899 | void Konsole::parseCommandLine() { |
873 | QString cmd; | 900 | QString cmd; |
874 | // newSession(); | 901 | // newSession(); |
875 | for (int i=1;i< qApp->argc();i++) { | 902 | for (int i=1;i< qApp->argc();i++) { |
876 | if( QString(qApp->argv()[i]) == "-e") { | 903 | if( QString(qApp->argv()[i]) == "-e") { |
877 | i++; | 904 | i++; |
878 | for ( int j=i;j< qApp->argc();j++) { | 905 | for ( int j=i;j< qApp->argc();j++) { |
879 | cmd+=QString(qApp->argv()[j])+" "; | 906 | cmd+=QString(qApp->argv()[j])+" "; |
880 | } | 907 | } |
881 | cmd.stripWhiteSpace(); | 908 | cmd.stripWhiteSpace(); |
882 | system(cmd.latin1()); | 909 | system(cmd.latin1()); |
883 | exit(0);//close(); | 910 | exit(0);//close(); |
884 | } // end -e switch | 911 | } // end -e switch |
885 | } | 912 | } |
886 | startUp++; | 913 | startUp++; |
887 | } | 914 | } |
915 | |||
916 | void Konsole::changeForegroundColor(const QColor &color) { | ||
917 | Config cfg("Konsole"); | ||
918 | cfg.setGroup("Colors"); | ||
919 | int r, g, b; | ||
920 | color.rgb(&r,&g,&b); | ||
921 | foreground.setRgb(r,g,b); | ||
922 | // QString colors; | ||
923 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); | ||
924 | cfg.writeEntry("foreground",color.name()); | ||
925 | cfg.write(); | ||
926 | |||
927 | qDebug("do other dialog"); | ||
928 | ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); | ||
929 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, | ||
930 | SLOT(changeBackgroundColor(const QColor&))); | ||
931 | penColorPopupMenu2->exec(); | ||
932 | |||
933 | } | ||
934 | |||
935 | void Konsole::changeBackgroundColor(const QColor &color) { | ||
936 | |||
937 | qDebug("Change background"); | ||
938 | Config cfg("Konsole"); | ||
939 | cfg.setGroup("Colors"); | ||
940 | int r, g, b; | ||
941 | color.rgb(&r,&g,&b); | ||
942 | background.setRgb(r,g,b); | ||
943 | // QString colors; | ||
944 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); | ||
945 | cfg.writeEntry("background",color.name()); | ||
946 | cfg.write(); | ||
947 | } | ||
diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index 40edaec..0bf3fb3 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h | |||
@@ -19,86 +19,92 @@ | |||
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 <qpe/qpetoolbar.h> | 33 | #include <qpe/qpetoolbar.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qcolor.h> | ||
35 | 36 | ||
36 | #include "MyPty.h" | 37 | #include "MyPty.h" |
37 | #include "TEWidget.h" | 38 | #include "TEWidget.h" |
38 | #include "TEmuVt102.h" | 39 | #include "TEmuVt102.h" |
39 | #include "session.h" | 40 | #include "session.h" |
40 | 41 | ||
41 | class EKNumTabWidget; | 42 | class EKNumTabWidget; |
42 | 43 | ||
43 | class Konsole : public QMainWindow | 44 | class Konsole : public QMainWindow |
44 | { | 45 | { |
45 | Q_OBJECT | 46 | Q_OBJECT |
46 | 47 | ||
47 | public: | 48 | public: |
48 | 49 | ||
49 | Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 50 | Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); |
50 | Konsole(const char * name, const char* pgm, QStrList & _args, int histon); | 51 | Konsole(const char * name, const char* pgm, QStrList & _args, int histon); |
51 | ~Konsole(); | 52 | ~Konsole(); |
52 | void setColLin(int columns, int lines); | 53 | void setColLin(int columns, int lines); |
53 | QPEToolBar *secondToolBar; | 54 | QPEToolBar *secondToolBar; |
54 | void show(); | 55 | void show(); |
55 | void setColor(); | 56 | void setColor(); |
56 | int lastSelectedMenu; | 57 | int lastSelectedMenu; |
57 | int startUp; | 58 | int startUp; |
58 | private slots: | 59 | private slots: |
59 | void setDocument(const QString &); | 60 | void setDocument(const QString &); |
60 | void doneSession(TESession*,int); | 61 | void doneSession(TESession*,int); |
61 | void changeColumns(int); | 62 | void changeColumns(int); |
62 | void fontChanged(int); | 63 | void fontChanged(int); |
63 | void configMenuSelected(int ); | 64 | void configMenuSelected(int ); |
64 | void colorMenuSelected(int); | 65 | void colorMenuSelected(int); |
66 | void colorMenuIsSelected(int); | ||
65 | void enterCommand(int); | 67 | void enterCommand(int); |
66 | void hitEnter(); | 68 | void hitEnter(); |
67 | void hitSpace(); | 69 | void hitSpace(); |
68 | void hitTab(); | 70 | void hitTab(); |
69 | void hitPaste(); | 71 | void hitPaste(); |
70 | void hitUp(); | 72 | void hitUp(); |
71 | void hitDown(); | 73 | void hitDown(); |
72 | void switchSession(QWidget *); | 74 | void switchSession(QWidget *); |
73 | void newSession(); | 75 | void newSession(); |
74 | void changeCommand(const QString &, int); | 76 | void changeCommand(const QString &, int); |
75 | void initCommandList(); | 77 | void initCommandList(); |
76 | void scrollMenuSelected(int); | 78 | void scrollMenuSelected(int); |
77 | void editCommandListMenuSelected(int); | 79 | void editCommandListMenuSelected(int); |
78 | void parseCommandLine(); | 80 | void parseCommandLine(); |
81 | void changeForegroundColor(const QColor &); | ||
82 | void changeBackgroundColor(const QColor &); | ||
79 | private: | 83 | private: |
80 | void init(const char* _pgm, QStrList & _args); | 84 | void init(const char* _pgm, QStrList & _args); |
81 | void initSession(const char* _pgm, QStrList & _args); | 85 | void initSession(const char* _pgm, QStrList & _args); |
82 | void runSession(TESession* s); | 86 | void runSession(TESession* s); |
83 | void setColorPixmaps(); | 87 | void setColorPixmaps(); |
84 | void setHistory(bool); | 88 | void setHistory(bool); |
85 | QSize calcSize(int columns, int lines); | 89 | QSize calcSize(int columns, int lines); |
86 | TEWidget* getTe(); | 90 | TEWidget* getTe(); |
87 | QStringList commands; | 91 | QStringList commands; |
88 | 92 | QLabel * msgLabel; | |
93 | QColor foreground, background; | ||
94 | bool fromMenu; | ||
89 | private: | 95 | private: |
90 | class VTFont | 96 | class VTFont |
91 | { | 97 | { |
92 | public: | 98 | public: |
93 | VTFont(QString name, QFont& font) | 99 | VTFont(QString name, QFont& font) |
94 | { | 100 | { |
95 | this->name = name; | 101 | this->name = name; |
96 | this->font = font; | 102 | this->font = font; |
97 | } | 103 | } |
98 | 104 | ||
99 | QFont& getFont() | 105 | QFont& getFont() |
100 | { | 106 | { |
101 | return font; | 107 | return font; |
102 | } | 108 | } |
103 | 109 | ||
104 | QString getName() | 110 | QString getName() |