Diffstat (limited to 'core/apps/embeddedkonsole/konsole.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 68 |
1 files changed, 64 insertions, 4 deletions
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 @@ -56,2 +56,4 @@ +#include <opie/colorpopupmenu.h> + class EKNumTabBar : public QTabBar { @@ -208,2 +210,4 @@ void Konsole::init(const char* _pgm, QStrList & _args) startUp=0; + fromMenu = FALSE; + setCaption( tr("Terminal") ); @@ -290,2 +294,3 @@ void Konsole::init(const char* _pgm, QStrList & _args) colorMenu->insertItem(tr( "Amber on Black")); + colorMenu->insertItem(tr( "Custom")); configMenu->insertItem(tr( "Colors") ,colorMenu); @@ -294,3 +299,3 @@ void Konsole::init(const char* _pgm, QStrList & _args) 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))); @@ -616,2 +621,7 @@ void Konsole::switchSession(QWidget* w) { +void Konsole::colorMenuIsSelected(int iD) { + fromMenu = TRUE; + colorMenuSelected(iD); +} + /// ------------------------------- some new stuff by L.J. Potter @@ -624,4 +634,4 @@ void Konsole::colorMenuSelected(int iD) cfg.setGroup("Colors"); - QColor foreground; - QColor background; +// QColor foreground; +// QColor background; colorMenu->setItemChecked(lastSelectedMenu,FALSE); @@ -636,3 +646,3 @@ void Konsole::colorMenuSelected(int iD) m_table[i].transparent=1; - cfg.writeEntry("Schema","98"); + cfg.writeEntry("Schema","9"); colorMenu->setItemChecked(-9,TRUE); @@ -714,2 +724,18 @@ void Konsole::colorMenuSelected(int iD) } + 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); + } @@ -729,2 +755,3 @@ void Konsole::colorMenuSelected(int iD) update(); + } @@ -887 +914,34 @@ void Konsole::parseCommandLine() { } + +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(); +} |