summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rwxr-xr-xcore/apps/embeddedkonsole/embeddedkonsole.pro2
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp68
-rw-r--r--core/apps/embeddedkonsole/konsole.h8
3 files changed, 72 insertions, 6 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
@@ -31,7 +31,7 @@ INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui
31TARGET = embeddedkonsole 31TARGET = embeddedkonsole
32INCLUDEPATH += $(OPIEDIR)/include 32INCLUDEPATH += $(OPIEDIR)/include
33DEPENDPATH += $(OPIEDIR)/include 33DEPENDPATH += $(OPIEDIR)/include
34LIBS += -lqpe 34LIBS += -lqpe -lopie
35REQUIRES = embeddedkonsole 35REQUIRES = embeddedkonsole
36 36
37TRANSLATIONS = ../../../i18n/de/embeddedkonsole.ts \ 37TRANSLATIONS = ../../../i18n/de/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
@@ -54,6 +54,8 @@
54#include "keytrans.h" 54#include "keytrans.h"
55#include "commandeditdialog.h" 55#include "commandeditdialog.h"
56 56
57#include <opie/colorpopupmenu.h>
58
57class EKNumTabBar : public QTabBar { 59class EKNumTabBar : public QTabBar {
58public: 60public:
59 void numberTabs() 61 void numberTabs()
@@ -206,6 +208,8 @@ void Konsole::init(const char* _pgm, QStrList & _args)
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
@@ -288,11 +292,12 @@ void Konsole::init(const char* _pgm, QStrList & _args)
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 );
@@ -614,6 +619,11 @@ void Konsole::switchSession(QWidget* w) {
614 } 619 }
615} 620}
616 621
622void 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
618void Konsole::colorMenuSelected(int iD) 628void 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
@@ -622,8 +632,8 @@ void Konsole::colorMenuSelected(int 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();
@@ -634,7 +644,7 @@ void Konsole::colorMenuSelected(int iD)
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 {
@@ -712,6 +722,22 @@ void Konsole::colorMenuSelected(int iD)
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) {
@@ -727,6 +753,7 @@ void Konsole::colorMenuSelected(int iD)
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
732void Konsole::configMenuSelected(int iD) 759void Konsole::configMenuSelected(int iD)
@@ -885,3 +912,36 @@ void Konsole::parseCommandLine() {
885 } 912 }
886 startUp++; 913 startUp++;
887} 914}
915
916void 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
927qDebug("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
935void 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
@@ -32,6 +32,7 @@
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"
@@ -62,6 +63,7 @@ private slots:
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();
@@ -76,6 +78,8 @@ private slots:
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 &);
79private: 83private:
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);
@@ -85,7 +89,9 @@ private:
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;
94bool fromMenu;
89private: 95private:
90 class VTFont 96 class VTFont
91 { 97 {