-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 20 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 31 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 4 |
3 files changed, 49 insertions, 6 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index f10bfb2..a56dc50 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp @@ -41,24 +41,25 @@ - 'font_a' not used in mouse events - add destructor */ /* TODO - evtl. be sensitive to `paletteChange' while using default colors. - set different 'rounding' styles? I.e. have a mode to show clipped chars? */ // #include "config.h" #include "TEWidget.h" #include "session.h" +#include <qpe/config.h> #include <qcursor.h> #include <qregexp.h> #include <qpainter.h> #include <qclipboard.h> #include <qstyle.h> #include <qfile.h> #include <qdragobject.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -143,25 +144,25 @@ const ColorEntry* TEWidget::getdefaultColorTable() const const QPixmap *TEWidget::backgroundPixmap() { static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm"); const QPixmap *pm = bg; return pm; } void TEWidget::setColorTable(const ColorEntry table[]) { for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i]; - + const QPixmap* pm = backgroundPixmap(); if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color); update(); } //FIXME: add backgroundPixmapChanged. /* ------------------------------------------------------------------------- */ /* */ /* Font */ /* */ /* ------------------------------------------------------------------------- */ @@ -276,25 +277,38 @@ void TEWidget::setFont(const QFont &) TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) { #ifndef QT_NO_CLIPBOARD cb = QApplication::clipboard(); QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), this, SLOT(onClearSelection()) ); #endif scrollbar = new QScrollBar(this); scrollbar->setCursor( arrowCursor ); connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); - scrollLoc = SCRNONE; + + Config cfg("Konsole"); + cfg.setGroup("ScrollBar"); + switch( cfg.readNumEntry("Position",2)){ + case 0: + scrollLoc = SCRNONE; + break; + case 1: + scrollLoc = SCRLEFT; + break; + case 2: + scrollLoc = SCRRIGHT; + break; + }; blinkT = new QTimer(this); connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); // blinking = FALSE; blinking = TRUE; resizing = FALSE; actSel = 0; image = 0; lines = 1; columns = 1; font_w = 1; @@ -642,25 +656,25 @@ void TEWidget::mousePressEvent(QMouseEvent* ev) //printf("press top left [%d,%d] by=%d\n",tLx,tLy, bY); if ( ev->button() == LeftButton) { QPoint pos = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h); if ( ev->state() & ControlButton ) preserve_line_breaks = FALSE ; if (mouse_marks || (ev->state() & ShiftButton)) { emit clearSelectionSignal(); iPntSel = pntSel = pos; actSel = 1; // left mouse button pressed but nothing selected yet. - grabMouse( /*crossCursor*/ ); // handle with care! + grabMouse( /*crossCursor*/ ); // handle with care! } else { emit mouseSignal( 0, pos.x() + 1, pos.y() + 1 ); // left button } } if ( ev->button() == MidButton ) { emitSelection(); } if ( ev->button() == RightButton ) // Configure { diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index d54fa1f..e2d4886 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -215,25 +215,26 @@ void Konsole::init(const char* _pgm, QStrList & _args) QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); fontList = new QPopupMenu( this ); for(uint i = 0; i < fonts.count(); i++) { VTFont *fnt = fonts.at(i); fontList->insertItem(fnt->getName(), i); } fontChanged(cfont); configMenu = new QPopupMenu( this); colorMenu = new QPopupMenu( this); - + scrollMenu = new QPopupMenu( this); + bool listHidden; cfg.setGroup("Menubar"); if( cfg.readEntry("Hidden","FALSE") == "TRUE") { configMenu->insertItem("Show command list"); listHidden=TRUE; } else { configMenu->insertItem("Hide command list"); listHidden=FALSE; } cfg.setGroup("Tabs"); tmp=cfg.readEntry("Position","Bottom"); @@ -254,24 +255,25 @@ void Konsole::init(const char* _pgm, QStrList & _args) colorMenu->insertItem("Red on Black"); colorMenu->insertItem("Green on Yellow"); colorMenu->insertItem("Blue on Magenta"); colorMenu->insertItem("Magenta on Blue"); colorMenu->insertItem("Cyan on White"); colorMenu->insertItem("White on Cyan"); colorMenu->insertItem("Blue on Black"); configMenu->insertItem("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( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); menuBar->insertItem( tr("Font"), fontList ); menuBar->insertItem( tr("Options"), configMenu ); QPEToolBar *toolbar = new QPEToolBar( this ); QAction *a; // Button Commands a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); @@ -307,24 +309,29 @@ void Konsole::init(const char* _pgm, QStrList & _args) cfg.setGroup("Commands"); commonCombo->setInsertionPolicy(QComboBox::AtCurrent); for (int i = 0; commonCmds[i] != NULL; i++) { commonCombo->insertItem( commonCmds[i], i ); tmp = cfg.readEntry( QString::number(i),""); if(tmp != "") commonCombo->changeItem( tmp,i ); } connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); + scrollMenu->insertItem("None"); + scrollMenu->insertItem("Left"); + scrollMenu->insertItem("Right"); + configMenu->insertItem("ScrollBar",scrollMenu); + // create applications ///////////////////////////////////////////////////// setCentralWidget(tab); // load keymaps //////////////////////////////////////////////////////////// KeyTrans::loadAll(); for (int i = 0; i < KeyTrans::count(); i++) { KeyTrans* s = KeyTrans::find(i); assert( s ); } se_pgm = _pgm; se_args = _args; @@ -754,12 +761,34 @@ void Konsole::changeCommand(const QString &text, int c) commonCombo->setCurrentItem(c); } } void Konsole::setColor() { Config cfg("Konsole"); cfg.setGroup("Colors"); int scheme = cfg.readNumEntry("Schema",1); if(scheme != 1) colorMenuSelected( -scheme); } + +void Konsole::scrollMenuSelected(int index) +{ + TEWidget* te = getTe(); +Config cfg("Konsole"); + cfg.setGroup("Scrollbar"); + switch( index){ + case -21: + te->setScrollbarLocation(0); + cfg.writeEntry("Position",0); + break; + case -22: + te->setScrollbarLocation(1); + cfg.writeEntry("Position",1); + break; + case -23: + te->setScrollbarLocation(2); + cfg.writeEntry("Position",2); + break; + }; + +} diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index 40003d4..b4e5d87 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h @@ -61,25 +61,25 @@ private slots: void configMenuSelected(int ); void colorMenuSelected(int); void enterCommand(int); void hitEnter(); void hitSpace(); void hitTab(); void hitPaste(); void hitUp(); void hitDown(); void switchSession(QWidget *); void newSession(); void changeCommand(const QString &, int); - + void scrollMenuSelected(int); private: void init(const char* _pgm, QStrList & _args); void initSession(const char* _pgm, QStrList & _args); void runSession(TESession* s); void setColorPixmaps(); void setHistory(bool); QSize calcSize(int columns, int lines); TEWidget* getTe(); private: class VTFont { @@ -103,25 +103,25 @@ private: private: QString name; QFont font; }; EKNumTabWidget* tab; int nsessions; QList<VTFont> fonts; int cfont; QCString se_pgm; QStrList se_args; - QPopupMenu* fontList,*configMenu,*colorMenu; + QPopupMenu* fontList,*configMenu,*colorMenu,*scrollMenu; QComboBox *commonCombo; // history scrolling I think bool b_scroll; int n_keytab; int n_scroll; int n_render; QString pmPath; // pixmap path QString dropText; QFont defaultFont; QSize defaultSize; |