-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 16db0ea..06bee33 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -16,12 +16,13 @@ /* Ported Konsole to Qt/Embedded */ /* */ /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ /* */ /* -------------------------------------------------------------------------- */ // enhancements added by L.J. Potter <ljp@llornkcor.com> +#define QWS_QT_OPIE #include <qpe/resource.h> #include <qdir.h> #include <qevent.h> #include <qdragobject.h> @@ -51,13 +52,15 @@ #include <assert.h> #include "konsole.h" #include "keytrans.h" #include "commandeditdialog.h" +#ifdef QWS_QT_OPIE #include <opie/colorpopupmenu.h> +#endif class EKNumTabBar : public QTabBar { public: void numberTabs() { // Yes, it really is this messy. QTabWidget needs functions @@ -289,13 +292,17 @@ void Konsole::init(const char* _pgm, QStrList & _args) colorMenu->insertItem(tr( "Blue on Magenta")); colorMenu->insertItem(tr( "Magenta on Blue")); colorMenu->insertItem(tr( "Cyan on White")); colorMenu->insertItem(tr( "White on Cyan")); colorMenu->insertItem(tr( "Blue on Black")); colorMenu->insertItem(tr( "Amber on Black")); + +#ifdef QWS_QT_OPIE colorMenu->insertItem(tr( "Custom")); +#endif + 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( colorMenuIsSelected(int) )); connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); @@ -739,13 +746,15 @@ void Konsole::colorMenuSelected(int iD) if(iD==-18) {// Black, Gold background.setRgb(0x00,0x00,0x00); foreground.setRgb(255,215,0); cfg.writeEntry("Schema","18"); colorMenu->setItemChecked(-18,TRUE); } - if(iD==-19) {// Custom +#ifdef QWS_QT_OPIE + 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(); @@ -755,13 +764,13 @@ void Konsole::colorMenuSelected(int iD) foreground.setNamedColor(cfg.readEntry("foreground","")); background.setNamedColor(cfg.readEntry("background","")); } fromMenu=FALSE; colorMenu->setItemChecked(-19,TRUE); } - +#endif for (i = 0; i < TABLE_COLORS; i++) { if(i==0 || i == 10) { m_table[i].color = foreground; } else if(i==1 || i == 11) { m_table[i].color = background; m_table[i].transparent=0; @@ -775,14 +784,14 @@ void Konsole::colorMenuSelected(int iD) update(); } void Konsole::configMenuSelected(int iD) { - QString temp; - qDebug( temp.sprintf("configmenu %d",iD)); +// QString temp; +// qDebug( temp.sprintf("configmenu %d",iD)); TEWidget* te = getTe(); Config cfg("Konsole"); cfg.setGroup("Menubar"); if( iD == -4) { cfg.setGroup("Tabs"); QString tmp=cfg.readEntry("Position","Bottom"); @@ -794,13 +803,20 @@ void Konsole::configMenuSelected(int iD) } else { tab->setTabPosition(QTabWidget::Top); configMenu->changeItem( iD,"Tabs on Bottom"); cfg.writeEntry("Position","Top"); } } - if( iD == -29) { + int i; +#ifdef QWS_QT_OPIE +i=-29; +#else +i=-28; +#endif + + if( iD == i) { cfg.setGroup("ScrollBar"); bool b=cfg.readBoolEntry("HorzScroll",0); b=!b; cfg.writeEntry("HorzScroll", b ); cfg.write(); doWrap(); @@ -968,17 +984,19 @@ void Konsole::changeForegroundColor(const QColor &color) { // QString colors; // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); cfg.writeEntry("foreground",color.name()); cfg.write(); qDebug("do other dialog"); +#ifdef QWS_QT_OPIE + ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBackgroundColor(const QColor&))); penColorPopupMenu2->exec(); - +#endif } void Konsole::changeBackgroundColor(const QColor &color) { qDebug("Change background"); Config cfg("Konsole"); @@ -990,18 +1008,25 @@ void Konsole::changeBackgroundColor(const QColor &color) { // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); cfg.writeEntry("background",color.name()); cfg.write(); } void Konsole::doWrap() { - Config cfg("Konsole"); +int i; +#ifdef QWS_QT_OPIE +i=-29; +#else +i=-28; +#endif + + Config cfg("Konsole"); cfg.setGroup("ScrollBar"); TEWidget* te = getTe(); if( !cfg.readBoolEntry("HorzScroll",0)) { te->setWrapAt(0); - configMenu->setItemChecked(-29,FALSE); + configMenu->setItemChecked( i,FALSE); } else { te->setWrapAt(90); // te->setWrapAt(120); - configMenu->setItemChecked(-29,TRUE); + configMenu->setItemChecked( i,TRUE); } } |