summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xcore/apps/embeddedkonsole/embeddedkonsole.pro28
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp68
-rw-r--r--core/apps/embeddedkonsole/konsole.h8
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
@@ -32,19 +32,19 @@ TARGET = embeddedkonsole
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe
+LIBS += -lqpe -lopie
REQUIRES = embeddedkonsole
TRANSLATIONS = ../../../i18n/de/embeddedkonsole.ts \
- ../../../i18n/en/embeddedkonsole.ts \
- ../../../i18n/es/embeddedkonsole.ts \
- ../../../i18n/fr/embeddedkonsole.ts \
- ../../../i18n/hu/embeddedkonsole.ts \
- ../../../i18n/ja/embeddedkonsole.ts \
- ../../../i18n/ko/embeddedkonsole.ts \
- ../../../i18n/no/embeddedkonsole.ts \
- ../../../i18n/pl/embeddedkonsole.ts \
- ../../../i18n/pt/embeddedkonsole.ts \
- ../../../i18n/pt_BR/embeddedkonsole.ts \
- ../../../i18n/sl/embeddedkonsole.ts \
- ../../../i18n/zh_CN/embeddedkonsole.ts \
- ../../../i18n/zh_TW/embeddedkonsole.ts
+ ../../../i18n/en/embeddedkonsole.ts \
+ ../../../i18n/es/embeddedkonsole.ts \
+ ../../../i18n/fr/embeddedkonsole.ts \
+ ../../../i18n/hu/embeddedkonsole.ts \
+ ../../../i18n/ja/embeddedkonsole.ts \
+ ../../../i18n/ko/embeddedkonsole.ts \
+ ../../../i18n/no/embeddedkonsole.ts \
+ ../../../i18n/pl/embeddedkonsole.ts \
+ ../../../i18n/pt/embeddedkonsole.ts \
+ ../../../i18n/pt_BR/embeddedkonsole.ts \
+ ../../../i18n/sl/embeddedkonsole.ts \
+ ../../../i18n/zh_CN/embeddedkonsole.ts \
+ ../../../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
@@ -55,4 +55,6 @@
#include "commandeditdialog.h"
+#include <opie/colorpopupmenu.h>
+
class EKNumTabBar : public QTabBar {
public:
@@ -207,4 +209,6 @@ void Konsole::init(const char* _pgm, QStrList & _args)
n_render = 0;
startUp=0;
+ fromMenu = FALSE;
+
setCaption( tr("Terminal") );
setIcon( Resource::loadPixmap( "konsole" ) );
@@ -289,9 +293,10 @@ void Konsole::init(const char* _pgm, QStrList & _args)
colorMenu->insertItem(tr( "Blue on Black"));
colorMenu->insertItem(tr( "Amber on Black"));
+ colorMenu->insertItem(tr( "Custom"));
configMenu->insertItem(tr( "Colors") ,colorMenu);
connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
- connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) ));
+ connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) ));
connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
@@ -615,4 +620,9 @@ void Konsole::switchSession(QWidget* w) {
}
+void Konsole::colorMenuIsSelected(int iD) {
+ fromMenu = TRUE;
+ colorMenuSelected(iD);
+}
+
/// ------------------------------- some new stuff by L.J. Potter
void Konsole::colorMenuSelected(int iD)
@@ -623,6 +633,6 @@ void Konsole::colorMenuSelected(int iD)
Config cfg("Konsole");
cfg.setGroup("Colors");
- QColor foreground;
- QColor background;
+// QColor foreground;
+// QColor background;
colorMenu->setItemChecked(lastSelectedMenu,FALSE);
ColorEntry m_table[TABLE_COLORS];
@@ -635,5 +645,5 @@ void Konsole::colorMenuSelected(int iD)
if(i==1 || i == 11)
m_table[i].transparent=1;
- cfg.writeEntry("Schema","98");
+ cfg.writeEntry("Schema","9");
colorMenu->setItemChecked(-9,TRUE);
}
@@ -713,4 +723,20 @@ void Konsole::colorMenuSelected(int iD)
colorMenu->setItemChecked(-18,TRUE);
}
+ if(iD==-19) {// Custom
+ qDebug("do custom");
+ if(fromMenu) {
+ ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color");
+ connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this,
+ SLOT(changeForegroundColor(const QColor&)));
+ penColorPopupMenu->exec();
+ }
+ cfg.writeEntry("Schema","19");
+ if(!fromMenu) {
+ foreground.setNamedColor(cfg.readEntry("foreground",""));
+ background.setNamedColor(cfg.readEntry("background",""));
+ }
+ fromMenu=FALSE;
+ colorMenu->setItemChecked(-19,TRUE);
+ }
for (i = 0; i < TABLE_COLORS; i++) {
@@ -728,4 +754,5 @@ void Konsole::colorMenuSelected(int iD)
te->setColorTable(m_table);
update();
+
}
@@ -886,2 +913,35 @@ void Konsole::parseCommandLine() {
startUp++;
}
+
+void Konsole::changeForegroundColor(const QColor &color) {
+ Config cfg("Konsole");
+ cfg.setGroup("Colors");
+ int r, g, b;
+ color.rgb(&r,&g,&b);
+ foreground.setRgb(r,g,b);
+// QString colors;
+// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue);
+ cfg.writeEntry("foreground",color.name());
+ cfg.write();
+
+qDebug("do other dialog");
+ ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color");
+ connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this,
+ SLOT(changeBackgroundColor(const QColor&)));
+ penColorPopupMenu2->exec();
+
+}
+
+void Konsole::changeBackgroundColor(const QColor &color) {
+
+ qDebug("Change background");
+ Config cfg("Konsole");
+ cfg.setGroup("Colors");
+ int r, g, b;
+ color.rgb(&r,&g,&b);
+ background.setRgb(r,g,b);
+// QString colors;
+// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue);
+ cfg.writeEntry("background",color.name());
+ cfg.write();
+}
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
@@ -33,4 +33,5 @@
#include <qpe/qpetoolbar.h>
#include <qcombobox.h>
+#include <qcolor.h>
#include "MyPty.h"
@@ -63,4 +64,5 @@ private slots:
void configMenuSelected(int );
void colorMenuSelected(int);
+ void colorMenuIsSelected(int);
void enterCommand(int);
void hitEnter();
@@ -77,4 +79,6 @@ private slots:
void editCommandListMenuSelected(int);
void parseCommandLine();
+ void changeForegroundColor(const QColor &);
+ void changeBackgroundColor(const QColor &);
private:
void init(const char* _pgm, QStrList & _args);
@@ -86,5 +90,7 @@ private:
TEWidget* getTe();
QStringList commands;
-
+ QLabel * msgLabel;
+ QColor foreground, background;
+bool fromMenu;
private:
class VTFont